Main Page   Alphabetical List   Data Structures   File List   Data Fields   Globals  

mysql_interface.h File Reference

#include "mysql_header.h"
#include "tables.h"
#include "server_config.h"
#include "packets_data.h"

Go to the source code of this file.

Defines

#define MYSQL_INTERFACE_REQUEST_SKIPED   -1
 Return value for the functions:
  • load_abonnes
  • load_vlan
  • load_abonne_ip
  • load_options
  • load_ip_lease
  • load_pool
  • try_reserve_ip_from_pool
  • try_find_and_reserve_ip_from_pool
  • release_ip_from_pool
  • load_context
  • find_ip_in_vlan_pool
  • get_ip_from_pool
The SQL request was skiped because the reconnection delay did not expire.


#define MYSQL_INTERFACE_CONNECTION_LOST   -2
 Return value for the functions:
  • load_abonnes
  • load_vlan
  • load_abonne_ip
  • load_options
  • load_ip_lease
  • load_pool
  • try_reserve_ip_from_pool
  • try_find_and_reserve_ip_from_pool
  • release_ip_from_pool
  • load_context
  • find_ip_in_vlan_pool
  • get_ip_from_pool
Connection with the MySql server was lost.


#define MYSQL_INTERFACE_RECONNECTION_FAILED   -3
 Return value for the functions:
  • load_abonnes
  • load_vlan
  • load_abonne_ip
  • load_options
  • load_ip_lease
  • load_pool
  • try_reserve_ip_from_pool
  • try_find_and_reserve_ip_from_pool
  • release_ip_from_pool
  • load_context
  • find_ip_in_vlan_pool
  • get_ip_from_pool
Could not reconnect to the MySql server.


#define MYSQL_INTERFACE_SQL_PROBLEM   -4
 Return value for the functions:
  • load_abonnes
  • load_vlan
  • load_abonne_ip
  • load_options
  • load_ip_lease
  • load_pool
  • try_reserve_ip_from_pool
  • try_find_and_reserve_ip_from_pool
  • release_ip_from_pool
  • load_context
  • find_ip_in_vlan_pool
  • get_ip_from_pool
A SQL error occured.


#define MYSQL_INTERFACE_UNEXPECTED_ERROR   -5
 Return value for the functions:
  • load_abonnes
  • load_vlan
  • load_abonne_ip
  • load_options
  • load_ip_lease
  • load_pool
  • try_reserve_ip_from_pool
  • try_find_and_reserve_ip_from_pool
  • release_ip_from_pool
  • load_context
  • find_ip_in_vlan_pool
  • get_ip_from_pool
An unexpected error occured.


#define MYSQL_INTERFACE_NOT_FOUND   -6
 Return value for the functions:
  • load_abonnes
  • load_vlan
  • load_abonne_ip
  • load_options
  • load_ip_lease
  • load_pool
  • load_context
Could not found the requested data in the database (no row matched the WHERE statement).


#define MYSQL_INTERFACE_MORE_THAN_ONE   -7
 Return value for the functions:
  • load_abonnes
  • load_vlan
  • load_abonne_ip
  • load_ip_lease
  • load_pool
  • load_context
  • find_ip_in_vlan_pool
  • get_ip_from_pool
Find more than one data in the database (several rows row matched the WHERE statement).
More...


#define MYSQL_INTERFACE_TOO_MANY_ITEMS   -8
 Return value for the functions:
  • load_options
  • load_context
Find more options than the maximum allowed.
More...


#define MYSQL_INTERFACE_NO_TIMESTAMP   -9
 Return value for the all functions that need to get the UNIX timestamp from the MySql server.
  • load_pool
  • try_reserve_ip_from_pool
  • try_find_and_reserve_ip_from_pool
  • release_ip_from_pool
  • find_ip_in_vlan_pool
  • get_ip_from_pool
.


#define MYSQL_INTERFACE_NO_LEASE_ID   -10
 Return value for the the functions:
  • find_ip_in_vlan_pool
  • get_ip_from_pool
Could not find any lease ID associated with the given vlan_id.


#define MYSQL_INTERFACE_NO_IP_FOUND   -11
 Return value for the the functions:
  • find_ip_in_vlan_pool
Could not find any lease IP address associated with the given vlan_id and abonnes_id in the pool.


#define MYSQL_INTERFACE_MAC_ADDRESS_FOUND   -12
 Return value for the the functions:
Found a MAC address in table 'LOGISTIC_RADIUS' while deleting it.



Functions

int mydns_init (struct smysql *mysql_info)
 Initialize the MyDns service. More...

void clear_tables (struct mysql_tables *mysql_tables)
 Initialize the table structure. More...

int get_ip_from_pool (struct smysql *mysql_info, struct mysql_tables *mysql_tables, struct global_config *config, unsigned int timeout, int reserve_ip)
 Try to reserve an IP address in the IP pool. More...

int load_context (struct smysql *mysql_info, struct smysql *mysql_info_write, struct mysql_tables *mysql_tables, struct global_config *config)
 Load the entire context associated with a user. More...

int load_abonne_ip (struct smysql *mysql_info, struct mysql_tables *mysql_tables, struct global_config *config)
 Load the content of table 'abonne_ip'. More...

