Messaging System
[Networking]

Collaboration diagram for Messaging System:

A system used to send data, receive acknowledgment of sent data, and responding to acknowledgments or lack thereof. More...


Files

file  message.c
 Implementation of the Messaging System.
file  message.h
 Interface to the Messaging System.

Data Structures

struct  MsgDescr_t
 Describes a message, including who should receive it and data needed to handle acknowledgments. More...
struct  NetBuffer_t
 The buffer type used to store messages sent and received over the network. More...

Defines

#define DESTMAPLEN   bitarraylen(MAX_PLAYERS, DESTMAPTYPE)
 The number of elements in the array MsgDescr::destMap.
#define DESTMAPTYPE   Uint16
 The data type used for MsgDescr::destMap.
#define GetDestMapFlag(id)   bitflag(id, DESTMAPTYPE)
 Returns the bit flag that indicates the given client in the MsgDescr::destMap array at the correct index (see GetDestMapIndex()).
#define GetDestMapIndex(id)   bitindex(id, DESTMAPTYPE)
 Returns the index to the MsgDescr::destMap array that contains the flag for the given client.
#define MSG_MAX_SIZE   510
 The maximum size of a message in bytes.
#define SetDestToAll(msg)
 Marks a message as being destined to all clients.

Typedefs

typedef void(*) AcknowledgeMsg (MsgDescr *descr, int cid)
 The function prototype used to react to the recipient acknowledging a message.
typedef Bool(*) ApproveSendMsg (MsgDescr *descr, int cid)
 Approves sending a message to a given recipient.
typedef void(*) ConstructMsg (MsgDescr *descr)
 The function prototype used to construct the message in a buffer.
typedef void(*) FailMsg (MsgDescr *descr, ClientData *client)
 The function prototype used to react to a recipient that did not acknowledge a message, or if an error occured when trying to send a message.
typedef Bool(*) HandleMsg (SocketAddr *origin, NetBuffer *buffer, Uint8 *clientId, Uint16 messageId)
 The function prototype used to process incomming messages.
typedef MsgDescr_t MsgDescr
typedef NetBuffer_t NetBuffer

Enumerations

enum  {
  MSG_TYPE_ACK, MSG_TYPE_CONN_REQ, MSG_TYPE_CONN_DENY, MSG_TYPE_CONN_ACCEPT,
  MSG_TYPE_CONN_DISCONN, MSG_TYPE_OPTION, MSG_TYPE_OBSTACLE, MSG_TYPE_SPAWN,
  MSG_TYPE_GOAL, MSG_TYPE_GAME_START, MSG_TYPE_GAME_OVER, MSG_TYPE_SCORE = MSG_TYPE_GOAL + 1,
  MSG_TYPE_PLAYER_UPDATE, MSG_TYPE_PLAYER_SPWAN, MSG_TYPE_MAX
}
 The message type identifiers that are always sent as the first byte of every message. More...

Functions

Bool AddMessage (MsgDescr *msg)
 Adds a new message to the messaging system and sends it out immediately.
void BufferFree (NetBuffer *buff)
 Returns a no longer used network buffer to the queue of available buffers.
NetBufferBufferNew ()
 Obtains a new message buffer from the internal list of buffers.
void BufferVecDestr (void *buff)
 A Vector destructor that returns a no longer used network buffer to the queue of available buffers.
void CancelAllMessages ()
 Cancels all in-flight messages effectively killing communication with the remote end(s).
int GetNumOutgoingMessages ()
 Returns the number of messages that have been sent but not acknowledged.
void MessageFree (MsgDescr *msg)
 Returns an unused message to the queue of available messages, or deallocates it if the maximum number of messages are in the available queue (MAX_MESSAGES).
Bool MessageInit ()
 Initializes the network messaging system.
MsgDescrMessageNew ()
 Gets a new uninitialized message so that it can be put to use describing a new message.
void MessageUninit ()
 Uninitializes the network messaging system.
