#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:
| |
#define | MYSQL_INTERFACE_CONNECTION_LOST -2 |
Return value for the functions:
| |
#define | MYSQL_INTERFACE_RECONNECTION_FAILED -3 |
Return value for the functions:
| |
#define | MYSQL_INTERFACE_SQL_PROBLEM -4 |
Return value for the functions:
| |
#define | MYSQL_INTERFACE_UNEXPECTED_ERROR -5 |
Return value for the functions:
| |
#define | MYSQL_INTERFACE_NOT_FOUND -6 |
Return value for the functions:
| |
#define | MYSQL_INTERFACE_MORE_THAN_ONE -7 |
Return value for the functions:
| |
#define | MYSQL_INTERFACE_TOO_MANY_ITEMS -8 |
Return value for the functions:
| |
#define | MYSQL_INTERFACE_NO_TIMESTAMP -9 |
Return value for the all functions that need to get the UNIX timestamp from the MySql server.
| |
#define | MYSQL_INTERFACE_NO_LEASE_ID -10 |
Return value for the the functions:
| |
#define | MYSQL_INTERFACE_NO_IP_FOUND -11 |
Return value for the the functions:
| |
#define | MYSQL_INTERFACE_MAC_ADDRESS_FOUND -12 |
Return value for the the functions: | |
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... |
Definition in file mysql_interface.h.
|
Return value for the functions:
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(). |
|
Return value for the functions:
Definition at line 163 of file mysql_interface.h. Referenced by load_context(), load_options(), and main(). |
|
Set a client's profile to "autoconfblackhole".
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(). |
|
Initialize the table structure.
Definition at line 62 of file mysql_interface.c. Referenced by main(). |
|
Lookup the IP pool in order to find out if a guven user has an IP address.
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(). |
|
Try to reserve an IP address in the IP pool.
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(). |
|
Load the content of table 'abonne_ip'.
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(). |
|
Load the entire context associated with a user.
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(). |
|
Load the content of table 'LOGIDTIC'.
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(). |
|
Load the content of table 'options'.
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(). |
|
Initialize the MyDns service.
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(). |
|
Update the value of the field 'nack_flag' of the table 'abonnes'.
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(). |
|
Release IP from pool.
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(). |
|
Set a client's profile to "STANDARD".
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(). |
|
Send a ticket (START or STOP) into the MyDns database.
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(). |
|
Send a ticket (START or STOP) into the Radonline database.
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(). |
|
Set the flag FLAG_CHECK_RADIUS to the value 1.
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(). |
|
Insert a couple (login_modem,mac_address) into the LOGISTIC_RADIUS table.
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(). |