$treeview $search $mathjax
Stratagus
2.2.6
$projectbrief
|
$projectbrief
|
$searchbox |
_________ __ __ / _____// |_____________ _/ |______ ____ __ __ ______ \_____ \\ __\_ __ \__ \\ __\__ \ / ___\| | \/ ___/ / \| | | | \// __ \| | / __ \_/ /_/ > | /\___ \ /_______ /|__| |__| (____ /__| (____ /\___ /|____//____ > \/ \/ \//_____/ \/ ______________________ ______________________ T H E W A R B E G I N S Stratagus - A free fantasy real time strategy game engine
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
#include <errno.h>
#include "stratagus.h"
#include "netdriver.h"
#include "net_lowlevel.h"
netdriver.cpp - Session mangement (SDL_net Socket Implementation). | |
#define | LINK(first, item, last, count) |
#define | UNLINK(first, item, last, count) |
static Socket | MasterSocket |
SessionPool * | Pool |
external reference to session tracking. | |
ServerStruct | Server |
void | Send (Session *session, const char *msg) |
int | ServerInit (int port) |
void | ServerQuit (void) |
static int | IdleSeconds (Session *session) |
static int | KillSession (Session *session) |
static void | AcceptConnections (void) |
static void | KickIdlers (void) |
static int | ReadData (void) |
int | UpdateSessions (void) |
#define LINK | ( | first, | |||
item, | |||||
last, | |||||
count | ) |
Value:
{ \ if (!first) \ first = item; \ if (!last) { \ last = item; \ } else { \ item->Next = last->Next; \ last->Next = item; \ item->Prev = last; \ last = item; \ if (!item->Prev->Next) \ item->Prev->Next = item;\ } \ ++count; \ }
Adds an item to a linked list.
#define UNLINK | ( | first, | |||
item, | |||||
last, | |||||
count | ) |
Value:
{ \ if (item->Prev) \ item->Prev->Next = item->Next;\ if (item->Next) \ item->Next->Prev = item->Prev;\ if (item == last) \ last = item->Prev; \ if (item == first) \ first = item->Next; \ --count; \ }
Removes an item from the linked list.
static void AcceptConnections | ( | void | ) | [static] |
Accept new connections
static int IdleSeconds | ( | Session * | session | ) | [static] |
Returns time (in seconds) that a session has been idle.
session | This is the session we are checking. |
static void KickIdlers | ( | void | ) | [static] |
Kick idlers
static int KillSession | ( | Session * | session | ) | [static] |
Destroys and cleans up session data.
session | Reference to the session to be killed. |
static int ReadData | ( | void | ) | [static] |
Read data
void Send | ( | Session * | session, | |
const char * | msg | |||
) |
int ServerInit | ( | int | port | ) |
Initialize the server
port | Defines the port to which the server will bind. |
void ServerQuit | ( | void | ) |
ServerQuit: Releases the server socket.
int UpdateSessions | ( | void | ) |
Accepts new connections, receives data, manages buffers,
Socket MasterSocket [static] |
external reference to session tracking.