void MsgFailDisconnect (MsgDescr *descr, ClientData *client)
 A message failure function that disconnects from the remote end in the most reliable manner possible.
void MsgFailDropConnection (MsgDescr *descr, ClientData *client)
 A message failure function that immediately terminates all communication.
void ProcessNetworkMessages ()
 Handles all network I/O for the client or server.
Bool ReceiveMessages ()
 Handles all incomming messages.
static Bool Send (MsgDescr *msg, Bool inSys)
 Transmits the given message to the other end(s) and/or cancels the message.
Bool SendDisconnectMessage (Uint8 id)
 Sends a disconnect message (see MSG_TYPE_CONN_DISCONN and the data format) indicating the specified client is leaving the game.
void ServiceMessages ()
 Services the outgoing messages that are already in the system.
Bool ValidateClient (SocketAddr *origin, Uint8 clientId)
 Determines if incomming client data came from a valid source.
Bool ValidateServer (SocketAddr *origin)
 Determines if the inomming server data came from the server that is running the game, and if this process is a client.

Detailed Description

A system used to send data, receive acknowledgment of sent data, and responding to acknowledgments or lack thereof.

Diagram of message data relationships:

inline_dotgraph_3.dot
Bug:
In the above dot digraph, all the links must not use the Javadoc style @ symbol to denote tags, although the Javadoc style is valid everywhere else.
Bug:
It would be nice to add line breaks to the labels in the above graph, but Doxygen wrecks the line break tags that the dot tool recognizes.
In the diagram, arrows point in the same direction as the actual pointer. Dashed lines indicate how an item's state can change at run-time.

The following macros affect how the message system operates:

Warning:
The messaging system is not thread safe.
Copyright (C) 2007 Jeff Jackowski

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Or visit their website at: http://www.gnu.org/

Author:
Jeff Jackowski

Define Documentation

#define DESTMAPLEN   bitarraylen(MAX_PLAYERS, DESTMAPTYPE)

The number of elements in the array MsgDescr::destMap.

Definition at line 309 of file message.h.

Referenced by HandleAck(), MessageNew(), Send(), and ServiceGameConfig().

#define DESTMAPTYPE   Uint16

The data type used for MsgDescr::destMap.

Definition at line 304 of file message.h.

Referenced by HandleAck(), and Send().

#define GetDestMapFlag ( id   )     bitflag(id, DESTMAPTYPE)

Returns the bit flag that indicates the given client in the MsgDescr::destMap array at the correct index (see GetDestMapIndex()).

Parameters:
id The ID of the client who's bit flag is sought.
Returns:
The bit flag. Only the client's bit is set.
Author:
Jeff Jackowski

Definition at line 327 of file message.h.

Referenced by AddToConfigList(), HandleAck(), and RemoveFromConfigList().

#define GetDestMapIndex ( id   )     bitindex(id, DESTMAPTYPE)

Returns the index to the MsgDescr::destMap array that contains the flag for the given client.

Parameters:
id The ID of the client who's array position is sought.
Returns:
The index.
Author:
Jeff Jackowski

Definition at line 318 of file message.h.

Referenced by AddToConfigList(), HandleAck(), and RemoveFromConfigList().

#define MSG_MAX_SIZE   510

The maximum size of a message in bytes.

See NetBuffer for details on appropriate values.

Definition at line 199 of file message.h.

Referenced by AppendPlayerData(), MakeAreaBuffers(), and ReceiveMessages().

#define SetDestToAll ( msg   ) 

Value:

{                                                                \
    int loop;                                                    \
    DESTMAPTYPE *map = &((msg)->destMap[0]);                     \
    *map = ~0;                                                   \
    for (loop = DESTMAPLEN - 1; loop > 0; loop--) *(++map) = ~0; \
}
Marks a message as being destined to all clients.

Parameters:
msg A pointer to the message descriptor to modify.
Author:
Jeff Jackowski

Definition at line 334 of file message.h.

Referenced by AppendPlayerData(), SendDisconnectMessage(), and SendScoreUpdate().


