centralserver.h File Reference

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

Go to the source code of this file.

Defines

#define REQUEST_TYPE_LOGIN   "login"
 Ask the central server to login a client.
#define REQUEST_TYPE_LOGOUT   "logout"
 Notify the the central server of a client logout.
#define REQUEST_TYPE_COUNTERS   "counters"
 Update the central server's traffic counters.
#define GATEWAY_MESSAGE_DENIED   "denied"
 Sent when the user's token is denied by the central server.
#define GATEWAY_MESSAGE_ACTIVATE_ACCOUNT   "activate"
 Sent when the user's token is accepted, but user is on probation.
#define GATEWAY_MESSAGE_ACCOUNT_VALIDATION_FAILED   "failed_validation"
 Sent when the user's token is denied by the central server because the probation period is over.
#define GATEWAY_MESSAGE_ACCOUNT_LOGGED_OUT   "logged-out"
 Sent after the user performed a manual log-out on the gateway.

Functions

t_authcode auth_server_request (t_authresponse *authresponse, char *request_type, char *ip, char *mac, 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.


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.h.


Define Documentation

#define GATEWAY_MESSAGE_ACCOUNT_LOGGED_OUT   "logged-out"

Sent after the user performed a manual log-out on the gateway.

Definition at line 46 of file centralserver.h.

Referenced by http_callback_auth().

#define GATEWAY_MESSAGE_ACCOUNT_VALIDATION_FAILED   "failed_validation"

Sent when the user's token is denied by the central server because the probation period is over.

Definition at line 44 of file centralserver.h.

Referenced by authenticate_client().

#define GATEWAY_MESSAGE_ACTIVATE_ACCOUNT   "activate"

Sent when the user's token is accepted, but user is on probation.

Definition at line 42 of file centralserver.h.

Referenced by authenticate_client().

#define GATEWAY_MESSAGE_DENIED   "denied"

Sent when the user's token is denied by the central server.

Definition at line 40 of file centralserver.h.

Referenced by authenticate_client().

#define REQUEST_TYPE_COUNTERS   "counters"

Update the central server's traffic counters.

Definition at line 37 of file centralserver.h.

Referenced by fw_sync_with_authserver().

#define REQUEST_TYPE_LOGIN   "login"

Ask the central server to login a client.

Definition at line 33 of file centralserver.h.

Referenced by authenticate_client().

#define REQUEST_TYPE_LOGOUT   "logout"

Notify the the central server of a client logout.

Definition at line 35 of file centralserver.h.

Referenced by fw_sync_with_authserver(), and http_callback_auth().


Function Documentation

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 201 of file centralserver.c.

References _connect_auth_server(), s_config::auth_servers, t_auth_serv::authserv_hostname, t_auth_serv::authserv_http_port, config, config_get_config(), debug, t_auth_serv::last_ip, mark_auth_server_bad(), mark_offline(), t_auth_serv::next, safe_strdup(), and wd_gethostbyname().

t_authcode auth_server_request ( t_authresponse authresponse,
char *  request_type,
char *  ip,
char *  mac,
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, connect_auth_server(), debug, get_auth_server(), and MAX_BUF.

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 179 of file centralserver.c.

References _connect_auth_server(), debug, LOCK_CONFIG, mark_auth_offline(), mark_auth_online(), and UNLOCK_CONFIG.


Generated on Sun Apr 13 21:55:00 2008 for WifiDog by  doxygen 1.5.3