Main Page | Alphabetical List | Compound List | File List | Compound Members | File Members

NetMgr.h File Reference

#include <Windows.h>
#include "Genesis.h"
#include "Buffer.h"

Go to the source code of this file.

Defines

#define NETMGR_VERSION_MAJOR   1
#define NETMGR_VERSION_MINOR   0
#define NETMGR_MAX_CLIENTS   8
#define NETMGR_MAX_PLAYERS   512
#define NETMGR_MAX_IP_ADDRESS   128
#define NETMGR_SINGLE_PLAYER_NETID   0xff
#define NETMGR_SPECIAL_BOT_NETID   -2
#define NETMGR_LOCAL_MSG_BUFFER_SIZE   20000
#define NetState_Disconnected   0
#define NetState_Connecting   1
#define NetState_ConnectedIdle   2
#define NetState_WorldChange   3
#define NetState_WorldActive   4
#define NETMGR_MAX_NET_STATES   5
#define NETMGR_MSG_CLIENT_MOVE   1
#define NETMGR_MSG_CLIENT_CONFIRM   2
#define NETMGR_MSG_VERSION   3
#define NETMGR_MSG_TIME   4
#define NETMGR_MSG_PLAYER_DATA   5
#define NETMGR_MSG_NEW_WORLD_PLAYER_DATA   6
#define NETMGR_MSG_VIEW_PLAYER   7
#define NETMGR_MSG_MESH_INDEX   8
#define NETMGR_MSG_ACTOR_INDEX   9
#define NETMGR_MSG_MOTION_INDEX   10
#define NETMGR_MSG_BONE_INDEX   11
#define NETMGR_MSG_TEXTURE_INDEX   12
#define NETMGR_MSG_SOUND_INDEX   13
#define NETMGR_MSG_SET_WORLD   14
#define NETMGR_MSG_CD_TRACK   15
#define NETMGR_MSG_PLAY_SOUND_INDEX   16
#define NETMGR_MSG_EFFECT   17
#define NETMGR_MSG_CLIENT_INDEX   18
#define NETMGR_MSG_CLIENT_ACTIVE   19
#define NETMGR_MSG_CLIENT_NAME   20
#define NETMGR_MSG_CLIENT_SCORE   21
#define NETMGR_MSG_CLIENT_HEALTH   22
#define NETMGR_MSG_CLIENT_INVENTORY   23
#define NETMGR_MSG_CLIENT_WEAPON   24
#define NETMGR_MSG_SPAWN_FX   25
#define NETMGR_MSG_HEADER_PRINTF   26
#define NETMGR_MSG_CLIENT_PLAYER_INDEX   27
#define NETMGR_MSG_NET_STATE_CHANGE   28
#define NETMGR_MSG_SHUTDOWN   128
#define NETMGR_SEND_SPAWN_TIME   (1<<0)
#define NETMGR_SEND_VIEW_FLAGS   (1<<1)
#define NETMGR_SEND_VIEW_INDEX   (1<<2)
#define NETMGR_SEND_MOTION_INDEX   (1<<3)
#define NETMGR_SEND_FX_FLAGS   (1<<4)
#define NETMGR_SEND_POS   (1<<5)
#define NETMGR_SEND_ANGLES   (1<<6)
#define NETMGR_SEND_FRAME_TIME   (1<<7)
#define NETMGR_SEND_SCALE   (1<<8)
#define NETMGR_SEND_VELOCITY   (1<<9)
#define NETMGR_SEND_STATE   (1<<10)
#define NETMGR_SEND_CONTROL_INDEX   (1<<11)
#define NETMGR_SEND_TRIGGER_INDEX   (1<<12)
#define NETMGR_SEND_MINS_MAXS   (1<<13)

Typedefs

typedef NetMgr NetMgr
typedef int32 NetMgr_NetState

Functions