Typedef Documentation

typedef void(*) AcknowledgeMsg(MsgDescr *descr, int cid)

The function prototype used to react to the recipient acknowledging a message.

After this function is called, the bit corresponding to the acknowledging host in MsgDescr::destMap will be cleared.

Precondition:
The client has been validated with ValidateClient().
Parameters:
descr The message descriptor data.
cid The client's ID.

Definition at line 256 of file message.h.

typedef Bool(*) ApproveSendMsg(MsgDescr *descr, int cid)

Approves sending a message to a given recipient.

If approval is not given, the recipient will be removed from the message's destination list and the corresponding FailMsg function will not be called.

Parameters:
descr The message descriptor data for the message to approve.
cid The destination client ID.
Returns:
True if the message should be sent to the indicated player.

Definition at line 299 of file message.h.

typedef void(*) ConstructMsg(MsgDescr *descr)

The function prototype used to construct the message in a buffer.

When the function is called for the first time for a given message, the MsgDescr::inflight flag will be cleared; all subsequent calls will see the flag set. The system is responsible for transmitting the message to all the recipiants.

Deprecated:
Parameters:
descr The message descriptor data.

Definition at line 229 of file message.h.

typedef void(*) FailMsg(MsgDescr *descr, ClientData *client)

The function prototype used to react to a recipient that did not acknowledge a message, or if an error occured when trying to send a message.

Parameters:
descr The message descriptor data.
client A pointer to the client data that failed to respond, or NULL if this process is a client.

Definition at line 265 of file message.h.

typedef Bool(*) HandleMsg(SocketAddr *origin, NetBuffer *buffer, Uint8 *clientId, Uint16 messageId)

The function prototype used to process incomming messages.

Parameters:
origin The originating address of the message as reported by recvfrom().
buffer The buffer that contains the whole message including the message type byte.
clientId A pointer used to return the ID of the client sending the message. This must be set for the message to be acknowledged by the server. For client side operation, this value should always be zero.
messageId The message ID that this function is processing. This is useful to prevent re-updating player data that has been received twice because the server didn't get an acknowledgment in time. Some message types lack a message ID; see the message formats for which ones.
Returns:
True to acknowledge the message, false otherwise.

Definition at line 654 of file message.h.

typedef struct MsgDescr_t MsgDescr

Definition at line 124 of file message.h.

typedef struct NetBuffer_t NetBuffer

Definition at line 218 of file message.h.


Enumeration Type Documentation

anonymous enum

The message type identifiers that are always sent as the first byte of every message.

The ID's must be put in the following order to simplify ReceiveMessages():

Enumerator:
MSG_TYPE_ACK  Message acknowledgment.
MSG_TYPE_CONN_REQ  Connection request; see design and message format.
MSG_TYPE_CONN_DENY  Connection denial.
MSG_TYPE_CONN_ACCEPT  Connection acceptance; see design and message format.
MSG_TYPE_CONN_DISCONN  Disconnection notice.

This can be sent by client and server.

MSG_TYPE_OPTION  Game configuration options; only sent by the server.
MSG_TYPE_OBSTACLE  A set of obstacle data; only sent by the server.
MSG_TYPE_SPAWN  A set of spawn areas; only sent by the server.
MSG_TYPE_GOAL  A set of goal areas for CTF; only sent by the server.
MSG_TYPE_GAME_START  Notice that the game is about to begin.
MSG_TYPE_GAME_OVER  Notice that the game has concluded.
MSG_TYPE_SCORE  An update to the scores of the teams.
MSG_TYPE_PLAYER_UPDATE  Contains updated state data for multiple players.
MSG_TYPE_PLAYER_SPWAN  A request from a player to spwan in the game.
MSG_TYPE_MAX 

Definition at line 133 of file message.h.


Function Documentation

Bool AddMessage ( MsgDescr msg  ) 

Adds a new message to the messaging system and sends it out immediately.

