[dhcp-agent-commits] dhcp-agent/src dhcp-local.h,NONE,1.1 Makefile.am,1.2,1.3 dhcp-util.c,1.3,1.4 dh
Status: Alpha
Brought to you by:
actmodern
Update of /cvsroot/dhcp-agent/dhcp-agent/src In directory usw-pr-cvs1:/tmp/cvs-serv30990 Modified Files: Makefile.am dhcp-util.c dhcp-stringbuffer.c dhcp-snprintf.c dhcp-log.c dhcp-list.c dhcp-libutil.h Added Files: dhcp-local.h Removed Files: dhcp-util.h Log Message: redid utility library layout and some additional minor changes --- NEW FILE: dhcp-local.h --- /* $Header: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-local.h,v 1.1 2002/11/03 16:34:55 actmodern Exp $ * * Copyright 2002 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. * * Local header file. Here we set all local settings and include * system headers. * */ #ifndef DHCP_LOCAL_H #define DHCP_LOCAL_H #define __STDC_FORMAT_MACROS /* we need the C99 type macros. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include <stdlib.h> #include <stdio.h> #include <sys/types.h> #include <sys/time.h> #include <string.h> #include <unistd.h> #include <syslog.h> #include <signal.h> #include <stdarg.h> #include <inttypes.h> #include <dnet.h> #include <pcap.h> /* XXX -- ??? -- what's the deal with this? must remember. */ /* must be placed in main source of each binary. * if not available. */ extern const char *__progname; #endif /* DHCP_LOCAL_H */ Index: Makefile.am =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/Makefile.am,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Makefile.am 30 Oct 2002 05:00:46 -0000 1.2 --- Makefile.am 3 Nov 2002 16:34:55 -0000 1.3 *************** *** 9,33 **** # Programs we are compiling. #bin_PROGRAMS = dhcp-sniff dhcp-client ! lib_LTLIBRARIES = libutil.la ! ! libutil_la_SOURCES = dhcp-util.c dhcp-util.h \ ! dhcp-stringbuffer.c \ ! dhcp-list.c \ ! dhcp-log.c \ ! dhcp-snprintf.c \ ! dhcp-libutil.h ! # Main network code. ! # RAWNET_SOURCES = \ ! # dhcp-net.c \ ! # dhcp-align.c \ ! # dhcp-com.c \ ! # dhcp-eth.c \ ! # dhcp-ip.c \ ! # dhcp-udp.c \ ! # dhcp-arp.c \ ! # dhcp-icmp.c \ ! # dhcp-rtt.c \ ! dhcp-interface.c # dhcp_sniff_SOURCES = \ --- 9,30 ---- # Programs we are compiling. #bin_PROGRAMS = dhcp-sniff dhcp-client ! lib_LTLIBRARIES = libdhcputil.la ! libdhcputil_la_SOURCES = dhcp-util.c \ ! dhcp-util.h \ ! dhcp-stringbuffer.c \ ! dhcp-list.c \ ! dhcp-log.c \ ! dhcp-snprintf.c ! # dhcp-rawnet.c \ ! # dhcp-align.c \ ! # dhcp-com.c \ ! # dhcp-eth.c \ ! # dhcp-ip.c \ ! # dhcp-udp.c \ ! # dhcp-arp.c \ ! # dhcp-icmp.c \ ! # dhcp-rtt.c \ ! # dhcp-interface.c # dhcp_sniff_SOURCES = \ Index: dhcp-util.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-util.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** dhcp-util.c 30 Oct 2002 05:11:17 -0000 1.3 --- dhcp-util.c 3 Nov 2002 16:34:55 -0000 1.4 *************** *** 27,32 **** #define MODULE_NAME "dhcp-util" ! #include <dhcp-util.h> ! #include <dhcp-libutil.h> static uint8_t interactive = 1; --- 27,32 ---- #define MODULE_NAME "dhcp-util" ! #include "dhcp-local.h" ! #include "dhcp-libutil.h" static uint8_t interactive = 1; *************** *** 455,458 **** --- 455,462 ---- } + /* Random number generation. * + * We're interfacing into dnet's code * + * here. */ + static rand_t *ran_gen = NULL; *************** *** 479,482 **** --- 483,487 ---- } + /* timeval difference. */ struct timeval timeval_diff(struct timeval begin, struct timeval end) { *************** *** 588,606 **** return 1; - } - - /* get port number for named service. */ - int port_for_service(const char *serv, const char *proto) - { - struct servent *sv; - - setservent(0); - - if((sv = getservbyname(serv, proto)) == NULL) { - ERROR_MESSAGE("rawnet: could not get service listing: %d", strerror(errno)); - return -1; - } - - return(sv->s_port); } --- 593,596 ---- Index: dhcp-stringbuffer.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-stringbuffer.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** dhcp-stringbuffer.c 30 Oct 2002 05:00:46 -0000 1.2 --- dhcp-stringbuffer.c 3 Nov 2002 16:34:55 -0000 1.3 *************** *** 33,38 **** #define MODULE_NAME "dhcp-stringbuffer" ! #include <dhcp-util.h> ! #include <dhcp-libutil.h> /* * * * * * * * * * * * * --- 33,38 ---- #define MODULE_NAME "dhcp-stringbuffer" ! #include "dhcp-local.h" ! #include "dhcp-libutil.h" /* * * * * * * * * * * * * *************** *** 127,132 **** void destroy_stringbuffer(stringbuffer *sb) { ! free(sb->buf); ! free(sb); } --- 127,132 ---- void destroy_stringbuffer(stringbuffer *sb) { ! xfree(sb->buf); ! xfree(sb); } Index: dhcp-snprintf.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-snprintf.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** dhcp-snprintf.c 29 Oct 2002 17:11:29 -0000 1.1.1.1 --- dhcp-snprintf.c 3 Nov 2002 16:34:55 -0000 1.2 *************** *** 56,60 **** --- 56,62 ---- **************************************************************/ + #ifdef HAVE_CONFIG_H #include "config.h" + #endif /* HAVE_CONFIG_H */ #if !defined(HAVE_SNPRINTF) || !defined(HAVE_VSNPRINTF) Index: dhcp-log.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-log.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** dhcp-log.c 30 Oct 2002 05:00:46 -0000 1.2 --- dhcp-log.c 3 Nov 2002 16:34:55 -0000 1.3 *************** *** 25,30 **** */ ! #include <dhcp-util.h> ! #include <dhcp-libutil.h> void init_log(const char *s) --- 25,30 ---- */ ! #include "dhcp-local.h" ! #include "dhcp-libutil.h" void init_log(const char *s) Index: dhcp-list.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-list.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** dhcp-list.c 30 Oct 2002 05:00:46 -0000 1.2 --- dhcp-list.c 3 Nov 2002 16:34:55 -0000 1.3 *************** *** 24,29 **** #define MODULE_NAME "dhcp-list" ! #include <dhcp-util.h> ! #include <dhcp-libutil.h> list_t *add_to_list(list_t *head, void *datum) --- 24,29 ---- #define MODULE_NAME "dhcp-list" ! #include "dhcp-local.h" ! #include "dhcp-libutil.h" list_t *add_to_list(list_t *head, void *datum) Index: dhcp-libutil.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-libutil.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** dhcp-libutil.h 30 Oct 2002 05:11:16 -0000 1.2 --- dhcp-libutil.h 3 Nov 2002 16:34:55 -0000 1.3 *************** *** 101,105 **** extern const char *getprogname(void); extern int resolv(char *address, uint32_t *addr); - extern int port_for_service(const char *serv, const char *proto); extern int is_seven_bit_clean(const char *data, int len); --- 101,104 ---- --- dhcp-util.h DELETED --- |