NetMgrNetMgr_Create (geBoolean UseLocalBuffers)
void NetMgr_Destroy (NetMgr *NMgr)
void NetMgr_FreeAllObjects (NetMgr *NMgr)
geBoolean NetMgr_StartSession (NetMgr *NMgr, const char *SessionName, const char *PlayerName)
geBoolean NetMgr_JoinSession (NetMgr *NMgr, const char *IPAddress, const char *PlayerName)
geCSNetMgr_NetID NetMgr_GetOurID (NetMgr *NMgr)
geBoolean NetMgr_IsValid (NetMgr *NMgr)
geBoolean NetMgr_SendServerMessage (NetMgr *NMgr, Buffer_Data *Buffer, geBoolean G)
geBoolean NetMgr_SendClientMessage (NetMgr *NMgr, geCSNetMgr_NetID NetID, Buffer_Data *Buffer, geBoolean G)
geBoolean NetMgr_ReceiveServerMessage (NetMgr *NMgr, geCSNetMgr_NetMsgType *Type, Buffer_Data *Buffer)
geBoolean NetMgr_ReceiveClientMessage (NetMgr *NMgr, geCSNetMgr_NetMsgType *MsgType, geCSNetMgr_NetID *ClientID, Buffer_Data *Buffer)
void NetMgr_ResetClientBuffer (NetMgr *NMgr)
void NetMgr_ResetServerBuffer (NetMgr *NMgr)


Define Documentation

#define NETMGR_LOCAL_MSG_BUFFER_SIZE   20000
 

Definition at line 47 of file NetMgr.h.

Referenced by Client_ReadServerMessages(), NetMgr_Create(), and ReadServerMessages().

#define NETMGR_MAX_CLIENTS   8
 

Definition at line 38 of file NetMgr.h.

Referenced by Client_ReadServerMessages(), FillBufferWithClientInfo(), FindClient(), PrintClientScores(), ReadServerMessages(), SendAllClientsMessage(), SendPlayersToClients(), Server_BotConnect(), Server_ClientConnect(), Server_ClientDisconnect(), Server_Frame(), Server_IsClientBot(), Server_NewWorldDefaults(), Server_PlaySound(), Server_SendClientStartupData(), Server_SetClientInventory(), Server_SetupAllClientsWithCurrentWorld(), Server_SetViewPlayer(), Server_SpawnWorld(), SetupClientPlayerSendFlags(), and UpdateStatusBar().

#define NETMGR_MAX_IP_ADDRESS   128
 

Definition at line 42 of file NetMgr.h.

Referenced by WinMain().

#define NETMGR_MAX_NET_STATES   5
 

Definition at line 60 of file NetMgr.h.

#define NETMGR_MAX_PLAYERS   512
 

Definition at line 40 of file NetMgr.h.

Referenced by BuildClientViewXForm(), Client_DestroyALLPlayers(), Client_GetPlayer(), Client_MovePlayerModel(), Client_NewWorldDefaults(), ControlPlayers(), ForceServerPlayerOnLocalClient(), SendClientPlayerData(), SendPlayersToClients(), Server_CountBots(), Server_Create(), Server_CreatePlayer(), Server_DestroyPlayer(), Server_FreeWorldData(), Server_GetBotByName(), Server_GetNextPlayer(), Server_MovePlayerModel(), Server_NewWorldDefaults(), SetupClientPlayerSendFlags(), and UpdatePlayers().

#define NETMGR_MSG_ACTOR_INDEX   9
 

Definition at line 76 of file NetMgr.h.

Referenced by ReadServerMessages(), and Server_SendClientCurrentWorldData().

#define NETMGR_MSG_BONE_INDEX   11
 

Definition at line 78 of file NetMgr.h.

Referenced by ReadServerMessages(), and Server_SendClientCurrentWorldData().

#define NETMGR_MSG_CD_TRACK   15
 

Definition at line 82 of file NetMgr.h.

Referenced by ReadServerMessages().

#define NETMGR_MSG_CLIENT_ACTIVE   19
 

Definition at line 86 of file NetMgr.h.

Referenced by FillBufferWithClientInfo(), ReadServerMessages(), Server_ClientDisconnect(), and Server_ClientDisconnectByHandle().

#define NETMGR_MSG_CLIENT_CONFIRM   2
 

Definition at line 67 of file NetMgr.h.

Referenced by Client_ChangeNetState(), and ParseClientMessage().

#define NETMGR_MSG_CLIENT_HEALTH   22
 

