Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

CBSock Class Reference

CBSock. More...

#include <BSock.h>

Inheritance diagram for CBSock:

CBLinuxSock CBWinSock List of all members.

Public Member Functions

virtual ~CBSock ()
 ~CBSOCK
int32 Process ()
 Process.
int32 PeekSize () const
 PeekSize.
uint32 PeekType () const
 Peek.
bool Peek () const
 Peek.
CMessageReadNext ()
 ReadNext.
bool WriteNext (const CMessage *Msg)
 WriteNext.
int32 GetPendingUDPBytes ()
 GetPendingUDPBytes.
void SetAddr (uint8 addr[])
 buffer to store send mes headers.

Protected Member Functions

int32 ProcessRead ()
 ProcessRead.
int32 ProcessSend ()
 ProcessSend.
bool PingConnection ()
 PingConnection.

Protected Attributes

CBSOCK_PROCESS_STATE m_MessageInState
 Stores the number of bytes available.
int8 * m_pSendBuffer
 ptr to the ReadQueue msg buffer
int8 * m_pSendMsgBuffer
 ptr to the SendQueue msg buffer
int8 * m_pReadMsgBuffer
 ptr to a copy of the buffer contained in CMessage
MSG_HEADER m_ReadMsgHeader
 ptr to a copy of the buffer contained in CMessage
MSG_HEADER m_SendMsgHeader
 buffer to store read msg headers.

Static Protected Attributes

static const int32 TIMEOUT = 10
 VERSION CONTROL HISTORY
Revision
1.1
.

Detailed Description

CBSock.

Description: A buffered socket class

Limitations: None


Constructor & Destructor Documentation

CBSock::~CBSock  )  [virtual]
 

~CBSOCK

Description: CBSock class destructor

Limitations: None


Member Function Documentation

int32 CBSock::GetPendingUDPBytes  )  [inline]
 

GetPendingUDPBytes.

Description: This function returns the number of bytes that can can be read by ReadUDP.

Returns:
The number of UDP package bytes is returned.
Limitations: The socket must have been created as a SOCK_DGRAM.

bool CBSock::Peek  )  const [inline]
 

Peek.

Description: Returns true if a message is waiting to be read

Returns:
true if message is waiting in the queue false if there are no messages waiting
Limitations: None

int CBSock::PeekSize  )  const
 

PeekSize.

Description: Will return the number of bytes in the next message to be read

Returns:
The number of bytes in the next message
Limitations: None

uint32 CBSock::PeekType  )  const [inline]
 

Peek.

Description: Returns the type of the next message. If no message is available, MSG_INVALID is returned. Always use this function in conjunction with Peek().

Returns:
uint32: the type of the message next in line or MSG_INVALID if no message is available.
Limitations: None

bool CBSock::PingConnection  )  [protected]
 

PingConnection.

Description: Sends a test message to the connection to see if it is still alive

Returns:
true if connection is still alive
Limitations: None

int CBSock::Process  ) 
 

Process.

Description: This function will read in data from the socket and place it into the queue. It will also write data from the queue and send it out over the socket.

Returns:
CBSOCK_OK if everything is fine CBSOCK_READ_ERROR on read error CBSOCK_WRITE_ERROR on write error
Limitations: Needs to be called periodically to process incoming and outgoing messages. This function is not MT-Safe.

int32 CBSock::ProcessRead  )  [protected]
 

ProcessRead.

Description: This function will read in data from the socket and place it into the queue. It will also write data from the queue and send it out over the socket

Returns:
CBSOCK_OK if everything is fine CBSOCK_READ_ERROR on read error
Limitations: Needs to be called periodically to process incoming and outgoing messages. This function is not MT-Safe.

int CBSock::ProcessSend  )  [protected]
 

ProcessSend.

Description: This function will read in data from the socket and place it into the queue. It will also write data from the queue and send it out over the socket.

Returns:
CBSOCK_OK if everything is fine CBSOCK_WRITE_ERROR on write error
Limitations: Needs to be called periodically to process incoming and outgoing messages. This function is not MT-Safe.

CMessage * CBSock::ReadNext  ) 
 

ReadNext.

Description: Fills in the arguments passed into it with the values of the next message

Returns:
Msg: The message filled with the data recieved from connection
Limitations: pBuffer must be created before calling this function

bool CBSock::WriteNext const CMessage inMsg  ) 
 

WriteNext.

Description: Adds the message into the queue to be sent out the socket

Parameters:
Msg,: CMessage structure filled appropriately
Returns:
true on successful addition to the queue false on full queue or invalid buffer with Msg.m_uiDataLength > 0
Limitations: None


Member Data Documentation

const int32 CBSock::TIMEOUT = 10 [static, protected]
 

VERSION CONTROL HISTORY

Revision
1.1
.

Log
BSock.cpp,v
Revision 1.1 2005/06/12 18:22:17 mabruns Initial Import

Revision 1.21 2005/04/15 04:13:33 plh844 Updated the address functions representative of an array of uint8s

Revision 1.20 2005/04/14 04:06:25 mab6d5 Fixed the ProcessSend and ProcessRead functions so that they preserve the m_bIsBufferPacked variable value of the messages.

Revision 1.19 2005/04/14 03:25:58 plh844 Address functions now use the in_addr struct.

Revision 1.18 2005/04/11 01:10:49 plh844 Added public accessors for the address and port variables.

Revision 1.17 2005/04/10 21:28:51 plh844 Added functions that return an address/port associated with an accepted socket.

Revision 1.16 2005/03/19 00:21:39 kjm266 BSock changed to support new message copying requirements. Timers were added to prevent infinite looping. Extra function returns created for WOULD_BLOCK. etc.

Revision 1.15 2005/03/08 05:57:40 plh844 Fixed two compilation bugs.

Revision 1.14 2005/03/08 05:04:09 plh844 Updated the includes to point to the right files (case senetive names).

Revision 1.13 2005/03/07 16:01:20 tcsvw5 Updated ProcessRead and ProcessSend to send the message buffer along with the message.

Revision 1.12 2005/02/15 22:40:10 cafene Travis Service: Updated variable and function names to conform to our standard

Revision 1.11 2005/02/15 20:41:47 kjm266 Added functionality to support datagram socket creation. Added the Bind, GetUDPPendingBytes, ReadUDP and WriteUDP functions.

Revision 1.10 2005/02/09 21:50:21 bjsk3b Made Send, Recv, and GetPendingBytes pure virtual functions. Made ProcessSend, ProcessRead, and PingConnection non-virtual member functions

Revision 1.9 2005/02/08 20:19:31 mab6d5 Fixed a logic error where in the ReadNext function where the message was deleted before it was copied.

Revision 1.8 2005/02/08 06:27:56 mab6d5 Fixed the initialization of the mutex variable.

Revision 1.7 2005/02/07 02:21:42 cafene Added the Accept pure virtual function. Also changed the type of the MSG_HEADER_SIZE static const to an unsigned int.

Revision 1.00. 01/27/2005 09:55PM. Brian Shaver. Initial Revision


The documentation for this class was generated from the following files:
Copyright (c) 2005 Matt Bruns, Pat Hammond, Kevin Markussen, Travis Service, Brain Shaver

SourceForge.net Logo