Main Page   Alphabetical List   Data Structures   File List   Data Fields   Globals  

tables.h

Go to the documentation of this file.
00001 /*! \file tables.h
00002           Header that difines all the tables structure.
00003  */
00004 
00005 #ifdef __cplusplus
00006 extern "C" {
00007 #endif
00008 
00009 #ifndef TABLES_HEADER
00010 #define TABLES_HEADER
00011 
00012 
00013 /*! \brief Maximum number of characters for a radius login.
00014  */
00015 
00016 #define LOGIN_RADIUS_SIZE 51
00017 
00018 /*! \brief Maximum number of characters for a MyDns login = radius2mydns(login).
00019            You MUST set MYDNS_LOGIN_SIZE > 2*LOGIN_RADIUS_SIZE
00020  */
00021 
00022 #define MYDNS_LOGIN_SIZE  128
00023 
00024 /*! \brief Maximum number of characters for an IP address (XXX.XXX.XXX.XXX).
00025  */ 
00026 
00027 #define IP_ADDRESS_STR_SIZE 16
00028 
00029 /*! \brief Maximum number of characters for the optionnal profile ID.
00030  */
00031 
00032 #define OPTIONNAL_PROFILE_SIZE 256
00033 
00034 /*! \brief Maximum number of characters for the radius 'ACCT' identifier.
00035  */
00036 
00037 #define ACCT_IDENTIFIER_SIZE 36
00038 
00039 /*! \brief Maximum number of characters for a label. 
00040  */
00041 
00042 #define LABEL_SIZE 256
00043 
00044 /*! \brief Maximum number of characters for a comment.
00045  */
00046 
00047 #define COMMENT_SIZE 256
00048 
00049 /*! \brief Maximum number of characters for a CIDR (XXX.XXX.XXX.XXX/N).
00050  */
00051 
00052 #define CIDR_SIZE 256
00053 
00054 /*! \brief Size, in bytes, for the option's type.
00055  */
00056 
00057 #define OPTION_TYPE_SIZE 20
00058 
00059 /*! \brief Size, in bytes, for the option's value.
00060  */
00061 
00062 #define OPTION_VALUE_SIZE 256
00063 
00064 /*! \brief Maximum number of options for a DHCP packet's profile.
00065  */
00066 
00067 #define MAX_PROFILE_OPTIONS 256
00068 
00069 /*! \brief Size of the buffer used to store the field 'MAC_ADDRESS' of the table 'LOGISTIC_RADIUS'.
00070  */
00071 
00072 #define LOGISTIC_MAC_ADDRESS_SIZE 256
00073 
00074 /*! \brief Size of the buffer used to store the field 'RADIUS_LOGIN' of the table 'LOGISTIC_RADIUS'.
00075  */
00076 
00077 #define LOGISTIC_RADIUS_LOGIN_SIZE 256
00078 
00079 /*! \brief Size of the buffer used to store the field 'LOGIN_MODEM' of the table 'LOGISTIC_RADIUS'.
00080  */
00081 
00082 #define LOGISTIC_LOGIN_MODEM_SIZE 256
00083 
00084 /*! \brief Size of the buffer used to store the field 'LOGIN_MODEM' of the table 'RADONLINE'.
00085  */ 
00086 
00087 #define LOGIN_MODEM_SIZE 128
00088 
00089 /*! \brief Number of bytes used to represent a node ID.
00090     \remark <ul>
00091                 <li>Alcatel's DSLAMs need up to 20 bytes to represent the node ID.
00092                 <li>Utstarcom's DSLAMs need up to 5 bytes (maximum value is "65535" - unsigned shot int).
00093             </ul>
00094     \warning If you modify the value of this constant, you must also modify the value of the constant
00095              NODE_BUFFER_SIZE (see file "packets_data.h"). 
00096  */
00097 
00098 #define NODE_ID_SIZE     20
00099 
00100 
00101 /*! \brief This data structure represents the table 'abonnes'.
00102  */
00103 
00104 struct table_abonnes
00105 {
00106     /*! \brief Auto incremented ID. */
00107 
00108     unsigned long int      abonnes_id;
00109 
00110     /*! \brief DSLAM's node ID. */
00111 
00112     char                   node_id[NODE_ID_SIZE];
00113 
00114     /*! \brief DSLAM's shelf number. */
00115 
00116     unsigned char          shelf;
00117 
00118     /*! \brief DSLAM's port number. */
00119 
00120     unsigned char          numero_port;
00121 
00122     /*! \brief DSLAM's slot number. */
00123 
00124     unsigned char          numero_slot;
00125 
00126     /*! \brief Client's radius login. */
00127 
00128     char                   login_radius[LOGIN_RADIUS_SIZE];
00129 
00130     /*! \brief First connection flag. */
00131 
00132     unsigned char          first_connection;
00133 
00134     /*! \brief This flag is used if the client should be assigned a specific list of DHCP options.
00135                <ul>
00136                    <li>If the field contains the value "STANDARD", it means that the client 
00137                        will receive the default list of DHCP option (depending in the VLAN tag and
00138                        the VALAN gateway).
00139                    <li>Otherwise, the value represents the pointer to the list of options that
00140                        will be sent to the client (field "profile_optionnel" of table "options").
00141                </ul>
00142      */
00143 
00144      char                  profile[OPTIONNAL_PROFILE_SIZE];
00145 
00146     /*! \brief Field 'nack_flag' of the table 'abonnes'. 
00147                This flag is used to tell the DHCP to send a NAK.
00148      */
00149 
00150      unsigned long int     nack_flag;
00151 };
00152 
00153 /*! \brief This data structure represents the table 'abonne_ip'.
00154  */
00155 
00156 struct table_abonne_ip
00157 {
00158     /*! \brief Auto incremented ID. */
00159 
00160     unsigned long int      abonne_ip_id;
00161 
00162     /*! \brief Joint key to table 'abonnes'. */
00163 
00164     unsigned long int      abonnes_id;
00165 
00166     /*! \brief Joint key to table 'vlan'. */
00167 
00168     unsigned long int      vlan_id;
00169 
00170     /*! \brief Fixed IP address for the user. */
00171 
00172     char                   ip[IP_ADDRESS_STR_SIZE];
00173 
00174     /*! \brief Gateway IP address. */
00175 
00176     char                   gateway[IP_ADDRESS_STR_SIZE];
00177 
00178     /*! \brief Subnet IP. */
00179 
00180     char                   subnet[IP_ADDRESS_STR_SIZE];
00181 };
00182 
00183 /*! \brief This structure represents the table 'vlan'.
00184  */
00185 
00186 struct table_vlan
00187 {
00188    /*! \brief Auto incremented ID. */
00189 
00190    unsigned long int      vlan_id;
00191 
00192    /*! \brief Optionnal profile. */
00193 
00194    char                   profile_optionnel[OPTIONNAL_PROFILE_SIZE];
00195 
00196    /*! \brief VLAN ID (from Option 82). */
00197 
00198    unsigned long int      vlan_tag;
00199 
00200    /*! \brief VLAN gateway. */
00201 
00202    char                   vlan_gateway[IP_ADDRESS_STR_SIZE];
00203 
00204    /*! \brief Radius 'ACCT' identifier. */
00205 
00206    char                   radius_identifiant[ACCT_IDENTIFIER_SIZE];
00207 
00208    /*! \brief Label. */
00209 
00210    char                   libelle[LABEL_SIZE];
00211 
00212    /*! \brief Comment. */
00213 
00214    char                   comment[COMMENT_SIZE];
00215 
00216    /*! \brief Timeout for a DHCP offer. */
00217 
00218    unsigned long int      offer_timeout;
00219 };
00220 
00221 /*! \brief This table represents the table 'options'.
00222  */
00223 
00224 struct table_options
00225 {
00226   /*! \brief "Auto incremented" ID. */
00227 
00228   unsigned long int      options_id;
00229 
00230   /*! \brief Profile's ID. */
00231 
00232   char                   profile_optionnel[OPTIONNAL_PROFILE_SIZE];
00233 
00234   /*! \brief Option's code. */
00235 
00236   unsigned char          option_code;
00237 
00238   /*! \brief Option's type. */
00239 
00240   char                   option_type[OPTION_TYPE_SIZE];
00241 
00242   /*! \brief Option's value. */
00243 
00244   char                   option_value[OPTION_VALUE_SIZE];
00245 
00246   /*! \brief Comment. */
00247 
00248   char                   comment[COMMENT_SIZE];
00249 };
00250 
00251 
00252 /*! \brief This table represents the table 'ip_lease'.
00253  */
00254 
00255 struct table_ip_lease
00256 {
00257   /*! \brief "Auto incremented" ID. */
00258 
00259   unsigned long int      ip_lease_id;
00260 
00261   /*! \brief Joint key to the table "vlan". */
00262 
00263   unsigned long int      vlan_id;
00264 
00265   /*! \brief "CIRD", as given from Ogre. */
00266 
00267   char                   cidr[CIDR_SIZE];
00268 
00269   /*! \brief Subnet IP. */
00270 
00271   char                   subnet[IP_ADDRESS_STR_SIZE];
00272 
00273   /*! \brief Gateway IP address. */
00274 
00275   char                   gateway[IP_ADDRESS_STR_SIZE];
00276 };
00277 
00278 /*! \brief This table represents the table 'pool'.
00279  */
00280 
00281 struct table_pool
00282 {
00283   /*! \brief "Auto incremented" ID. */
00284 
00285   unsigned long int      pool_id;
00286 
00287   /*! \brief Joint key to the table "ip_lease". */
00288 
00289   unsigned long int      ip_lease_id;
00290 
00291   /*! \brief Joint key to the table "abonnes". */
00292 
00293   unsigned long int      abonnes_id;
00294 
00295   /*! \brief IP address. */
00296 
00297   char                   ip[IP_ADDRESS_STR_SIZE];
00298 
00299   /*! \brief Expiration timestamp. */
00300 
00301   unsigned long int      expiration;
00302 
00303 };
00304 
00305 /*! \brief This structure represents the table 'LOGISTIC_RADIUS' of the database 'autoconf'.
00306  */
00307 
00308 struct table_logistic_radius
00309 {
00310   /*! \brief Field 'MAC_ADDRESS'. */
00311 
00312   char MAC_ADDRESS[LOGISTIC_MAC_ADDRESS_SIZE];
00313 
00314   /*! \brief Field 'RADIUS_LOGIN'. */
00315 
00316   char RADIUS_LOGIN[LOGISTIC_RADIUS_LOGIN_SIZE];
00317 
00318   /*! \brief Field 'LOGIN_MODEM'. */
00319 
00320   char LOGIN_MODEM[LOGISTIC_LOGIN_MODEM_SIZE];
00321 
00322   /*! \brief Field 'FLAG_CHECK_RADIUS'. */
00323 
00324   int FLAG_CHECK_RADIUS;
00325 
00326   /* -------------------------------------------------------- */
00327   /* The following fields are not part of the DB tables       */
00328   /* -------------------------------------------------------- */
00329 
00330   /*! \brief This field is not part of the table 'LOGISTIC_RADIUS'. But it will be used when
00331              the server update the Radonline database.
00332              If this string is not empty, then the Radonline ACCT_IDENTIFIER inserted in the 
00333              Radonline table will be the value of this string.
00334    */
00335 
00336   char radonline_acct_identifier[ACCT_IDENTIFIER_SIZE];
00337 
00338   /*! \brief This field is not part of the table 'LOGISTIC_RADIUS'. But it will be used when
00339              the server update the Radonline database.
00340              If this string is not empty, then the USERNAME inserted in the Radonline table
00341              will be the value of this string.
00342    */
00343 
00344   char radonline_user_name[LOGIN_RADIUS_SIZE];
00345 
00346   /*! \brief This field is not part of the table 'LOGISTIC_RADIUS'. But it will be used when
00347              the server update the Radonline database.
00348              If this string is not empty, then the LOGIN_MODEM inserted in the Radonline table
00349              will be the value of this string.
00350    */
00351 
00352   char login_modem[LOGISTIC_LOGIN_MODEM_SIZE];
00353 
00354   /*! \brief This field is not part of the table 'LOGISTIC_RADIUS'.
00355              This fields identifies the modem's manufacturor.
00356    */
00357 
00358   int modem_manufacturor;
00359 };
00360 
00361 /*! \brief This structure contains all the database description.
00362  */
00363 
00364 struct mysql_tables
00365 {
00366   /*! \brief Table 'abonnes'. */
00367 
00368   struct table_abonnes abonnes;
00369 
00370   /*! \brief Table 'abonne_ip'. */
00371 
00372   struct table_abonne_ip abonne_ip;
00373 
00374   /*! \brief Table 'vlan'. */
00375 
00376   struct table_vlan vlan;
00377 
00378   /*! \brief Table 'options'. */
00379 
00380   struct table_options options[MAX_PROFILE_OPTIONS];
00381 
00382   /*! \brief Table 'ip_lease'. */
00383 
00384   struct table_ip_lease ip_lease;
00385 
00386   /*! \brief Table 'pool'. */
00387 
00388   struct table_pool pool;
00389 
00390   /*! \brief Table 'logistic'. */
00391 
00392   struct table_logistic_radius logistic;
00393 
00394   /*! \brief Number of elements in the array of options (field 'options').
00395    */
00396 
00397   int option_number;
00398 };
00399 
00400 #endif
00401 
00402 #ifdef __cplusplus
00403 }
00404 #endif
00405 
00406 
00407 
00408 

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