Main Page   Alphabetical List   Data Structures   File List   Data Fields   Globals  

mysql_interface.h

Go to the documentation of this file.
00001 /*! \file mysql_interface.h
00002           Header file for the MySql module 'mysql_interface.c'.
00003  */
00004 
00005 #ifdef __cplusplus
00006 extern "C" {
00007 #endif
00008 
00009 
00010 #ifndef MY_MYSQL_INTERFACE_HEADER_FILE_
00011 #define MY_MYSQL_INTERFACE_HEADER_FILE_
00012 
00013   #include "mysql_header.h"
00014   #include "tables.h"
00015   #include "server_config.h"
00016   #include "packets_data.h"
00017 
00018   /* ------------------------------------------------- */
00019   /* Return values                                     */
00020   /* ------------------------------------------------- */
00021 
00022   /*! \brief Return value for the functions:
00023              <UL>
00024                <LI>load_abonnes
00025                <LI>load_vlan
00026                <LI>load_abonne_ip
00027                <LI>load_options
00028                <LI>load_ip_lease
00029                <LI>load_pool
00030                <LI>try_reserve_ip_from_pool
00031                <LI>try_find_and_reserve_ip_from_pool
00032                <LI>release_ip_from_pool 
00033                <LI>load_context
00034                <LI>find_ip_in_vlan_pool
00035                <LI>get_ip_from_pool
00036              </UL>
00037              The SQL request was skiped because the reconnection delay did not expire.
00038    */
00039 
00040   #define MYSQL_INTERFACE_REQUEST_SKIPED         -1
00041 
00042   /*! \brief Return value for the functions:
00043              <UL>
00044                <LI>load_abonnes
00045                <LI>load_vlan
00046                <LI>load_abonne_ip
00047                <LI>load_options
00048                <LI>load_ip_lease
00049                <LI>load_pool
00050                <LI>try_reserve_ip_from_pool
00051                <LI>try_find_and_reserve_ip_from_pool
00052                <LI>release_ip_from_pool 
00053                <LI>load_context
00054                <LI>find_ip_in_vlan_pool
00055                <LI>get_ip_from_pool
00056              </UL>
00057              Connection with the MySql server was lost.
00058    */
00059 
00060   #define MYSQL_INTERFACE_CONNECTION_LOST        -2
00061 
00062   /*! \brief Return value for the functions:
00063              <UL>
00064                <LI>load_abonnes
00065                <LI>load_vlan
00066                <LI>load_abonne_ip
00067                <LI>load_options
00068                <LI>load_ip_lease
00069                <LI>load_pool
00070                <LI>try_reserve_ip_from_pool
00071                <LI>try_find_and_reserve_ip_from_pool
00072                <LI>release_ip_from_pool 
00073                <LI>load_context
00074                <LI>find_ip_in_vlan_pool
00075                <LI>get_ip_from_pool
00076              </UL>
00077              Could not reconnect to the MySql server.
00078    */
00079 
00080   #define MYSQL_INTERFACE_RECONNECTION_FAILED    -3
00081 
00082   /*! \brief Return value for the functions:
00083              <UL>
00084                <LI>load_abonnes
00085                <LI>load_vlan
00086                <LI>load_abonne_ip
00087                <LI>load_options
00088                <LI>load_ip_lease
00089                <LI>load_pool
00090                <LI>try_reserve_ip_from_pool
00091                <LI>try_find_and_reserve_ip_from_pool
00092                <LI>release_ip_from_pool 
00093                <LI>load_context
00094                <LI>find_ip_in_vlan_pool
00095                <LI>get_ip_from_pool
00096              </UL>
00097              A SQL error occured.
00098    */
00099 
00100   #define MYSQL_INTERFACE_SQL_PROBLEM            -4
00101 
00102   /*! \brief Return value for the functions:
00103              <UL>
00104                <LI>load_abonnes
00105                <LI>load_vlan
00106                <LI>load_abonne_ip
00107                <LI>load_options
00108                <LI>load_ip_lease
00109                <LI>load_pool
00110                <LI>try_reserve_ip_from_pool
00111                <LI>try_find_and_reserve_ip_from_pool
00112                <LI>release_ip_from_pool 
00113                <LI>load_context
00114                <LI>find_ip_in_vlan_pool
00115                <LI>get_ip_from_pool
00116              </UL>
00117              An unexpected error occured.
00118    */
00119 
00120   #define MYSQL_INTERFACE_UNEXPECTED_ERROR       -5
00121 
00122   /*! \brief Return value for the functions:
00123              <UL>
00124                <LI>load_abonnes
00125                <LI>load_vlan
00126                <LI>load_abonne_ip
00127                <LI>load_options
00128                <LI>load_ip_lease
00129                <LI>load_pool
00130                <LI>load_context
00131              </UL>
00132              Could not found the requested data in the database (no row matched the WHERE statement).
00133   */
00134 
00135   #define MYSQL_INTERFACE_NOT_FOUND              -6
00136 
00137   /*! \brief Return value for the functions:
00138              <UL>
00139                <LI>load_abonnes
00140                <LI>load_vlan
00141                <LI>load_abonne_ip
00142                <LI>load_ip_lease
00143                <LI>load_pool
00144                <LI>load_context
00145                <LI>find_ip_in_vlan_pool
00146                <LI>get_ip_from_pool
00147              </UL>
00148              Find more than one data in the database (several rows row matched the WHERE statement).
00149       \remark This error should not happen due to database constraints.
00150    */
00151 
00152   #define MYSQL_INTERFACE_MORE_THAN_ONE          -7
00153 
00154   /*! \brief Return value for the functions:
00155              <UL>
00156                <LI>load_options
00157                <LI>load_context
00158              </UL>
00159              Find more options than the maximum allowed. 
00160       \remark This error should not happen.
00161    */
00162 
00163   #define MYSQL_INTERFACE_TOO_MANY_ITEMS         -8
00164 
00165   /*! \brief Return value for the all functions that need to get the UNIX timestamp from the MySql server.
00166              <UL>
00167                <LI>load_pool
00168                <LI>try_reserve_ip_from_pool
00169                <LI>try_find_and_reserve_ip_from_pool
00170                <LI>release_ip_from_pool
00171                <LI>find_ip_in_vlan_pool
00172                <LI>get_ip_from_pool
00173              </UL>
00174    */
00175 
00176   #define MYSQL_INTERFACE_NO_TIMESTAMP           -9
00177 
00178   /*! \brief Return value for the the functions:
00179              <UL>
00180                <LI>find_ip_in_vlan_pool
00181                <LI>get_ip_from_pool
00182              </UL>
00183              Could not find any lease ID associated with the given vlan_id.
00184    */
00185 
00186   #define MYSQL_INTERFACE_NO_LEASE_ID            -10
00187 
00188   /*! \brief Return value for the the functions:
00189              <UL>
00190                <LI>find_ip_in_vlan_pool
00191              </UL>
00192              Could not find any lease IP address associated with the given vlan_id and abonnes_id in the pool.
00193   */ 
00194 
00195   #define MYSQL_INTERFACE_NO_IP_FOUND            -11
00196 
00197   /*! \brief Return value for the the functions:
00198              <UL>
00199                 <LI>
00200              </UL>
00201              Found a MAC address in table 'LOGISTIC_RADIUS' while deleting it.
00202    */
00203 
00204   #define MYSQL_INTERFACE_MAC_ADDRESS_FOUND      -12
00205 
00206   /* ------------------------------------------------- */
00207   /* Functionnal interface                             */
00208   /* ------------------------------------------------- */
00209 
00210   #ifdef TESTS_UNITAIRES
00211 
00212       int load_abonnes (struct smysql *mysql_info,
00213                         struct mysql_tables *mysql_tables,
00214                         struct global_config *config);
00215       int load_vlan (struct smysql *mysql_info,
00216                      struct smysql *mysql_tables,
00217                      struct mysql_tables *mysql_info_pool, 
00218                      struct global_config *config); 
00219       int load_ip_lease (struct smysql *mysql_info,
00220                          struct mysql_tables *mysql_tables,
00221                          struct global_config *config);
00222       int load_pool (struct smysql *mysql_info,
00223                      struct mysql_tables *mysql_tables,
00224                      struct global_config *config); 
00225       int try_reserve_ip_from_pool (struct smysql *mysql_info,
00226                                     struct mysql_tables *mysql_tables,
00227                                     struct global_config *config,
00228                                     unsigned long int timeout);
00229       int try_find_and_reserve_ip_from_pool (struct smysql *mysql_info,
00230                                              struct mysql_tables *mysql_tables,
00231                                              struct global_config *config,
00232                                              unsigned long int timeout);
00233       int send_to_radonline (struct smysql *mysql_info,
00234                              struct mysql_tables *mysql_tables,
00235                              char *ip,
00236                              int action,
00237                              struct global_config *config);
00238       int send_to_mydns (struct smysql *mysql_info,
00239                          struct mysql_tables *mysql_tables,
00240                          char *ip,
00241                          int action,
00242                          struct global_config *config);
00243 
00244       #ifdef NOT_USED
00245 
00246       int select_login_modem_from_logistic (struct smysql *mysql_info,
00247                                             char *login_modem,
00248                                             struct global_config *config);
00249       int delete_mac_address_from_logistic (struct smysql        *mysql_info,
00250                                             char                 *mac_address,
00251                                             struct global_config *config);
00252 
00253       #endif
00254 
00255   #endif
00256 
00257   int mydns_init (struct smysql *mysql_info);
00258 
00259   void clear_tables (struct mysql_tables *mysql_tables);
00260   int get_ip_from_pool (struct smysql *mysql_info,
00261                         struct mysql_tables *mysql_tables,
00262                         struct global_config *config,
00263                         unsigned int timeout,
00264                         int reserve_ip);
00265   int load_context (struct smysql *mysql_info,
00266                     struct smysql *mysql_info_write,
00267                     struct mysql_tables *mysql_tables,
00268                     struct global_config *config);
00269   int load_abonne_ip (struct smysql *mysql_info,
00270                       struct mysql_tables *mysql_tables,
00271                       struct global_config *config);
00272   int load_options (struct smysql *mysql_info,
00273                     struct mysql_tables *mysql_tables,
00274                     struct global_config *config);
00275   int find_ip_in_vlan_pool (struct smysql *mysql_info,
00276                             struct mysql_tables *mysql_tables,
00277                             struct global_config *config);
00278   int release_ip_from_pool (struct smysql *mysql_info,
00279                             struct mysql_tables *mysql_tables,
00280                             struct global_config *config);
00281   int send_to_radonline (struct smysql *mysql_info,
00282                          struct mysql_tables *mysql_tables,
00283                          char *ip,
00284                          int action,
00285                          struct global_config *config);
00286   int send_to_mydns (struct smysql *mysql_info,
00287                      struct mysql_tables *mysql_tables,
00288                      char *ip,
00289                      int action,
00290                      struct global_config *config);
00291   int load_logistic (struct smysql *mysql_info,
00292                      struct mysql_tables *mysql_tables,
00293                      struct global_config *config);
00294   int blackhole_abonne (struct smysql *mysql_info,
00295                         struct mysql_tables *mysql_tables,
00296                         struct global_config *config);
00297   int nack_flag_abonne (struct smysql          *mysql_info,
00298                         struct mysql_tables    *mysql_tables,
00299                         struct global_config   *config,
00300                         unsigned long int      new_value);
00301   int set_flag_check_radius (struct smysql *mysql_info,
00302                              struct mysql_tables *mysql_tables,
00303                              struct global_config *config);
00304   int signal_unknown_mac_address (struct smysql *mysql_info,
00305                                   struct mysql_tables *mysql_tables,
00306                                   struct global_config *config);
00307   int remove_autoconf_bh (struct smysql *mysql_info,
00308                           struct mysql_tables *mysql_tables,
00309                           struct global_config *config);
00310 
00311 #endif
00312 
00313 #ifdef __cplusplus
00314 }
00315 #endif
00316 

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