Main Page   Alphabetical List   Data Structures   File List   Data Fields   Globals  

dhcp.c File Reference

#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <pwd.h>
#include <grp.h>
#include <time.h>
#include "dhcp.h"
#include "modem.h"
#include "sockets.h"
#include "server_config.h"
#include "mysql_header.h"
#include "mysql_interface.h"
#include "logging.h"
#include "deamon.h"
#include "logistic.h"
#include "packets_data.h"
#include "conversion.h"
#include "packets.h"
#include "find_ip_and_reply.h"
#include "packets_operations.h"

Go to the source code of this file.

Defines

#define BUILD   "This binary was build the __DATE__ on __HOST__"
 Build information. The tags __DATE__ and __HOST__ will be replaced by the output of commands 'date' and 'uname -a'.

#define CVS_TAGS   "__CVSTAGS__"
 CVS tags for all sources.

#define MTSQL_TESTING(n, s)

Functions

void dump_packet_hexa (void *packet, int size, char *file)
 Dump a packet into hexa. This function is called when it is not possible to parse the packet (invalid size ot invalid organisation). More...

int main (int argc, char **argv)
 Main entry point for the DHCP server. More...


Variables

char mysql_error_str [MYSQL_MAX_ERROR_SIZE]
 Last MySql error message. This variable is defined in the file 'mysql.c'.

int mysql_error_errno
 Last MySql error code. This variable is defined in the file 'mysql.c'.

global_config configuration_globale
 This structure contains the global server configuration. It is defined in the C file 'configuration.c'.

smysql conf_mysql_dhcp_read_only
 This structure contains the configuration for the connection to the local DHCP database. This database is access only for READ operations.

smysql conf_mysql_dhcp_read_write
 This structure contains the configuration for the connection to the POOL database. This database contains the pool of dynamic IP addresses. It is accessed for READ and WRITE operations.

smysql conf_mysql_radonline
 This structure contains the configuration for the connection to the Radonline database.

smysql conf_mysql_mydns
 This structure contains the configuration for the connection to the Mydns database.

smysql conf_mysql_logistic
 This structure contains the configuration for the connection to the Logistic database.

char * tags_read [MYSQL_CONFIGURATION_TAG_NUMBER]
 This array contains the configuration tags associated to the local DHCP database (read only database). More...

char * tags_read_write [MYSQL_CONFIGURATION_TAG_NUMBER]
 This array contains the configuration tags associated to the POOL DHCP database. (read/write database). More...

char * tags_radonline [MYSQL_CONFIGURATION_TAG_NUMBER]
 This array contains the configuration tags associated to the radonline database. More...

char * tags_mydns [MYSQL_CONFIGURATION_TAG_NUMBER]
 This array contains the configuration tags associated to the mydns database. More...

char * tags_logistic [MYSQL_CONFIGURATION_TAG_NUMBER]
 This array contains the configuration tags associated to the Logistic database. More...

int dump_sync_fd = 0
 This file descriptor is defined in the main server source (dhcp.c). It is used to synchronize access to the dump file.


Detailed Description

Main entry point for the DHCP server.

Definition in file dhcp.c.


Function Documentation

void dump_packet_hexa void *    packet,
int    size,
char *    file
[static]
 

Dump a packet into hexa. This function is called when it is not possible to parse the packet (invalid size ot invalid organisation).

Parameters:
packet  Pointer to the packet as received by the server.
size  Size, in bytes of the packet.
file  Path to the log file.

Definition at line 1935 of file dhcp.c.

References my_syslog().

Referenced by main().

int main int    argc,
char **    argv
 

Main entry point for the DHCP server.

Author:
Denis BEURIVE

Definition at line 232 of file dhcp.c.

References mysql_tables::abonnes, activate_log_size_management(), BUILD, check_packet_size(), clear_tables(), configuration_load(), connect_to_mysql(), conversion_logging_service(), create_socket(), global_config::csv_file, CVS_TAGS, global_config::deamon_group_id, global_config::deamon_user_id, global_config::debug, global_config::debug_file, global_config::dhcp_bind_ip, DHCP_INVALID_MESSAGE_TYPE, DHCP_LEASE_INCONSTANCY, DHCP_MYDNS_MYSQL_SQL_PROBLEM, DHCP_MYDNS_MYSQL_UNEXPECTED_ERROR, DHCP_NO_DYNAMIC_IP_FOUND, DHCP_NO_DYNAMIC_IP_FOUND_RELEASE, DHCP_RADONLINE_MYSQL_SQL_PROBLEM, DHCP_RADONLINE_MYSQL_UNEXPECTED_ERROR, DHCPDECLINE, global_config::dummy_ip, dump_packet_hexa(), dump_sync_fd, global_config::dumper_mode, find_ip_and_reply(), get_last_socket_error(), init_client_ids(), init_mysql_structure(), init_syslogger(), IP_ADDRESS_STR_SIZE, smysql::last_error_int, smysql::last_error_str, load_context(), load_mysql_configuration_from_file(), load_options(), global_config::log_file, global_config::log_size_management, logger_set_gateway(), logging_new_tag(), mysql_tables::logistic, look_up_logistic(), modem_conf_is_autoconf(), MODEM_HITACHI, table_logistic_radius::modem_manufacturor, MODEM_SAGEM, my_syslog(), my_syslog_skip_line(), mydns_init(), mysql_error_errno, mysql_error_str, MYSQL_INTERFACE_CONNECTION_LOST, MYSQL_INTERFACE_MORE_THAN_ONE, 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_TOO_MANY_ITEMS, MYSQL_INTERFACE_UNEXPECTED_ERROR, NODE_BUFFER_SIZE, table_abonnes::node_id, table_abonnes::numero_port, table_abonnes::numero_slot, packet_dump(), packet_init_dump_service(), packet_logging_service(), packet_set_taille(), PACKET_SIZE, packets_clear(), packets_get_chaddr(), packets_get_message_type(), packets_get_node_id(), packets_get_numero_port(), packets_get_numero_slot(), packets_get_shelf(), packets_get_vci(), packets_get_vlan_id(), packets_get_xid(), packets_parse_options(), packets_send_dummy_nak(), global_config::pid_file, remove_autoconf_bh(), SERVER_PORT, table_abonnes::shelf, global_config::sync_dump, tags_logistic, tags_mydns, tags_radonline, tags_read, tags_read_write, mysql_tables::vlan, table_vlan::vlan_gateway, table_vlan::vlan_id, table_vlan::vlan_tag, and global_config::working_dir.