The system will handle acknowledgments and re-transmissions as needed, and will assume the responsibility of deallocating the message.

Flowchart:

inline_dotgraph_4.dot

Parameters:
msg The message to add to the system. The pointer should have been returned by a previous call to MessageNew(). A message can only be added once, after which it will represent the transmission state of the message.
Returns:
True on success, false if the message failed to send. On failure, the message is deallocated.
Author:
Jeff Jackowski

Definition at line 654 of file message.c.

References AATreeAdd(), MsgDescr_t::buffer, AANode_t::data, NetBuffer_t::data, MsgDescr_t::destMap, MsgDescr_t::doNotAddId, FALSE, inflightId, inflightTime, NetBuffer_t::length, MSG_WRITE_16C, MsgDescr_t::msgId, NETSTATE_CLIENT, NETSTATE_SERVER, networkState, nextMessageId, Send(), MsgDescr_t::triesLeft, TRUE, and Vector_t::VectorHeapPush().

Referenced by AppendPlayerData(), GameInit(), GameRun(), SendDisconnectMessage(), SendScoreUpdate(), SendSpawnRequest(), and ServiceGameConfig().

Here is the call graph for this function:

void BufferFree ( NetBuffer buff  ) 

Returns a no longer used network buffer to the queue of available buffers.

When the macro MSG_PTR_CHK is defined, the process will fail on an assert if the given buffer is already in the available buffer list.

Parameters:
buff The buffer to reclaim.
Author:
Jeff Jackowski

Definition at line 273 of file message.c.

References Vector_t::array, buffers, Vector_t::items, MAX_BUFFERS, and Vector_t::VectorPush().

Referenced by BufferVecDestr(), MakeAreaBuffers(), MakeBuffers(), MessageFree(), MsgDescrDestructor(), and Send().

Here is the call graph for this function:

NetBuffer* BufferNew (  ) 

Obtains a new message buffer from the internal list of buffers.

Intended to allow a buffer to be added to a message prior to passing its descriptor to AddMessage() rather than use a message constructor function (MsgDescr::constrFunc). For this to work, do the following:

Returns:
The address of the buffer, or NULL if no buffers were available and a new buffer could not be allocated. The new buffer's NetBuffer::length field will be initialized to zero.
Author:
Jeff Jackowski.

Definition at line 247 of file message.c.

References buffers, NetBuffer_t::length, and Vector_t::VectorLast.

Referenced by AppendPlayerData(), MakeAreaBuffers(), MakeBuffers(), SendDisconnectMessage(), SendScoreUpdate(), and SendSpawnRequest().

void BufferVecDestr ( void *  buff  ) 

A Vector destructor that returns a no longer used network buffer to the queue of available buffers.

Parameters:
buff A double pointer to the NetBuffer to reclaim.
Warning:
The parameter is a single pointer to fit the Vector interface for a DestructorOp. The function really expects a double pointer. Since the available buffer vector stores pointers, the vector code will pass in a pointer into the list where a pointer is stored, so a double pointer is correct.
Author:
Jeff Jackowski

Definition at line 296 of file message.c.

References BufferFree().

Here is the call graph for this function:

void CancelAllMessages (  ) 

Cancels all in-flight messages effectively killing communication with the remote end(s).

Prepares the messaging system for use with another host. There is no need to call this function if the message system is about to be uninitialized with a call to MessageUninit().

Author:
Jeff Jackowski

Definition at line 162 of file message.c.

References AA_ROOT_NODE, AATreeDestroy(), Vector_t::destructOp, inflightId, inflightTime, MsgDescrDestructor(), and Vector_t::VectorClear().

Referenced by MessageCliToSrv(), MessageSrvToCli(), NetDisconnect(), and NetUninit().

Here is the call graph for this function:

int GetNumOutgoingMessages (  ) 

Returns the number of messages that have been sent but not acknowledged.

Returns:
The number of messages.
Author:
Jeff Jackowski

Definition at line 177 of file message.c.

References inflightTime, and Vector_t::items.