Definition at line 89 of file NetMgr.h.

Referenced by FillBufferWithClientInfo(), ReadServerMessages(), and Server_SetClientHealth().

#define NETMGR_MSG_CLIENT_INDEX   18
 

Definition at line 85 of file NetMgr.h.

Referenced by ReadServerMessages(), and Server_SendClientStartupData().

#define NETMGR_MSG_CLIENT_INVENTORY   23
 

Definition at line 90 of file NetMgr.h.

Referenced by ReadServerMessages(), and Server_SetClientInventory().

#define NETMGR_MSG_CLIENT_MOVE   1
 

Definition at line 66 of file NetMgr.h.

Referenced by Client_SendMove(), and ParseClientMessage().

#define NETMGR_MSG_CLIENT_NAME   20
 

Definition at line 87 of file NetMgr.h.

Referenced by FillBufferWithClientInfo(), and ReadServerMessages().

#define NETMGR_MSG_CLIENT_PLAYER_INDEX   27
 

Definition at line 94 of file NetMgr.h.

Referenced by ReadServerMessages(), Server_SendClientCurrentWorldData(), and Server_ValidateClient().

#define NETMGR_MSG_CLIENT_SCORE   21
 

Definition at line 88 of file NetMgr.h.

Referenced by FillBufferWithClientInfo(), ReadServerMessages(), and Server_SetClientScore().

#define NETMGR_MSG_CLIENT_WEAPON   24
 

Definition at line 91 of file NetMgr.h.

Referenced by ReadServerMessages(), and Server_SetClientWeapon().

#define NETMGR_MSG_EFFECT   17
 

Definition at line 84 of file NetMgr.h.

#define NETMGR_MSG_HEADER_PRINTF   26
 

Definition at line 93 of file NetMgr.h.

Referenced by ReadServerMessages(), and Server_ConsoleHeaderPrintf().

#define NETMGR_MSG_MESH_INDEX   8
 

Definition at line 75 of file NetMgr.h.

#define NETMGR_MSG_MOTION_INDEX   10
 

Definition at line 77 of file NetMgr.h.

Referenced by ReadServerMessages(), and Server_SendClientCurrentWorldData().

#define NETMGR_MSG_NET_STATE_CHANGE   28
 

Definition at line 95 of file NetMgr.h.

Referenced by ReadServerMessages(), and Server_ChangeClientState().

#define NETMGR_MSG_NEW_WORLD_PLAYER_DATA   6
 

Definition at line 73 of file NetMgr.h.

Referenced by ReadServerMessages(), and SendClientPlayerData().

#define NETMGR_MSG_PLAY_SOUND_INDEX   16
 

Definition at line 83 of file NetMgr.h.

Referenced by ReadServerMessages(), and Server_PlaySound().

#define NETMGR_MSG_PLAYER_DATA   5
 

Definition at line 72 of file NetMgr.h.

Referenced by ReadServerMessages(), and SendPlayersToClients().

#define NETMGR_MSG_SET_WORLD   14
 

Definition at line 81 of file NetMgr.h.

Referenced by ReadServerMessages(), and Server_SendClientCurrentWorldData().

#define NETMGR_MSG_SHUTDOWN   128
 

Definition at line 97 of file NetMgr.h.

Referenced by ReadServerMessages(), and Server_Destroy().

#define NETMGR_MSG_SOUND_INDEX   13
 

Definition at line 80 of file NetMgr.h.

Referenced by ReadServerMessages(), and Server_SendClientCurrentWorldData().

#define NETMGR_MSG_SPAWN_FX   25
 

Definition at line 92 of file NetMgr.h.

Referenced by ReadServerMessages(), and Server_SpawnFx().

#define NETMGR_MSG_TEXTURE_INDEX   12
 

Definition at line 79 of file NetMgr.h.

Referenced by ReadServerMessages(), and Server_SendClientCurrentWorldData().

#define NETMGR_MSG_TIME   4
 

Definition at line 71 of file NetMgr.h.

Referenced by ReadServerMessages(), SendClientPlayerData(), and SendPlayersToClients().

#define NETMGR_MSG_VERSION   3
 

