#include <ArNetPacketReceiverTcp.h>
Public Member Functions | |
| ArNetPacketReceiverTcp () | |
| Constructor. | |
| ArFunctor1< ArNetPacket * > * | getProcessPacketCB (void) |
| Gets the callback used when a packet is received. | |
| bool | getQuiet (void) |
| Gets whether we're quiet about errors or not. | |
| ArSocket * | getSocket (void) |
| Gets the socket this receiver uses. | |
| bool | readData (void) |
| Reads in all the data available calling the processPacketCB. | |
| void | setLoggingPrefix (const char *loggingPrefix) |
| Sets the logging prefix. | |
| void | setProcessPacketCB (ArFunctor1< ArNetPacket * > *functor) |
| Sets the callback for use when a packet is received. | |
| void | setQuiet (bool quiet) |
| Sets whether we're quiet about errors or not. | |
| void | setSocket (ArSocket *socket) |
| Sets the socket this receiver uses. | |
| ~ArNetPacketReceiverTcp () | |
| Destructor. | |
Protected Types | |
| enum | { TOTAL_PACKET_LENGTH = ArNetPacket::MAX_LENGTH+ArNetPacket::HEADER_LENGTH+ArNetPacket::FOOTER_LENGTH } |
| enum | Ret { RET_CONN_CLOSED, RET_GOT_PACKET, RET_BAD_PACKET, RET_FAILED_READ, RET_TIMED_OUT } |
| RET_BAD_PACKET | |
| RET_CONN_CLOSED | |
| RET_FAILED_READ | |
| RET_GOT_PACKET | |
| RET_TIMED_OUT | |
| enum | State { STATE_SYNC1, STATE_SYNC2, STATE_LENGTH1, STATE_LENGTH2, STATE_ACQUIRE_DATA } |
| STATE_ACQUIRE_DATA | |
| STATE_LENGTH1 | |
| STATE_LENGTH2 | |
| STATE_SYNC1 | |
| STATE_SYNC2 | |
| TOTAL_PACKET_LENGTH = ArNetPacket::MAX_LENGTH+ArNetPacket::HEADER_LENGTH+ArNetPacket::FOOTER_LENGTH | |
Protected Member Functions | |
| Ret | readPacket (int msWait) |
| Reads in a single packet, returns NULL if not one. | |
Protected Attributes | |
| ArTime | myLastPacket |
| std::string | myLoggingPrefix |
| ArNetPacket | myPacket |
| ArFunctor1< ArNetPacket * > * | myProcessPacketCB |
| bool | myQuiet |
| char | myReadBuff [TOTAL_PACKET_LENGTH] |
| int | myReadCommand |
| int | myReadCount |
| int | myReadLength |
| ArSocket * | mySocket |
| State | myState |
| unsigned char | mySync1 |
| unsigned char | mySync2 |
enum ArNetPacketReceiverTcp::Ret [protected] |
enum ArNetPacketReceiverTcp::State [protected] |
| ArNetPacketReceiverTcp::ArNetPacketReceiverTcp | ( | ) |
Constructor.
| ArNetPacketReceiverTcp::~ArNetPacketReceiverTcp | ( | ) |
Destructor.
| ArFunctor1< ArNetPacket * > * ArNetPacketReceiverTcp::getProcessPacketCB | ( | void | ) |
Gets the callback used when a packet is received.
| bool ArNetPacketReceiverTcp::getQuiet | ( | void | ) | [inline] |
Gets whether we're quiet about errors or not.
| ArSocket * ArNetPacketReceiverTcp::getSocket | ( | void | ) |
Gets the socket this receiver uses.
| bool ArNetPacketReceiverTcp::readData | ( | void | ) |
Reads in all the data available calling the processPacketCB.
If an error occurs that is unrecoverable false will be returned which means that the socket owner who is calling this should close the socket and clean up.
| ArNetPacketReceiverTcp::Ret ArNetPacketReceiverTcp::readPacket | ( | int | msWait | ) | [protected] |
Reads in a single packet, returns NULL if not one.
| void ArNetPacketReceiverTcp::setLoggingPrefix | ( | const char * | loggingPrefix | ) |
Sets the logging prefix.
| void ArNetPacketReceiverTcp::setProcessPacketCB | ( | ArFunctor1< ArNetPacket * > * | functor | ) |
Sets the callback for use when a packet is received.
| functor | the callback to use when a packet needs to be processed |
| void ArNetPacketReceiverTcp::setQuiet | ( | bool | quiet | ) | [inline] |
Sets whether we're quiet about errors or not.
| void ArNetPacketReceiverTcp::setSocket | ( | ArSocket * | socket | ) |
Sets the socket this receiver uses.
| socket | the socket to use for receiving data |
ArTime ArNetPacketReceiverTcp::myLastPacket [protected] |
std::string ArNetPacketReceiverTcp::myLoggingPrefix [protected] |
ArNetPacket ArNetPacketReceiverTcp::myPacket [protected] |
ArFunctor1<ArNetPacket *>* ArNetPacketReceiverTcp::myProcessPacketCB [protected] |
bool ArNetPacketReceiverTcp::myQuiet [protected] |
char ArNetPacketReceiverTcp::myReadBuff[TOTAL_PACKET_LENGTH] [protected] |
int ArNetPacketReceiverTcp::myReadCommand [protected] |
int ArNetPacketReceiverTcp::myReadCount [protected] |
int ArNetPacketReceiverTcp::myReadLength [protected] |
ArSocket* ArNetPacketReceiverTcp::mySocket [protected] |
State ArNetPacketReceiverTcp::myState [protected] |
unsigned char ArNetPacketReceiverTcp::mySync1 [protected] |
unsigned char ArNetPacketReceiverTcp::mySync2 [protected] |
1.4.7