Atrinik Client  4.0
Functions | Variables
server_files.c File Reference
#include <global.h>
#include <toolkit/string.h>
#include <toolkit/path.h>
#include <toolkit/curl.h>

Go to the source code of this file.


void server_files_init (void)
void server_files_deinit (void)
void server_files_init_all (void)
server_files_structserver_files_create (const char *name)
server_files_structserver_files_find (const char *name)
void server_files_load (int post_load)
void server_files_listing_retrieve (void)
int server_files_listing_processed (void)
static int server_file_process (server_files_struct *tmp)
int server_files_processed (void)
static char * server_file_path (server_files_struct *tmp, char *buf, size_t buf_size)
FILE * server_file_open (server_files_struct *tmp)
FILE * server_file_open_name (const char *name)
bool server_file_save (server_files_struct *tmp, unsigned char *data, size_t len)


static server_files_structserver_files
static curl_request_t * listing_request = NULL

Detailed Description

Manages server file updates.

Alex Tokar

Definition in file server_files.c.

Function Documentation

FILE* server_file_open ( server_files_struct tmp)

Open a server file for reading.

tmpServer file.
The file pointer, or NULL on failure of opening the file.

Definition at line 417 of file server_files.c.

FILE* server_file_open_name ( const char *  name)

Wrapper for server_file_open(), allows opening a server file by its name.

nameName of the server file.
Opened file pointer, NULL on failure.

Definition at line 437 of file server_files.c.

static char* server_file_path ( server_files_struct tmp,
char *  buf,
size_t  buf_size 

Construct a path to the specified server file.

tmpServer file.
[out]bufWill contain the constructed path.
buf_sizeSize of 'buf'.

Definition at line 402 of file server_files.c.

static int server_file_process ( server_files_struct tmp)

Process a single server file.

tmpWhat to process.
1 if the file is being processed, 0 otherwise.

Definition at line 299 of file server_files.c.

bool server_file_save ( server_files_struct tmp,
unsigned char *  data,
size_t  len 

We have received the server file we asked for, so save it to disk.

tmpServer file.
dataThe data to save.
lenLength of 'data'.
True on success, false on failure.

Definition at line 455 of file server_files.c.

server_files_struct* server_files_create ( const char *  name)

Create a server file with the specified name.

The server file will be added to a hash table automatically.

nameName of the server file.
Created server file.

Definition at line 116 of file server_files.c.

void server_files_deinit ( void  )

De-initialize the server files API.

Definition at line 81 of file server_files.c.

server_files_struct* server_files_find ( const char *  name)

Find the specified server file in the hash table.

nameName of the server file.
Server file if found, NULL otherwise.

Definition at line 136 of file server_files.c.

void server_files_init ( void  )

Initialize the server files API.

Definition at line 47 of file server_files.c.

void server_files_init_all ( void  )

Init all of the available server files.

Definition at line 95 of file server_files.c.

int server_files_listing_processed ( void  )

Check if the listing file has been downloaded and processed.

1 if it has been processed, 0 otherwise.

Definition at line 228 of file server_files.c.

void server_files_listing_retrieve ( void  )

Begin downloading the listing file.

Definition at line 207 of file server_files.c.

void server_files_load ( int  post_load)

Load the server files. If they haven't changed since last load, no loading will be done.

post_loadUnless 1, (re-)parsing the server files will not be done.

Definition at line 151 of file server_files.c.

int server_files_processed ( void  )

Check if all of the server files have been processed.

1 if they all have been processed, 0 otherwise.

Definition at line 377 of file server_files.c.

Variable Documentation

curl_request_t* listing_request = NULL

Listing file request.

Definition at line 41 of file server_files.c.

server_files_struct* server_files

The server files.

Definition at line 38 of file server_files.c.