int load_options (struct smysql *mysql_info, struct mysql_tables *mysql_tables, struct global_config *config)
 Load the content of table 'options'. More...

int find_ip_in_vlan_pool (struct smysql *mysql_info, struct mysql_tables *mysql_tables, struct global_config *config)
 Lookup the IP pool in order to find out if a guven user has an IP address. More...

int release_ip_from_pool (struct smysql *mysql_info, struct mysql_tables *mysql_tables, struct global_config *config)
 Release IP from pool. More...

int send_to_radonline (struct smysql *mysql_info, struct mysql_tables *mysql_tables, char *ip, int action, struct global_config *config)
 Send a ticket (START or STOP) into the Radonline database. More...

int send_to_mydns (struct smysql *mysql_info, struct mysql_tables *mysql_tables, char *ip, int action, struct global_config *config)
 Send a ticket (START or STOP) into the MyDns database. More...

int load_logistic (struct smysql *mysql_info, struct mysql_tables *mysql_tables, struct global_config *config)
 Load the content of table 'LOGIDTIC'. More...

int blackhole_abonne (struct smysql *mysql_info, struct mysql_tables *mysql_tables, struct global_config *config)
 Set a client's profile to "autoconfblackhole". More...

int nack_flag_abonne (struct smysql *mysql_info, struct mysql_tables *mysql_tables, struct global_config *config, unsigned long int new_value)
 Update the value of the field 'nack_flag' of the table 'abonnes'. More...

int set_flag_check_radius (struct smysql *mysql_info, struct mysql_tables *mysql_tables, struct global_config *config)
 Set the flag FLAG_CHECK_RADIUS to the value 1. More...

int signal_unknown_mac_address (struct smysql *mysql_info, struct mysql_tables *mysql_tables, struct global_config *config)
 Insert a couple (login_modem,mac_address) into the LOGISTIC_RADIUS table. More...

int remove_autoconf_bh (struct smysql *mysql_info, struct mysql_tables *mysql_tables, struct global_config *config)
 Set a client's profile to "STANDARD". More...


Detailed Description

Header file for the MySql module 'mysql_interface.c'.

Definition in file mysql_interface.h.


Define Documentation

#define MYSQL_INTERFACE_MORE_THAN_ONE   -7
 

Return value for the functions:

  • load_abonnes
  • load_vlan
  • load_abonne_ip
  • load_ip_lease
  • load_pool
  • load_context
  • find_ip_in_vlan_pool
  • get_ip_from_pool
Find more than one data in the database (several rows row matched the WHERE statement).

Remarks:
This error should not happen due to database constraints.

Definition at line 152 of file mysql_interface.h.

Referenced by blackhole_abonne(), find_ip_and_reply(), find_ip_in_vlan_pool(), get_ip_from_pool(), load_abonne_ip(), load_abonnes(), load_context(), load_ip_lease(), load_logistic(), load_pool(), load_vlan(), look_up_logistic(), main(), nack_flag_abonne(), remove_autoconf_bh(), and set_flag_check_radius().

#define MYSQL_INTERFACE_TOO_MANY_ITEMS   -8
 

Return value for the functions:

  • load_options
  • load_context
Find more options than the maximum allowed.

Remarks:
This error should not happen.

Definition at line 163 of file mysql_interface.h.

Referenced by load_context(), load_options(), and main().


Function Documentation

int blackhole_abonne struct smysql   mysql_info,
struct mysql_tables   mysql_tables,
struct global_config   config
 

Set a client's profile to "autoconfblackhole".

Author:
Denis BEURIVE
Parameters:
mysql_info  Pointer to a 'smysql' data structure that contains the MySql configuration.
mysql_tables  Pointer to a 'mysql_tables' data structure that represents the databases model. The following information must be set :
  • abonnes.abonnes_id
config  Pointer to a 'global_config' data structure that contains the main server's configuration.
Returns:
Upon successful completion, the function returns the value 0. Otherwize, the function may return one of the following value:
  • MYSQL_INTERFACE_REQUEST_SKIPED
  • MYSQL_INTERFACE_CONNECTION_LOST
  • MYSQL_INTERFACE_RECONNECTION_FAILED
  • MYSQL_INTERFACE_SQL_PROBLEM
  • MYSQL_INTERFACE_UNEXPECTED_ERROR
  • MYSQL_INTERFACE_NOT_FOUND
  • MYSQL_INTERFACE_MORE_THAN_ONE

Definition at line 3360 of file mysql_interface.c.

References mysql_tables::abonnes, table_abonnes::abonnes_id, smysql::debug, smysql::log_file, my_fake_syslog(), smysql::my_syslog, MYSQL_CONNECTION_LOST, MYSQL_INTERFACE_CONNECTION_LOST, MYSQL_INTERFACE_MORE_THAN_ONE, MYSQL_INTERFACE_NOT_FOUND, MYSQL_INTERFACE_RECONNECTION_FAILED, MYSQL_INTERFACE_REQUEST_SKIPED, MYSQL_INTERFACE_SQL_PROBLEM, MYSQL_INTERFACE_UNEXPECTED_ERROR, MYSQL_RECONNECTION_FAILED, MYSQL_REQUEST_SKIPED, MYSQL_SQL_PROBLEM, MYSQL_UNEXPECTED_ERROR, SQL_REQUEST_SIZE, and sql_update().

