Loading...
Searching...
No Matches
ASSA::Socket Class Referenceabstract

`#include <Socket.h>`

Inheritance diagram for ASSA::Socket:

## Public Types

enum | io_state_t { goodbit = 0 , eofbit = 1 , failbit = 2 , badbit = 4 }
| State bits: goodbit, eofbit, failbit, badbit. More...
enum | opt_t { reuseaddr , rcvlowat , sndlowat , nonblocking }
| Socket options. More...
typedef int | iostate
typedef unsigned char | IOState

## Public Member Functions

| Socket ()
| Constructor.
virtual | ~Socket ()
| Destructor.
virtual bool | open (const int domain_)=0
| Open socket.
virtual bool | close ()=0
| Close socket.
virtual bool | connect (const Address &address_)
| Make a connection.
virtual bool | bind (const Address &my_address_)=0
| Server binds listening socket to its local well-known port.
virtual int | write (const char *buf_, const u_int size_)
| Write specified number of bytes to the socket.
int | getBytesAvail (void) const
| Return number of bytes available in socket receive buffer.
virtual int | read (char *buf_, const u_int size_)
| Read expected number of bytes from the socket.
int | ignore (int n_=INT_MAX, int delim_=EOF)
| Extracts bytes and discards them.
virtual handler_t | getHandler () const =0
| Get file descriptor.
virtual const int | getDomain () const =0
| Get socket domain.
virtual Streambuf * | rdbuf ()
| Return a pointer to the Streambuf associated with the stream.
virtual Streambuf * | rdbuf (Streambuf *)
| Virtual function that sets new socket buffer and returns the old one.
virtual int | in_avail () const =0
| This function returns the number of characters immediately available in the get area of the underlying Socketbuf buffer without making a system call if Socket is doing buffering I/O.
virtual Socket & | flush ()
| This function simply calls the public "synchronizing" function rdbuf()->pubsync() (assuming the associated streambuf object is present).
bool | turnOptionOn (opt_t opt_)
| Enable socket option.
bool | turnOptionOff (opt_t opt_)
| Disable socket option.
bool | setOption (opt_t opt_, int arg_)
| Set socket option to value required.
int | getOption (opt_t opt_) const
| Get current value of a socket option.
| operator void * () const
| Convertion to void* (for testing where bool is required)
bool | operator! () const
| Alias to fail()
iostate | rdstate () const
| Retrieve state of the socket.
void | clear (iostate state_=Socket::goodbit)
| Clear the socket state. Closed socket remains in bad state.
void | setstate (iostate flag_)
| Set socket state to flag_ by adding flag_ to the existing state.
bool | good () const
| Indicates no error on the socket.
bool | eof () const
| An earlier extraction operation has encountered the end of file of the input stream (peer closed its socket).
bool | fail () const
| Indicates that earlier extraction opeartion has failed to match the required pattern of input.
bool | bad () const
| Socket fd == -1 or read/write error occured or some loss of integrity on assosiated stream buffer.
void | dumpState () const
| Write state bits of the socket to the log file.
Socket & | operator>> (char &c)
| Input of built-in char type. The value will be XDR-decoded.
Socket & | operator>> (unsigned char &c_)
| Input of built-in u_char type. The value will be XDR-decoded.
Socket & | operator>> (signed char &c_)
| Input of built-in signed char type. The value will be XDR-decoded.
Socket & | operator>> (std::string &s_)
| Input of STL string type. The string content will be XDR-decoded.
Socket & | operator>> (short &n_)
| Input of built-in short type. The value will be XDR-decoded.
Socket & | operator>> (unsigned short &n_)
| Input of built-in u_short type. The value will be XDR-decoded.
Socket & | operator>> (int &n_)
| Input of built-in integer type. The value will be XDR-decoded.
Socket & | operator>> (unsigned int &n_)
| Input of built-in u_int type. The value will be XDR-decoded.
Socket & | operator>> (long &n_)
| Input of built-in long type. The value will be XDR-decoded.
Socket & | operator>> (unsigned long &n_)
| Input of built-in u_long type. The value will be XDR-decoded.
Socket & | operator>> (float &n_)
| Input of built-in float type. The value will be XDR-decoded.
Socket & | operator>> (double &n_)
| Input of built-in double type. The value will be XDR-decoded.
Socket & | operator<< (char c)
| Output of built-in char type. The value will be XDR-encoded.
Socket & | operator<< (unsigned char c_)
| Output of built-in u_char type. The value will be XDR-encoded.
Socket & | operator<< (signed char c_)
| Output of built-in signed char type. The value will be XDR-encoded.
Socket & | operator<< (const std::string &s_)
| Output of STL string type. The value will be XDR-encoded.
Socket & | operator<< (short n_)
| Output of built-in short type. The value will be XDR-encoded.
Socket & | operator<< (unsigned short n_)
| Output of built-in u_short type. The value will be XDR-encoded.
Socket & | operator<< (int n_)
| Output of built-in integer type. The value will be XDR-encoded.
Socket & | operator<< (unsigned int n_)
| Output of built-in u_int type. The value will be XDR-encoded.
Socket & | operator<< (long n_)
| Output of built-in long type. The value will be XDR-encoded.
Socket & | operator<< (unsigned long n_)
| Output of built-in u_long type. The value will be XDR-encoded.
Socket & | operator<< (float n_)
| Output of built-in float type. The value will be XDR-encoded.
Socket & | operator<< (double n_)
| Output of built-in double type. The value will be XDR-encoded.
Socket & | operator<< (Socket &(*f)(Socket &))
| Manipulators plug-in operator.

## Static Public Member Functions

static size_t | xdr_length (const std::string &s_)
| Give the true length of the XDR-encoded STL string.
static bool | is_little_endian ()
| Determine the endianess of the platform we are on.
static void | close_handler (handler_t &socket_)
| Close socket endpoint in a portable way.
static string | decode_fcntl_flags (long mask_)
| Decipher flags packed into mask_ used in fcntl() call.

## Static Public Attributes

static const int | PGSIZE = 4096
| Size of bytes of a kernel page.

## Protected Member Functions

int | set_option (int level_, int optname_, int val_)
| Gateway method of setting socket options.
int | set_fd_options (long flags_)
| Gateway method for setting file descriptor options.
int | clear_fd_options (long flags_)
| Gateway method for clearing file descriptor options.

## Protected Attributes

handler_t | m_fd
| File descriptor.
int | m_type
| Socket domain type.
IOState | m_state
| Control state of the socket.