Definition at line 70 of file NetMgr.h.

Referenced by ReadServerMessages(), and Server_ClientConnect().

#define NETMGR_MSG_VIEW_PLAYER   7
 

Definition at line 74 of file NetMgr.h.

Referenced by ReadServerMessages(), and Server_SetViewPlayer().

#define NETMGR_SEND_ANGLES   (1<<6)
 

Definition at line 106 of file NetMgr.h.

Referenced by Client_ParsePlayerData(), FillBufferWithPlayerData(), and GetPlayerSendFlags().

#define NETMGR_SEND_CONTROL_INDEX   (1<<11)
 

Definition at line 111 of file NetMgr.h.

Referenced by Client_ParsePlayerData(), FillBufferWithPlayerData(), and GetPlayerSendFlags().

#define NETMGR_SEND_FRAME_TIME   (1<<7)
 

Definition at line 107 of file NetMgr.h.

Referenced by Client_ParsePlayerData(), FillBufferWithPlayerData(), and GetPlayerSendFlags().

#define NETMGR_SEND_FX_FLAGS   (1<<4)
 

Definition at line 104 of file NetMgr.h.

Referenced by Client_ParsePlayerData(), FillBufferWithPlayerData(), and GetPlayerSendFlags().

#define NETMGR_SEND_MINS_MAXS   (1<<13)
 

Definition at line 113 of file NetMgr.h.

Referenced by Client_ParsePlayerData(), FillBufferWithPlayerData(), and GetPlayerSendFlags().

#define NETMGR_SEND_MOTION_INDEX   (1<<3)
 

Definition at line 103 of file NetMgr.h.

Referenced by Client_ParsePlayerData(), FillBufferWithPlayerData(), and GetPlayerSendFlags().

#define NETMGR_SEND_POS   (1<<5)
 

Definition at line 105 of file NetMgr.h.

Referenced by Client_ParsePlayerData(), FillBufferWithPlayerData(), and GetPlayerSendFlags().

#define NETMGR_SEND_SCALE   (1<<8)
 

Definition at line 108 of file NetMgr.h.

Referenced by Client_ParsePlayerData(), FillBufferWithPlayerData(), and GetPlayerSendFlags().

#define NETMGR_SEND_SPAWN_TIME   (1<<0)
 

Definition at line 100 of file NetMgr.h.

Referenced by Client_ParsePlayerData(), FillBufferWithPlayerData(), and GetPlayerSendFlags().

#define NETMGR_SEND_STATE   (1<<10)
 

Definition at line 110 of file NetMgr.h.

Referenced by Client_ParsePlayerData(), FillBufferWithPlayerData(), and GetPlayerSendFlags().

#define NETMGR_SEND_TRIGGER_INDEX   (1<<12)
 

Definition at line 112 of file NetMgr.h.

Referenced by Client_ParsePlayerData(), FillBufferWithPlayerData(), and GetPlayerSendFlags().

#define NETMGR_SEND_VELOCITY   (1<<9)
 

Definition at line 109 of file NetMgr.h.

Referenced by Client_ParsePlayerData(), FillBufferWithPlayerData(), and GetPlayerSendFlags().

#define NETMGR_SEND_VIEW_FLAGS   (1<<1)
 

Definition at line 101 of file NetMgr.h.

Referenced by Client_ParsePlayerData(), FillBufferWithPlayerData(), and GetPlayerSendFlags().

#define NETMGR_SEND_VIEW_INDEX   (1<<2)
 

Definition at line 102 of file NetMgr.h.

Referenced by Client_ParsePlayerData(), FillBufferWithPlayerData(), and GetPlayerSendFlags().

#define NETMGR_SINGLE_PLAYER_NETID   0xff
 

Definition at line 44 of file NetMgr.h.

Referenced by Host_Create(), and NetMgr_ReceiveClientMessage().

#define NETMGR_SPECIAL_BOT_NETID   -2
 

Definition at line 45 of file NetMgr.h.

Referenced by NetMgr_SendClientMessage(), Server_BotConnect(), and Server_IsClientBot().

#define NETMGR_VERSION_MAJOR   1
 

