database.h
上传用户:luoyougen
上传日期:2008-05-12
资源大小:23136k
文件大小:6k
源码类别:

VxWorks

开发平台:

C/C++

  1. /* database.h -  DHCP server include file for database functions */
  2. /* Copyright 1984 - 2001 Wind River Systems, Inc. */
  3. /*
  4. modification history
  5. --------------------
  6. 01d,09oct01,rae  merge from truestack (remove some variables) 
  7. 01c,06aug97,spm  added definitions for C++ compilation
  8. 01b,09may97,spm  corrected declarations of hooks for storage routines
  9. 01a,07apr97,spm  created by modifying WIDE project DHCP implementation
  10. */
  11. /*
  12.  * WIDE Project DHCP Implementation
  13.  * Copyright (c) 1995 Akihiro Tominaga
  14.  * Copyright (c) 1995 WIDE Project
  15.  * All rights reserved.
  16.  *
  17.  * Permission to use, copy, modify and distribute this software and its
  18.  * documentation is hereby granted, provided only with the following
  19.  * conditions are satisfied:
  20.  *
  21.  * 1. Both the copyright notice and this permission notice appear in
  22.  *    all copies of the software, derivative works or modified versions,
  23.  *    and any portions thereof, and that both notices appear in
  24.  *    supporting documentation.
  25.  * 2. All advertising materials mentioning features or use of this software
  26.  *    must display the following acknowledgement:
  27.  *      This product includes software developed by WIDE Project and
  28.  *      its contributors.
  29.  * 3. Neither the name of WIDE Project nor the names of its contributors
  30.  *    may be used to endorse or promote products derived from this software
  31.  *    without specific prior written permission.
  32.  *
  33.  * THIS SOFTWARE IS PROVIDED BY THE DEVELOPER ``AS IS'' AND WIDE
  34.  * PROJECT DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES
  35.  * WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. ALSO, THERE
  36.  * IS NO WARRANTY IMPLIED OR OTHERWISE, NOR IS SUPPORT PROVIDED.
  37.  *
  38.  * Feedback of the results generated from any improvements or
  39.  * extensions made to this software would be much appreciated.
  40.  * Any such feedback should be sent to:
  41.  * 
  42.  *  Akihiro Tominaga
  43.  *  WIDE Project
  44.  *  Keio University, Endo 5322, Kanagawa, Japan
  45.  *  (E-mail: dhcp-dist@wide.ad.jp)
  46.  *
  47.  * WIDE project has the rights to redistribute these changes.
  48.  */
  49. #ifndef __INCdatabaseh
  50. #define __INCdatabaseh
  51. #ifdef __cplusplus
  52. extern "C" {
  53. #endif
  54. /*
  55.  * functions prototype definition
  56.  */
  57. void dump_bind_entry();
  58. static time_t strtotime();
  59. int bindcidcmp();
  60. int paramcidcmp();
  61. int resipcmp();
  62. int relayipcmp();
  63. time_t _mktime();
  64. static void read_entry();
  65. int process_entry();
  66. void set_default(struct dhcp_resource *);
  67. static void adjust();
  68. static void get_string();
  69. int eval_symbol();
  70. static void eat_whitespace();
  71. static long get_integer();
  72. static int prs_inaddr();
  73. static STATUS get_ip();
  74. static void default_netmask();
  75. int resnmcmp();
  76. static int read_idtype();
  77. static int read_cid();
  78. static int read_haddr();
  79. static int read_subnet();
  80. int proc_sname();
  81. int proc_file();
  82. int proc_tblc();
  83. int proc_mtpt();
  84. int proc_clid();
  85. int proc_class();
  86. int proc_ip();
  87. int proc_ips();
  88. int proc_ippairs();
  89. int proc_hl();
  90. int proc_hs();
  91. int proc_nl();
  92. int proc_ns();
  93. int proc_octet();
  94. int proc_str();
  95. int proc_bool();
  96. #define SUCCESS     0
  97. #define E_END_OF_ENTRY   1
  98. #define MAXENTRYLEN             4096
  99. #define MAXSTRINGLEN             260
  100. #define MAX_MTUPLTSZ             127
  101. #define MAX_IPS                   63
  102. #define MAX_IPPAIR                31
  103. #define OP_ADDITION   1 /* Operations on tags */
  104. #define OP_DELETION   2
  105. #ifndef BUFSIZ
  106. #define BUFSIZ                  1024
  107. #endif
  108. IMPORT FUNCPTR dhcpsLeaseHookRtn;
  109. IMPORT FUNCPTR dhcpsAddressHookRtn;
  110. struct symbolmap {
  111.     char *symbol;
  112.     int code;
  113.     int (*func)();
  114. };
  115. static struct symbolmap symbol_list[] = {
  116.   { "tblc", S_TABLE_CONT, proc_tblc },
  117.   { "snam", S_SNAME, proc_sname },
  118.   { "file", S_FILE, proc_file },
  119.   { "siad", S_SIADDR, proc_ip },
  120.   { "albp", S_ALLOW_BOOTP, proc_bool },
  121.   { "ipad", S_IP_ADDR, proc_ip },
  122.   { "maxl", S_MAX_LEASE, proc_hl },
  123.   { "dfll", S_DEFAULT_LEASE, proc_hl },
  124.   { "clid", S_CLIENT_ID, proc_clid },
  125.   { "pmid", S_PARAM_ID, proc_clid},
  126.   { "clas", S_CLASS_ID, proc_class},
  127.   { "snmk", S_SUBNET_MASK, proc_ip },
  128.   { "tmof", S_TIME_OFFSET, proc_nl },
  129.   { "rout", S_ROUTER, proc_ips },
  130.   { "tmsv", S_TIME_SERVER, proc_ips },
  131.   { "nmsv", S_NAME_SERVER, proc_ips },
  132.   { "dnsv", S_DNS_SERVER, proc_ips },
  133.   { "lgsv", S_LOG_SERVER, proc_ips },
  134.   { "cksv", S_COOKIE_SERVER, proc_ips },
  135.   { "lpsv", S_LPR_SERVER, proc_ips },
  136.   { "imsv", S_IMPRESS_SERVER, proc_ips },
  137.   { "rlsv", S_RLS_SERVER, proc_ips },
  138.   { "hstn", S_HOSTNAME, proc_str },
  139.   { "btsz", S_BOOTSIZE, proc_ns },
  140.   { "mdmp", S_MERIT_DUMP, proc_str },
  141.   { "dnsd", S_DNS_DOMAIN, proc_str },
  142.   { "swsv", S_SWAP_SERVER, proc_ip },
  143.   { "rpth", S_ROOT_PATH, proc_str },
  144.   { "epth", S_EXTENSIONS_PATH, proc_str },
  145.   { "ipfd", S_IP_FORWARD, proc_bool },
  146.   { "nlsr", S_NONLOCAL_SRCROUTE, proc_bool },
  147.   { "plcy", S_POLICY_FILTER, proc_ippairs },
  148.   { "mdgs", S_MAX_DGRAM_SIZE, proc_ns },
  149.   { "ditl", S_DEFAULT_IP_TTL, proc_octet },
  150.   { "mtat", S_MTU_AGING_TIMEOUT, proc_nl },
  151.   { "mtpt", S_MTU_PLATEAU_TABLE, proc_mtpt },
  152.   { "ifmt", S_IF_MTU, proc_ns },
  153.   { "asnl", S_ALL_SUBNET_LOCAL, proc_bool },
  154.   { "brda", S_BRDCAST_ADDR, proc_ip },
  155.   { "mskd", S_MASK_DISCOVER, proc_bool },
  156.   { "msks", S_MASK_SUPPLIER, proc_bool },
  157.   { "rtrd", S_ROUTER_DISCOVER, proc_bool },
  158.   { "rtsl", S_ROUTER_SOLICIT, proc_ip },
  159.   { "strt", S_STATIC_ROUTE, proc_ippairs },
  160.   { "trlr", S_TRAILER, proc_bool },
  161.   { "arpt", S_ARP_CACHE_TIMEOUT, proc_nl },
  162.   { "encp", S_ETHER_ENCAP, proc_bool },
  163.   { "dttl", S_DEFAULT_TCP_TTL, proc_octet },
  164.   { "kain", S_KEEPALIVE_INTER, proc_nl },
  165.   { "kagb", S_KEEPALIVE_GARBA, proc_bool },
  166.   { "nisd", S_NIS_DOMAIN, proc_str },
  167.   { "nisv", S_NIS_SERVER, proc_ips },
  168.   { "ntsv", S_NTP_SERVER, proc_ips },
  169.   { "nnsv", S_NBN_SERVER, proc_ips },
  170.   { "ndsv", S_NBDD_SERVER, proc_ips },
  171.   { "nbnt", S_NB_NODETYPE, proc_octet },
  172.   { "nbsc", S_NB_SCOPE, proc_str },
  173.   { "xfsv", S_XFONT_SERVER, proc_ips },
  174.   { "xdmn", S_XDISPLAY_MANAGER, proc_ips },
  175.   { "dht1", S_DHCP_T1, proc_hs },
  176.   { "dht2", S_DHCP_T2, proc_hs },
  177.   { "nspd", S_NISP_DOMAIN, proc_str },
  178.   { "nsps", S_NISP_SERVER, proc_ips },
  179.   { "miph", S_MOBILEIP_HA, proc_ips },
  180.   { "smtp", S_SMTP_SERVER, proc_ips },
  181.   { "pops", S_POP3_SERVER, proc_ips },
  182.   { "nntp", S_NNTP_SERVER, proc_ips },
  183.   { "wwws", S_DFLT_WWW_SERVER, proc_ips },
  184.   { "fngs", S_DFLT_FINGER_SERVER, proc_ips },
  185.   { "ircs", S_DFLT_IRC_SERVER, proc_ips },
  186.   { "stsv", S_STREETTALK_SERVER, proc_ips },
  187.   { "stda", S_STDA_SERVER, proc_ips }
  188. };
  189. #ifdef __cplusplus
  190. }
  191. #endif
  192. #endif