Referenced by Disconnect().

void MessageFree ( MsgDescr msg  ) 

Returns an unused message to the queue of available messages, or deallocates it if the maximum number of messages are in the available queue (MAX_MESSAGES).

When the macro MSG_PTR_CHK is defined, the process will fail on an assert if the given message is already in the available message list.

Warning:
Do not call this on messages passed to AddMessage().
Precondition:
The message is not referenced in either the ID sorted tree (inflightId) or the resend time sorted priority queue (inflightTime).
Returns:
msg The unused message.
Author:
Jeff Jackowski

Definition at line 217 of file message.c.

References Vector_t::array, available, MsgDescr_t::buffer, BufferFree(), MsgDescr_t::buffLifeUnmanaged, Vector_t::items, MAX_MESSAGES, and Vector_t::VectorPush().

Referenced by AppendPlayerData(), Send(), SendDisconnectMessage(), SendScoreUpdate(), and SendSpawnRequest().

Here is the call graph for this function:

Bool MessageInit (  ) 

Initializes the network messaging system.

Returns:
True if the operation succeeded.
Author:
Jeff Jackowski

Definition at line 1603 of file message.c.

References available, buffers, Vector_t::destructOp, FALSE, GenericPointerFree(), inflightTime, INIT_BUFFERS, INIT_MESSAGES, Vector_t::itemSize, Vector_t::lessOp, MIN_POINTERS, Vector_t::minSize, MSG_ACK_SIZE, TimeCompare(), TRUE, Vector_t::VectorAdd(), and Vector_t::VectorInit().

Referenced by NetInit(), and NetInitSrv().

Here is the call graph for this function:

MsgDescr* MessageNew (  ) 

Gets a new uninitialized message so that it can be put to use describing a new message.

Postcondition:
The resulting message will have default values for:
Returns:
A pointer to the message data, or NULL if there is inadequate memory.
Author:
Jeff Jackowski

Todo:
Set the initial resend time to twice the average two-way latency of network commincations as determined by the time sync operation with some constant minimum (32ms?).

Definition at line 181 of file message.c.

References available, MsgDescr_t::destMap, DESTMAPLEN, MsgDescr_t::flags, INIT_RESEND, INIT_TRIES, MsgDescr_t::interval, Vector_t::items, MsgDescr_t::triesLeft, and Vector_t::VectorLast.

Referenced by AppendPlayerData(), SendDisconnectMessage(), SendScoreUpdate(), SendSpawnRequest(), and ServiceGameConfig().

void MessageUninit (  ) 

Uninitializes the network messaging system.

Author:
Jeff Jackowski

Definition at line 1647 of file message.c.

References AA_ROOT_NODE, AATreeDestroy(), available, buffers, Vector_t::destructOp, inflightId, inflightTime, MsgDescrDestructor(), and Vector_t::VectorDestroy().

Referenced by NetUninit().

Here is the call graph for this function:

void MsgFailDisconnect ( MsgDescr descr,
ClientData client 
)

A message failure function that disconnects from the remote end in the most reliable manner possible.

It sends out the disconnect message to all possible destinations. Because a failure has occured, the disconnect message may not be received.

Parameters:
descr The message descriptor data.
client A pointer to the client data that failed to respond, or NULL if this process is a client.
Author:
Jeff Jackowski

Definition at line 1244 of file message.c.

References ClientData_t::active, ClientData_t::cid, ClientData_t::contact, ClientData_t::disconn, ClientData_t::disconnTime, FALSE, localPlayer, MsgDescr_t::msgId, NETSTATE_CLIDISCONN, NETSTATE_CLIENT, NETSTATE_RCVCFG, NETSTATE_SERVER, networkState, players, RemoveFromConfigList(), RemovePlayer(), SendDisconnectMessage(), and TRUE.

Referenced by AppendPlayerData(), and SendScoreUpdate().

Here is the call graph for this function:

void MsgFailDropConnection ( MsgDescr descr,
ClientData client 
)