Definition at line 34 of file NetMgr.h.

Referenced by Host_Create(), ReadServerMessages(), and Server_ClientConnect().

#define NETMGR_VERSION_MINOR   0
 

Definition at line 35 of file NetMgr.h.

Referenced by Host_Create(), ReadServerMessages(), and Server_ClientConnect().

#define NetState_ConnectedIdle   2
 

Definition at line 56 of file NetMgr.h.

#define NetState_Connecting   1
 

Definition at line 55 of file NetMgr.h.

Referenced by Server_ClientConnect().

#define NetState_Disconnected   0
 

Definition at line 54 of file NetMgr.h.

Referenced by Client_Create().

#define NetState_WorldActive   4
 

Definition at line 58 of file NetMgr.h.

Referenced by Client_Frame(), Client_RenderFrame(), ReadServerMessages(), SendPlayersToClients(), and Server_SetupClientWithCurrentWorld().

#define NetState_WorldChange   3
 

Definition at line 57 of file NetMgr.h.

Referenced by ReadServerMessages(), and Server_SetupClientWithCurrentWorld().


Typedef Documentation

typedef struct NetMgr NetMgr
 

Definition at line 32 of file NetMgr.h.

typedef int32 NetMgr_NetState
 

Definition at line 52 of file NetMgr.h.

Referenced by ParseClientMessage(), and ReadServerMessages().


Function Documentation

NetMgr* NetMgr_Create geBoolean  UseLocalBuffers  ) 
 

Definition at line 49 of file NetMgr.c.

References Buffer_Set(), NetMgr::ClientBuffer, NetMgr::ClientToServerBuffer, NetMgr::CSNetMgr, GE_RAM_ALLOCATE_STRUCT, geCSNetMgr_Create(), geErrorLog_AddString, NetMgr_FreeAllObjects(), NETMGR_LOCAL_MSG_BUFFER_SIZE, NULL, NetMgr::SelfCheck1, NetMgr::SelfCheck2, NetMgr::ServerBuffer, NetMgr::ServerToClientBuffer, and NetMgr::UseLocalBuffers.

Referenced by Host_Create().

00050 {
00051         NetMgr  *NMgr;
00052 
00053         NMgr = GE_RAM_ALLOCATE_STRUCT(NetMgr);
00054 
00055         if (!NMgr)
00056         {
00057                 geErrorLog_AddString(-1, "NetMgr_Create:  Could not create NetMgr object.", NULL);
00058                 return NULL;
00059         }
00060 
00061         memset(NMgr, 0 , sizeof(NetMgr));
00062 
00063         // Setup local message buffers...
00064         Buffer_Set(&NMgr->ClientToServerBuffer, NMgr->ClientBuffer, NETMGR_LOCAL_MSG_BUFFER_SIZE);
00065         Buffer_Set(&NMgr->ServerToClientBuffer, NMgr->ServerBuffer, NETMGR_LOCAL_MSG_BUFFER_SIZE);
00066 
00067         NMgr->UseLocalBuffers = UseLocalBuffers;
00068 
00069         if (!UseLocalBuffers)
00070         {
00071                 NMgr->CSNetMgr = geCSNetMgr_Create();
00072 
00073                 if (!NMgr->CSNetMgr)
00074                 {
00075                         geErrorLog_AddString(-1,"NetMgr_Create Could not create geCSNeMgr...\n", NULL);
00076                         NetMgr_FreeAllObjects(NMgr);
00077                         return NULL;
00078                 }
00079         }
00080 
00081         NMgr->SelfCheck1 = NMgr;
00082         NMgr->SelfCheck2 = NMgr;
00083 
00084         return NMgr;
00085 }

void NetMgr_Destroy NetMgr NMgr  ) 
 

Definition at line 90 of file NetMgr.c.

References NetMgr_FreeAllObjects(), and NetMgr_IsValid().

Referenced by Host_DestroyAllObjects().

00091 {
00092         assert(NetMgr_IsValid(NMgr));
00093 
00094         NetMgr_FreeAllObjects(NMgr);
00095 }

void NetMgr_FreeAllObjects NetMgr NMgr  ) 
 

Definition at line 100 of file NetMgr.c.

