Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

Wireless Class Reference

#include <Wireless.h>

List of all members.


Detailed Description

Tekkotsu wireless class.

For more information on using wireless, please read the following tutorials:

The networking interface needs more documentation. It also needs a cleanup. In the mean time, take a look at the TekkotsuMon objects in Tekkotsu/Behaviors/Mon. They all listen for new connections. Unfortunately, at the momement there are no examples of outgoing connections, but it should give you a pretty good idea how to start moving.

Definition at line 37 of file Wireless.h.

Public Member Functions

 Wireless ()
 constructor - only one wireless object is required per Aperios process.
 ~Wireless ()
 destructor
int listen (int sock, int port)
 The socket waits for incoming connections.
int connect (int sock, const char *ipaddr, int port)
 The socket tries to connect to a specific.
void setReceiver (int sock, int(*rcvcbckfn)(char *, int))
 sets receiver callback for a socket
void setReceiver (int sock, SocketListener *listener)
void setDaemon (int sock, bool val=true)
 sets the socket to be a daemon (recycles on close)
bool getDaemon (int sock)
 sets the socket to be a daemon (recycles on close)
void close (int sock)
 closes and destroys non server, daemon sockets
Socketsocket (TransportType_t ttype)
 Creates a new socket.
Socketsocket (TransportType_t ttype, int recvsize, int sendsize)
bool isConnected (int sock)
 utility function that you can use if you're curious about the state of the socket.
bool isError (int sock)
 utility function that you can use if you're curious about the state of the socket.
bool isReady (int sock)
 utility function that you can use if you're curious about the state of the socket.
bool hasData (int sock)
 utility function that you can use if you're curious about the state of the socket.
void setReceiver (Socket &sobj, int(*rcvcbckfn)(char *, int))
 helper function for the function with the same name that takes a socket descriptor (int)
void setReceiver (Socket *sobj, int(*rcvcbckfn)(char *, int))
 helper function for the function with the same name that takes a socket descriptor (int)
void setReceiver (Socket &sobj, SocketListener *listener)
 helper function for the function with the same name that takes a socket descriptor (int)
void setReceiver (Socket *sobj, SocketListener *listener)
 helper function for the function with the same name that takes a socket descriptor (int)
void setDaemon (Socket &sobj, bool val=true)
 helper function for the function with the same name that takes a socket descriptor (int)
void setDaemon (Socket *sobj, bool val=true)
 helper function for the function with the same name that takes a socket descriptor (int)
bool getDaemon (Socket &sobj)
 helper function for the function with the same name that takes a socket descriptor (int)
bool getDaemon (Socket *sobj)
 helper function for the function with the same name that takes a socket descriptor (int)
int listen (Socket &sobj, int port)
 helper function for the function with the same name that takes a socket descriptor (int)
int listen (Socket *sobj, int port)
 helper function for the function with the same name that takes a socket descriptor (int)
int connect (Socket &sobj, const char *ipaddr, int port)
 helper function for the function with the same name that takes a socket descriptor (int)
int connect (Socket *sobj, const char *ipaddr, int port)
 helper function for the function with the same name that takes a socket descriptor (int)
void close (Socket &sobj)
 helper function for the function with the same name that takes a socket descriptor (int)
void close (Socket *sobj)
 helper function for the function with the same name that takes a socket descriptor (int)
unsigned int getNumInterfaces ()
 helper function for the function with the same name that takes a socket descriptor (int)
uint32 getIPAddress (unsigned int idx=0)
 helper function for the function with the same name that takes a socket descriptor (int)
void receive (int sock, int(*rcvcbckfn)(char *, int))
 function for internal and Socket use. You should not call this
void receive (int sock)
 function for internal and Socket use. You should not call this
void send (int sock)
void blockingSend (int sock)
void ListenCont (void *msg)
void BindCont (void *msg)
void ConnectCont (void *msg)
void SendCont (void *msg)
void ReceiveCont (void *msg)
void CloseCont (void *msg)

Static Public Attributes

static const int WIRELESS_MAX_SOCKETS = 100
 Maximum number of sockets which can be created.
static const int WIRELESS_DEF_RECV_SIZE = 1024
 Default number of bytes to use for receive buffers (overridden by value passed to socket()).
