unix_buffer.H File Reference

some abstraction layers for using UNIX-network services in C++ (mainly TCP) More...

#include <sys/socket.h>
#include <sys/poll.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <netdb.h>
#include <unistd.h>
#include <pthread.h>
#include <cerrno>
#include <cstring>
#include <string>
#include <iostream>
#include <sstream>
#include <exception>

Include dependency graph for unix_buffer.H:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  unix_buffer_exception
 This class provides basic exception handling. More...
class  Cprovide_descriptor_access
 a virtual base class to provide access to a file/socket descriptor More...
class  Cpoll_methods
 virtual abstraction layer for the poll system call More...
class  Cpoll
 abstraction layer for the poll system call More...
class  Cnetwork_connection_methods
 a virtual base class More...
class  connection_waiter
class  unix_fd_buffer
 This class provides a streambuffer for handling file/socket descriptor resources. More...
class  unix_buffer
 This class provides a streambuffer for handling network connections. More...
class  unix_io_stream
 a simple network connection stream More...
class  fd_iostream
 iostream attached to a file descriptor (can be reduced to an istream or ostream!) More...
class  sd_iostream
 iostream attached to a socket descriptor (can be reduced to an istream or ostream!) More...
class  socket_piper
 this class provides a socket creator for unnamed pipes More...

Defines

#define PTHREAD_TESTCANCEL   pthread_testcancel();

Functions

std::string my_strerror (const int errnum)
 threadsafe version of strerror that returns error message as string
int open_internet_port (const int port, const int qsize=5)
std::ostreamoperator<< (std::ostream &ostr, const sockaddr &sa)
 returns information about the specified socket to the given stream
std::string peer_info (const int socket_descriptor)
std::string socket_info (const int socket_descriptor)
std::string connection_info (const int socket_descriptor)
template<class T>
std::string peer_info (const T &obj)
template<class T>
std::string socket_info (const T &obj)
template<class T>
std::string connection_info (const T &obj)


Detailed Description

some abstraction layers for using UNIX-network services in C++ (mainly TCP)

Definition in file unix_buffer.H.


Define Documentation

#define PTHREAD_TESTCANCEL   pthread_testcancel();

Definition at line 33 of file unix_buffer.H.

Referenced by unix_buffer::empty_buffer(), unix_fd_buffer::empty_buffer(), unix_buffer::underflow(), and unix_fd_buffer::underflow().


Function Documentation

template<class T>
std::string connection_info ( const T &  obj  )  [inline]

Parameters:
obj an object that handles a network connection and provides the attached socket descriptor through get_descriptor()
Returns:
string that contains human readable information about the client who has initiated the network connection and the server who has "picked up" the network connection

Definition at line 320 of file unix_buffer.H.

std::string connection_info ( const int  socket_descriptor  )  [inline]

Parameters:
socket_descriptor a socket descriptor
Returns:
string that contains human readable information about the client who has initiated the network connection and the server who has "picked up" the network connection

Definition at line 259 of file unix_buffer.H.

std::string my_strerror ( const int  errnum  )  [inline]

threadsafe version of strerror that returns error message as string

Definition at line 108 of file unix_buffer.H.

Referenced by unix_buffer::empty_buffer(), unix_fd_buffer::empty_buffer(), unix_buffer::underflow(), and unix_fd_buffer::underflow().

int open_internet_port ( const int  port,
const int  qsize = 5 
)

Parameters:
port port to listen for a tcp based network connection
qsize optional "backlog" parameter (refer "listen(2)" manpage)
Returns:
socket descriptor for the connection, or -1 on error
Use this function to wait for incoming tcp connection requests and for handling the serversided part to establish the network connection.

Definition at line 138 of file unix_buffer.H.

std::ostream& operator<< ( std::ostream ostr,
const sockaddr &  sa 
) [inline]

returns information about the specified socket to the given stream

Definition at line 170 of file unix_buffer.H.

template<class T>
std::string peer_info ( const T &  obj  )  [inline]

Parameters:
obj an object that handles a network connection and provides the attached socket descriptor through get_descriptor()
Returns:
string that contains human readable information about the client who has initiated the network connection

Definition at line 295 of file unix_buffer.H.

std::string peer_info ( const int  socket_descriptor  )  [inline]

Parameters:
socket_descriptor a socket descriptor
Returns:
string that contains human readable information about the client who has initiated the network connection

Definition at line 222 of file unix_buffer.H.

Referenced by Cprocess_clients::process_data_stream_ecm(), and Cprocess_clients::THREAD_process_data_stream().

template<class T>
std::string socket_info ( const T &  obj  )  [inline]

Parameters:
obj an object that handles a network connection and provides the attached socket descriptor through get_descriptor()
Returns:
string that contains human readable information about the server who has "picked up" the network connection

Definition at line 307 of file unix_buffer.H.

std::string socket_info ( const int  socket_descriptor  )  [inline]

Parameters:
socket_descriptor a socket descriptor
Returns:
string that contains human readable information about the server who has "picked up" the network connection

Definition at line 240 of file unix_buffer.H.


Generated on Wed Nov 7 23:30:38 2007 for Qsieve by  doxygen 1.5.4