/build/buildd/libassa-3.4.1/assa/UNIXAddress.cpp

Go to the documentation of this file.
00001 // -*- c++ -*-
00002 //------------------------------------------------------------------------------
00003 //                           UNIXAddress.C
00004 //------------------------------------------------------------------------------
00005 //  Copyright (C) 1997-2002  Vladislav Grinchenko 
00006 //
00007 //  This library is free software; you can redistribute it and/or
00008 //  modify it under the terms of the GNU Library General Public
00009 //  License as published by the Free Software Foundation; either
00010 //  version 2 of the License, or (at your option) any later version.
00011 //------------------------------------------------------------------------------
00012 //  Created: 03/22/99
00013 //------------------------------------------------------------------------------
00014 
00015 #include "assa/UNIXAddress.h"
00016 
00017 using namespace ASSA;
00018 
00019 UNIXAddress::
00020 UNIXAddress (const char* socket_name_)
00021 {
00022     trace("UNIXAddress::UNIXAddress(char* name_)");
00023     
00024     size_t len;
00025     m_address.sun_family = AF_UNIX;
00026     
00027     if ( (len = strlen(socket_name_)) > sizeof(m_address.sun_path) ) {
00028         EL((ERROR,"Socket path name is too long (%d bytes)\n", len));
00029         setstate (Address::badbit);
00030     }
00031     strcpy (m_address.sun_path, socket_name_);
00032 }
00033 
00034 UNIXAddress::
00035 UNIXAddress (SA* saddr_)
00036 {
00037     trace("UNIXAddress::UNIXAddress(SA_UN*)");
00038 
00039     SA_UN* sa_un = (SA_UN*) saddr_;
00040     m_address.sun_family = AF_UNIX;
00041     
00042     size_t len = strlen(sa_un->sun_path);
00043 
00044     if ( len > sizeof (m_address.sun_path) - 1 ) {
00045         EL((ERROR,"Socket path name is too long (%d bytes)\n", len));
00046         setstate (Address::badbit);
00047     }
00048     strcpy(m_address.sun_path, sa_un->sun_path);
00049 }
00050 

Generated on Thu Jun 22 12:39:21 2006 for libassa by  doxygen 1.4.6