Atrinik Server  4.0
Functions | Variables
updates.c File Reference
#include <global.h>
#include <toolkit/packet.h>
#include <toolkit/string.h>
#include <toolkit/path.h>
#include <zlib.h>

Go to the source code of this file.

Functions

static void updates_file_new (const char *filename, struct stat *sb)
 
static int updates_file_compare (const void *a, const void *b)
 
static update_file_structupdates_file_find (const char *filename)
 
static void updates_traverse (const char *path)
 
void updates_init (void)
 
void socket_command_request_update (socket_struct *ns, player *pl, uint8_t *data, size_t len, size_t pos)
 

Variables

static update_file_structupdate_files
 
static size_t update_files_num
 

Detailed Description

Handles file updates that the client may request.

Definition in file updates.c.

Function Documentation

static int updates_file_compare ( const void *  a,
const void *  b 
)
static

Compare two entries of update_files.

Parameters
aFirst entry to compare.
bSecond entry to compare.
Returns
Return value of strcmp().

Definition at line 108 of file updates.c.

static update_file_struct* updates_file_find ( const char *  filename)
static

Find an entry in update_files based on its filename.

Parameters
filenameWhat to look for.
Returns
The found entry, NULL if not found.

Definition at line 120 of file updates.c.

static void updates_file_new ( const char *  filename,
struct stat *  sb 
)
static

Add a new file to update_files.

Parameters
filenamePath to the file to add.
sbStat buffer.

Definition at line 51 of file updates.c.

void updates_init ( void  )

Initialize all the file updates, traversing the updates directory, creating the srv updates file, etc.

Definition at line 170 of file updates.c.

static void updates_traverse ( const char *  path)
static

Recursively traverse through the updates directory.

Parameters
pathPath we're traversing through.

Definition at line 133 of file updates.c.

Variable Documentation

update_file_struct* update_files
static

All the files the client can request an update for, sorted using Quicksort..

Definition at line 40 of file updates.c.

size_t update_files_num
static

Number of update_files.

Definition at line 42 of file updates.c.