socket/init.c File Reference

#include <global.h>
#include <sys/types.h>
#include <sys/time.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <netdb.h>
#include <sys/stat.h>
#include <stdio.h>
#include <newserver.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 ()
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 416 of file init.c.

void free_all_newserver (  ) 

Frees all the memory that ericserver allocates.

Definition at line 295 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:
ns The socket.

Definition at line 309 of file init.c.

void free_srv_files (  ) 

Free all server files previously initialized by init_srv_files().

Definition at line 504 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:
ns Client's socket.
from Where the connection is coming from.
Todo:
Remove version sending legacy support for older clients at some point.

Definition at line 67 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 469 of file init.c.

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

Load server file.

Parameters:
fname Filename of the server file.
id ID of the server file.
cmd The data command.

Definition at line 353 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:
ns The client's socket.
id ID of the server file.

Definition at line 524 of file init.c.


Variable Documentation

Established connections for clients not yet playing.

Definition at line 56 of file init.c.

Socket information.

Definition at line 54 of file init.c.

_srv_client_files SrvClientFiles[SRV_CLIENT_FILES]

All the server/client files.

Definition at line 51 of file init.c.


Generated by  doxygen 1.6.2