## Private Member Functions

| Socket (const Socket &)
| The copy constructor and assignment operator are private to prevent copying of Socket objects, since the effect of such copying is not well defined.
Socket & | operator= (const Socket &)

## Detailed Description

Definition at line 71 of file Socket.h.

## Member Typedef Documentation

## iostate

typedef int ASSA::Socket::iostate

Definition at line 92 of file Socket.h.

## IOState

typedef unsigned char ASSA::Socket::IOState

Definition at line 93 of file Socket.h.

## Member Enumeration Documentation

## io_state_t

enum ASSA::Socket::io_state_t

State bits: goodbit, eofbit, failbit, badbit.

Meaning to these is explained in class' documentation.

Enumerator
goodbit | indicates that socket is ready for use
eofbit | indicates that an input operation reached the end of an input sequence
failbit | indicates that an input operation failed to read the expected characters, or that an output operation failed to generate the desired characters.
badbit | indicates a loss of integrity in an input or output sequence (such as an irrecoverable read error from a file)

Definition at line 80 of file Socket.h.

{
goodbit = 0,
eofbit = 1,
failbit = 2,
badbit = 4
};
ASSA::Socket::eofbit
@ eofbit
indicates that an input operation reached the end of an input sequence
Definition Socket.h:82
ASSA::Socket::goodbit
@ goodbit
indicates that socket is ready for use
Definition Socket.h:81
ASSA::Socket::badbit
@ badbit
indicates a loss of integrity in an input or output sequence (such as an irrecoverable read error fro...
Definition Socket.h:87
ASSA::Socket::failbit
@ failbit
indicates that an input operation failed to read the expected characters, or that an output operation...
Definition Socket.h:84

## opt_t

enum ASSA::Socket::opt_t

Socket options.

Enumerator
reuseaddr | Allow local address reuse.
rcvlowat | The receiver low-water mark is the amount of data that must be in the socket receive buffer for select(3) to return "readable". It defaults to 1 for a TCP and UDP socket (NOTE: Posix.1g does not require support for this option).
sndlowat | The send low-water mark si the amount of available space that must exist in the socket send buffer for select to return "writable". This low-water mark normally defaults to 2048 for TCP socket. UDP socket is always writable (NOTE: Posix.1g does not require support for this option)

nonblocking

Set Socket to a non-blocking mode (O_RDWR|O_NONBLOCK).

                The default setup for a socket is BLOCKING (O_RDWR),
                Blocking implies being suspended while waiting
                for data to arrive on read. On write, it means
                that there is no room to send all data out and
                the process is being suspended until more room
                in the output buffer becomes available.

                Use nonblocking option to set the socket to
                non-blocking mode.

                For input operations, if an operation cannot be
                satisfied (at least 1 byte of data for a TCP socket
                or a complete datagram for a UDP socket), return is
                made immediately with an error of EWOULDBLOCK.

                For output operations, if there is no room at
                all in the socket send buffer, return is made
                immediately with an error of EWOULDBLOCK. If,
                however, there is some room in the socket send buffer,
                the return value will be the number of bytes that the
                kernel was able to copy into the buffer
                (This is called a short count).

                NOTE: To go back to blocking mode, clear nonblocking
                with turnOptionOff().

Definition at line 98 of file Socket.h.

{
reuseaddr,
rcvlowat,
sndlowat,
nonblocking
};
ASSA::Socket::reuseaddr
@ reuseaddr
Allow local address reuse.
Definition Socket.h:100
ASSA::Socket::sndlowat
@ sndlowat
The send low-water mark si the amount of available space that must exist in the socket send buffer fo...
Definition Socket.h:108
ASSA::Socket::rcvlowat
@ rcvlowat
The receiver low-water mark is the amount of data that must be in the socket receive buffer for selec...
Definition Socket.h:102
ASSA::Socket::nonblocking
@ nonblocking
Set Socket to a non-blocking mode (O_RDWR|O_NONBLOCK).
Definition Socket.h:115

## Constructor & Destructor Documentation

## Socket() [1/2]

ASSA::Socket::Socket | ( |  | ) |

inline

Constructor.

Definition at line 518 of file Socket.h.

:
m_fd (BAD_HANDLER),
m_type(0),
#if defined (WIN32)
m_nonblocking (false),
#endif
m_state(Socket::badbit)
{
trace_with_mask("Socket::Socket",SOCKTRACE);
}
trace_with_mask
#define trace_with_mask(s, m)
trace_with_mask() is used to trace function call chain in C++ program.
Definition Logger.h:437
BAD_HANDLER
#define BAD_HANDLER
Sort out WIN32/mingw oddities.
Definition Logger_Impl.h:81
ASSA::Socket::m_type
int m_type
Socket domain type.
Definition Socket.h:488
ASSA::Socket::m_fd
handler_t m_fd
File descriptor.
Definition Socket.h:485
ASSA::Socket::m_state
IOState m_state
Control state of the socket.
Definition Socket.h:496
ASSA::SOCKTRACE
@ SOCKTRACE
Extended Socket & friends messages
Definition LogMask.h:42

References ASSA::SOCKTRACE, and trace_with_mask.

## ~Socket()

ASSA::Socket::~Socket | ( |  | ) |

inline virtual

Destructor.

Definition at line 531 of file Socket.h.

{
trace_with_mask("Socket::~Socket",SOCKTRACE);
}

References ASSA::SOCKTRACE, and trace_with_mask.

## Socket() [2/2]

ASSA::Socket::Socket | ( | const Socket & |  | ) |

private

The copy constructor and assignment operator are private to prevent copying of Socket objects, since the effect of such copying is not well defined.

Usually you want to copy a pointer to the object, or pass a reference to a function.

## Member Function Documentation

## bad()

bool ASSA::Socket::bad | ( |  | ) | const

inline

Socket fd == -1 or read/write error occured or some loss of integrity on assosiated stream buffer.

Returns
  true if badbit is set, false otherwise

Definition at line 337 of file Socket.h.

{ return m_state & Socket::badbit; }

References badbit, and m_state.

Referenced by dumpState().

## bind()

virtual bool ASSA::Socket::bind | ( | const Address & | my_address_ | ) |

pure virtual

Server binds listening socket to its local well-known port.

Parameters

  my_address_ | address to bind to

Returns
  true if success, false otherwise

Implemented in ASSA::IPv4Socket, and ASSA::UDPSocket.

## clear()

void ASSA::Socket::clear | ( | iostate | state_ = `Socket::goodbit` | ) |

inline

Clear the socket state. Closed socket remains in bad state.

Definition at line 571 of file Socket.h.

{
m_state = is_valid_handler (m_fd) ? state_ : state_ | Socket::badbit;
}
ASSA::is_valid_handler
bool is_valid_handler(handler_t socket_)
Detect socket() error in a portable way.
Definition Logger_Impl.h:100

References badbit, ASSA::is_valid_handler(), m_fd, and m_state.

Referenced by ASSA::IPv4Socket::connect(), ASSA::IPv4Socket::open(), and ASSA::UDPSocket::open().

## clear_fd_options()

int Socket::clear_fd_options | ( | long | flags_ | ) |

protected

Gateway method for clearing file descriptor options.

This is a private function used only by class Socket.

Returns
  0 on success, -1 on error (fcntl(2) failed)

The only value for flags_ is O_NONBLOCK - set the socket back to the blocking mode.

Definition at line 146 of file Socket.cpp.

{
trace_with_mask("Socket::clear_fd_options",SOCKTRACE);
long oldflags;
long newflags;
int ret;
#if defined (WIN32)
u_long set_block = 0;
if ((ret = ioctlsocket (m_fd, FIONBIO, &set_block)) == 0) {
m_nonblocking = false;
return 0;
}
return -1;
#else
if ((oldflags = ::fcntl (m_fd, F_GETFL, 0)) < 0) {
return -1;
}
newflags = oldflags & ~flags_; // clear flags
DL ((SOCKTRACE,"Set flags fcntl(%d, %s)\n", m_fd,
decode_fcntl_flags (newflags).c_str ()));
ret = ::fcntl (m_fd, F_SETFL, newflags);
newflags = ::fcntl (m_fd, F_GETFL, 0);
DL ((SOCKTRACE,"Flags are set to %s via fcntl(%d)\n",
decode_fcntl_flags (newflags).c_str ()));
return (ret);
#endif
}
DL
#define DL(X)
A macro for writing debug message to the Logger.
Definition Logger.h:273
ASSA::AutoPtrRef
A wrapper class to provide AutoPtr with reference semantics.
Definition AutoPtr.h:32
ASSA::Socket::decode_fcntl_flags
static string decode_fcntl_flags(long mask_)
Decipher flags packed into mask_ used in fcntl() call.
Definition Socket.cpp:713

References decode_fcntl_flags(), DL, m_fd, ASSA::SOCKTRACE, and trace_with_mask.

Referenced by setOption(), and turnOptionOff().

## close()

virtual bool ASSA::Socket::close | ( |  | ) |

pure virtual

Close socket.

Implemented in ASSA::IPv4Socket, and ASSA::UDPSocket.

Referenced by close_handler().

## close_handler()

static void ASSA::Socket::close_handler | ( | handler_t & | socket_ | ) |

inline static

Close socket endpoint in a portable way.

Socket is also set to an invalid value.

Definition at line 448 of file Socket.h.

{
#if defined (WIN32)
closesocket (socket_);
#else
::close (socket_);
#endif
disable_handler (socket_);
}
ASSA::Socket::close
virtual bool close()=0
Close socket.
ASSA::disable_handler
void disable_handler(handler_t &socket_)
Set socket descriptor to invalid value in a portable way.
Definition Logger_Impl.h:108

References close(), and ASSA::disable_handler().

Referenced by ASSA::IPv4Socket::close().

## connect()

bool ASSA::Socket::connect | ( | const Address & | address_ | ) |

inline virtual

Make a connection.

Parameters

  address_ | address of the server to connect to

Reimplemented in ASSA::IPv4Socket, and ASSA::ConUDPSocket.

Definition at line 537 of file Socket.h.

{
trace_with_mask("Socket::connect",SOCKTRACE);
return false;
}

References ASSA::SOCKTRACE, and trace_with_mask.

## decode_fcntl_flags()

string Socket::decode_fcntl_flags | ( | long | mask_ | ) |

static

Decipher flags packed into mask_ used in fcntl() call.

Definition at line 712 of file Socket.cpp.

{
string answer;
#if !defined (WIN32)
if (mask_ & O_RDONLY) {
answer = "O_RDONLY|"; // 000000
}
if (mask_ & O_WRONLY) {
answer += "O_WRONLY|"; // 000001
}
if (mask_ & O_RDWR) {
answer += "O_RDWR|"; // 000002
}
if (mask_ & O_APPEND) {
answer += "O_APPEND|"; // 001000
}
if (mask_ & O_NONBLOCK) {
answer += "O_NONBLOCK|";// 004000
}
if (mask_ & O_SYNC) {
answer += "O_SYNC|"; // 010000
}
if (mask_ & O_ASYNC) { // 020000
answer += "O_ASYNC|";
}
answer.erase (answer.end () - 1);
#endif
return answer;
}

Referenced by clear_fd_options(), and set_fd_options().

## dumpState()

void Socket::dumpState | ( | void |  | ) | const

Write state bits of the socket to the log file.

Definition at line 652 of file Socket.cpp.

{
trace_with_mask("Socket::dumpState",SOCKTRACE);
char state_set[] = "[ set]\n";
char state_not_set[] = "[not set]\n";
std::ostringstream msg;
msg << "\n";
msg << "\tTesting good() ....... ";
if (this->good ()) msg << state_set;
else msg << state_not_set;
msg << "\tTesting eof() ........ ";
if (this->eof ()) msg << state_set;
else msg << state_not_set;
msg << "\tTesting fail() ....... ";
if (this->fail ()) msg << state_set;
else msg << state_not_set;
msg << "\tTesting bad() ........ ";
if (this->bad ()) msg << state_set;
else msg << state_not_set;
msg << "\tTesting !() .......... ";
if ( !(*this) ) msg << state_set;
else msg << state_not_set;
msg << "\tTesting void *() ..... ";
if ( *this ) msg << state_set;
else msg << state_not_set;
msg << "\tTesting nonblocking... ";
if (getOption (nonblocking) == 1) msg << state_set;
else msg << state_not_set;
/*--- Terminate stream buffer ---*/
msg << std::ends;
DL((SOCKTRACE,"%s\n", msg.str ().c_str ()));
}
ASSA::Socket::fail
bool fail() const
Indicates that earlier extraction opeartion has failed to match the required pattern of input.
Definition Socket.h:328
ASSA::Socket::eof
bool eof() const
An earlier extraction operation has encountered the end of file of the input stream (peer closed its ...
Definition Socket.h:321
ASSA::Socket::bad
bool bad() const
Socket fd == -1 or read/write error occured or some loss of integrity on assosiated stream buffer.
Definition Socket.h:337
ASSA::Socket::getOption
int getOption(opt_t opt_) const
Get current value of a socket option.
Definition Socket.cpp:248
ASSA::Socket::good
bool good() const
Indicates no error on the socket.
Definition Socket.h:315

References bad(), DL, eof(), fail(), getOption(), good(), nonblocking, ASSA::SOCKTRACE, and trace_with_mask.

## eof()

bool ASSA::Socket::eof | ( |  | ) | const

inline

An earlier extraction operation has encountered the end of file of the input stream (peer closed its socket).

Returns
  true if peer closed the socket; false otherwise

Definition at line 321 of file Socket.h.

{ return m_state & Socket::eofbit; }

References eofbit, and m_state.

Referenced by dumpState().

## fail()

bool ASSA::Socket::fail | ( |  | ) | const

inline

Indicates that earlier extraction opeartion has failed to match the required pattern of input.

Socket should be closed at this point by the owner.

Returns
  true if failbit or badbit is set, false otherwise

Definition at line 328 of file Socket.h.

{
return m_state & (Socket::failbit | Socket::badbit);
}

References badbit, failbit, and m_state.

Referenced by dumpState(), and operator!().

## flush()

Socket & Socket::flush | ( |  | ) |

virtual

This function simply calls the public "synchronizing" function rdbuf()->pubsync() (assuming the associated streambuf object is present).

Typically, such an operation flushes an output stream to the associated external pipe.

Definition at line 73 of file Socket.cpp.

{
if (good () && rdbuf ()) {
if (rdbuf ()->pubsync () == EOF) {
setstate (badbit);
}
}
return (*this);
}
ASSA::Socket::rdbuf
virtual Streambuf * rdbuf()
Return a pointer to the Streambuf associated with the stream.
Definition Socket.h:240
ASSA::Socket::setstate
void setstate(iostate flag_)
Set socket state to flag_ by adding flag_ to the existing state.
Definition Socket.h:577

References badbit, good(), rdbuf(), and setstate().

Referenced by ASSA::IPv4Socket::close().

## getBytesAvail()

int Socket::getBytesAvail | ( | void |  | ) | const

Return number of bytes available in socket receive buffer.

There can be bytes already stored in the Streambuf buffer, in addition to bytes that arrived and are ready for reading in the socket buffer (kernel address space).

Sum of these two numbers is the true number of bytes available for immediate reading.

Definition at line 47 of file Socket.cpp.

{
trace_with_mask("Socket::getBytesAvail",SOCKTRACE);
Socket* This = (Socket*) this;
u_long ba = 0;
int ret = 0;
#if defined(WIN32)
ret = ioctlsocket (m_fd, FIONREAD, &ba);
#else
ret = ioctl (m_fd, FIONREAD, &ba);
#endif
if (ret == -1) {
EL((ASSAERR,"ioctl(2) failed with ret: %d\n", ret));
return ret;
}
ba += This->rdbuf ()->in_avail ();
DL((SOCKTRACE,"%ld bytes available for reading\n", ba));
return (int(ba));
}
EL
#define EL(X)
A macro for writing error message to the Logger.
Definition Logger.h:285
ASSA::Socket
Definition Socket.h:71
ASSA::ASSAERR
@ ASSAERR
ASSA and system errors
Definition LogMask.h:34

References ASSA::ASSAERR, DL, EL, m_fd, ASSA::SOCKTRACE, and trace_with_mask.

Referenced by ASSA::Socketbuf::showmanyc().

## getDomain()

virtual const int ASSA::Socket::getDomain | ( |  | ) | const

pure virtual

Get socket domain.

Implemented in ASSA::IPv4Socket, and ASSA::UDPSocket.

## getHandler()

virtual handler_t ASSA::Socket::getHandler | ( |  | ) | const

pure virtual

Get file descriptor.

Implemented in ASSA::IPv4Socket, and ASSA::UDPSocket.

Referenced by ASSA::Socketbuf::sys_read(), and ASSA::Socketbuf::sys_write().

## getOption()

int Socket::getOption | ( | opt_t | opt_ | ) | const

Get current value of a socket option.

Parameters

  opt_ | option name

Returns
  option value on success (for binary: 0 - disable, 1 - enabled); -1 if error

Definition at line 247 of file Socket.cpp.

{
trace_with_mask("Socket::getOption",SOCKTRACE);
int optval = 0;
if (nonblocking == opt_)
{
#if defined (WIN32)
return (m_nonblocking ? 1 : 0);
#else
if ((optval = ::fcntl (m_fd, F_GETFL, 0)) < 0) {
return -1;
}
return ((optval & O_NONBLOCK) == O_NONBLOCK ? 1 : 0);
#endif
}
int optname;
int level = SOL_SOCKET;
bool bin = false;
socklen_t len = sizeof (optval);
int ret;
if (rcvlowat == opt_) {
optname = SO_RCVLOWAT;
}
else if (sndlowat == opt_) {
optname = SO_SNDLOWAT;
}
else if (reuseaddr == opt_) {
optname = SO_REUSEADDR;
bin = true;
}
else {
EL((ASSAERR,"Invalid socket option\n"));
return (-1);
}
#if defined (__CYGWIN32__) || defined (WIN32)
ret = getsockopt (m_fd, level, optname, (char*) &optval, (int*)&len);
#else // posix/unix
ret = getsockopt (m_fd, level, optname, (char*) &optval, &len);
#endif
if (ret < 0) {
return (-1);
}
if (bin) {
return (ret == 0 ? 0 : 1);
}
return (ret);
}

References ASSA::ASSAERR, EL, m_fd, nonblocking, rcvlowat, reuseaddr, sndlowat, ASSA::SOCKTRACE, and trace_with_mask.

Referenced by dumpState().

## good()

bool ASSA::Socket::good | ( |  | ) | const

inline

Indicates no error on the socket.

Returns
  true if goodbit is set, false otherwise

Definition at line 315 of file Socket.h.

{ return m_state == 0; }

References m_state.

Referenced by ASSA::IPv4Socket::clone(), dumpState(), flush(), and ASSA::RemoteLogger::log_func().

## ignore()

int Socket::ignore | ( | int | n_ = `INT_MAX`,
|  | int | delim_ = `EOF`
| ) |  |

Extracts bytes and discards them.

With no arguments, read and discard until eof is encountered.

Bytes are extracted in the following manner:

n_ | delim_ | Action
--- | --- | ---
1 | EOF | Read and discard 1 byte
k | EOF | Read and discard at most k bytes
INT_MAX | EOF | Read and discard till eof is reached
INT_MAX | 'c' | Read and discard till either 'c' or eof is found
k | 'c' | Read and discard at most k bytes, but stop if 'c' is found

Parameters

  n_ | number of bytes to ignore (default=INT_MAX)
  delim_ | delimiter to search for (default=EOF)

Returns
  number of bytes discarded

Definition at line 307 of file Socket.cpp.

{
trace_with_mask("Socket::ignore",SOCKTRACE);
register int b;
register int count = 0;
register char c;
if (n_ == INT_MAX && delim_ == EOF) {
char buf[PGSIZE];
while ((b = read (buf, PGSIZE))) {
count += b;
}
setstate (Socket::eofbit|Socket::failbit);
return count;
}
for (; n_; n_--, count++) {
if ( (b = read (&c, 1)) == 0 ) {
setstate (Socket::eofbit|Socket::failbit);
break;
}
if ( c == delim_ )
break;
}
return count;
}
ASSA::Socket::read
virtual int read(char *buf_, const u_int size_)
Read expected number of bytes from the socket.
Definition Socket.h:551
ASSA::Socket::PGSIZE
static const int PGSIZE
Size of bytes of a kernel page.
Definition Socket.h:74

References eofbit, failbit, PGSIZE, read(), setstate(), ASSA::SOCKTRACE, and trace_with_mask.

Referenced by operator>>().

## in_avail()

virtual int ASSA::Socket::in_avail | ( |  | ) | const

pure virtual

This function returns the number of characters
immediately available in the get area of the underlying Socketbuf buffer without making a system call if Socket is doing buffering I/O.

It is certain that returned number of characters may be fetched without error, and without accessing any external device.

Implemented in ASSA::ConUDPSocket, ASSA::IPv4Socket, and ASSA::UnConUDPSocket.

## is_little_endian()

bool Socket::is_little_endian | ( |  | ) |

static

Determine the endianess of the platform we are on.

Returns
  true if it is a little-endian host; false if a big-endian host.

Definition at line 699 of file Socket.cpp.

{
union {
char c [sizeof (short)];
short v;
} endian_u;
endian_u.v = 256;
return (endian_u.c [0] == 0);
}

## open()

virtual bool ASSA::Socket::open | ( | const int | domain_ | ) |

pure virtual

Open socket.

Implemented in ASSA::IPv4Socket, and ASSA::UDPSocket.

## operator void *()

ASSA::Socket::operator void * | ( |  | ) | const

inline

Convertion to void* (for testing where bool is required)

Definition at line 558 of file Socket.h.

{
return fail() ? (void *)0 : (void *)(-1);
}

## operator!()

bool ASSA::Socket::operator! | ( |  | ) | const

inline

Alias to fail()

Definition at line 564 of file Socket.h.

{
return fail();
}

References fail().

## operator<<() [1/13]

Socket & Socket::operator<< | ( | char | c | ) |

Output of built-in char type. The value will be XDR-encoded.

Definition at line 506 of file Socket.cpp.

{
/* See comment to operator>>(char n_) */
int buf = 0;
int len = sizeof (int);
XDR xdrs;
xdrmem_create (&xdrs, (caddr_t) &buf, len, XDR_ENCODE);
xdr_char (&xdrs, &n_);
if (write ((const char*) &buf, len) != len) {
(Socket::eofbit|Socket::failbit);
}
xdr_destroy (&xdrs);
return *this;
}
ASSA::Socket::write
virtual int write(const char *buf_, const u_int size_)
Write specified number of bytes to the socket.
Definition Socket.h:544

References eofbit, failbit, and write().

## operator<<() [2/13]

Socket & Socket::operator<< | ( | const std::string & | s_ | ) |

Output of STL string type. The value will be XDR-encoded.

XDR STRING representation: (from RFC 1832 - http://www.faqs.org/rfcs/rfc1832.html)

0 1 2 3 4 5 ... +--—+--—+--—+--—+--—+--—+...+--—+--—+...+--—+ | length n |byte0|byte1|...| n-1 | 0 |...| 0 | +--—+--—+--—+--—+--—+--—+...+--—+--—+...+--—+ |<----—4 bytes----—>|<---—n bytes---—>|<—r bytes—>| |<-—n+r (where (n+r) mod 4 = 0)-—>|

If n is not a multiple of four, then the n bytes are followed by enough (0 to 3) residual zero bytes, r, to make the total byte count a multiple of four. In other words, (4 - n % 4) == r.

We follow the format, but send data bytes as-is - no conversion is required. We also pad data with r bytes.

Definition at line 544 of file Socket.cpp.

{
static const char pad [4] = { 0, 0, 0, 0 };
(*this) << s_.length ();
int ret = write (s_.c_str (), s_.length ());
if ( ret != s_.length () ) {
setstate (Socket::eofbit|Socket::failbit);
}
size_t r = 4 - s_.length() % 4;
if (r) {
if (write (pad, r) != r) {
setstate (Socket::eofbit|Socket::failbit);
}
}
return *this;
}

References eofbit, failbit, setstate(), and write().

## operator<<() [3/13]

Socket & Socket::operator<< | ( | double | n_ | ) |

Output of built-in double type. The value will be XDR-encoded.

Definition at line 634 of file Socket.cpp.

{
double buf, f = n_;
XDR xdrs;
xdrmem_create (&xdrs, (caddr_t) &buf, sizeof(double), XDR_ENCODE);
xdr_double (&xdrs, &f);
int ret = write ((const char*) &buf, sizeof(double));
xdr_destroy (&xdrs);
if ( ret != sizeof(double) ) {
setstate (Socket::eofbit|Socket::failbit);
}
return *this;
}

References eofbit, failbit, setstate(), and write().

## operator<<() [4/13]

Socket & Socket::operator<< | ( | float | n_ | ) |

Output of built-in float type. The value will be XDR-encoded.

Definition at line 617 of file Socket.cpp.

{
float buf, f = n_;
XDR xdrs;
xdrmem_create (&xdrs, (caddr_t) &buf, sizeof(float), XDR_ENCODE);
xdr_float (&xdrs, &f);
int ret = write ((const char*) &buf, sizeof(float));
xdr_destroy (&xdrs);
if ( ret != sizeof(float) ) {
setstate (Socket::eofbit|Socket::failbit);
}
return *this;
}

References eofbit, failbit, setstate(), and write().

## operator<<() [5/13]

Socket & Socket::operator<< | ( | int | n_ | ) |

Output of built-in integer type. The value will be XDR-encoded.

Definition at line 612 of file Socket.cpp.

## operator<<() [6/13]

Socket & Socket::operator<< | ( | long | n_ | ) |

Output of built-in long type. The value will be XDR-encoded.

Definition at line 614 of file Socket.cpp.

## operator<<() [7/13]

Socket & Socket::operator<< | ( | short | n_ | ) |

Output of built-in short type. The value will be XDR-encoded.

Definition at line 564 of file Socket.cpp.

{
short val = (short) htons((short)n_);
if (write ((const char*) &val, sizeof(short)) != sizeof(short))
{
setstate (Socket::eofbit|Socket::failbit);
}
return *this;
}

References eofbit, failbit, setstate(), and write().

## operator<<() [8/13]

Socket & ASSA::Socket::operator<< | ( | signed char | c_ | ) |

inline

Output of built-in signed char type. The value will be XDR-encoded.

Definition at line 400 of file Socket.h.

{
return (*this) << (char) c_;
}

## operator<<() [9/13]

Socket & ASSA::Socket::operator<< | ( | Socket &(*)(Socket &) | f | ) |

inline

Manipulators plug-in operator.

Definition at line 433 of file Socket.h.

{
return (f (*this));
}

## operator<<() [10/13]

Socket & ASSA::Socket::operator<< | ( | unsigned char | c_ | ) |

inline

Output of built-in u_char type. The value will be XDR-encoded.

Definition at line 394 of file Socket.h.

{
return (*this) << (char) c_;
}

## operator<<() [11/13]

Socket & Socket::operator<< | ( | unsigned int | n_ | ) |

Output of built-in u_int type. The value will be XDR-encoded.

Definition at line 613 of file Socket.cpp.

## operator<<() [12/13]

Socket & Socket::operator<< | ( | unsigned long | n_ | ) |

Output of built-in u_long type. The value will be XDR-encoded.

Definition at line 615 of file Socket.cpp.

## operator<<() [13/13]

Socket & Socket::operator<< | ( | unsigned short | n_ | ) |

Output of built-in u_short type. The value will be XDR-encoded.

Definition at line 576 of file Socket.cpp.

{
u_short val = (u_short) htons((u_short)n_);
if (write ((const char*) &val, sizeof(u_short)) != sizeof(u_short))
{
setstate (Socket::eofbit|Socket::failbit);
}
return *this;
}
u_short
unsigned short u_short
Definition Logger_Impl.h:39

References eofbit, failbit, setstate(), and write().

## operator=()

Socket & ASSA::Socket::operator= | ( | const Socket & |  | ) |

private

## operator>>() [1/12]

Socket & Socket::operator>> | ( | char & | n_ | ) |

Input of built-in char type. The value will be XDR-decoded.

From xdr_simple(3N) man page:

"xdr_char() translates between C characters and their external representations. Note: encoded characters are not packed, and occupy 4 bytes each."

From SunOS 5.3 Network Interfaces Programmer's Guide, "XDR Protocol Specification":

"The representation of all items requires a multipe of four bytes (or 32 bits) of data. ... The n bytes are followed by enough (0 to 3) residual zero bytes, r, to make the total byte count a multiple of four."

The implication if this is that even though we transerfer 1 byte, we still have to allocate and transfer 4 bytes to hold it.

Definition at line 358 of file Socket.cpp.

{
int c = 0;
int len = sizeof (int);
XDR xdrs;
xdrmem_create (&xdrs, (caddr_t) &c, len, XDR_DECODE);
if (read ((char* ) &c, len) == len) {
xdr_char (&xdrs, &n_);
}
else {
setstate (Socket::eofbit|Socket::failbit);
}
xdr_destroy(&xdrs);
return *this;
}

References eofbit, failbit, read(), and setstate().

Referenced by operator>>(), and operator>>().

## operator>>() [2/12]

Socket & Socket::operator>> | ( | double & | n_ | ) |

Input of built-in double type. The value will be XDR-decoded.

Definition at line 486 of file Socket.cpp.

{
double val = 0;
XDR xdrs;
xdrmem_create (&xdrs, (caddr_t) &val, sizeof(double), XDR_DECODE);
if (read ((char*) &val, sizeof(double)) == sizeof(double)) {
xdr_double (&xdrs, &n_);
}
else {
setstate (Socket::eofbit|Socket::failbit);
}
xdr_destroy (&xdrs);
return *this;
}

References eofbit, failbit, read(), and setstate().

## operator>>() [3/12]

Socket & Socket::operator>> | ( | float & | n_ | ) |

Input of built-in float type. The value will be XDR-decoded.

Definition at line 468 of file Socket.cpp.

{
float val;
XDR xdrs;
xdrmem_create (&xdrs, (caddr_t) &val, sizeof(float), XDR_DECODE);
if (read ((char*) &val, sizeof(float)) == sizeof(float)) {
xdr_float (&xdrs, &n_);
}
else {
setstate (Socket::eofbit|Socket::failbit);
}
xdr_destroy (&xdrs);
return *this;
}

References eofbit, failbit, read(), and setstate().

## operator>>() [4/12]

Socket & Socket::operator>> | ( | int & | n_ | ) |

Input of built-in integer type. The value will be XDR-decoded.

Definition at line 462 of file Socket.cpp.

## operator>>() [5/12]

Socket & Socket::operator>> | ( | long & | n_ | ) |

Input of built-in long type. The value will be XDR-decoded.

Definition at line 464 of file Socket.cpp.

## operator>>() [6/12]

Socket & Socket::operator>> | ( | short & | n_ | ) |

Input of built-in short type. The value will be XDR-decoded.

Definition at line 401 of file Socket.cpp.

{
short val;
if (read ((char*) &val, sizeof(short)) == sizeof(short)) {
n_ = (short) ntohs ((short)val);
}
else {
setstate (Socket::eofbit|Socket::failbit);
}
return *this;
}

References eofbit, failbit, read(), and setstate().

## operator>>() [7/12]

Socket & ASSA::Socket::operator>> | ( | signed char & | c_ | ) |

inline

Input of built-in signed char type. The value will be XDR-decoded.

Definition at line 358 of file Socket.h.

{
return operator>>((char&) c_);
}
ASSA::Socket::operator>>
Socket & operator>>(char &c)
Input of built-in char type. The value will be XDR-decoded.
Definition Socket.cpp:359

References operator>>().

## operator>>() [8/12]

Socket & Socket::operator>> | ( | std::string & | s_ | ) |

Input of STL string type. The string content will be XDR-decoded.

For format explanation, see comment to operator<<(string&)

Definition at line 380 of file Socket.cpp.

{
char c = 0;
size_t n = 0;
s_ = "";
(*this) >> n;
if (n == 0) {
return *this;
}
size_t len = n;
while (len-- && read (&c, 1) == 1) {
s_ += c;
}
ignore (4 - n % 4);
return *this;
}
ASSA::Socket::ignore
int ignore(int n_=INT_MAX, int delim_=EOF)
Extracts bytes and discards them.
Definition Socket.cpp:308

References ignore(), and read().

## operator>>() [9/12]

Socket & ASSA::Socket::operator>> | ( | unsigned char & | c_ | ) |

inline

Input of built-in u_char type. The value will be XDR-decoded.

Definition at line 352 of file Socket.h.

{
return operator>>((char&) c_);
}

References operator>>().

## operator>>() [10/12]

Socket & Socket::operator>> | ( | unsigned int & | n_ | ) |

Input of built-in u_int type. The value will be XDR-decoded.

Definition at line 463 of file Socket.cpp.

## operator>>() [11/12]

Socket & Socket::operator>> | ( | unsigned long & | n_ | ) |

Input of built-in u_long type. The value will be XDR-decoded.

Definition at line 465 of file Socket.cpp.

## operator>>() [12/12]

Socket & Socket::operator>> | ( | unsigned short & | n_ | ) |

Input of built-in u_short type. The value will be XDR-decoded.

Definition at line 415 of file Socket.cpp.

{
u_short val;
if (read ((char*) &val, sizeof(u_short)) == sizeof(u_short)) {
n_ = (u_short) ntohs ((u_short)val);
}
else {
setstate (Socket::eofbit|Socket::failbit);
}
return *this;
}

References eofbit, failbit, read(), and setstate().

## rdbuf() [1/2]

virtual Streambuf * ASSA::Socket::rdbuf | ( |  | ) |

inline virtual

Return a pointer to the Streambuf associated with the stream.

This is part of the construction of a stream, and the buffer class object is not normally changed. This function may be used to get at Streambuf functionality directly, given a Socket object. Default behavior is to return NULL.

Returns
  NULL

Reimplemented in ASSA::IPv4Socket.

Definition at line 240 of file Socket.h.

{ return 0; }

Referenced by flush().

## rdbuf() [2/2]

virtual Streambuf * ASSA::Socket::rdbuf | ( | Streambuf * |  | ) |

inline virtual

Virtual function that sets new socket buffer and returns the old one.

Default behavior is to return NULL.

Returns
  Old Socketbuf object.

Reimplemented in ASSA::IPv4Socket.

Definition at line 247 of file Socket.h.

{ return 0; }

## rdstate()

iostate ASSA::Socket::rdstate | ( |  | ) | const

inline

Retrieve state of the socket.

Returns
  control state of the socket

Definition at line 302 of file Socket.h.

{ return m_state; }

References m_state.

## read()

int ASSA::Socket::read | ( | char * | buf_,
|  | const u_int | size_
| ) |  |

inline virtual

Read expected number of bytes from the socket.

Parameters

  buf_ | buffer to save received packet to
  size_ | size of the packet

Reimplemented in ASSA::ConUDPSocket, and ASSA::IPv4Socket.

Definition at line 551 of file Socket.h.

{
trace_with_mask("Socket::read()",SOCKTRACE);
return -1;
}

References ASSA::SOCKTRACE, and trace_with_mask.

Referenced by ignore(), operator>>(), operator>>(), operator>>(), operator>>(), operator>>(), and operator>>().

## set_fd_options()

int Socket::set_fd_options | ( | long | flags_ | ) |

protected

Gateway method for setting file descriptor options.

This is a private function used only by class Socket.

Returns
  0 on success, -1 on error (fcntl(2) failed)

The only value for flags_ is O_NONBLOCK.

Definition at line 103 of file Socket.cpp.

{
trace_with_mask("Socket::set_fd_options",SOCKTRACE);
int val;
int ret;
#if defined (WIN32)
u_long set_nonblock = 1;
if ((val = ioctlsocket (m_fd, FIONBIO, &set_nonblock)) == 0) {
m_nonblocking = true;
return 0;
}
return -1;
#else // POSIX/UNIX
if ((val = ::fcntl (m_fd, F_GETFL, 0)) < 0) {
return -1;
}
val |= flags_; // turn flags on
DL ((SOCKTRACE,"Set flags fcntl(%d, %s)\n", m_fd,
decode_fcntl_flags (val).c_str ()));
ret = ::fcntl (m_fd, F_SETFL, val);
val = ::fcntl (m_fd, F_GETFL, 0);
DL ((SOCKTRACE,"Flags are set to %s via fcntl(25)\n",
decode_fcntl_flags (val).c_str ()));
return (ret);
#endif
}

References decode_fcntl_flags(), DL, m_fd, ASSA::SOCKTRACE, and trace_with_mask.

Referenced by setOption(), and turnOptionOn().

## set_option()

int Socket::set_option | ( | int | level_,
|  | int | optname_,
|  | int | val_
| ) |  |

protected

Gateway method of setting socket options.

Returns
  0 on success, -1 on error (setsockopt(2) failed)

Definition at line 85 of file Socket.cpp.

{
int ret = setsockopt (m_fd,
level_,
optname_,
(const char*) &val_,
sizeof (val_));
if (ret < 0) {
setstate (Socket::failbit);
}
return ret;
}

References failbit, m_fd, and setstate().

Referenced by setOption(), turnOptionOff(), and turnOptionOn().

## setOption()

bool Socket::setOption | ( | opt_t | opt_,
|  | int | arg_
| ) |  |

Set socket option to value required.

Parameters

  opt_ | option name
  arg_ | value to set (for binary: 0 - disable, 1 - enable).

Returns
  true on success_; false if error

Definition at line 222 of file Socket.cpp.

{
trace_with_mask("Socket::setOption(,)",SOCKTRACE);
int optname;
if (nonblocking == opt_) {
return (arg_ == 1) ? set_fd_options (O_NONBLOCK)
: clear_fd_options (O_NONBLOCK);
}
if (rcvlowat == opt_) {
optname = SO_RCVLOWAT;
}
else if (sndlowat == opt_) {
optname = SO_SNDLOWAT;
}
else {
EL((ASSAERR,"Invalid socket option\n"));
return false;
}
return set_option (SOL_SOCKET, optname, arg_) == 0;
}
ASSA::Socket::clear_fd_options
int clear_fd_options(long flags_)
Gateway method for clearing file descriptor options.
Definition Socket.cpp:147
ASSA::Socket::set_fd_options
int set_fd_options(long flags_)
Gateway method for setting file descriptor options.
Definition Socket.cpp:104
ASSA::Socket::set_option
int set_option(int level_, int optname_, int val_)
Gateway method of setting socket options.
Definition Socket.cpp:86

References ASSA::ASSAERR, clear_fd_options(), EL, nonblocking, rcvlowat, set_fd_options(), set_option(), sndlowat, ASSA::SOCKTRACE, and trace_with_mask.

## setstate()

void ASSA::Socket::setstate | ( | iostate | flag_ | ) |

inline

Set socket state to flag_ by adding flag_ to the existing state.

Parameters

  flag_ | new state

Definition at line 577 of file Socket.h.

{
m_state |= flag_;
}

References m_state.

Referenced by ASSA::IPv4Socket::bind(), ASSA::UDPSocket::bind(), ASSA::IPv4Socket::close(), ASSA::UDPSocket::close(), ASSA::ConUDPSocket::connect(), flush(), ignore(), ASSA::IPv4Socket::open(), ASSA::UDPSocket::open(), operator<<(), operator<<(), operator<<(), operator<<(), operator<<(), operator>>(), operator>>(), operator>>(), operator>>(), operator>>(), ASSA::ConUDPSocket::read(), ASSA::IPv4Socket::read(), and set_option().

## turnOptionOff()

bool Socket::turnOptionOff | ( | opt_t | opt_ | ) |

Disable socket option.

Parameters

  opt_ | option name

Returns
  true on success; false if error

Definition at line 203 of file Socket.cpp.

{
trace_with_mask("Socket::turnOptionOff",SOCKTRACE);
if (nonblocking == opt_)
return clear_fd_options (O_NONBLOCK);
int optname;
if (reuseaddr == opt_)
optname = SO_REUSEADDR;
else {
EL((ASSAERR,"Invalid socket option\n"));
return false;
}
return set_option (SOL_SOCKET, optname, 0) == 0;
}

References ASSA::ASSAERR, clear_fd_options(), EL, nonblocking, reuseaddr, set_option(), ASSA::SOCKTRACE, and trace_with_mask.

Referenced by ASSA::RemoteLogger::log_open().

## turnOptionOn()

bool Socket::turnOptionOn | ( | opt_t | opt_ | ) |

Enable socket option.

Parameters

  opt_ | option name

Returns
  true on success; false if error

Definition at line 184 of file Socket.cpp.

{
trace_with_mask("Socket::turnOptionOn",SOCKTRACE);
if (nonblocking == opt_)
return set_fd_options (O_NONBLOCK);
int optname;
if (reuseaddr == opt_)
optname = SO_REUSEADDR;
else {
EL((ASSAERR,"Invalid socket option\n"));
return false;
}
return set_option (SOL_SOCKET, optname, 1) == 0;
}

References ASSA::ASSAERR, EL, nonblocking, reuseaddr, set_fd_options(), set_option(), ASSA::SOCKTRACE, and trace_with_mask.

Referenced by ASSA::IPv4Socket::bind(), and ASSA::IPv4Socket::open().

## write()

int ASSA::Socket::write | ( | const char * | buf_,
|  | const u_int | size_
| ) |  |

inline virtual

Write specified number of bytes to the socket.

Parameters

  buf_ | packet to send
  size_ | size of the packet

Reimplemented in ASSA::IPv4Socket, and ASSA::ConUDPSocket.

Definition at line 544 of file Socket.h.

{
trace_with_mask("Socket::write",SOCKTRACE);
return -1;
}

References ASSA::SOCKTRACE, and trace_with_mask.

Referenced by operator<<(), operator<<(), operator<<(), operator<<(), operator<<(), and operator<<().

## xdr_length()

static size_t ASSA::Socket::xdr_length | ( | const std::string & | s_ | ) |

inline static

Give the true length of the XDR-encoded STL string.

Definition at line 343 of file Socket.h.

{
return (4 + s_.length () + s_.length () % 4);
}

Referenced by ASSA::RemoteLogger::log_func(), ASSA::RemoteLogger::log_msg(), ASSA::RemoteLogger::log_open(), and ASSA::xdrIOBuffer::operator>>().

## Member Data Documentation

## m_fd

handler_t ASSA::Socket::m_fd

protected

File descriptor.

Definition at line 485 of file Socket.h.

Referenced by ASSA::IPv4Socket::accept(), ASSA::IPv4Socket::bind(), ASSA::UDPSocket::bind(), clear(), clear_fd_options(), ASSA::IPv4Socket::clone(), ASSA::IPv4Socket::close(), ASSA::UDPSocket::close(), ASSA::IPv4Socket::connect(), getBytesAvail(), ASSA::IPv4Socket::getHandler(), ASSA::UDPSocket::getHandler(), getOption(), ASSA::IPv4Socket::IPv4Socket(), ASSA::IPv4Socket::open(), ASSA::UDPSocket::open(), ASSA::IPv4Socket::read(), set_fd_options(), set_option(), ASSA::UDPSocket::setHandler(), ASSA::UDPSocket::UDPSocket(), and ASSA::IPv4Socket::write().

## m_state

IOState ASSA::Socket::m_state

protected

Control state of the socket.

Definition at line 496 of file Socket.h.

Referenced by bad(), clear(), eof(), fail(), good(), rdstate(), and setstate().

## m_type

int ASSA::Socket::m_type

protected

Socket domain type.

Definition at line 488 of file Socket.h.

Referenced by ASSA::IPv4Socket::getDomain(), ASSA::UDPSocket::getDomain(), ASSA::IPv4Socket::open(), ASSA::UDPSocket::open(), and ASSA::UDPSocket::setDomain().

## PGSIZE

const int ASSA::Socket::PGSIZE = 4096

static

Size of bytes of a kernel page.

Definition at line 74 of file Socket.h.

Referenced by ignore().

The documentation for this class was generated from the following files:

- Socket.h
- Socket.cpp