Referenced by look_up_logistic().

void clear_tables struct mysql_tables   mysql_tables
 

Initialize the table structure.

Author:
Denis BEURIVE
Parameters:
mysql_tables  Pointer to a 'mysql_tables' data structure that represents the databases model.

Definition at line 62 of file mysql_interface.c.

Referenced by main().

int find_ip_in_vlan_pool struct smysql   mysql_info,
struct mysql_tables   mysql_tables,
struct global_config   config
 

Lookup the IP pool in order to find out if a guven user has an IP address.

Author:
Denis BEURIVE
Parameters:
mysql_info  Pointer to a 'smysql' data structure that contains the MySql configuration. This structure points to the 'read/write' database.
mysql_tables  Pointer to a 'mysql_tables' data structure that represents the databases model. Make sure to load the context first (using load_context()). Tables 'vlan' and 'pool' will be use to initialize the following entries:
  • ip_lease->vlan_id = vlan->vlan_id
  • pool->abonnes_id = abonnes->abonnes_id
config  Pointer to a 'global_config' data structure that contains the main server's configuration.
Returns:
Upon successful completion, the function returs the value 0. Otherwize, the function may return one of the following values:
  • MYSQL_INTERFACE_REQUEST_SKIPED
  • MYSQL_INTERFACE_CONNECTION_LOST
  • MYSQL_INTERFACE_RECONNECTION_FAILED
  • MYSQL_INTERFACE_SQL_PROBLEM
  • MYSQL_INTERFACE_MORE_THAN_ONE
  • MYSQL_INTERFACE_UNEXPECTED_ERROR
  • MYSQL_INTERFACE_NO_TIMESTAMP
  • MYSQL_INTERFACE_NO_LEASE_ID
  • MYSQL_INTERFACE_NO_IP_FOUND
Remarks:
  • The result is copied into the entry 'pool' of the structure pointed by 'mysql_tables'.
  • The entry 'ip_lease' is also initialized.
  • Make sure to load the context first (using load_context()). If you forget, some data won't be correctly initialized.

Definition at line 2090 of file mysql_interface.c.

References mysql_tables::abonnes, mysql_tables::ip_lease, load_ip_lease(), load_pool(), smysql::log_file, my_fake_syslog(), smysql::my_syslog, MYSQL_INTERFACE_CONNECTION_LOST, MYSQL_INTERFACE_MORE_THAN_ONE, MYSQL_INTERFACE_NO_IP_FOUND, MYSQL_INTERFACE_NO_LEASE_ID, MYSQL_INTERFACE_NO_TIMESTAMP, MYSQL_INTERFACE_NOT_FOUND, MYSQL_INTERFACE_RECONNECTION_FAILED, MYSQL_INTERFACE_REQUEST_SKIPED, MYSQL_INTERFACE_SQL_PROBLEM, MYSQL_INTERFACE_UNEXPECTED_ERROR, mysql_tables::pool, and mysql_tables::vlan.

Referenced by find_ip_and_reply(), and get_ip_from_pool().

int get_ip_from_pool struct smysql   mysql_info,
struct mysql_tables   mysql_tables,
struct global_config   config,
unsigned int    timeout,
int    reserve_ip
 

Try to reserve an IP address in the IP pool.

Author:
Denis BEURIVE
Parameters:
mysql_info  Pointer to a 'smysql' data structure that contains the MySql configuration. This structure points to the 'read/write' database.
mysql_tables  Pointer to a 'mysql_tables' data structure that represents the databases model. The entry 'ip_lease' must have the following field:
  • vlan_id
The entry 'pool' must have the following entries:
  • abonnes_id
config  Pointer to a 'global_config' data structure that contains the main server's configuration.
timeout  Timeout for the expiration date. The timeout's value depends on the event. It could be:
  • An OFFER (reply to DISCOVER).
  • An ACK (reply to OFFER).
reserve_ip  This flag tells the function whether it should try to reserve an IP address from the pool.
  • 0: Do not try to reserve IP address from pool.
  • Any other value: Try to reserve IP address from pool.
Returns:
  • If the function finds a free IP address in the pool, it returns the value 1.
  • If the function did not find a free IP address in the pool, it returns the value 0.
  • Otherwize, the function may return one of the following values:
    • MYSQL_INTERFACE_UNEXPECTED_ERROR
    • MYSQL_INTERFACE_SQL_PROBLEM
    • MYSQL_INTERFACE_RECONNECTION_FAILED
    • MYSQL_INTERFACE_CONNECTION_LOST
    • MYSQL_INTERFACE_REQUEST_SKIPED
    • MYSQL_INTERFACE_NO_TIMESTAMP
    • MYSQL_INTERFACE_NO_LEASE_ID
    • MYSQL_INTERFACE_MORE_THAN_ONE
Remarks:
  • The result is copied into the entry 'pool' of the structure pointed by 'mysql_tables'.
  • The entry 'ip_lease' is also initialized.

