Atrinik Server 2.5
Functions | Variables
socket/init.c File Reference
#include <global.h>
#include "zlib.h"

Go to the source code of this file.

Functions

void init_connection (socket_struct *ns, const char *from_ip)
void init_ericserver ()
void free_all_newserver ()
void free_newsocket (socket_struct *ns)
static void load_srv_file (char *fname, int id)
static void create_client_settings ()
static void create_server_settings ()
static void create_server_animations ()
void init_srv_files ()
void free_srv_files ()
void send_srv_file (socket_struct *ns, int id)

Variables

_srv_client_files SrvClientFiles [SRV_CLIENT_FILES]
Socket_Info socket_info
socket_structinit_sockets

Detailed Description

Socket initialization related code.

Definition in file init.c.


Function Documentation

static void create_client_settings ( ) [static]

Get the lib/settings default file and create the data/client_settings file from it.

Definition at line 394 of file init.c.

static void create_server_animations ( ) [static]

Initialize animations file for the client.

Definition at line 480 of file init.c.

static void create_server_settings ( ) [static]

Get the lib/server_settings default file and create the data/server_settings file from it.

Definition at line 445 of file init.c.

void free_all_newserver ( )

Frees all the memory that ericserver allocates.

Definition at line 273 of file init.c.

void free_newsocket ( socket_struct ns)

Basically, all we need to do here is free all data structures that might be associated with the socket.

It is up to the called to update the list.

Parameters:
nsThe socket.

Definition at line 287 of file init.c.

void free_srv_files ( )

Free all server files previously initialized by init_srv_files().

Definition at line 579 of file init.c.

void init_connection ( socket_struct ns,
const char *  from_ip 
)

Initializes a connection - really, it just sets up the data structure, socket setup is handled elsewhere.

Sends server version to the client.

Parameters:
nsClient's socket.
fromWhere the connection is coming from.
Todo:
Remove version sending legacy support for older clients at some point.

Definition at line 50 of file init.c.

void init_ericserver ( )

This sets up the socket and reads all the image information into memory.

Definition at line 151 of file init.c.

void init_srv_files ( )

Load all the server files we can send to client.

client_bmaps is generated from the server at startup out of the Atrinik png file.

Definition at line 529 of file init.c.

static void load_srv_file ( char *  fname,
int  id 
) [static]

Load server file.

Parameters:
fnameFilename of the server file.
idID of the server file.
cmdThe data command.

Definition at line 331 of file init.c.

void send_srv_file ( socket_struct ns,
int  id 
)

A connecting client has requested a server file.

Note that we don't know anything about the player at this point - we got an open socket, an IP, a matching version, and an usable setup string from the client.

Parameters:
nsThe client's socket.
idID of the server file.

Definition at line 599 of file init.c.


Variable Documentation

Established connections for clients not yet playing.

Definition at line 39 of file init.c.

Socket information.

Definition at line 37 of file init.c.

_srv_client_files SrvClientFiles[SRV_CLIENT_FILES]

All the server/client files.

Definition at line 34 of file init.c.