A message failure function that immediately terminates all communication.

It does not send out a disconnect message unless it is on the server and the message is not a disconnect message or the failed client is the one specified in the disconnect message.

Parameters:
descr The message descriptor data.
client A pointer to the client data that failed to respond, or NULL if this process is a client.
Author:
Jeff Jackowski

Definition at line 1180 of file message.c.

References MsgDescr_t::buffer, ClientData_t::cid, CloseSocket, NetBuffer_t::data, Player_t::flags, ClientData_t::flags, NetBuffer_t::length, MSG_TYPE_CONN_DISCONN, NETSTATE_CLIDISCONN, NETSTATE_CLIENT, NETSTATE_INIT, NETSTATE_RCVCFG, NETSTATE_SERVER, networkState, players, RemoveFromConfigList(), SendDisconnectMessage(), and sock.

Referenced by SendDisconnectMessage(), and SendSpawnRequest().

Here is the call graph for this function:

void ProcessNetworkMessages (  ) 

Handles all network I/O for the client or server.

Receives incomming messages, services outgoing messages, and updates player data. If running as a server, also services the game configuration messages.

Author:
Jeff Jackowski

Definition at line 1708 of file message.c.

References frameTime, NETSTATE_RCVCFG, NETSTATE_SERVER, networkState, ReceiveMessages(), ServiceGameConfig(), ServiceMessages(), and UpdatePlayers().

Referenced by BfldErrRun(), GameRun(), MenuRun(), and SplashRun().

Here is the call graph for this function:

Bool ReceiveMessages (  ) 

Handles all incomming messages.

Returns:
True if successful, false on network error.
Author:
Jeff Jackowski

Definition at line 1485 of file message.c.

References SocketAddr_t::addr, NetBuffer_t::data, FALSE, GetNetErrorString(), GetNetErrorVal, inbuff, NetBuffer_t::length, SocketAddr_t::length, MAX_PLAYERS, MSG_ACK_SIZE, MSG_MAX_ACK, MSG_MAX_SIZE, MSG_READ_16C, MSG_TYPE_CONN_ACCEPT, MSG_TYPE_MAX, MSG_WRITE_16C, NETSTATE_CLIENT, NETSTATE_SERVER, NETSTATE_SRVDISCONN, networkState, rounddivup, SendAck(), sock, and TRUE.

Referenced by Disconnect(), DiscoverConnectServer(), and ProcessNetworkMessages().

Here is the call graph for this function:

static Bool Send ( MsgDescr msg,
Bool  inSys 
) [static]

Transmits the given message to the other end(s) and/or cancels the message.

For internal use only.

Precondition:
The message is not in the inflightTime priority queue, but is in the inflightId tree.
Flowchart:
Todo:
Update the flowchart. Messages are now constructed in a buffer just before sending them the first time rather than at the start of this function. The construction now happens in ConstructMessage(). Also added in functionality to call failure function on message when not acknowledged and to cancel message after a set number of retries. Implemented the functionality for the MsgDescr::noResend flag. Added message approvals to client-side sending.
inline_dotgraph_5.dot
Parameters:
msg The message to transmit.
inSys True if the message has been added to the heap and tree tracking messages in the system. This value will be false when called from AddMessage() because the resend time will be set while in this function.
Returns:
True on success, false if the message was not sent because of error or no recipients.
Author:
Jeff Jackowski

Definition at line 458 of file message.c.

References AATreeRemove, SocketAddr_t::addr, MsgDescr_t::approveFunc, MsgDescr_t::bcast, MsgDescr_t::buffer, BufferFree(), MsgDescr_t::buffLifeUnmanaged, clients, NetBuffer_t::data, MsgDescr_t::destMap, DESTMAPLEN, DESTMAPTYPE, MsgDescr_t::failFunc, FALSE, ClientData_t::flags, MsgDescr_t::inflight, inflightId, MsgDescr_t::interval, SocketAddr_t::ipv4, SocketAddr_t::length, NetBuffer_t::length, localPlayer, MAX_PLAYERS, MessageFree(), MSG_TYPE_CONN_DISCONN, MsgDescr_t::msgId, NETSTATE_CLIDISCONN, NETSTATE_CLIENT, NETSTATE_RCVCFG, networkState, MsgDescr_t::nextSend, MsgDescr_t::noResend, outgoingAddr, sock, MsgDescr_t::triesLeft, and TRUE.