Definition at line 2272 of file mysql_interface.c.

References table_pool::abonnes_id, smysql::debug, find_ip_in_vlan_pool(), table_pool::ip, mysql_tables::ip_lease, table_ip_lease::ip_lease_id, table_pool::ip_lease_id, load_pool(), smysql::log_file, my_fake_syslog(), smysql::my_syslog, MYSQL_INTERFACE_CONNECTION_LOST, MYSQL_INTERFACE_MORE_THAN_ONE, MYSQL_INTERFACE_NO_IP_FOUND, MYSQL_INTERFACE_NO_LEASE_ID, MYSQL_INTERFACE_NO_TIMESTAMP, MYSQL_INTERFACE_NOT_FOUND, MYSQL_INTERFACE_RECONNECTION_FAILED, MYSQL_INTERFACE_REQUEST_SKIPED, MYSQL_INTERFACE_SQL_PROBLEM, MYSQL_INTERFACE_UNEXPECTED_ERROR, mysql_tables::pool, table_pool::pool_id, try_find_and_reserve_ip_from_pool(), and try_reserve_ip_from_pool().

Referenced by find_ip_and_reply().

int load_abonne_ip struct smysql   mysql_info,
struct mysql_tables   mysql_tables,
struct global_config   config
 

Load the content of table 'abonne_ip'.

Author:
Denis BEURIVE
Parameters:
mysql_info  Pointer to a 'smysql' data structure that contains the MySql configuration.
mysql_tables  Pointer to a 'mysql_tables' data structure that represents the databases model. Entry 'abonne_ip' must have the following definitions (that will be used for SQL query):
  • abonnes_id
  • vlan_id
config  Pointer to a 'global_config' data structure that contains the main server's configuration.
Returns:
Upon successful completion, the function returns the value 0. Otherwize, the function may return one of the following value:
  • MYSQL_INTERFACE_REQUEST_SKIPED
  • MYSQL_INTERFACE_CONNECTION_LOST
  • MYSQL_INTERFACE_RECONNECTION_FAILED
  • MYSQL_INTERFACE_SQL_PROBLEM
  • MYSQL_INTERFACE_NOT_FOUND
  • MYSQL_INTERFACE_MORE_THAN_ONE
  • MYSQL_INTERFACE_UNEXPECTED_ERROR
Remarks:
The result is copied into the entry 'abonne_ip' of the structure pointed by 'mysql_tables'.

Definition at line 699 of file mysql_interface.c.

References mysql_tables::abonne_ip, table_abonne_ip::abonne_ip_id, table_abonne_ip::abonnes_id, smysql::debug, table_abonne_ip::gateway, table_abonne_ip::ip, IP_ADDRESS_STR_SIZE, smysql::log_file, my_fake_syslog(), smysql::my_syslog, MYSQL_CONNECTION_LOST, MYSQL_INTERFACE_CONNECTION_LOST, MYSQL_INTERFACE_MORE_THAN_ONE, MYSQL_INTERFACE_NOT_FOUND, MYSQL_INTERFACE_RECONNECTION_FAILED, MYSQL_INTERFACE_REQUEST_SKIPED, MYSQL_INTERFACE_SQL_PROBLEM, MYSQL_INTERFACE_UNEXPECTED_ERROR, MYSQL_RECONNECTION_FAILED, MYSQL_REQUEST_SKIPED, MYSQL_SQL_PROBLEM, MYSQL_UNEXPECTED_ERROR, smysql::result, SQL_REQUEST_SIZE, sql_select(), table_abonne_ip::subnet, and table_abonne_ip::vlan_id.

Referenced by find_ip_and_reply().

int load_context struct smysql   mysql_info,
struct smysql   mysql_info_write,
struct mysql_tables   mysql_tables,
struct global_config   config
 

Load the entire context associated with a user.

Author:
Denis BEURIVE
Parameters:
mysql_info  Pointer to a 'smysql' data structure that contains the MySql configuration. This structure points to the 'read only' database.
mysql_info_write  Pointer to a 'smysql' data structure that contains the MySql configuration. This structure points to the 'read / write' database.
mysql_tables  Pointer to a 'mysql_tables' data structure that represents the databases model. Entry 'abonnes' must have the following definitions (that will be used for SQL query):
  • node_id
  • shelf
  • numero_port
  • numero_slot
Entry 'vlan' must have the following definitions (that will be used for SQL query):
  • vlan_tag
  • vlan_gateway
config  Pointer to a 'global_config' data structure that contains the main server's configuration.
Returns:
Upon successful completion, the function returns the value 0. Otherwize, the function may return one of the following value:
  • MYSQL_INTERFACE_REQUEST_SKIPED
  • MYSQL_INTERFACE_CONNECTION_LOST
  • MYSQL_INTERFACE_RECONNECTION_FAILED
  • MYSQL_INTERFACE_SQL_PROBLEM
  • MYSQL_INTERFACE_NOT_FOUND
  • MYSQL_INTERFACE_MORE_THAN_ONE
  • MYSQL_INTERFACE_UNEXPECTED_ERROR
  • MYSQL_INTERFACE_TOO_MANY_ITEMS