Variable Documentation

char* tags_logistic[MYSQL_CONFIGURATION_TAG_NUMBER] [static]
 

Initial value:

       {
         "mysql-host-logistic",
         "mysql-user-logistic",
         "mysql-passwd-logistic",
         "mysql-db-logistic",
         "mysql-port-logistic",
         "mysql-socket-logistic",
         "mysql-retry-logistic",
         "mysql-timeout-logistic",
         "mysql-sleep-logistic",
         "mysql-debug-logistic",
         "mysql-log-file-logistic",
         "mysql-reconnection-delay-logistic"
       }
This array contains the configuration tags associated to the Logistic database.

Definition at line 173 of file dhcp.c.

Referenced by main().

char* tags_mydns[MYSQL_CONFIGURATION_TAG_NUMBER] [static]
 

Initial value:

       {
         "mysql-host-mydns",
         "mysql-user-mydns",
         "mysql-passwd-mydns",
         "mysql-db-mydns",
         "mysql-port-mydns",
         "mysql-socket-mydns",
         "mysql-retry-mydns",
         "mysql-timeout-mydns",
         "mysql-sleep-mydns",
         "mysql-debug-mydns",
         "mysql-log-file-mydns",
         "mysql-reconnection-delay-mydns"
       }
This array contains the configuration tags associated to the mydns database.

Definition at line 154 of file dhcp.c.

Referenced by main().

char* tags_radonline[MYSQL_CONFIGURATION_TAG_NUMBER] [static]
 

Initial value:

       {
         "mysql-host-radonline",
         "mysql-user-radonline",
         "mysql-passwd-radonline",
         "mysql-db-radonline",
         "mysql-port-radonline",
         "mysql-socket-radonline",
         "mysql-retry-radonline",
         "mysql-timeout-radonline",
         "mysql-sleep-radonline",
         "mysql-debug-radonline",
         "mysql-log-file-radonline",
         "mysql-reconnection-delay-radonline"
       }
This array contains the configuration tags associated to the radonline database.

Definition at line 135 of file dhcp.c.

Referenced by main().

char* tags_read[MYSQL_CONFIGURATION_TAG_NUMBER] [static]
 

Initial value:

       {
         "mysql-host-dhcp-read",
         "mysql-user-dhcp-read",
         "mysql-passwd-dhcp-read",
         "mysql-db-dhcp-read",
         "mysql-port-dhcp-read",
         "mysql-socket-dhcp-read",
         "mysql-retry-dhcp-read",
         "mysql-timeout-dhcp-read",
         "mysql-sleep-dhcp-read",
         "mysql-debug-dhcp-read",
         "mysql-log-file-dhcp-read",
         "mysql-reconnection-delay-dhcp-read"
       }
This array contains the configuration tags associated to the local DHCP database (read only database).

Definition at line 96 of file dhcp.c.

Referenced by main().

char* tags_read_write[MYSQL_CONFIGURATION_TAG_NUMBER] [static]
 

Initial value:

       {
         "mysql-host-dhcp-read-write",
         "mysql-user-dhcp-read-write",
         "mysql-passwd-dhcp-read-write",
         "mysql-db-dhcp-read-write",
         "mysql-port-dhcp-read-write",
         "mysql-socket-dhcp-read-write",
         "mysql-retry-dhcp-read-write",
         "mysql-timeout-dhcp-read-write",
         "mysql-sleep-dhcp-read-write",
         "mysql-debug-dhcp-read-write",
         "mysql-log-file-dhcp-read-write",
         "mysql-reconnection-delay-dhcp-read-write"
       }
This array contains the configuration tags associated to the POOL DHCP database. (read/write database).

Definition at line 116 of file dhcp.c.

Referenced by main().


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