Referenced by AddMessage(), and ServiceMessages().

Here is the call graph for this function:

Bool SendDisconnectMessage ( Uint8  id  ) 

Sends a disconnect message (see MSG_TYPE_CONN_DISCONN and the data format) indicating the specified client is leaving the game.

The message is sent using the messaging system.

Parameters:
id The client ID of the host leaving the game. For servers, the value should be zero.
Returns:
True if the message was transmitted.
Author:
Jeff Jackowski

Definition at line 1367 of file message.c.

References MsgDescr_t::ackFunc, AddMessage(), MsgDescr_t::approveFunc, MsgDescr_t::bcast, MsgDescr_t::buffer, BufferNew(), NetBuffer_t::data, MsgDescr_t::destMap, MsgDescr_t::failFunc, FALSE, INIT_TRIES, NetBuffer_t::length, MessageFree(), MessageNew(), MSG_TYPE_CONN_DISCONN, MsgFailDropConnection(), NETSTATE_SERVER, networkState, SetDestToAll, MsgDescr_t::triesLeft, and TRUE.

Referenced by HandleConnDisconn(), MsgFailDisconnect(), MsgFailDropConnection(), NetDisconnect(), and NetUninit().

Here is the call graph for this function:

void ServiceMessages (  ) 

Services the outgoing messages that are already in the system.

This includes removing messages that have been acknowledged by all recipients, and resending messages that haven't.

Author:
Jeff Jackowski

Definition at line 692 of file message.c.

References AATreeFind(), AANode_t::data, inflightId, inflightTime, AANode_t::key, MsgDescr_t::msgId, NETSTATE_CONNECTING, NETSTATE_SERVER, networkState, MsgDescr_t::nextSend, Send(), TRUE, Vector_t::VectorFirst, Vector_t::VectorHeapPop(), and Vector_t::VectorHeapPush().

Referenced by Disconnect(), and ProcessNetworkMessages().

Here is the call graph for this function:

Bool ValidateClient ( SocketAddr origin,
Uint8  clientId 
)

Determines if incomming client data came from a valid source.

This function relies on data returned from socket functions of the operating system, and as such is suseptible to things like spoofing.

Parameters:
origin The originating address of the data.
clientId The reported identity of the client.
Returns:
True if it appears the data came from the indicated client, false if the data seems to have come from another source.
Author:
Jeff Jackowski

Definition at line 743 of file message.c.

References ClientData_t::addr, clients, SocketAddr_t::EqualAddresses, FALSE, localPlayer, MAX_PLAYERS, and TRUE.

Referenced by HandleAck(), HandleConnDisconn(), HandlePlayerSpawn(), HandlePlayerUpdate(), and ServerTimeSyncThread().

Bool ValidateServer ( SocketAddr origin  ) 

Determines if the inomming server data came from the server that is running the game, and if this process is a client.

Parameters:
origin The originating address of the data.
Returns:
True if it appears the data came from the server and should not be ignored.
Author:
Jeff Jackowski

Definition at line 761 of file message.c.

References SocketAddr_t::EqualAddresses, FALSE, NETSTATE_CLIDISCONN, NETSTATE_CLIENT, NETSTATE_RCVCFG, networkState, outgoingAddr, and TRUE.

Referenced by HandleAck(), HandleArea(), HandleConnDeny(), HandleConnDisconn(), HandleGameOption(), HandleObstacle(), HandlePlayerUpdate(), and HandleScoreUpdate().


Generated on Mon May 28 04:41:42 2007 for Retro Tank Super Attack by  doxygen 1.5.2