nnl::Socket::Impl Struct Reference

Socket private implementation. More...

#include <socket_private.hh>

List of all members.

Public Types

enum  State
 State of socket. More...

Public Member Functions

void Constructor ()
 General constructor.
void SetError (int eno, const char *text)
 Set error.
void SetError (const char *text)
 Set error text.
bool SetSoError (const char *prefix, const char *text)
 Set socket error.
int GetSoError (int s, int &optval)
 Get error.
int SetNonblocking (bool on)
 Set socket (non)blocking.
int Init (int domain=AF_INET)
 Initialize a socket.
size_t DoSend ()
 Try to send data.
size_t DoRecv ()
 Try to receive data.

Public Attributes

int mFd
 socket's file descriptor
int mPort
 port socket is connected to
int mErrno
 error number
std::string mError
 error string
bool mIsConnected
 connected status
const char * mpDataToSend
 data to send
const char * mpSendPtr
 ptr to mpDataToSend keeping position of next send
size_t mLenToSend
 number of bytes to send
AbsMsecTime mSendTimeoutMs
 timeout of send operation in absolute ms time
char mRecvBuf [RECV_BUF_SIZE]
 buffer for receiving
char * mpRecvPtr
 pointer to mRecvBuf where recv will be done
AbsMsecTime mRecvTimeoutMs
 timeout of recv operation in absolute time
size_t mLenToRecv
 number of bytes that can be received (fit to the buffer)
AbsMsecTime mAcceptTimeoutMsAbs
 timeout of accept operation in absolute time
Netman * mpNetman
 pointer netman class
bool mTerminationRequest
 termination request
bool mIsSocket
 true if fd is a socket

Classes

struct  Event
 Struct filled in upon calling Event() by netman. More...
struct  SocketType


Detailed Description

Socket private implementation.


Member Enumeration Documentation

enum nnl::Socket::Impl::State

State of socket.

Warning:
Attribute Socket::mHelperFn depends on this.


Member Function Documentation

void nnl::Socket::Impl::Constructor (  )  [inline]

General constructor.

General constructor as delegating constructors are not yet supported.

size_t nnl::Socket::Impl::DoRecv (  )  [inline]

Try to receive data.

Try to receive some data without blocking. If blocking occures, exit.

Returns:
number of bytes received in this call

size_t nnl::Socket::Impl::DoSend (  )  [inline]

Try to send data.

Try to send all the data without blocking. If blocking occures, exit. Optimized assuming the first send() op sends all the data.

Returns:
number of bytes sent in this call

int nnl::Socket::Impl::GetSoError ( int  s,
int &  optval 
) [inline]

Get error.

Get error using getsockopt().

Parameters:
s file descriptor
optval error value
Returns:
0 on success, other value on error

int nnl::Socket::Impl::Init ( int  domain = AF_INET  )  [inline]

Initialize a socket.

A new socket is created.

Returns:
0 on success, other value on error

void nnl::Socket::Impl::SetError ( const char *  text  )  [inline]

Set error text.

Called upon custom error. Set internal variables to hold error messages. Also set mIsConnected to false indicated socket is not connected.

Parameters:
text error text

void nnl::Socket::Impl::SetError ( int  eno,
const char *  text 
) [inline]

Set error.

Called upon error. Set internal variables to hold error messages. Also set mIsConnected to false indicated socket is not connected.

Parameters:
eno value of errno
text error text

int nnl::Socket::Impl::SetNonblocking ( bool  on  )  [inline]

Set socket (non)blocking.

Parameters:
on true if set to non-blocking, false if set to blocking
Returns:
0 on success, other value on error

bool nnl::Socket::Impl::SetSoError ( const char *  prefix,
const char *  text 
) [inline]

Set socket error.

Parameters:
prefix error prefix
text error text
Returns:
true if there was an error


The documentation for this struct was generated from the following file:
Generated on Tue Jun 19 10:31:48 2012 for nnl by  doxygen 1.4.7