#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"
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 (const char *msg) |
static void | netlib::verify (bool isOK, const char *msg) |
static void | netlib::setNonBlocking (int s) |
static void | netlib::getAddressFromSockaddr (const struct sockaddr_storage *psa, address_t &address) throw () |
static void | netlib::getSockaddrFromAddress (const address_t &address, struct sockaddr_in &sa) throw () |
bool | netlib::getLocalInterfaces (map_ip_addr_t &interfaces) |
get set of local interfaces | |
static bool | netlib::tryInterface (const map_ip_addr_t &map, const char *name, ip_addr_t &ip) throw () |
bool | netlib::wsIsValidSocket (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 (char *buffer,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 (bool broadcast) throw () |
creates a socket that can be used for UDP | |
int | netlib::wsBindToPort (int s,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 (int s,int maxBacklog) throw () |
usually used for TCP listening sockets. | |
int | netlib::wsConnect (int s,const address_t &server) throw () |
makes a connection to the specified server | |
int | netlib::wsReceive (int s,char *buffer,int bufferSize) throw () |
receives data (typically from TCP). | |
int | netlib::wsReceiveFrom (int s,char *buffer,int bufferSize,address_t &from) throw () |
receives data (typically from UPD). | |
int | netlib::wsSend (int s,const char *buffer,int bufferSize) throw () |
sends data (typically for TCP). | |
int | netlib::wsSendTo (int s,const char *buffer,int bufferSize,const address_t &to) throw () |
sends data (typically for UDP). | |
int | netlib::wsAccept (int s,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 (ws_set_t set) throw () |
clears the given set | |
void | netlib::wsAddSocketToSet (ws_set_t set,int s) throw () |
adds the given socket to the given set | |
bool | netlib::wsIsSocketInSet (ws_set_t set,int s) throw () |
is the given socket in the set? | |
void | netlib::wsDestroySet (ws_set_t set) throw () |
destroys the given set | |
int | netlib::wsSelect (int maxSocket,ws_set_t readers,ws_set_t writers,long wait_microseconds) throw () |
waits until a socket is ready for read/write. | |
void | netlib::wsCloseSocket (int s) throw () |
closes a socket |
#define ASSERT_SOCK | ( | s | ) | ASSERT( wsIsValidSocket(s) , "Bad socket: %d", s) |
Definition at line 71 of file wavesock.cpp.