Homepage Demos Overview Downloads Tutorials 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:

Definition at line 26 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 setDaemon (int sock, bool val=true)
 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 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 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)

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)

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

const int WIRELESS_MAX_SOCKETS = 100
 Maximum number of sockets which can be created.

const int WIRELESS_DEF_RECV_SIZE = 1024
 Default number of bytes to use for receive buffers (overridden by value passed to socket()).

const int WIRELESS_DEF_SEND_SIZE = 1024
 Default number of bytes to use for send buffers (overridden by value passed to socket()).


Private Member Functions

 Wireless (const Wireless &)
 don't call

Wirelessoperator= (const Wireless &)
 don't call


Private Attributes

antStackRef ipstackRef
 private ALOKL_TODO

OID myOID
 private ALOKL_TODO

Socketsockets [WIRELESS_MAX_SOCKETS]
 private ALOKL_TODO

list< int > freeSockets
 private ALOKL_TODO


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 17 of file Wireless.cc.

References freeSockets, ipstackRef, myOID, sockets, and WIRELESS_MAX_SOCKETS.

Wireless::~Wireless  ) 
 

destructor

Definition at line 30 of file Wireless.cc.

Wireless::Wireless const Wireless  )  [private]
 

don't call


Member Function Documentation

void Wireless::BindCont void *  msg  ) 
 

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

Definition at line 196 of file Wireless.cc.

References SocketNS::CONNECTION_CONNECTED, SocketNS::CONNECTION_ERROR, sockets, and Socket::state.

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 249 of file Wireless.cc.

References SocketNS::CONNECTION_CONNECTED, ipstackRef, Socket::sendSize, sockets, Socket::state, Socket::tx, and WIRELESS_MAX_SOCKETS.

void Wireless::close Socket sobj  )  [inline]
 

helper function for the function with the same name that takes a socket descriptor (int)

Definition at line 99 of file Wireless.h.

References close(), and Socket::sock.

Here is the call graph for this function:

void Wireless::close Socket sobj  )  [inline]
 

helper function for the function with the same name that takes a socket descriptor (int)

Definition at line 98 of file Wireless.h.

References close(), and Socket::sock.

Here is the call graph for this function:

void Wireless::close int  sock  ) 
 

closes and destroys non server, daemon sockets

Definition at line 329 of file Wireless.cc.

References SocketNS::CONNECTION_CLOSED, SocketNS::CONNECTION_CLOSING, Socket::daemon, ipstackRef, myOID, Socket::recvBuffer, Socket::sendBuffer, Socket::server_port, sockets, and Socket::state.

void Wireless::CloseCont void *  msg  ) 
 

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

Definition at line 353 of file Wireless.cc.

References SocketNS::CONNECTION_CLOSED, Socket::daemon, freeSockets, listen(), Socket::server_port, sockets, and Socket::state.

Here is the call graph for this function:

int Wireless::connect Socket sobj,
const char *  ipaddr,
int  port
[inline]
 

helper function for the function with the same name that takes a socket descriptor (int)

Definition at line 96 of file Wireless.h.

References connect(), and Socket::sock.

Here is the call graph for this function:

int Wireless::connect Socket sobj,
const char *  ipaddr,
int  port
[inline]
 

helper function for the function with the same name that takes a socket descriptor (int)

Definition at line 94 of file Wireless.h.

References connect(), and Socket::sock.

Here is the call graph for this function:

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

The socket tries to connect to a specific.

Definition at line 130 of file Wireless.cc.

References SocketNS::CONNECTION_CLOSED, SocketNS::CONNECTION_CONNECTING, Socket::endpoint, Socket::init(), ipstackRef, myOID, SocketNS::SOCK_DGRAM, SocketNS::SOCK_STREAM, sockets, Socket::state, Socket::trType, and WIRELESS_MAX_SOCKETS.

Here is the call graph for this function:

void Wireless::ConnectCont void *  msg  ) 
 

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

Definition at line 181 of file Wireless.cc.

References SocketNS::CONNECTION_CONNECTED, SocketNS::CONNECTION_ERROR, Socket::rcvcbckfn, receive(), sockets, and Socket::state.

Here is the call graph for this function:

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 81 of file Wireless.h.

References Socket::rx, and sockets.

bool Wireless::isConnected 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 78 of file Wireless.h.

References SocketNS::CONNECTION_CONNECTED, sockets, and Socket::state.

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 80 of file Wireless.h.

References sockets, and Socket::tx.

int Wireless::listen Socket sobj,
int  port
[inline]
 

helper function for the function with the same name that takes a socket descriptor (int)

Definition at line 93 of file Wireless.h.

References listen(), and Socket::sock.

Here is the call graph for this function:

int Wireless::listen Socket sobj,
int  port
[inline]
 

helper function for the function with the same name that takes a socket descriptor (int)

Definition at line 92 of file Wireless.h.

References listen(), and Socket::sock.

Here is the call graph for this function:

int Wireless::listen int  sock,
int  port
 

The socket waits for incoming connections.

That is, it acts like a server. If a connection is established and later broken, it resumes waiting for new connections.

Definition at line 78 of file Wireless.cc.

References SocketNS::CONNECTION_CLOSED, SocketNS::CONNECTION_LISTENING, Socket::endpoint, Socket::init(), ipstackRef, myOID, Socket::server_port, SocketNS::SOCK_DGRAM, SocketNS::SOCK_STREAM, sockets, Socket::state, Socket::trType, and WIRELESS_MAX_SOCKETS.

