centralserver.c File Reference

Functions to talk to the central server (auth/send stats/get rules/etc...). More...

Go to the source code of this file.

Functions

t_authcode auth_server_request (t_authresponse *authresponse, const char *request_type, const char *ip, const char *mac, const char *token, unsigned long long int incoming, unsigned long long int outgoing)
 Initiates a transaction with the auth server.
int connect_auth_server ()
 Tries really hard to connect to an auth server. Returns a connected file descriptor or -1 on error.
int _connect_auth_server (int level)
 Helper function called by connect_auth_server() to do the actual work including recursion - DO NOT CALL DIRECTLY.

Variables

pthread_mutex_t config_mutex


Detailed Description

Functions to talk to the central server (auth/send stats/get rules/etc...).

Author:
Copyright (C) 2004 Philippe April <papril777@yahoo.com>

Definition in file centralserver.c.


Function Documentation

int _connect_auth_server ( int  level  ) 

t_authcode auth_server_request ( t_authresponse authresponse,
const char *  request_type,
const char *  ip,
const char *  mac,
const char *  token,
unsigned long long int  incoming,
unsigned long long int  outgoing 
)

Initiates a transaction with the auth server.

Initiates a transaction with the auth server, either to authenticate or to update the traffic counters at the server

Parameters:
authresponse Returns the information given by the central server
request_type Use the REQUEST_TYPE_* defines in centralserver.h
ip IP adress of the client this request is related to
mac MAC adress of the client this request is related to
token Authentification token of the client
incoming Current counter of the client's total incoming traffic, in bytes
outgoing Current counter of the client's total outgoing traffic, in bytes

TODO: XXX change the PHP so we can harmonize stage as request_type everywhere.

We don't have to use FD_ISSET() because there was only one fd.

Definition at line 65 of file centralserver.c.

References AUTH_ERROR, _t_authresponse::authcode, config_get_config(), connect_auth_server(), debug, get_auth_server(), and MAX_BUF.

Referenced by authenticate_client(), fw_sync_with_authserver(), and http_callback_auth().

int connect_auth_server (  ) 

Tries really hard to connect to an auth server. Returns a connected file descriptor or -1 on error.

Definition at line 185 of file centralserver.c.

References _connect_auth_server(), and debug.

Referenced by auth_server_request(), and ping().


Variable Documentation

pthread_mutex_t config_mutex

Mutex for the configuration file, used by the auth_servers related functions.

Definition at line 56 of file conf.c.


Generated on Fri Sep 25 15:28:43 2009 for WifiDog by  doxygen 1.5.5