#include <cabal_netbase.h>
Inheritance diagram for Cabal::NetBase:
Static Public Member Functions | |
bool | init () throw (InitError) |
bool | exit () throw (DataIncompleteError) |
RawSocket | createTCPSocket () |
Create a socket with cabal properties. | |
RawSocket | createUDPSocket () |
int | closeSocket (RawSocket s) |
Closes a underlying OS system socket resource. | |
bool | bind (const RawSocket s, const SockAddrInet &addr) |
Binds a socket to a local address and/or port. | |
bool | connect (const RawSocket s, const SockAddrInet &addr) |
Connect a socket with a remote address. | |
bool | listen (const RawSocket m_skCom, const int incomingMax) |
Prepare a socket to receive connections. | |
RawSocket | accept (const RawSocket s, SockAddrInet *in) |
Accepts incoming connections. | |
void | initSockAddr (SockAddrInet &attr) |
Address initializer. | |
void | initSockAddr (SockAddrInet &attr, const char *ip) |
void | initSockAddr (SockAddrInet &attr, const char *ip, const NetPort port) |
void | initSockAddr (SockAddrInet &attr, const NetAddr data, const NetPort port) |
bool | SockAddrIsZero (const SockAddrInet &addr) |
Socket Address related functions. | |
bool | SockAddrIsSame (const SockAddrInet &addr, const SockAddrInet &addr1) |
void | SockAddrSetPort (SockAddrInet &attr, NetPort port) |
NetPort | SockAddrGetPort (const SockAddrInet &attr) |
bool | getHostList (const std::string &name, std::string &real_name, char *real_ip, NetAddr *other_addrs, int na_count) |
Return a threadsafe value for gethostbyname. | |
bool | addrToString (const SockAddrInet &addr, char *dest) |
Returns a string representation of a given address. | |
bool | addrToString (const NetAddr addr, char *dest) |
Returns a string representation of a given address. | |
bool | stringToAddr (const char *source, SockAddrInet &addr) |
Creates Socket address from a given string representation If the source string is not in any convertible ip address representation, the function return false. | |
bool | isAddressString (const char *source) |
Returns true if the given string is a valid IP address representation. | |
int | errorCode () |
Return last OS dependant error code. | |
void | resetError () |
Clears OS level error code. | |
std::string | errorDescription (const int osCode) |
Returns the error description of a given code. | |
RawSocket | dup (RawSocket s) |
Duplicates an handle. | |
bool | inProgress () |
True if current low level error means "operation in progress". | |
bool | errorAgain () |
True if current low level error means "try again". | |
bool | errorAgain (const int error) |
True if parameter is an error code meaning "try again". | |
bool | errorPipe () |
True if current low level error means "broken pipe". | |
void | setNonBlocking (RawSocket s) |
System specific way to set socket as nonblocking. | |
void | setBlocking (RawSocket s) |
System specific way to set socket as blocking. | |
void | setTCPDefaults (const RawSocket s) |
Sets default TCP attributes on the socket. | |
bool | validSocket (const RawSocket s) |
True if socket is a valid socket (not a return error code). | |
void | invalidate (RawSocket &s) |
Make s to become an "invalid socket" marker. | |
int | getSocketOption (const RawSocket s, const int level, int &iErrval) |
System specific way to set a socket file control option. | |
int | send (const RawSocket s, const void *buffer, const int len, const int params) |
System specific send call. | |
int | recv (const RawSocket s, void *buffer, const int len, const int params) |
System specific receive call. | |
int | sendto (const RawSocket s, const void *buffer, const int len, const int params, const SockAddrInet *remote, const int remsize) |
System specific send to address call. | |
int | recvfrom (const RawSocket s, void *buffer, const int len, const int params, SockAddrInet *remote, int *remsize) |
System specific receive from address call. | |
void | shutdown (const RawSocket s) |
System specific way to close a TCP connection cleanly. | |
void | sleep (const int msecs) |
Used to sleep. | |
NetPort | hostToNetPort (const NetPort data) |
Host to network byte swapping. | |
NetAddr | hostToNetAddr (const NetAddr data) |
NetPort | netToHostPort (const NetPort data) |
NetAddr | netToHostAddr (const NetAddr data) |
MSECS | timeOfDay () |
Returns the time of day in milliseconds since midnight. |
Definition at line 47 of file cabal_netbase.h.
|
Accepts incoming connections.
Reimplemented in Cabal::Net_WSA. |
|
Returns a string representation of a given address. Sometimes it's handy to have the function that acts directly on the NetAddr element that it's inside SockAddrInet, instead of the version that acts on the whole structure. |
|
Returns a string representation of a given address. Puts into dest, that must be long CABAL_MAX_IP_SIZE to accept the returned data. On error, returns false; this may be because addr is not valid, (i.e. it has an unknown address family).
Reimplemented in Cabal::Net_WSA. |
|
Binds a socket to a local address and/or port. returns false on failure. Reimplemented in Cabal::Net_WSA. |
|
Sets default TCP attributes on the socket. For Cabal, they are keep alive and reuse address options. Reimplemented in Cabal::Net_WSA. |
|
Used to sleep. Really, this function should be used in other libraries, but it turns tobe useful for portable tests. Reimplemented in Cabal::Net_WSA. |
|
Creates Socket address from a given string representation If the source string is not in any convertible ip address representation, the function return false.
Reimplemented in Cabal::Net_WSA. |
|
Returns the time of day in milliseconds since midnight. Used to temporize sendings. Reimplemented in Cabal::Net_WSA. |