static const int WIRELESS_DEF_SEND_SIZE = 1024
 Default number of bytes to use for send buffers (overridden by value passed to socket()).

Protected Attributes

antStackRef ipstackRef
 private ALOKL_TODO
OID myOID
 private ALOKL_TODO
Socketsockets [WIRELESS_MAX_SOCKETS]
 private ALOKL_TODO
std::list< int > freeSockets
 private ALOKL_TODO
std::list< int > usedSockets
 private ALOKL_TODO

Static Protected Attributes

static const int MAXCONNECTIONS = 5
 the maximum number of connections which can be queued when listening

Private Member Functions

 Wireless (const Wireless &)
 don't call
Wirelessoperator= (const Wireless &)
 don't call

Friends

class Socket


Constructor & Destructor Documentation

Wireless::Wireless (  ) 

constructor - only one wireless object is required per Aperios process.

MMCombo already creates one. The (global) instance is called wireless, and you can access it by including Wireless/Wireless.h (this file) in your code

Definition at line 22 of file Wireless.cc.


Member Function Documentation

void Wireless::BindCont ( void *  msg  ) 

callback function for communicating with Aperios Networking Toolkit. You should not call this.

Definition at line 255 of file Wireless.cc.

void Wireless::blockingSend ( int  sock  ) 

Bug:
This doesn't actually seem to block until the message is fully sent... a crash immediately after this will still cause a line or two to be dropped. This is still less dropped than regular send, but doesn't do much good for debugging until we fix this. (if we can...)

Definition at line 360 of file Wireless.cc.

Referenced by Socket::flush().

void Wireless::CloseCont ( void *  msg  ) 

callback function for communicating with Aperios Networking Toolkit. You should not call this.

Definition at line 588 of file Wireless.cc.

int Wireless::connect ( int  sock,
const char *  ipaddr,
int  port 
)

The socket tries to connect to a specific.

Tell the ipstack we want to recieve messages with this function.

Definition at line 139 of file Wireless.cc.

Referenced by connect(), RemoteRouter::connect(), EchoBehavior::processCallback(), EchoBehavior::processEvent(), and ReceiveCont().

void Wireless::ConnectCont ( void *  msg  ) 

callback function for communicating with Aperios Networking Toolkit. You should not call this.

Definition at line 224 of file Wireless.cc.

bool Wireless::hasData ( int  sock  )  [inline]

utility function that you can use if you're curious about the state of the socket.

You shouldn't need to use it, since asking sockets for write and read buffers does the necessary sanity checks

Definition at line 104 of file Wireless.h.

bool Wireless::isError ( int  sock  )  [inline]

utility function that you can use if you're curious about the state of the socket.

You shouldn't need to use it, since asking sockets for write and read buffers does the necessary sanity checks

Definition at line 99 of file Wireless.h.

bool Wireless::isReady ( int  sock  )  [inline]

utility function that you can use if you're curious about the state of the socket.

You shouldn't need to use it, since asking sockets for write and read buffers does the necessary sanity checks

Definition at line 103 of file Wireless.h.

void Wireless::ListenCont ( void *  msg  ) 

callback function for communicating with Aperios Networking Toolkit. You should not call this.

Definition at line 188 of file Wireless.cc.

void Wireless::ReceiveCont ( void *  msg  ) 

callback function for communicating with Aperios Networking Toolkit. You should not call this.

Definition at line 444 of file Wireless.cc.

void Wireless::send ( int  sock  ) 

function called by the Socket objects to actually write data to the network. You should not call this.

Definition at line 284 of file Wireless.cc.

Referenced by Socket::flush().

void Wireless::SendCont ( void *  msg  ) 

callback function for communicating with Aperios Networking Toolkit. You should not call this.

Definition at line 313 of file Wireless.cc.

Socket * Wireless::socket ( TransportType_t  ttype,
int  recvsize,
int  sendsize 
)

Parameters:
ttype selects between TCP and UDP
recvsize size of input buffer
sendsize size of output buffer

Definition at line 53 of file Wireless.cc.


The documentation for this class was generated from the following files:

Tekkotsu v3.0
Generated Fri May 11 20:09:01 2007 by Doxygen 1.4.7