Remarks:
  • The result is copied into entries:
    • 'abonnes'
    • 'vlan'
    • 'options'
  • This function takes care of the black-hole flag. If necessary, the correct balckhole profile is loaded.

Definition at line 1818 of file mysql_interface.c.

References mysql_tables::abonnes, smysql::debug, load_abonnes(), load_options(), load_vlan(), smysql::log_file, my_fake_syslog(), smysql::my_syslog, MYSQL_INTERFACE_CONNECTION_LOST, MYSQL_INTERFACE_MORE_THAN_ONE, MYSQL_INTERFACE_NOT_FOUND, MYSQL_INTERFACE_RECONNECTION_FAILED, MYSQL_INTERFACE_REQUEST_SKIPED, MYSQL_INTERFACE_SQL_PROBLEM, MYSQL_INTERFACE_TOO_MANY_ITEMS, MYSQL_INTERFACE_UNEXPECTED_ERROR, OPTIONNAL_PROFILE_SIZE, mysql_tables::options, and mysql_tables::vlan.

Referenced by main().

int load_logistic struct smysql   mysql_info,
struct mysql_tables   mysql_tables,
struct global_config   config
 

Load the content of table 'LOGIDTIC'.

Author:
Denis BEURIVE
Parameters:
mysql_info  Pointer to a 'smysql' data structure that contains the MySql configuration.
mysql_tables  Pointer to a 'mysql_tables' data structure that represents the databases model. The following information must be set :
  • logistic.LOGIN_MODEM
config  Pointer to a 'global_config' data structure that contains the main server's configuration.
Returns:
Upon successful completion, the function returns the value 0. Otherwize, the function may return one of the following value:
  • MYSQL_INTERFACE_REQUEST_SKIPED
  • MYSQL_INTERFACE_CONNECTION_LOST
  • MYSQL_INTERFACE_RECONNECTION_FAILED
  • MYSQL_INTERFACE_SQL_PROBLEM
  • MYSQL_INTERFACE_NOT_FOUND
  • MYSQL_INTERFACE_MORE_THAN_ONE
  • MYSQL_INTERFACE_UNEXPECTED_ERROR
Remarks:
The result is copied into the entry 'table_logistic_radius' of the structure pointed by 'mysql_tables'. Fields are:
  • RADIUS_LOGIN
  • FLAG_CHECK_RADIUS

Definition at line 3227 of file mysql_interface.c.

References smysql::debug, table_logistic_radius::FLAG_CHECK_RADIUS, smysql::log_file, table_logistic_radius::LOGIN_MODEM, mysql_tables::logistic, LOGISTIC_RADIUS_LOGIN_SIZE, my_fake_syslog(), smysql::my_syslog, MYSQL_CONNECTION_LOST, MYSQL_INTERFACE_CONNECTION_LOST, MYSQL_INTERFACE_MORE_THAN_ONE, MYSQL_INTERFACE_NOT_FOUND, MYSQL_INTERFACE_RECONNECTION_FAILED, MYSQL_INTERFACE_REQUEST_SKIPED, MYSQL_INTERFACE_SQL_PROBLEM, MYSQL_INTERFACE_UNEXPECTED_ERROR, MYSQL_RECONNECTION_FAILED, MYSQL_REQUEST_SKIPED, MYSQL_SQL_PROBLEM, MYSQL_UNEXPECTED_ERROR, table_logistic_radius::RADIUS_LOGIN, smysql::result, SQL_REQUEST_SIZE, and sql_select().

Referenced by look_up_logistic().

int load_options struct smysql   mysql_info,
struct mysql_tables   mysql_tables,
struct global_config   config
 

Load the content of table 'options'.

Author:
Denis BEURIVE
Parameters:
mysql_info  Pointer to a 'smysql' data structure that contains the MySql configuration.
mysql_tables  Pointer to a 'mysql_tables' data structure that represents the databases model. The first element of the entry 'options' must have the following definitions (that will be used for SQL query):
  • profile_optionnel
config  Pointer to a 'global_config' data structure that contains the main server's configuration.
Returns:
Upon successful completion, the function returns the value 0. Otherwize, the function may return one of the following value:
  • MYSQL_INTERFACE_REQUEST_SKIPED
  • MYSQL_INTERFACE_CONNECTION_LOST
  • MYSQL_INTERFACE_RECONNECTION_FAILED
  • MYSQL_INTERFACE_SQL_PROBLEM
  • MYSQL_INTERFACE_NOT_FOUND
  • MYSQL_INTERFACE_TOO_MANY_ITEMS
  • MYSQL_INTERFACE_UNEXPECTED_ERROR
Remarks:
The result is copied into the entry 'options' of the structure pointed by 'mysql_tables'.

Definition at line 856 of file mysql_interface.c.

