Classes | Public Types | Public Member Functions | Protected Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes
utilmm::base_socket Class Reference

#include <socket.hh>

Inheritance diagram for utilmm::base_socket:
Inheritance graph
[legend]

List of all members.

Classes

struct  bad_address

Public Types

enum  Domain { Unix, Inet }
enum  Type { Stream, Datagram }
enum  Wait { WaitRead = 1, WaitWrite = 2, WaitException = 4 }

Public Member Functions

 base_socket (int fd)
 base_socket (Domain domain, Type type)
int fd () const
void flush () const
bool try_wait (int what) const
void wait (int what) const
 ~base_socket ()

Protected Member Functions

std::vector< uint8_t > to_sockaddr (std::string const &to) const

Private Member Functions

int wait (int what, timeval *tv) const

Static Private Member Functions

static int to_unix (Domain d)
static int to_unix (Type t)

Private Attributes

Domain m_domain
int m_fd
Type m_type

Detailed Description

Base class for sockets

Definition at line 16 of file socket.hh.


Member Enumeration Documentation

Enumerator:
Unix 
Inet 

Definition at line 19 of file socket.hh.

Enumerator:
Stream 
Datagram 

Definition at line 20 of file socket.hh.

Enumerator:
WaitRead 
WaitWrite 
WaitException 

Definition at line 21 of file socket.hh.


Constructor & Destructor Documentation

Definition at line 44 of file socket.cc.

Definition at line 46 of file socket.cc.

Closes the socket

Definition at line 56 of file socket.cc.


Member Function Documentation

int utilmm::base_socket::fd ( ) const

Get the socket file descriptor

Definition at line 127 of file socket.cc.

Flush all buffers related to this socket

Definition at line 163 of file socket.cc.

vector< uint8_t > utilmm::base_socket::to_sockaddr ( std::string const &  to) const [protected]

Definition at line 62 of file socket.cc.

int utilmm::base_socket::to_unix ( Domain  d) [static, private]

Definition at line 24 of file socket.cc.

int utilmm::base_socket::to_unix ( Type  t) [static, private]

Definition at line 34 of file socket.cc.

bool utilmm::base_socket::try_wait ( int  what) const

Non-blocking version of wait

Parameters:
whatan OR-ed field of values in the Wait enum
Returns:
true if the event was present and false otherwise

Definition at line 128 of file socket.cc.

int utilmm::base_socket::wait ( int  what,
timeval *  tv 
) const [private]

Definition at line 134 of file socket.cc.

void utilmm::base_socket::wait ( int  what) const

Blocks until one of the specified events is detected on this socket

Parameters:
whatan OR-ed field of values in the Wait enum

Definition at line 133 of file socket.cc.


Member Data Documentation

Definition at line 30 of file socket.hh.

Definition at line 29 of file socket.hh.

Definition at line 31 of file socket.hh.


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


utilmm
Author(s): Sylvain Joyeux/sylvain.joyeux@m4x.org
autogenerated on Wed Sep 16 2015 07:05:43