Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

Logger_Impl.h File Reference

#include <errno.h>
#include <string>
#include "assa/LogMask.h"

Go to the source code of this file.

Namespaces

namespace  ASSA

Defines

#define _BSDTYPES_DEFINED
#define BAD_HANDLER   -1
 Sort out WIN32/mingw oddities.

Typedefs

typedef unsigned char u_char
typedef unsigned short u_short
typedef unsigned int u_int
typedef unsigned long u_long
typedef int handler_t

Functions

bool is_valid_handler (handler_t socket_)
 Detect socket() error in a portable way.
void disable_handler (handler_t &socket_)
 Set socket descriptor to invalid value in a portable way.
int get_errno ()
 Fetch error number in a portable way.
void set_errno (int new_errno_)
 Set error number in a portable way.


Define Documentation

#define _BSDTYPES_DEFINED
 

Definition at line 41 of file Logger_Impl.h.

#define BAD_HANDLER   -1
 

Sort out WIN32/mingw oddities.

Definition at line 79 of file Logger_Impl.h.

Referenced by ASSA::disable_handler(), and ASSA::is_valid_handler().


Typedef Documentation

typedef int handler_t
 

Definition at line 80 of file Logger_Impl.h.

typedef unsigned char u_char
 

Definition at line 36 of file Logger_Impl.h.

typedef unsigned int u_int
 

Definition at line 38 of file Logger_Impl.h.

typedef unsigned long u_long
 

Definition at line 39 of file Logger_Impl.h.

typedef unsigned short u_short
 

Definition at line 37 of file Logger_Impl.h.


Function Documentation

void ASSA::disable_handler handler_t socket_  )  [inline]
 

Set socket descriptor to invalid value in a portable way.

socket_ is set to the value out of valid range.

Definition at line 106 of file Logger_Impl.h.

References BAD_HANDLER.

Referenced by ASSA::IPv4Socket::accept(), ASSA::Socket::close_handler(), and ASSA::IPv4Socket::open().

00107     {
00108         socket_ = BAD_HANDLER;
00109     }

int ASSA::get_errno  )  [inline]
 

Fetch error number in a portable way.

Definition at line 113 of file Logger_Impl.h.

Referenced by ASSA::IPv4Socket::connect(), ASSA::Connector< SERVICE_HANDLER, PEER_CONNECTOR >::connect(), ASSA::Connector< SERVICE_HANDLER, PEER_CONNECTOR >::handle_write(), ASSA::IPv4Socket::read(), ASSA::Socketbuf::sys_read(), and ASSA::Socketbuf::underflow().

00114     {
00115         int myerrno;
00116 #if defined (WIN32)
00117         myerrno = WSAGetLastError ();
00118 #else
00119         myerrno = errno;
00120 #endif
00121         return myerrno;
00122     }       

bool ASSA::is_valid_handler handler_t  socket_  )  [inline]
 

Detect socket() error in a portable way.

Returns:
true if socket is in valid range; false otherwise.

Definition at line 98 of file Logger_Impl.h.

References BAD_HANDLER.

Referenced by ASSA::IPv4Socket::accept(), ASSA::Socket::clear(), ASSA::IPv4Socket::clone(), ASSA::IPv4Socket::close(), ASSA::IPv4Socket::connect(), ASSA::IPv4Socket::open(), ASSA::IPv4Socket::read(), ASSA::Reactor::removeIOHandler(), and ASSA::IPv4Socket::write().

00099     {
00100         return (socket_ != BAD_HANDLER);
00101     }

void ASSA::set_errno int  new_errno_  )  [inline]
 

Set error number in a portable way.

Definition at line 126 of file Logger_Impl.h.

Referenced by ASSA::Connector< SERVICE_HANDLER, PEER_CONNECTOR >::connect(), ASSA::Connector< SERVICE_HANDLER, PEER_CONNECTOR >::doSync(), ASSA::Connector< SERVICE_HANDLER, PEER_CONNECTOR >::handle_timeout(), and ASSA::Connector< SERVICE_HANDLER, PEER_CONNECTOR >::handle_write().

00127     {
00128 #if defined (WIN32)
00129         WSASetLastError (new_errno_); 
00130 #else
00131         errno = new_errno_;
00132 #endif
00133     }       


Generated on Mon Mar 26 22:47:36 2007 for libassa by  doxygen 1.4.2