References COMMENT_SIZE, smysql::debug, smysql::log_file, MAX_PROFILE_OPTIONS, my_fake_syslog(), smysql::my_syslog, MYSQL_CONNECTION_LOST, MYSQL_INTERFACE_CONNECTION_LOST, MYSQL_INTERFACE_NOT_FOUND, MYSQL_INTERFACE_RECONNECTION_FAILED, MYSQL_INTERFACE_REQUEST_SKIPED, MYSQL_INTERFACE_SQL_PROBLEM, MYSQL_INTERFACE_TOO_MANY_ITEMS, MYSQL_INTERFACE_UNEXPECTED_ERROR, MYSQL_RECONNECTION_FAILED, MYSQL_REQUEST_SKIPED, MYSQL_SQL_PROBLEM, MYSQL_UNEXPECTED_ERROR, mysql_tables::option_number, OPTION_TYPE_SIZE, OPTION_VALUE_SIZE, OPTIONNAL_PROFILE_SIZE, mysql_tables::options, smysql::result, SQL_REQUEST_SIZE, and sql_select().

Referenced by load_context(), and main().

int mydns_init struct smysql   mysql_info
 

Initialize the MyDns service.

Author:
Denis BEURIVE
Parameters:
mysql_info  Pointer to a 'smysql' data structure that contains the MySql configuration. This structure points to the 'mydns' database.
Returns:
Upon successful completion, the function returns the value 0. Otherwize, the function returns the value 1.

Definition at line 2884 of file mysql_interface.c.

References smysql::debug, smysql::log_file, my_fake_syslog(), smysql::my_syslog, mydns_id, MYSQL_CONNECTION_LOST, MYSQL_RECONNECTION_FAILED, MYSQL_REQUEST_SKIPED, MYSQL_SQL_PROBLEM, MYSQL_UNEXPECTED_ERROR, smysql::result, SQL_REQUEST_SIZE, and sql_select().

Referenced by main().

int nack_flag_abonne struct smysql   mysql_info,
struct mysql_tables   mysql_tables,
struct global_config   config,
unsigned long int    new_value
 

Update the value of the field 'nack_flag' of the table 'abonnes'.

Author:
Denis BEURIVE
Parameters:
mysql_info  Pointer to a 'smysql' data structure that contains the MySql configuration.
mysql_tables  Pointer to a 'mysql_tables' data structure that represents the databases model. The following information must be set :
  • abonnes.abonnes_id
config  Pointer to a 'global_config' data structure that contains the main server's configuration.
new_value  New value for the field 'nack_flag'.
Returns:
Upon successful completion, the function returns the value 0. Otherwize, the function may return one of the following value:
  • MYSQL_INTERFACE_REQUEST_SKIPED
  • MYSQL_INTERFACE_CONNECTION_LOST
  • MYSQL_INTERFACE_RECONNECTION_FAILED
  • MYSQL_INTERFACE_SQL_PROBLEM
  • MYSQL_INTERFACE_UNEXPECTED_ERROR
  • MYSQL_INTERFACE_NOT_FOUND
  • MYSQL_INTERFACE_MORE_THAN_ONE

Definition at line 3763 of file mysql_interface.c.

References mysql_tables::abonnes, table_abonnes::abonnes_id, smysql::debug, smysql::log_file, my_fake_syslog(), smysql::my_syslog, MYSQL_CONNECTION_LOST, MYSQL_INTERFACE_CONNECTION_LOST, MYSQL_INTERFACE_MORE_THAN_ONE, MYSQL_INTERFACE_NOT_FOUND, MYSQL_INTERFACE_RECONNECTION_FAILED, MYSQL_INTERFACE_REQUEST_SKIPED, MYSQL_INTERFACE_SQL_PROBLEM, MYSQL_INTERFACE_UNEXPECTED_ERROR, MYSQL_RECONNECTION_FAILED, MYSQL_REQUEST_SKIPED, MYSQL_SQL_PROBLEM, MYSQL_UNEXPECTED_ERROR, SQL_REQUEST_SIZE, and sql_update().

Referenced by find_ip_and_reply().

int release_ip_from_pool struct smysql   mysql_info,
struct mysql_tables   mysql_tables,
struct global_config   config
 

Release IP from pool.

Author:
Denis BEURIVE
Parameters:
mysql_info  Pointer to a 'smysql' data structure that contains the MySql configuration.
mysql_tables  Pointer to a 'mysql_tables' data structure that represents the databases model. Entry 'pool' must have the following definitions (that will be used for SQL query):
  • ip_lease_id
  • abonnes_id
config  Pointer to a 'global_config' data structure that contains the main server's configuration.
Returns:
Upon successful completion, the function returns the value 0. Otherwize, the function may return one of the following value:
  • MYSQL_INTERFACE_REQUEST_SKIPED
  • MYSQL_INTERFACE_CONNECTION_LOST
  • MYSQL_INTERFACE_RECONNECTION_FAILED
  • MYSQL_INTERFACE_SQL_PROBLEM
  • MYSQL_INTERFACE_UNEXPECTED_ERROR
  • MYSQL_INTERFACE_NO_TIMESTAMP

Definition at line 1666 of file mysql_interface.c.

