Classes | Namespaces | Typedefs | Enumerations | Functions

netlib.h File Reference

#include "message-buffer.h"
#include "wavesock.h"
Include dependency graph for netlib.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  netlib::connection_info_t
struct  netlib::envelope_t
 An envelope describes from where and how a remote message arrived. More...

Namespaces

namespace  netlib

Typedefs

typedef dword_t netlib::conn_id_t
 connection ID type. Will never be null for a valid connection.

Enumerations

enum  netlib::eConnectionType {
  netlib::eType_TCP = 0x0001,
  netlib::eType_SecureTCP = 0x0002,
  netlib::eType_UDPLocal = 0x0010,
  netlib::eType_UDPRemote = 0x0020,
  netlib::eType_UDPBroadcast = 0x0040,
  netlib::eType_TCPListener = 0x0100,
  netlib::eType_Invalid = 0
}
 

the type of connection

More...

Functions

std::string netlib::getServerFromIP (IN const ip_addr_t &ip)
conn_id_t netlib::createTcpListener (IN const address_t &address, IN int maxBacklog)
 create a listener (if clients connect, you'll see their messages show up)
conn_id_t netlib::createTcpConnection (IN const address_t &address)
 create a connection to a remote peer (connection ID is returned)
conn_id_t netlib::createUdpLocal (IN const address_t &localUdp)
 create a local UDP connection for sending/receiving datagrams.
conn_id_t netlib::createUdpRemote (IN conn_id_t localUdp, IN const address_t &address)
 create a logical connection to represent a remote UDP sender/receiver

  • caller must specify the local UDP connection that will communicate this is used for sending to remote UDP listeners

conn_id_t netlib::createUdpBroadcast (IN const address_t &broadcastAddress)
 create a local UDP sending point for datagram broadcasts to a specific port.
bool netlib::enqueueMessage (IN conn_id_t connId, IN smart_ptr< MessageBuffer > &message)
 asynchronously send data to a particular connection

  • conn_id specifies the (remote) receiver
  • queued messages are actually sent via getNextMessage() calls

bool netlib::getNextMessage (IN long wait_microseconds, OUT netlib::envelope_t &envelope, OUT smart_ptr< MessageBuffer > &buffer)
 get next message from all open connections (empty if no messages waiting)

  • this is the main message pump so applications should keep calling it

bool netlib::isValidConnection (IN conn_id_t conn_id)
 is this a valid connection?
bool netlib::getConnectionInfo (IN conn_id_t conn_id, OUT connection_info_t &info)
 given a connection, retrieve information about it
void netlib::closeConnection (IN conn_id_t conn_id)
 terminate a particular connection
void netlib::dumpMessage (IO std::ostream &stream, IN const char *title, IN const envelope_t &envelope, IN const MessageBuffer *buffer)
 for debugging
void netlib::dumpStats (void)
 info only