Classes | Namespaces | Typedefs | Enumerations | Functions

wavesock.h File Reference

#include "common/common.h"
Include dependency graph for wavesock.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  netlib::ip_addr_t
 representation of IP address (abstracts IPv4 and IPv6) More...
struct  netlib::address_t
 holds the IP address and port of a remote host More...

Namespaces

namespace  netlib

Typedefs

typedef std::map< std::string,
ip_addr_t > 
netlib::map_ip_addr_t
 a map of IP addresses (typically interface name --> IP address)
typedef void * netlib::ws_set_t

Enumerations

enum  netlib::eWSError {
  netlib::eWS_Okay = 0,
  netlib::eWS_Again = 1,
  netlib::eWS_Denied = 2,
  netlib::eWS_InUse = 3,
  netlib::eWS_ConnectionRefused = 4,
  netlib::eWS_Unknown = 0x100,
  netlib::eWS_Invalid = 0x7ff
}
 

these are error codes.

More...

Functions

bool netlib::getLocalInterfaces (OUT map_ip_addr_t &interfaces)
 get set of local interfaces
bool netlib::wsIsValidSocket (IN int s) throw ()
 is the given socket identifier valid?
eWSError netlib::wsGetError (void) throw ()
 gets the current error (0 means no error).
void netlib::wsGetErrorMessage (IN char *buffer, IN int bufferSize) throw ()
 returns the most recent error message
int netlib::wsCreateTcpSocket (void) throw ()
 creates a socket that can be used for TCP
int netlib::wsCreateUdpSocket (IN bool broadcast) throw ()
 creates a socket that can be used for UDP
int netlib::wsBindToPort (IN int s, IN int port) throw ()
 binds the given socket to a specific local port for UDP or TCP returns 0 on success, -1 for error.
int netlib::wsListen (IN int s, IN int maxBacklog) throw ()
 usually used for TCP listening sockets.
int netlib::wsConnect (IN int s, IN const address_t &server) throw ()
 makes a connection to the specified server
int netlib::wsReceive (IN int s, IN char *buffer, IN int bufferSize) throw ()
 receives data (typically from TCP).
int netlib::wsReceiveFrom (IN int s, IN char *buffer, IN int bufferSize, OUT address_t &from) throw ()
 receives data (typically from UPD).
int netlib::wsSend (IN int s, IN const char *buffer, IN int bufferSize) throw ()
 sends data (typically for TCP).
int netlib::wsSendTo (IN int s, IN const char *buffer, IN int bufferSize, IN const address_t &to) throw ()
 sends data (typically for UDP).
int netlib::wsAccept (IN int s, OUT address_t &address) throw ()
 accepts an incoming request.
ws_set_t netlib::wsCreateSet (void)
 creates an object that you can clear, and then populate with sockets.
void netlib::wsClearSet (IN ws_set_t set) throw ()
 clears the given set
void netlib::wsAddSocketToSet (IN ws_set_t set, IN int s) throw ()
 adds the given socket to the given set
bool netlib::wsIsSocketInSet (IN ws_set_t set, IN int s) throw ()
 is the given socket in the set?
void netlib::wsDestroySet (IN ws_set_t set) throw ()
 destroys the given set
int netlib::wsSelect (IN int maxSocket,IN ws_set_t readers, IN ws_set_t writers, IN long wait_microseconds) throw ()
 waits until a socket is ready for read/write.
void netlib::wsCloseSocket (IN int s) throw ()
 closes a socket