Dibbler - a portable DHCPv6  1.0.2RC1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
TIfaceSocket Class Reference

#include <SocketIPv6.h>

+ Collaboration diagram for TIfaceSocket:

Public Member Functions

 TIfaceSocket (char *iface, int ifaceid, int port, SPtr< TIPv6Addr > addr, bool ifaceonly, bool reuse)
 TIfaceSocket (char *iface, int ifaceid, int port, bool ifaceonly, bool reuse)
 ~TIfaceSocket ()
SPtr< TIPv6AddrgetAddr ()
int getFD ()
int getIfaceID ()
int getPort ()
enum EState getStatus ()
bool multicast ()
int recv (char *buf, SPtr< TIPv6Addr > addr)
int send (char *buf, int len, SPtr< TIPv6Addr > addr, int port)

Static Public Member Functions

static int getCount ()
static fd_set * getFDS ()
static int getMaxFD ()

Private Member Functions

int createSocket (char *iface, int ifaceid, SPtr< TIPv6Addr > addr, int port, bool ifaceonly, bool reuse)
void printError (int error, char *iface, int ifaceid, SPtr< TIPv6Addr > addr, int port)

Private Attributes

SPtr< TIPv6AddrAddr
std::string Error
int FD
char Iface [MAX_IFNAME_LENGTH]
int IfaceID
bool IfaceOnly
bool Multicast
int Port
enum EState Status

Static Private Attributes

static int Count = 0
static int MaxFD = 0

Friends

std::ostream & operator<< (std::ostream &strum, TIfaceSocket &x)

Constructor & Destructor Documentation

TIfaceSocket::TIfaceSocket ( char *  iface,
int  ifindex,
int  port,
SPtr< TIPv6Addr addr,
bool  ifaceonly,
bool  reuse 
)

creates socket bound to specific address on this interface

Parameters
ifaceinterface name
ifindexinterface index
portUDP port, to which socket will be bound
addrIPv6 address
ifaceonlyforce interface-only flag in setsockopt()?
reuseshould socket be bound with reuse flag in setsockopt()?
TIfaceSocket::TIfaceSocket ( char *  iface,
int  ifaceid,
int  port,
bool  ifaceonly,
bool  reuse 
)

creates socket bound to this interface

Parameters
ifaceinterface name
ifaceidinterface index
portUDP port, to which socket will be bound
ifaceonlyforce interface-only flag in setsockopt()?
reuseshould socket be bound with reuse flag in setsockopt()?
TIfaceSocket::~TIfaceSocket ( )

closes socket, and removes its number from FDS

Member Function Documentation

int TIfaceSocket::createSocket ( char *  iface,
int  ifaceid,
SPtr< TIPv6Addr addr,
int  port,
bool  ifaceonly,
bool  reuse 
)
private

creates socket on this interface.

Parameters
iface- interface name
ifaceid- interface ID
port- port, to which socket will be bound
addr- address
ifaceonly- force interface-only flag in setsockopt()
reuseshould socket be bound with reuse flag in setsockopt()?
Returns
negative error code (or 0 if everything is ok)
SPtr< TIPv6Addr > TIfaceSocket::getAddr ( )

returns address

static int TIfaceSocket::getCount ( )
inlinestatic
int TIfaceSocket::getFD ( )

returns FileDescritor

fd_set * TIfaceSocket::getFDS ( )
static

returns FDS - FileDescriptorSet it's some really weird POSIX macro. It uses FD_SET, FD_ZERO and FD_CLR macros defined somewhere in system headers

int TIfaceSocket::getIfaceID ( )

returns interface ID

static int TIfaceSocket::getMaxFD ( )
inlinestatic
int TIfaceSocket::getPort ( )

returns port

enum EState TIfaceSocket::getStatus ( )
bool TIfaceSocket::multicast ( )
inline
void TIfaceSocket::printError ( int  error,
char *  iface,
int  ifaceid,
SPtr< TIPv6Addr addr,
int  port 
)
private
int TIfaceSocket::recv ( char *  buf,
SPtr< TIPv6Addr addr 
)

receives data from socket

Parameters
buf- received data are stored here
addr- will contain info about sender
int TIfaceSocket::send ( char *  buf,
int  len,
SPtr< TIPv6Addr addr,
int  port 
)

sends data through socket

Parameters
buf- buffer to send
len- number of bytes to send
addr- where send this data
port- to which port returns number of bytes sent or -1 if something went wrong

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  strum,
TIfaceSocket x 
)
friend

Member Data Documentation

SPtr<TIPv6Addr> TIfaceSocket::Addr
private
int TIfaceSocket::Count = 0
staticprivate

static elements of TIfaceSocket class

std::string TIfaceSocket::Error
private
int TIfaceSocket::FD
private
char TIfaceSocket::Iface[MAX_IFNAME_LENGTH]
private
int TIfaceSocket::IfaceID
private
bool TIfaceSocket::IfaceOnly
private
int TIfaceSocket::MaxFD = 0
staticprivate
bool TIfaceSocket::Multicast
private
int TIfaceSocket::Port
private
enum EState TIfaceSocket::Status
private

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