References NetMgr::CSNetMgr, GE_FALSE, geCSNetMgr_Destroy(), geCSNetMgr_StopSession(), geRam_Free, NULL, and NetMgr::UseLocalBuffers.

Referenced by NetMgr_Create(), and NetMgr_Destroy().

00101 {
00102         assert(NMgr);
00103 
00104         if (NMgr->CSNetMgr)
00105         {
00106                 assert(NMgr->UseLocalBuffers == GE_FALSE);
00107                 geCSNetMgr_StopSession(NMgr->CSNetMgr);
00108                 geCSNetMgr_Destroy(&NMgr->CSNetMgr);
00109         }
00110                 
00111         NMgr->CSNetMgr = NULL;
00112 
00113         geRam_Free(NMgr);
00114 }

geCSNetMgr_NetID NetMgr_GetOurID NetMgr NMgr  ) 
 

Definition at line 192 of file NetMgr.c.

References NetMgr::CSNetMgr, geCSNetMgr_GetOurID(), geCSNetMgr_NetID, and NetMgr_IsValid().

Referenced by Host_Create().

00193 {
00194         assert(NetMgr_IsValid(NMgr));
00195 
00196         return geCSNetMgr_GetOurID(NMgr->CSNetMgr);
00197 }

geBoolean NetMgr_IsValid NetMgr NMgr  ) 
 

Definition at line 119 of file NetMgr.c.

References GE_FALSE, GE_TRUE, geBoolean, geErrorLog_AddString, NULL, NetMgr::SelfCheck1, and NetMgr::SelfCheck2.

Referenced by NetMgr_Destroy(), NetMgr_GetOurID(), NetMgr_JoinSession(), NetMgr_ReceiveServerMessage(), NetMgr_SendClientMessage(), NetMgr_SendServerMessage(), and NetMgr_StartSession().

00120 {
00121         if (!NMgr)
00122         {
00123                 geErrorLog_AddString(-1, "NetMgr_IsValid:  NULL NetMgr object.", NULL);
00124                 return GE_FALSE;
00125         }
00126 
00127         if (NMgr->SelfCheck1 != NMgr)
00128         {
00129                 geErrorLog_AddString(-1, "NetMgr_IsValid:  NMgr->SeflfCheck1 != NMgr", NULL);
00130                 return GE_FALSE;
00131         }
00132 
00133         if (NMgr->SelfCheck2 != NMgr)
00134         {
00135                 geErrorLog_AddString(-1, "NetMgr_IsValid:  NMgr->SelfCheck2 != NMgr", NULL);
00136                 return GE_FALSE;
00137         }
00138 
00139         return GE_TRUE;
00140 }

geBoolean NetMgr_JoinSession NetMgr NMgr,
const char *  IPAddress,
const char *  PlayerName
 

Definition at line 160 of file NetMgr.c.

References NetMgr::CSNetMgr, GE_FALSE, GE_TRUE, geBoolean, geCSNetMgr_FindSession(), geCSNetMgr_JoinSession(), geErrorLog_AddString, int32, NetMgr_IsValid(), NULL, and NetMgr::UseLocalBuffers.

Referenced by Host_Create().

00161 {
00162         geCSNetMgr_NetSession   *SessionList;
00163         int32                                   NumSessions;
00164 
00165         assert(NetMgr_IsValid(NMgr));
00166         assert(NMgr->UseLocalBuffers == GE_FALSE);
00167 
00168         if (!geCSNetMgr_FindSession(NMgr->CSNetMgr, IPAddress, &SessionList, &NumSessions))
00169         {
00170                 geErrorLog_AddString(-1, "NetMgr_JoinSession:  geCSNetMgr_JoinSession failed...", NULL);
00171                 return GE_FALSE;
00172         }
00173 
00174         if (!NumSessions)
00175         {
00176                 geErrorLog_AddString(-1, "NetMgr_JoinSession:  Could not find a session at address:", IPAddress);
00177                 return GE_FALSE;
00178         }
00179 
00180         if (!geCSNetMgr_JoinSession(NMgr->CSNetMgr, PlayerName, &SessionList[0]))
00181         {
00182                 geErrorLog_AddString(-1, "NetMgr_JoinSession:  Could not join a session at address:", IPAddress);
00183                 return GE_FALSE;
00184         }
00185 
00186         return GE_TRUE;
00187 }

