Thread: [Dhcp-agent-commits] CVS: dhcp-agent dhcp-convert.h,NONE,1.1 dhcp-rtt.h,NONE,1.1 dhcp-sysconf.h,NONE
Status: Alpha
Brought to you by:
actmodern
From: Thamer Al-H. <act...@us...> - 2002-05-30 06:44:09
|
Update of /cvsroot/dhcp-agent/dhcp-agent In directory usw-pr-cvs1:/tmp/cvs-serv14887 Modified Files: dhcp-agent.h dhcp-client-cache.c dhcp-client-states.c dhcp-convert.c dhcp-files.h dhcp-globconf.c dhcp-icmp-discovery.c dhcp-net.c dhcp-rtt.c dhcp-sysconf.c Added Files: dhcp-convert.h dhcp-rtt.h dhcp-sysconf.h Log Message: more header fileage --- NEW FILE: dhcp-convert.h --- /* $Header: /cvsroot/dhcp-agent/dhcp-agent/dhcp-convert.h,v 1.1 2002/05/30 06:44:05 actmodern Exp $ * * Copyright 2001 Thamer Alharbash * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * 3. The names of the authors may not be used to endorse or promote * products derived from this software without specific prior * written permission. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. * */ #ifndef DHCP_CONVERT_H #define DHCP_CONVERT_H /* conversion handler. */ typedef struct option_convert_handler { char* (*serialize)(const unsigned char *data, int len); void* (*serialize_to_internal)(const char *string); void* (*serialize_to_network)(const char *string, unsigned char *retlen); void (*free_internal)(void *ptr); } option_convert_handler; /* global conversion handlers. */ extern option_convert_handler option_convert_handlers[]; /* conversion routines. */ /* byte routines. */ extern char *network_byte_to_string_byte(const unsigned char *data, int len); extern void *string_byte_to_byte(const char *s); extern void *string_byte_to_network(const char *s, unsigned char *ret_len); /* address routines. */ extern char *network_addr_to_string(const unsigned char *data, int len); extern char *network_addr_list_to_string(const unsigned char *data, int len); extern char *addr_list_to_string(const unsigned char *data, int len); extern void *string_to_addr_list(const char *string); extern void *string_to_addr(const char *string); extern void *string_addr_list_to_network(const char *string, unsigned char *len_ret); extern void *string_addr_to_network(const char *string, unsigned char *len_ret); extern char *network_addr_pair_list_to_string(const unsigned char *data, int len); extern void *string_to_addr_pair_list(const char *s); extern void *string_addr_pair_list_to_network(const char *s, unsigned char *retlen); /* integer routines. */ extern char *network_uint32_to_string(const unsigned char *data, int len); extern char *network_int32_to_string(const unsigned char *data, int len); extern char *network_uint16_to_string(const unsigned char *data, int len); extern char *network_int16_to_string(const unsigned char *data, int len); extern char *uint32_to_string(const unsigned char *data, int len); extern char *int32_to_string(const unsigned char *data, int len); extern char *uint16_to_string(const unsigned char *data, int len); extern char *int16_to_string(const unsigned char *data, int len); extern void *string_to_uint32(const char *s); extern void *string_to_int32(const char *s); extern void *string_to_uint16(const char *s); extern void *string_to_int16(const char *s); extern void *string_int32_to_network(const char *s, unsigned char *ret_len); extern void *string_uint32_to_network(const char *s, unsigned char *ret_len); extern void *string_int16_to_network(const char *s, unsigned char *ret_len); extern void *string_uint16_to_network(const char *s, unsigned char *ret_len); extern char *network_uint16_list_to_string(const unsigned char *data, int len); extern void *string_to_uint16_list(const char *s); extern void *string_uint16_list_to_network(const char *s, unsigned char *retlen); /* network to string */ extern char *validate_network_string_to_string(const unsigned char *data, int len); extern void *strdup_wrap(const char *s); extern void *strdup_wrap_net(const char *s, unsigned char *ret_len); /* static network address conversion routine */ extern char *network_address_to_string_static(uint32_t addr); #endif /* DHCP_CONVERT_H */ --- NEW FILE: dhcp-rtt.h --- /* $Header: /cvsroot/dhcp-agent/dhcp-agent/dhcp-rtt.h,v 1.1 2002/05/30 06:44:06 actmodern Exp $ * * Copyright 2001 Thamer Alharbash * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * 3. The names of the authors may not be used to endorse or promote * products derived from this software without specific prior * written permission. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. * */ #ifndef DHCP_RTT_H #define DHCP_RTT_H /* timeout as per rfc2131 */ #define MILLISECOND_TIMEOUT 4000 #define MILLISECOND_RAND_TIMEOUT 1000 #define MAX_SECS_WAIT 64 /* as mentioned in rfc2131, * 64 seconds is the upper limit of waiting time. */ /* Utility macros. */ #define SECS_TO_MSECS(x) (x * 1000) #define MSECS_TO_SECS(x) (x/1000) #define MSECS_TO_MSECS_REM(x) (x%1000) /* rtt struct. */ typedef struct rtt { struct timeval timeout; } rtt_t; /* prototypes. */ extern rtt_t *rtt_create(void); extern struct timeval rtt_get_timeout(rtt_t *rtt); extern void rtt_timeout(rtt_t *rtt); extern int rtt_can_retry(rtt_t *rtt); extern void rtt_destroy(rtt_t *rtt); #endif /* DHCP_RTT_H */ --- NEW FILE: dhcp-sysconf.h --- /* $Header: /cvsroot/dhcp-agent/dhcp-agent/dhcp-sysconf.h,v 1.1 2002/05/30 06:44:06 actmodern Exp $ * * Copyright 2001 Thamer Alharbash * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * 3. The names of the authors may not be used to endorse or promote * products derived from this software without specific prior * written permission. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. * */ #ifndef SYSCONF_H #define SYSCONF_H /* Sysconf handler. */ typedef struct { int (*sysconf_handler)(void *value, dhcp_client_control_t *dc); } sysconf_handler; /* System configuration routines. */ extern int sysconf_routers(void *value, dhcp_client_control_t *dc); extern int sysconf_domain_name_servers(void *value, dhcp_client_control_t *dc); extern int sysconf_domain_name(void *value, dhcp_client_control_t *dc); extern void do_sysconf(list_t *options, dhcp_client_control_t *dc); #endif /* SYSCONF_H */ Index: dhcp-agent.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-agent.h,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** dhcp-agent.h 29 May 2002 03:12:54 -0000 1.41 --- dhcp-agent.h 30 May 2002 06:44:05 -0000 1.42 *************** *** 131,147 **** # define BYTE_STRING_SIZE 5 - /* timeout as per rfc2131 */ - - #define MILLISECOND_TIMEOUT 4000 - #define MILLISECOND_RAND_TIMEOUT 1000 - #define MAX_SECS_WAIT 64 /* as mentioned in rfc2131, - * 64 seconds is the upper limit of waiting time. */ - - /* Utility macros. */ - - #define SECS_TO_MSECS(x) (x * 1000) - #define MSECS_TO_SECS(x) (x/1000) - #define MSECS_TO_MSECS_REM(x) (x%1000) - /* Reasonable defaults in case services db isn't up to date. */ --- 131,134 ---- *************** *** 377,399 **** } option_handler; - /* Sysconf handler. */ - - typedef struct { - int (*sysconf_handler)(void *value, dhcp_client_control_t *dc); - } sysconf_handler; - - typedef struct option_convert_handler { - char* (*serialize)(const unsigned char *data, int len); - void* (*serialize_to_internal)(const char *string); - void* (*serialize_to_network)(const char *string, unsigned char *retlen); - void (*free_internal)(void *ptr); - } option_convert_handler; - - typedef struct rtt { - struct timeval timeout; - } rtt_t; - - /* to string handler. */ - /* * * * * * * * Constants * --- 364,367 ---- *************** *** 884,902 **** extern int client_setup(dhcp_client_control_t *dc); - /* System configuration routines. */ - - extern int sysconf_routers(void *value, dhcp_client_control_t *dc); - extern int sysconf_domain_name_servers(void *value, dhcp_client_control_t *dc); - extern int sysconf_domain_name(void *value, dhcp_client_control_t *dc); - extern void do_sysconf(list_t *options, dhcp_client_control_t *dc); - - /* RTT mechanism object. */ - - extern rtt_t *rtt_create(void); - extern struct timeval rtt_get_timeout(rtt_t *rtt); - extern void rtt_timeout(rtt_t *rtt); - extern int rtt_can_retry(rtt_t *rtt); - extern void rtt_destroy(rtt_t *rtt); - /* Global vars. */ --- 852,855 ---- *************** *** 907,971 **** extern char *dhcp_conf_options_strings[]; extern option_handler option_handlers[]; - extern option_convert_handler option_convert_handlers[]; extern char *dhcp_options_strings[]; - - /* conversion routines. */ - - /* serialization functions. */ - - /* byte routines. */ - - extern char *network_byte_to_string_byte(const unsigned char *data, int len); - extern void *string_byte_to_byte(const char *s); - extern void *string_byte_to_network(const char *s, unsigned char *ret_len); - - /* address routines. */ - - extern char *network_addr_to_string(const unsigned char *data, int len); - extern char *network_addr_list_to_string(const unsigned char *data, int len); - extern char *addr_list_to_string(const unsigned char *data, int len); - extern void *string_to_addr_list(const char *string); - extern void *string_to_addr(const char *string); - extern void *string_addr_list_to_network(const char *string, unsigned char *len_ret); - extern void *string_addr_to_network(const char *string, unsigned char *len_ret); - extern char *network_addr_pair_list_to_string(const unsigned char *data, int len); - extern void *string_to_addr_pair_list(const char *s); - extern void *string_addr_pair_list_to_network(const char *s, unsigned char *retlen); - - /* integer routines. */ - - extern char *network_uint32_to_string(const unsigned char *data, int len); - extern char *network_int32_to_string(const unsigned char *data, int len); - extern char *network_uint16_to_string(const unsigned char *data, int len); - extern char *network_int16_to_string(const unsigned char *data, int len); - - extern char *uint32_to_string(const unsigned char *data, int len); - extern char *int32_to_string(const unsigned char *data, int len); - extern char *uint16_to_string(const unsigned char *data, int len); - extern char *int16_to_string(const unsigned char *data, int len); - - extern void *string_to_uint32(const char *s); - extern void *string_to_int32(const char *s); - extern void *string_to_uint16(const char *s); - extern void *string_to_int16(const char *s); - - extern void *string_int32_to_network(const char *s, unsigned char *ret_len); - extern void *string_uint32_to_network(const char *s, unsigned char *ret_len); - extern void *string_int16_to_network(const char *s, unsigned char *ret_len); - extern void *string_uint16_to_network(const char *s, unsigned char *ret_len); - - extern char *network_uint16_list_to_string(const unsigned char *data, int len); - extern void *string_to_uint16_list(const char *s); - extern void *string_uint16_list_to_network(const char *s, unsigned char *retlen); - - /* network to string */ - - extern char *validate_network_string_to_string(const unsigned char *data, int len); - extern void *strdup_wrap(const char *s); - extern void *strdup_wrap_net(const char *s, unsigned char *ret_len); - - /* static network address conversion routine */ - - extern char *network_address_to_string_static(uint32_t addr); #endif /* DHCP_AGENT_H */ --- 860,864 ---- Index: dhcp-client-cache.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-client-cache.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** dhcp-client-cache.c 29 May 2002 03:12:54 -0000 1.7 --- dhcp-client-cache.c 30 May 2002 06:44:05 -0000 1.8 *************** *** 26,29 **** --- 26,30 ---- #include <dhcp-agent.h> #include <dhcp-files.h> + #include <dhcp-convert.h> /* constructor. */ Index: dhcp-client-states.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-client-states.c,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** dhcp-client-states.c 19 May 2002 00:34:22 -0000 1.20 --- dhcp-client-states.c 30 May 2002 06:44:05 -0000 1.21 *************** *** 27,30 **** --- 27,31 ---- #include <dhcp-agent.h> + #include <dhcp-sysconf.h> /* alarm handling routine and variable. */ Index: dhcp-convert.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-convert.c,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** dhcp-convert.c 29 May 2002 03:12:54 -0000 1.11 --- dhcp-convert.c 30 May 2002 06:44:05 -0000 1.12 *************** *** 32,35 **** --- 32,36 ---- #include <dhcp-agent.h> + #include <dhcp-convert.h> /* We have four handlers: Index: dhcp-files.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-files.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** dhcp-files.h 29 May 2002 03:12:54 -0000 1.1 --- dhcp-files.h 30 May 2002 06:44:05 -0000 1.2 *************** *** 1,2 **** --- 1,27 ---- + /* $Header$ + * Copyright 2001 Thamer Alharbash <tm...@wh...> + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. The names of the authors may not be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + * + * Handles our variable files. + * + */ + #ifndef DHCP_FILE #define DHCP_FILE Index: dhcp-globconf.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-globconf.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** dhcp-globconf.c 29 May 2002 03:12:54 -0000 1.2 --- dhcp-globconf.c 30 May 2002 06:44:05 -0000 1.3 *************** *** 31,34 **** --- 31,35 ---- #include <dhcp-globconf.h> #include <dhcp-files.h> + #include <dhcp-convert.h> /* change this before... */ Index: dhcp-icmp-discovery.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-icmp-discovery.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** dhcp-icmp-discovery.c 25 May 2002 20:55:36 -0000 1.9 --- dhcp-icmp-discovery.c 30 May 2002 06:44:05 -0000 1.10 *************** *** 29,32 **** --- 29,33 ---- #include <dhcp-agent.h> #include <dhcp-globconf.h> + #include <dhcp-convert.h> /* Check for icmp mask response. */ Index: dhcp-net.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-net.c,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** dhcp-net.c 25 May 2002 14:02:30 -0000 1.21 --- dhcp-net.c 30 May 2002 06:44:05 -0000 1.22 *************** *** 62,65 **** --- 62,66 ---- #include <dhcp-agent.h> + #include <dhcp-rtt.h> /* Get port number for named service. */ Index: dhcp-rtt.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-rtt.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** dhcp-rtt.c 5 Feb 2002 13:47:38 -0000 1.4 --- dhcp-rtt.c 30 May 2002 06:44:06 -0000 1.5 *************** *** 23,26 **** --- 23,27 ---- #include <dhcp-agent.h> + #include <dhcp-rtt.h> static struct timeval make_timeval(time_t milliseconds) Index: dhcp-sysconf.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-sysconf.c,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** dhcp-sysconf.c 29 May 2002 03:12:54 -0000 1.12 --- dhcp-sysconf.c 30 May 2002 06:44:06 -0000 1.13 *************** *** 27,30 **** --- 27,32 ---- #include <dhcp-agent.h> #include <dhcp-files.h> + #include <dhcp-convert.h> + #include <dhcp-sysconf.h> /* Only use handlers here which can be done in any order. |