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 |
Definition in file centralserver.c.
int _connect_auth_server | ( | int | level | ) |
Helper function called by connect_auth_server() to do the actual work including recursion - DO NOT CALL DIRECTLY.
Definition at line 207 of file centralserver.c.
References _connect_auth_server(), s_config::auth_servers, _auth_serv_t::authserv_hostname, _auth_serv_t::authserv_http_port, config_get_config(), debug, _auth_serv_t::last_ip, mark_auth_server_bad(), and _auth_serv_t::next.
Referenced by _connect_auth_server(), and connect_auth_server().
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
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().
pthread_mutex_t config_mutex |