geBoolean NetMgr_ReceiveClientMessage NetMgr NMgr,
geCSNetMgr_NetMsgType MsgType,
geCSNetMgr_NetID ClientID,
Buffer_Data Buffer
 

Definition at line 279 of file NetMgr.c.

References NetMgr::ClientToServerBuffer, NetMgr::CSNetMgr, Buffer_Data::Data, GE_FALSE, GE_TRUE, geBoolean, geCSNetMgr_NetID, geCSNetMgr_ReceiveFromClient(), NET_MSG_NONE, NET_MSG_USER, NETMGR_SINGLE_PLAYER_NETID, Buffer_Data::Pos, Buffer_Data::Size, and NetMgr::UseLocalBuffers.

Referenced by ReadClientMessages().

00280 {
00281         if (NMgr->UseLocalBuffers)
00282         {
00283                 *ClientID = NETMGR_SINGLE_PLAYER_NETID;
00284                 *MsgType = NET_MSG_USER;
00285                         
00286                 Buffer->Size = NMgr->ClientToServerBuffer.Pos;
00287                 Buffer->Data = NMgr->ClientToServerBuffer.Data;
00288                 NMgr->ClientToServerBuffer.Pos = 0;
00289 
00290                 if (!Buffer->Size)
00291                         *MsgType = NET_MSG_NONE;
00292         }
00293         else
00294         {
00295                 geCSNetMgr_NetID        ToID;
00296 
00297                 //if (!geCSNetMgr_ReceiveAllMessages(NMgr->CSNetMgr, ClientID, &ToID, MsgType, &Buffer->Size, &Buffer->Data))
00298                 //      return GE_FALSE;
00299                 if (!geCSNetMgr_ReceiveFromClient(NMgr->CSNetMgr, MsgType, ClientID, &Buffer->Size, &Buffer->Data))
00300                         return GE_FALSE;
00301         }
00302 
00303         return GE_TRUE;         // Got a message for'em
00304 }

geBoolean NetMgr_ReceiveServerMessage NetMgr NMgr,
geCSNetMgr_NetMsgType Type,
Buffer_Data Buffer
 

Definition at line 249 of file NetMgr.c.

References NetMgr::CSNetMgr, Buffer_Data::Data, GE_FALSE, GE_TRUE, geBoolean, geCSNetMgr_ReceiveFromServer(), NET_MSG_NONE, NET_MSG_USER, NetMgr_IsValid(), Buffer_Data::Pos, NetMgr::ServerToClientBuffer, Buffer_Data::Size, and NetMgr::UseLocalBuffers.

Referenced by Client_ReadServerMessages().

00250 {
00251         assert(NetMgr_IsValid(NMgr));
00252 
00253         if (NMgr->UseLocalBuffers)
00254         {
00255                 *Type = NET_MSG_USER;
00256 
00257                 // Use the short-curcuit  buffers for local messages 
00258                 Buffer->Size = NMgr->ServerToClientBuffer.Pos;
00259                 Buffer->Data = NMgr->ServerToClientBuffer.Data;
00260                 
00261                 NMgr->ServerToClientBuffer.Pos = 0;
00262 
00263                 if (!Buffer->Size)
00264                         *Type = NET_MSG_NONE;
00265         }
00266         else
00267         {
00268                 // Use real message system if in real network mode
00269                 if (!geCSNetMgr_ReceiveFromServer(NMgr->CSNetMgr, Type, &Buffer->Size, &Buffer->Data))
00270                         return GE_FALSE;
00271         }
00272 
00273         return GE_TRUE;
00274 }

void NetMgr_ResetClientBuffer NetMgr NMgr  ) 
 

Definition at line 309 of file NetMgr.c.

References NetMgr::ClientToServerBuffer, and Buffer_Data::Pos.

Referenced by Host_Frame().

00310 {
00311         NMgr->ClientToServerBuffer.Pos = 0;
00312 }

