Namespaces | Defines | Typedefs | Functions

wavesock.cpp File Reference

#include "wavesock.h"
#include <fcntl.h>
#include <netdb.h>
#include <linux/if.h>
#include <sys/errno.h>
#include <sys/ioctl.h>
#include <sys/select.h>
#include <sys/time.h>
#include "common/wave_ex.h"
#include "perf/perf.h"
#include "util/parsing.h"
Include dependency graph for wavesock.cpp:

Go to the source code of this file.

Namespaces

namespace  netlib

Defines

#define ASSERT_SOCK(s)   ASSERT( wsIsValidSocket(s) , "Bad socket: %d", s)

Typedefs

typedef socklen_t netlib::socket_length_t

Functions

static void netlib::dumpErrorInfo (IN const char *msg)
static void netlib::verify (IN bool isOK, IN const char *msg)
static void netlib::setNonBlocking (IN int s)
static void netlib::getAddressFromSockaddr (IN const struct sockaddr_storage *psa, OUT address_t &address) throw ()
static void netlib::getSockaddrFromAddress (IN const address_t &address, OUT struct sockaddr_in &sa) throw ()
bool netlib::getLocalInterfaces (OUT map_ip_addr_t &interfaces)
 get set of local interfaces
static bool netlib::tryInterface (IN const map_ip_addr_t &map, IN const char *name, OUT ip_addr_t &ip) throw ()
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 (IO char *buffer, IN int bufferSize) throw ()
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

Define Documentation

#define ASSERT_SOCK (   s  )     ASSERT( wsIsValidSocket(s) , "Bad socket: %d", s)

Definition at line 67 of file wavesock.cpp.