#include <Windows.h>#include "Genesis.h"#include "Buffer.h"Go to the source code of this file.
|
|
Definition at line 47 of file NetMgr.h. Referenced by Client_ReadServerMessages(), NetMgr_Create(), and ReadServerMessages(). |
|
|
|
Definition at line 42 of file NetMgr.h. Referenced by WinMain(). |
|
|
|
|
|
|
Definition at line 76 of file NetMgr.h. Referenced by ReadServerMessages(), and Server_SendClientCurrentWorldData(). |
|
|
Definition at line 78 of file NetMgr.h. Referenced by ReadServerMessages(), and Server_SendClientCurrentWorldData(). |
|
|
Definition at line 82 of file NetMgr.h. Referenced by ReadServerMessages(). |
|
|
Definition at line 86 of file NetMgr.h. Referenced by FillBufferWithClientInfo(), ReadServerMessages(), Server_ClientDisconnect(), and Server_ClientDisconnectByHandle(). |
|
|
Definition at line 67 of file NetMgr.h. Referenced by Client_ChangeNetState(), and ParseClientMessage(). |
|
|
Definition at line 89 of file NetMgr.h. Referenced by FillBufferWithClientInfo(), ReadServerMessages(), and Server_SetClientHealth(). |
|
|
Definition at line 85 of file NetMgr.h. Referenced by ReadServerMessages(), and Server_SendClientStartupData(). |
|
|
Definition at line 90 of file NetMgr.h. Referenced by ReadServerMessages(), and Server_SetClientInventory(). |
|
|
Definition at line 66 of file NetMgr.h. Referenced by Client_SendMove(), and ParseClientMessage(). |
|
|
Definition at line 87 of file NetMgr.h. Referenced by FillBufferWithClientInfo(), and ReadServerMessages(). |
|
|
Definition at line 94 of file NetMgr.h. Referenced by ReadServerMessages(), Server_SendClientCurrentWorldData(), and Server_ValidateClient(). |
|
|
Definition at line 88 of file NetMgr.h. Referenced by FillBufferWithClientInfo(), ReadServerMessages(), and Server_SetClientScore(). |
|
|
Definition at line 91 of file NetMgr.h. Referenced by ReadServerMessages(), and Server_SetClientWeapon(). |
|
|
|
|
|
Definition at line 93 of file NetMgr.h. Referenced by ReadServerMessages(), and Server_ConsoleHeaderPrintf(). |
|
|
|
|
|
Definition at line 77 of file NetMgr.h. Referenced by ReadServerMessages(), and Server_SendClientCurrentWorldData(). |
|
|
Definition at line 95 of file NetMgr.h. Referenced by ReadServerMessages(), and Server_ChangeClientState(). |
|
|
Definition at line 73 of file NetMgr.h. Referenced by ReadServerMessages(), and SendClientPlayerData(). |
|
|
Definition at line 83 of file NetMgr.h. Referenced by ReadServerMessages(), and Server_PlaySound(). |
|
|
Definition at line 72 of file NetMgr.h. Referenced by ReadServerMessages(), and SendPlayersToClients(). |
|
|
Definition at line 81 of file NetMgr.h. Referenced by ReadServerMessages(), and Server_SendClientCurrentWorldData(). |
|
|
Definition at line 97 of file NetMgr.h. Referenced by ReadServerMessages(), and Server_Destroy(). |
|
|
Definition at line 80 of file NetMgr.h. Referenced by ReadServerMessages(), and Server_SendClientCurrentWorldData(). |
|
|
Definition at line 92 of file NetMgr.h. Referenced by ReadServerMessages(), and Server_SpawnFx(). |
|
|
Definition at line 79 of file NetMgr.h. Referenced by ReadServerMessages(), and Server_SendClientCurrentWorldData(). |
|
|
Definition at line 71 of file NetMgr.h. Referenced by ReadServerMessages(), SendClientPlayerData(), and SendPlayersToClients(). |
|
|
Definition at line 70 of file NetMgr.h. Referenced by ReadServerMessages(), and Server_ClientConnect(). |
|
|
Definition at line 74 of file NetMgr.h. Referenced by ReadServerMessages(), and Server_SetViewPlayer(). |
|
|
Definition at line 106 of file NetMgr.h. Referenced by Client_ParsePlayerData(), FillBufferWithPlayerData(), and GetPlayerSendFlags(). |
|
|
Definition at line 111 of file NetMgr.h. Referenced by Client_ParsePlayerData(), FillBufferWithPlayerData(), and GetPlayerSendFlags(). |
|
|
Definition at line 107 of file NetMgr.h. Referenced by Client_ParsePlayerData(), FillBufferWithPlayerData(), and GetPlayerSendFlags(). |
|
|
Definition at line 104 of file NetMgr.h. Referenced by Client_ParsePlayerData(), FillBufferWithPlayerData(), and GetPlayerSendFlags(). |
|
|
Definition at line 113 of file NetMgr.h. Referenced by Client_ParsePlayerData(), FillBufferWithPlayerData(), and GetPlayerSendFlags(). |
|
|
Definition at line 103 of file NetMgr.h. Referenced by Client_ParsePlayerData(), FillBufferWithPlayerData(), and GetPlayerSendFlags(). |
|
|
Definition at line 105 of file NetMgr.h. Referenced by Client_ParsePlayerData(), FillBufferWithPlayerData(), and GetPlayerSendFlags(). |
|
|
Definition at line 108 of file NetMgr.h. Referenced by Client_ParsePlayerData(), FillBufferWithPlayerData(), and GetPlayerSendFlags(). |
|
|
Definition at line 100 of file NetMgr.h. Referenced by Client_ParsePlayerData(), FillBufferWithPlayerData(), and GetPlayerSendFlags(). |
|
|
Definition at line 110 of file NetMgr.h. Referenced by Client_ParsePlayerData(), FillBufferWithPlayerData(), and GetPlayerSendFlags(). |
|
|
Definition at line 112 of file NetMgr.h. Referenced by Client_ParsePlayerData(), FillBufferWithPlayerData(), and GetPlayerSendFlags(). |
|
|
Definition at line 109 of file NetMgr.h. Referenced by Client_ParsePlayerData(), FillBufferWithPlayerData(), and GetPlayerSendFlags(). |
|
|
Definition at line 101 of file NetMgr.h. Referenced by Client_ParsePlayerData(), FillBufferWithPlayerData(), and GetPlayerSendFlags(). |
|
|
Definition at line 102 of file NetMgr.h. Referenced by Client_ParsePlayerData(), FillBufferWithPlayerData(), and GetPlayerSendFlags(). |
|
|
Definition at line 44 of file NetMgr.h. Referenced by Host_Create(), and NetMgr_ReceiveClientMessage(). |
|
|
Definition at line 45 of file NetMgr.h. Referenced by NetMgr_SendClientMessage(), Server_BotConnect(), and Server_IsClientBot(). |
|
|
Definition at line 34 of file NetMgr.h. Referenced by Host_Create(), ReadServerMessages(), and Server_ClientConnect(). |
|
|
Definition at line 35 of file NetMgr.h. Referenced by Host_Create(), ReadServerMessages(), and Server_ClientConnect(). |
|
|
|
|
|
Definition at line 55 of file NetMgr.h. Referenced by Server_ClientConnect(). |
|
|
Definition at line 54 of file NetMgr.h. Referenced by Client_Create(). |
|
|
Definition at line 58 of file NetMgr.h. Referenced by Client_Frame(), Client_RenderFrame(), ReadServerMessages(), SendPlayersToClients(), and Server_SetupClientWithCurrentWorld(). |
|
|
Definition at line 57 of file NetMgr.h. Referenced by ReadServerMessages(), and Server_SetupClientWithCurrentWorld(). |
|
|
|
|
|
Definition at line 52 of file NetMgr.h. Referenced by ParseClientMessage(), and ReadServerMessages(). |
|
|
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 }
|
|
|
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 }
|
|
|
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 }
|
|
|
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 }
|
|
|
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 }
|
|
||||||||||||||||
|
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 }
|
|
||||||||||||||||||||
|
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 }
|
|
||||||||||||||||
|
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 }
|
|
|
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 }
|
|
|
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 }
|
|
||||||||||||||||||||
|
||||||||||||||||
|
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 }
|
|
||||||||||||||||
|
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 }
|
1.3.2