Loading...
Searching...
No Matches
UNIXAddress.cpp
Go to the documentation of this file.
// -*- c++ -*-
//------------------------------------------------------------------------------
// UNIXAddress.C
//------------------------------------------------------------------------------
// Copyright (C) 1997-2002 Vladislav Grinchenko
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
// License as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later version.
//------------------------------------------------------------------------------
// Created: 03/22/99
//------------------------------------------------------------------------------
#include "assa/UNIXAddress.h"
#if !defined (WIN32)
using namespace ASSA;
UNIXAddress::
UNIXAddress (const char* socket_name_)
{
trace("UNIXAddress::UNIXAddress(char* name_)");
size_t len;
m_address.sun_family = AF_UNIX;
if ( (len = strlen(socket_name_)) > sizeof(m_address.sun_path) ) {
EL((ASSAERR,"Socket path name is too long (%d bytes)\n", len));
setstate (Address::badbit);
}
strcpy (m_address.sun_path, socket_name_);
}
UNIXAddress::
UNIXAddress (SA* saddr_)
{
trace("UNIXAddress::UNIXAddress(SA_UN*)");
SA_UN* sa_un = (SA_UN*) saddr_;
m_address.sun_family = AF_UNIX;
size_t len = strlen(sa_un->sun_path);
if ( len > sizeof (m_address.sun_path) - 1 ) {
EL((ASSAERR,"Socket path name is too long (%d bytes)\n", len));
setstate (Address::badbit);
}
strcpy(m_address.sun_path, sa_un->sun_path);
}
#endif /* !def WIN32 */
trace
#define trace(s)
trace() is used to trace function call chain in C++ program.
Definition Logger.h:429
EL
#define EL(X)
A macro for writing error message to the Logger.
Definition Logger.h:285
UNIXAddress.h
UNIXAddress encapsulates UNIX domain socket address structure.
ASSA::Address::setstate
void setstate(addrstate flag_)
Set state of the Address object.
Definition Address.h:111
ASSA::Address::badbit
@ badbit
bad state
Definition Address.h:56
ASSA::AutoPtrRef
A wrapper class to provide AutoPtr with reference semantics.
Definition AutoPtr.h:32
ASSA::UNIXAddress::m_address
SA_UN m_address
UNIX socket address structure.
Definition UNIXAddress.h:51
ASSA::UNIXAddress::UNIXAddress
UNIXAddress(const char *socket_name_)
Constructor.
Definition UNIXAddress.cpp:22
ASSA
Definition Acceptor.h:40
ASSA::ASSAERR
@ ASSAERR
ASSA and system errors
Definition LogMask.h:34
ASSA::SA
struct sockaddr SA
Definition Address.h:33