In file mailboxd.cxx:

class CMailbox

Mailbox server class implementation.

Public Methods

[more] CMailbox ()
Default constructor. Initializes data to empty values.
[more] Setup (int iSocket)
Initializes a new mailbox. Associates an unused mailbox to a socket.
[more] ~CMailbox ()
Default destructor.
[more] Close ()
Close the mailbox.
[more]bool IsUsed ()
Returns true if the mailbox is in use.
[more]const char* GetName ()
Returns the mailbox name.
[more]const int GetSocket ()
Returns the associated socket.
[more]const char* GetMsgDest ()
Returns the message recipient.
[more]const int GetMsgLen ()
Returns the message body length.
[more]const char* GetMsgBody ()
Returns the incoming message body text
[more]void Delivered (bool bSuccess)
Indicates the delivery success.
[more]bool HasPendingOutput ()
Returns true if the socket has pending output.
[more]void EnqueueData (const char * strData, int iLen)
Enqueue output data.
[more]bool WriteEnqueuedData ()
Write outgoing data.
[more]bool CharReceived (unsigned char ch)
Notifies mailbox of a character arrival.

Protected Fields

[more]bool m_bIsUsed
Use flag. Indicates whether the mailbox is in use or not.
[more]char m_strName [ID_BUF_SIZE+1]
Malbox Name. Contains the name of the mailbox.
[more]int m_iSocket
Socket file descriptor number. This is the file descriptor number of the socket associated to the mailbox.
[more]int m_iState
Mailbox state. This is the current state of the finite state machine which implements the mailbox.
[more]int m_iPosition
Current input buffer position. This is the current position in the input buffer of the mailbox, it is u
[more]int m_iMsgLen
Input message length. This is the read lenght of the body of the message which is being read.
[more]int m_iOutBufferSize
Output buffer size. This is the size of the allocated output data buffer
[more]int m_iOutBufferLen
Used portion of the output data buffer
[more]char m_strDest [ID_BUF_SIZE+1]
Recipient mailbox identifier.
[more]char m_strBody [TXT_BUF_SIZE+1]
Text of the incoming message
[more]char* m_strOutBuffer
Dynamically allocated pending output data buffer


Documentation

Mailbox server class implementation.
obool m_bIsUsed
Use flag. Indicates whether the mailbox is in use or not.

ochar m_strName[ID_BUF_SIZE+1]
Malbox Name. Contains the name of the mailbox.

oint m_iSocket
Socket file descriptor number. This is the file descriptor number of the socket associated to the mailbox.

oint m_iState
Mailbox state. This is the current state of the finite state machine which implements the mailbox.

oint m_iPosition
Current input buffer position. This is the current position in the input buffer of the mailbox, it is u

oint m_iMsgLen
Input message length. This is the read lenght of the body of the message which is being read.

oint m_iOutBufferSize
Output buffer size. This is the size of the allocated output data buffer

oint m_iOutBufferLen
Used portion of the output data buffer

ochar m_strDest[ID_BUF_SIZE+1]
Recipient mailbox identifier.

ochar m_strBody[TXT_BUF_SIZE+1]
Text of the incoming message

ochar* m_strOutBuffer
Dynamically allocated pending output data buffer

o CMailbox()
Default constructor. Initializes data to empty values.

o Setup(int iSocket)
Initializes a new mailbox. Associates an unused mailbox to a socket.

o ~CMailbox()
Default destructor.

o Close()
Close the mailbox. Resets the mailbox associated data and indicates that the mailbox is unused and can be set up for new mailboxes.

obool IsUsed()
Returns true if the mailbox is in use. The mailbox is defined to be in use when it has an associated socket and a remote process connected to it, even if the remote process has not yet indicatet its name.

oconst char* GetName()
Returns the mailbox name. Returns the name of the mailbox which has been chosen by the remote process connected to it.

oconst int GetSocket()
Returns the associated socket. Returns the file descriptor of the socket currently associated to the mailbox.

oconst char* GetMsgDest()
Returns the message recipient. Returns the destination mailbox of the incoming message, if any. When the mailbox is not receiving any message (i.e. it is in the STATE\_WAITING state), this is the destination of the last incoming message.

oconst int GetMsgLen()
Returns the message body length. Returns the length of the body (therefore not counting recipient mailbox identifier, string terminator, length bytes) of the incoming message, if any. When the mailbox is not receiving any message (i.e. it is in the STATE_WAITING state), this is the body length of the last incoming message.

oconst char* GetMsgBody()
Returns the incoming message body text

ovoid Delivered(bool bSuccess)
Indicates the delivery success. Indicates to the mailbox that the last incoming message has been (or not) correctly delivered to destination mailbox. This method notifies the success (or insuccess) to the process owning the mailbox.

obool HasPendingOutput()
Returns true if the socket has pending output. Returns true when the output pending data buffer is not empty. This represent a sort of request for the caller to call the WriteEnqueuedData() member as soon as the associated socket is ready for writing.

ovoid EnqueueData(const char * strData, int iLen)
Enqueue output data. Appends outgoing data to the the mailbox output buffer.

obool WriteEnqueuedData()
Write outgoing data. Tries to write to the socket the outgoing pending data, through a non-blocking write() call.

obool CharReceived(unsigned char ch)
Notifies mailbox of a character arrival. Updates the mailbox finite state machine with a new input


This class has no child classes.

Alphabetic index HTML hierarchy of classes or Java



This page was generated with the help of DOC++.