Here is the call graph for this function:

void Wireless::ListenCont void *  msg  ) 
 

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

Definition at line 165 of file Wireless.cc.

References SocketNS::CONNECTION_CONNECTED, SocketNS::CONNECTION_ERROR, Socket::rcvcbckfn, receive(), sockets, and Socket::state.

Here is the call graph for this function:

Wireless& Wireless::operator= const Wireless  )  [private]
 

don't call

void Wireless::receive int  sock  ) 
 

function for internal and Socket use. You should not call this

Definition at line 276 of file Wireless.cc.

References SocketNS::CONNECTION_CONNECTED, ipstackRef, myOID, Socket::rx, sockets, Socket::state, and WIRELESS_MAX_SOCKETS.

void Wireless::receive int  sock,
int(*  rcvcbckfn)(char *, int)
 

function for internal and Socket use. You should not call this

Definition at line 293 of file Wireless.cc.

References SocketNS::CONNECTION_CONNECTED, ipstackRef, myOID, Socket::rcvcbckfn, Socket::rx, sockets, Socket::state, and WIRELESS_MAX_SOCKETS.

void Wireless::ReceiveCont void *  msg  ) 
 

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

Definition at line 311 of file Wireless.cc.

References close(), SocketNS::CONNECTION_ERROR, Socket::rcvcbckfn, receive(), Socket::recvSize, sockets, and Socket::state.

Here is the call graph for this function:

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 210 of file Wireless.cc.

References SocketNS::CONNECTION_CONNECTED, ipstackRef, myOID, Socket::sendSize, sockets, Socket::state, Socket::tx, and WIRELESS_MAX_SOCKETS.

void Wireless::SendCont void *  msg  ) 
 

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

Definition at line 229 of file Wireless.cc.

References close(), SocketNS::CONNECTION_ERROR, Socket::flush(), sockets, Socket::state, and Socket::tx.

Here is the call graph for this function:

void Wireless::setDaemon Socket sobj,
bool  val = true
[inline]
 

helper function for the function with the same name that takes a socket descriptor (int)

Definition at line 91 of file Wireless.h.

References setDaemon(), and Socket::sock.

Here is the call graph for this function:

void Wireless::setDaemon Socket sobj,
bool  val = true
[inline]
 

helper function for the function with the same name that takes a socket descriptor (int)

Definition at line 90 of file Wireless.h.

References setDaemon(), and Socket::sock.

Here is the call graph for this function:

void Wireless::setDaemon int  sock,
bool  val = true
[inline]
 

sets the socket to be a daemon (recycles on close)

Definition at line 69 of file Wireless.h.

References Socket::daemon, and sockets.

void Wireless::setReceiver Socket sobj,
int(*  rcvcbckfn)(char *, int)
[inline]
 

helper function for the function with the same name that takes a socket descriptor (int)

Definition at line 88 of file Wireless.h.

References setReceiver(), and Socket::sock.

Here is the call graph for this function:

void Wireless::setReceiver Socket sobj,
int(*  rcvcbckfn)(char *, int)
[inline]
 

helper function for the function with the same name that takes a socket descriptor (int)

Definition at line 86 of file Wireless.h.

References setReceiver(), and Socket::sock.

Here is the call graph for this function:

void Wireless::setReceiver int  sock,
int(*  rcvcbckfn)(char *, int)
 

sets receiver callback for a socket

Definition at line 268 of file Wireless.cc.

References Socket::rcvcbckfn, sockets, and WIRELESS_MAX_SOCKETS.

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 40 of file Wireless.cc.

References freeSockets, ipstackRef, Socket::readData, Socket::recvBuffer, Socket::recvBufSize, Socket::recvData, Socket::sendBuffer, Socket::sendBufSize, Socket::sendData, sockets, Socket::trType, and Socket::writeData.

Socket * Wireless::socket TransportType_t  ttype  ) 
 

Creates a new socket.

Returns:
pointer to Socket object created
Parameters:
ttype selects between TCP and UDP
See also:
WIRELESS_DEF_RECV_SIZE, WIRELESS_DEF_SEND_SIZE

Definition at line 35 of file Wireless.cc.

References WIRELESS_DEF_RECV_SIZE, and WIRELESS_DEF_SEND_SIZE.


Member Data Documentation

list<int> Wireless::freeSockets [private]
 

private ALOKL_TODO

Definition at line 133 of file Wireless.h.

antStackRef Wireless::ipstackRef [private]
 

private ALOKL_TODO

Definition at line 130 of file Wireless.h.

OID Wireless::myOID [private]
 

private ALOKL_TODO

Definition at line 131 of file Wireless.h.

Socket* Wireless::sockets[WIRELESS_MAX_SOCKETS] [private]
 

private ALOKL_TODO

Definition at line 132 of file Wireless.h.

const int Wireless::WIRELESS_DEF_RECV_SIZE = 1024 [static]
 

Default number of bytes to use for receive buffers (overridden by value passed to socket()).

Definition at line 32 of file Wireless.h.

const int Wireless::WIRELESS_DEF_SEND_SIZE = 1024 [static]
 

Default number of bytes to use for send buffers (overridden by value passed to socket()).

Definition at line 35 of file Wireless.h.

const int Wireless::WIRELESS_MAX_SOCKETS = 100 [static]
 

Maximum number of sockets which can be created.

Definition at line 29 of file Wireless.h.


The documentation for this class was generated from the following files:
Tekkotsu v1.5
Generated Fri Oct 10 15:58:31 2003 by Doxygen 1.3.4