void NetMgr_ResetServerBuffer NetMgr NMgr  ) 
 

Definition at line 317 of file NetMgr.c.

References Buffer_Data::Pos, and NetMgr::ServerToClientBuffer.

Referenced by Host_Frame().

00318 {
00319         NMgr->ServerToClientBuffer.Pos = 0;
00320 }

geBoolean NetMgr_SendClientMessage NetMgr NMgr,
geCSNetMgr_NetID  NetID,
Buffer_Data Buffer,
geBoolean  G
 

Definition at line 225 of file NetMgr.c.

References Buffer_FillBuffer(), NetMgr::CSNetMgr, Buffer_Data::Data, G, GE_FALSE, GE_TRUE, geBoolean, geCSNetMgr_SendToClient(), NetMgr_IsValid(), NETMGR_SPECIAL_BOT_NETID, Buffer_Data::Pos, NetMgr::ServerToClientBuffer, and NetMgr::UseLocalBuffers.

Referenced by SendAllClientsMessage(), SendClientPlayerData(), SendPlayersToClients(), Server_ChangeClientState(), Server_ClientConnect(), Server_ConsoleHeaderPrintf(), Server_PlaySound(), Server_SendClientCurrentWorldData(), Server_SendClientStartupData(), Server_SetClientHealth(), Server_SetClientInventory(), Server_SetClientWeapon(), Server_SetViewPlayer(), and Server_ValidateClient().

00226 {
00227         assert(NetMgr_IsValid(NMgr));
00228     
00229         if (NetID == NETMGR_SPECIAL_BOT_NETID)
00230                 return GE_TRUE;
00231 
00232         if (NMgr->UseLocalBuffers)
00233         {
00234                 if (!Buffer_FillBuffer(&NMgr->ServerToClientBuffer, Buffer))
00235                         return GE_FALSE;
00236         }
00237         else
00238         {
00239                 if (!geCSNetMgr_SendToClient(NMgr->CSNetMgr, NetID, G, Buffer->Data, Buffer->Pos))
00240                         return GE_FALSE;
00241         }
00242 
00243         return GE_TRUE;
00244 }

geBoolean NetMgr_SendServerMessage NetMgr NMgr,
Buffer_Data Buffer,
geBoolean  G
 

Definition at line 203 of file NetMgr.c.

References Buffer_FillBuffer(), NetMgr::ClientToServerBuffer, NetMgr::CSNetMgr, Buffer_Data::Data, G, GE_FALSE, GE_TRUE, geBoolean, geCSNetMgr_SendToServer(), NetMgr_IsValid(), Buffer_Data::Pos, and NetMgr::UseLocalBuffers.

Referenced by Client_ChangeNetState(), and Client_SendMove().

00204 {
00205         assert(NetMgr_IsValid(NMgr));
00206 
00207         if (NMgr->UseLocalBuffers)
00208         {
00209                 if (!Buffer_FillBuffer(&NMgr->ClientToServerBuffer, Buffer))
00210                         return GE_FALSE;
00211         }
00212         else
00213         {
00214                 if (!geCSNetMgr_SendToServer(NMgr->CSNetMgr, G, Buffer->Data, Buffer->Pos))
00215                         return GE_FALSE;
00216         }
00217 
00218         return GE_TRUE;
00219 }

geBoolean NetMgr_StartSession NetMgr NMgr,
const char *  SessionName,
const char *  PlayerName
 

Definition at line 145 of file NetMgr.c.

References NetMgr::CSNetMgr, GE_FALSE, GE_TRUE, geBoolean, geCSNetMgr_StartSession(), NetMgr_IsValid(), and NetMgr::UseLocalBuffers.

Referenced by Host_Create().

00146 {
00147         assert(NetMgr_IsValid(NMgr));
00148 
00149         assert(NMgr->UseLocalBuffers == GE_FALSE);
00150 
00151         if (!geCSNetMgr_StartSession(NMgr->CSNetMgr, SessionName, PlayerName))
00152                 return GE_FALSE;
00153 
00154         return GE_TRUE;
00155 }


Generated on Tue Sep 30 12:37:48 2003 for GTestAndEngine by doxygen 1.3.2