References table_pool::abonnes_id, smysql::debug, get_unix_timestamp(), table_pool::ip_lease_id, smysql::log_file, my_fake_syslog(), smysql::my_syslog, MYSQL_CONNECTION_LOST, MYSQL_INTERFACE_CONNECTION_LOST, MYSQL_INTERFACE_NO_TIMESTAMP, MYSQL_INTERFACE_RECONNECTION_FAILED, MYSQL_INTERFACE_REQUEST_SKIPED, MYSQL_INTERFACE_SQL_PROBLEM, MYSQL_INTERFACE_UNEXPECTED_ERROR, MYSQL_NO_TIMESTAMP, MYSQL_RECONNECTION_FAILED, MYSQL_REQUEST_SKIPED, MYSQL_SQL_PROBLEM, MYSQL_UNEXPECTED_ERROR, mysql_tables::pool, SQL_REQUEST_SIZE, and sql_update().

Referenced by find_ip_and_reply().

int remove_autoconf_bh struct smysql   mysql_info,
struct mysql_tables   mysql_tables,
struct global_config   config
 

Set a client's profile to "STANDARD".

Author:
Denis BEURIVE
Parameters:
mysql_info  Pointer to a 'smysql' data structure that contains the MySql configuration.
mysql_tables  Pointer to a 'mysql_tables' data structure that represents the databases model. The following information must be set :
  • abonnes.abonnes_id
config  Pointer to a 'global_config' data structure that contains the main server's configuration.
Returns:
Upon successful completion, the function returns the value 0. Otherwize, the function may return one of the following value:
  • MYSQL_INTERFACE_REQUEST_SKIPED
  • MYSQL_INTERFACE_CONNECTION_LOST
  • MYSQL_INTERFACE_RECONNECTION_FAILED
  • MYSQL_INTERFACE_SQL_PROBLEM
  • MYSQL_INTERFACE_UNEXPECTED_ERROR
  • MYSQL_INTERFACE_MORE_THAN_ONE

Definition at line 3449 of file mysql_interface.c.

References mysql_tables::abonnes, table_abonnes::abonnes_id, smysql::debug, smysql::log_file, my_fake_syslog(), smysql::my_syslog, MYSQL_CONNECTION_LOST, MYSQL_INTERFACE_CONNECTION_LOST, MYSQL_INTERFACE_MORE_THAN_ONE, MYSQL_INTERFACE_RECONNECTION_FAILED, MYSQL_INTERFACE_REQUEST_SKIPED, MYSQL_INTERFACE_SQL_PROBLEM, MYSQL_INTERFACE_UNEXPECTED_ERROR, MYSQL_RECONNECTION_FAILED, MYSQL_REQUEST_SKIPED, MYSQL_SQL_PROBLEM, MYSQL_UNEXPECTED_ERROR, SQL_REQUEST_SIZE, and sql_update().

Referenced by main().

int send_to_mydns struct smysql   mysql_info,
struct mysql_tables   mysql_tables,
char *    ip,
int    action,
struct global_config   config
 

Send a ticket (START or STOP) into the MyDns database.

Author:
Denis BEURIVE
Parameters:
mysql_info  Pointer to a 'smysql' data structure that contains the MySql configuration. This structure points to the 'mydns' database.
mysql_tables  Pointer to a 'mysql_tables' data structure that contains the loaded context.
ip  Pointer to a zero terminated string of characters that represents the IP address of the user.
action  This integer represents the action to execute. Its value could be:
  • MYDNS_START
  • MYDNS_STOP
config  Pointer to a 'global_config' data structure that represents the global server's configuration.
Returns:
Upon successful completion, the function returns the value 0. Otherwize, the function may return one of the following values:
  • MYSQL_REQUEST_SKIPED
  • MYSQL_CONNECTION_LOST
  • MYSQL_RECONNECTION_FAILED
  • MYSQL_SQL_PROBLEM
  • MYSQL_UNEXPECTED_ERROR
Remarks:
You must all the function mydns_init() first! This will set the variable mydns_id to the correct value.

Definition at line 2992 of file mysql_interface.c.

References mysql_tables::abonnes, smysql::debug, smysql::log_file, my_fake_syslog(), smysql::my_syslog, mydns_id, MYDNS_LOGIN_SIZE, MYDNS_START, MYDNS_STOP, MYSQL_CONNECTION_LOST, MYSQL_RECONNECTION_FAILED, MYSQL_REQUEST_SKIPED, MYSQL_SQL_PROBLEM, MYSQL_UNEXPECTED_ERROR, sql_delete(), sql_insert(), and SQL_REQUEST_SIZE.

Referenced by find_ip_and_reply().

int send_to_radonline struct smysql   mysql_info,
struct mysql_tables   mysql_tables,
char *    ip,
int    action,
struct global_config   config
 

Send a ticket (START or STOP) into the Radonline database.

Author:
Denis BEURIVE
Parameters:
mysql_info  Pointer to a 'smysql' data structure that contains the MySql configuration. This structure points to the 'radonline' database.
mysql_tables  Pointer to a 'mysql_tables' data structure that contains the loaded context.
ip  Pointer to a zero terminated string of characters that represents the IP address of the user.
action  This integer represents the action to execute. Its value could be:
  • RADONLINE_START
  • RADONLINE_STOP
config  Pointer to a 'global_config' data structure that represents the global server's configuration.
Returns:
Upon successful completion, the function returns the value 0. Otherwize, the function may return one of the following values:
  • MYSQL_REQUEST_SKIPED
  • MYSQL_CONNECTION_LOST
  • MYSQL_RECONNECTION_FAILED
  • MYSQL_SQL_PROBLEM
  • MYSQL_UNEXPECTED_ERROR
Remarks:
This function checks the values of the following records:
  • ogistic.radonline_acct_identifier
  • ogistic.login_modem
If these records are defined, special values are assiged to ACCT_IDENTIFIER and LOGIN_MODEM.

Definition at line 2586 of file mysql_interface.c.

References mysql_tables::abonnes, smysql::debug, smysql::log_file, mysql_tables::logistic, my_fake_syslog(), smysql::my_syslog, MYSQL_CONNECTION_LOST, MYSQL_RECONNECTION_FAILED, MYSQL_REQUEST_SKIPED, MYSQL_SQL_PROBLEM, MYSQL_UNEXPECTED_ERROR, NASPORT_SIZE, RADONLINE_START, RADONLINE_STOP, sql_delete(), sql_insert(), SQL_REQUEST_SIZE, and mysql_tables::vlan.

Referenced by find_ip_and_reply().

int set_flag_check_radius struct smysql   mysql_info,
struct mysql_tables   mysql_tables,
struct global_config   config
 

Set the flag FLAG_CHECK_RADIUS to the value 1.

Author:
Denis BEURIVE
Parameters:
mysql_info  Pointer to a 'smysql' data structure that contains the MySql configuration.
mysql_tables  Pointer to a 'mysql_tables' data structure that represents the databases model. The following information must be set :
  • logistic.LOGIN_MODEM
config  Pointer to a 'global_config' data structure that contains the main server's configuration.
Returns:
Upon successful completion, the function returns the value 0. Otherwize, the function may return one of the following value:
  • MYSQL_INTERFACE_REQUEST_SKIPED
  • MYSQL_INTERFACE_CONNECTION_LOST
  • MYSQL_INTERFACE_RECONNECTION_FAILED
  • MYSQL_INTERFACE_SQL_PROBLEM
  • MYSQL_INTERFACE_UNEXPECTED_ERROR
  • MYSQL_INTERFACE_NOT_FOUND
  • MYSQL_INTERFACE_MORE_THAN_ONE

Definition at line 3538 of file mysql_interface.c.

References smysql::debug, smysql::log_file, table_logistic_radius::LOGIN_MODEM, mysql_tables::logistic, my_fake_syslog(), smysql::my_syslog, MYSQL_CONNECTION_LOST, MYSQL_INTERFACE_CONNECTION_LOST, MYSQL_INTERFACE_MORE_THAN_ONE, MYSQL_INTERFACE_NOT_FOUND, MYSQL_INTERFACE_RECONNECTION_FAILED, MYSQL_INTERFACE_REQUEST_SKIPED, MYSQL_INTERFACE_SQL_PROBLEM, MYSQL_INTERFACE_UNEXPECTED_ERROR, MYSQL_RECONNECTION_FAILED, MYSQL_REQUEST_SKIPED, MYSQL_SQL_PROBLEM, MYSQL_UNEXPECTED_ERROR, SQL_REQUEST_SIZE, and sql_update().

Referenced by look_up_logistic().

int signal_unknown_mac_address struct smysql   mysql_info,
struct mysql_tables   mysql_tables,
struct global_config   config
 

Insert a couple (login_modem,mac_address) into the LOGISTIC_RADIUS table.

Author:
Denis BEURIVE
Parameters:
mysql_info  Pointer to a 'smysql' data structure that contains the MySql configuration.
mysql_tables  Pointer to a 'mysql_tables' data structure that represents the databases model. The following information must be set :
  • logistic.LOGIN_MODEM
  • logistic.MAC_ADDRESS
config  Pointer to a 'global_config' data structure that contains the main server's configuration.
Returns:
Upon successful completion, the function returns the value 0. Otherwize, the function may return one of the following value:
  • MYSQL_INTERFACE_REQUEST_SKIPED
  • MYSQL_INTERFACE_CONNECTION_LOST
  • MYSQL_INTERFACE_RECONNECTION_FAILED
  • MYSQL_INTERFACE_SQL_PROBLEM
  • MYSQL_INTERFACE_UNEXPECTED_ERROR

Definition at line 3629 of file mysql_interface.c.

References smysql::debug, smysql::log_file, table_logistic_radius::LOGIN_MODEM, mysql_tables::logistic, table_logistic_radius::MAC_ADDRESS, my_fake_syslog(), smysql::my_syslog, MYSQL_CONNECTION_LOST, MYSQL_INTERFACE_CONNECTION_LOST, MYSQL_INTERFACE_RECONNECTION_FAILED, MYSQL_INTERFACE_REQUEST_SKIPED, MYSQL_INTERFACE_SQL_PROBLEM, MYSQL_INTERFACE_UNEXPECTED_ERROR, MYSQL_RECONNECTION_FAILED, MYSQL_REQUEST_SKIPED, MYSQL_SQL_PROBLEM, MYSQL_UNEXPECTED_ERROR, sql_insert(), and SQL_REQUEST_SIZE.

Referenced by look_up_logistic().


Generated on Mon Jun 19 12:31:06 2006 for MyDhcp_V2 by doxygen1.2.15