diff options
author | Jeff Morriss <jeff.morriss@ulticom.com> | 2010-05-28 20:19:55 +0000 |
---|---|---|
committer | Jeff Morriss <jeff.morriss@ulticom.com> | 2010-05-28 20:19:55 +0000 |
commit | 47e2d75820ee02066a61e341034aace6d28063c1 (patch) | |
tree | d70498d786146b2e819ee680cc26ba8c90fd167e /epan | |
parent | 17807a6b21c50a72e3bc11ddf0ff7bc2b313823a (diff) | |
download | wireshark-47e2d75820ee02066a61e341034aace6d28063c1.tar.gz |
Move some code (including the optional objects) into libwsutil
svn path=/trunk/; revision=33012
Diffstat (limited to 'epan')
-rw-r--r-- | epan/Makefile.am | 12 | ||||
-rw-r--r-- | epan/Makefile.nmake | 31 | ||||
-rw-r--r-- | epan/addr_resolv.c | 4 | ||||
-rw-r--r-- | epan/address_to_str.c | 4 | ||||
-rw-r--r-- | epan/dissectors/packet-dcom.c | 2 | ||||
-rw-r--r-- | epan/dissectors/packet-dtls.c | 4 | ||||
-rw-r--r-- | epan/dissectors/packet-giop.c | 2 | ||||
-rw-r--r-- | epan/dissectors/packet-sdp.c | 2 | ||||
-rw-r--r-- | epan/dissectors/packet-ssl.c | 4 | ||||
-rw-r--r-- | epan/dissectors/packet-tacacs.c | 2 | ||||
-rw-r--r-- | epan/ftypes/ftype-time.c | 10 | ||||
-rw-r--r-- | epan/inet_aton.c | 154 | ||||
-rw-r--r-- | epan/inet_aton.h | 34 |
13 files changed, 23 insertions, 242 deletions
diff --git a/epan/Makefile.am b/epan/Makefile.am index c7aa198e92..3200047410 100644 --- a/epan/Makefile.am +++ b/epan/Makefile.am @@ -87,10 +87,6 @@ libwireshark_asmopt_la_SOURCES = \ asm_utils.h \ asm_utils_win32_x86.asm -EXTRA_libwireshark_la_SOURCES = \ - inet_aton.c \ - inet_aton.h - EXTRA_DIST = \ diam_dict.l \ dtd_grammar.lemon \ @@ -116,8 +112,6 @@ CLEANFILES = \ libwireshark_generated.la \ libwireshark_asmopt.a \ libwireshark_asmopt.la \ - inet_ntop.c \ - inet_pton.c \ *~ DISTCLEANFILES = \ @@ -189,12 +183,6 @@ tvbtest.o exntest.o: exceptions.h sminmpec.c: enterprise-numbers ../tools/make-sminmpec.pl $(PERL) $(srcdir)/../tools/make-sminmpec.pl $(srcdir)/enterprise-numbers sminmpec.c -inet_ntop.c: - ln -s $(srcdir)/../inet_ntop.c . - -inet_pton.c: - ln -s $(srcdir)/../inet_pton.c . - if HAVE_PLUGINS if ENABLE_STATIC diff --git a/epan/Makefile.nmake b/epan/Makefile.nmake index 6db84ef56e..b0e2d43ed7 100644 --- a/epan/Makefile.nmake +++ b/epan/Makefile.nmake @@ -56,11 +56,6 @@ libwireshark_LIBS = \ LIBWIRESHARK_OBJECTS = $(LIBWIRESHARK_ALL_SRC:.c=.obj) EXTRA_OBJECTS = \ -# strerror.obj \ - inet_aton.obj \ - inet_pton.obj \ - inet_ntop.obj \ - strptime.obj \ !IF defined(NASM) && "$(WIRESHARK_TARGET_PLATFORM)" == "win32" asm_utils_win32_x86.obj !ELSE @@ -107,7 +102,7 @@ clean-local: libwireshark.lib libwireshark.dll *.manifest libwireshark.exp \ *.pdb doxygen.cfg html/*.* \ exntest.obj exntest.exe reassemble_test.obj reassemble_test.exe tvbtest.obj tvbtest.exe - if exist html rmdir html + if exist html rmdir html clean: clean-local cd crc @@ -134,13 +129,12 @@ clean: clean-local # the same for now. # distclean-local: clean-local - rm -f config.h register.c mkstemp.c strptime.c \ - inet_ntop.c inet_pton.c \ + rm -f config.h register.c mkstemp.c \ $(LIBWIRESHARK_DISTCLEAN_GENERATED_SRC) \ $(LIBWIRESHARK_DISTCLEAN_GENERATED_INCLUDES) \ $(LIBWIRESHARK_NODISTCLEAN_GENERATED_SRC) \ $(LIBWIRESHARK_NODISTCLEAN_GENERATED_INCLUDES) \ - dtd_grammar.out sminmpec.c + dtd_grammar.out sminmpec.c distclean: distclean-local cd crc @@ -285,28 +279,11 @@ asm_utils_win32_x86.obj: asm_utils_win32_x86.asm $(NASM) -f $(WIRESHARK_TARGET_PLATFORM) -o $@ $? !ENDIF -# (Windows only) Copy some sources from /trunk to /trunk/epan. -# It is a cleaner to compile these sources separately with this makefile than -# using the object code compiled by the makefile in /trunk for both dynamically -# and statically linking - -strptime.c: ..\strptime.c - set copycmd=/y - xcopy ..\strptime.c . /d - -inet_ntop.c: ..\inet_ntop.c - set copycmd=/y - xcopy ..\inet_ntop.c . /d - -inet_pton.c: ..\inet_pton.c - set copycmd=/y - xcopy ..\inet_pton.c . /d - sminmpec.c: enterprise-numbers ..\tools\make-sminmpec.pl $(PERL) ../tools/make-sminmpec.pl enterprise-numbers sminmpec.c RUNLEX=..\tools\runlex.sh - + diam_dict_lex.h: diam_dict.c diam_dict.obj : diam_dict.c $(CC) $(CVARSDLL) $(GENERATED_CFLAGS) -Fd.\ -c $? diff --git a/epan/addr_resolv.c b/epan/addr_resolv.c index 4a33c8dd25..758f66a328 100644 --- a/epan/addr_resolv.c +++ b/epan/addr_resolv.c @@ -90,11 +90,11 @@ #endif #ifdef NEED_INET_ATON_H -# include "inet_aton.h" +# include "wsutil/inet_aton.h" #endif #ifdef NEED_INET_V6DEFS_H -# include "inet_v6defs.h" +# include "wsutil/inet_v6defs.h" #endif #if defined(_WIN32) && defined(INET6) diff --git a/epan/address_to_str.c b/epan/address_to_str.c index a09a4ae11c..1c39a57d66 100644 --- a/epan/address_to_str.c +++ b/epan/address_to_str.c @@ -50,7 +50,7 @@ #endif #ifdef NEED_INET_V6DEFS_H -# include "inet_v6defs.h" +# include "wsutil/inet_v6defs.h" #endif #include "to_str.h" @@ -395,7 +395,7 @@ address_to_str_buf(const address *addr, gchar *buf, int buf_len) /* copy to output buffer */ if (tempptr != temp) { size_t temp_len = (size_t) (tempptr - temp); - + if (temp_len < (size_t) buf_len) { memcpy(buf, temp, temp_len); buf[temp_len] = '\0'; diff --git a/epan/dissectors/packet-dcom.c b/epan/dissectors/packet-dcom.c index 68672f4e0c..c14f8e3670 100644 --- a/epan/dissectors/packet-dcom.c +++ b/epan/dissectors/packet-dcom.c @@ -90,7 +90,7 @@ #include <epan/packet.h> #include <epan/emem.h> #include <epan/addr_resolv.h> -#include <epan/inet_aton.h> +#include <wsutil/inet_aton.h> #include <epan/expert.h> #include <epan/prefs.h> #include <ctype.h> diff --git a/epan/dissectors/packet-dtls.c b/epan/dissectors/packet-dtls.c index 5cc1bd437e..d4969b19e7 100644 --- a/epan/dissectors/packet-dtls.c +++ b/epan/dissectors/packet-dtls.c @@ -70,7 +70,9 @@ #include <epan/emem.h> #include <epan/tap.h> #include <epan/reassemble.h> -#include "inet_v6defs.h" +#ifdef NEED_INET_V6DEFS_H +#include "wsutil/inet_v6defs.h" +#endif #include "packet-ssl-utils.h" /* we need to remember the top tree so that subdissectors we call are created diff --git a/epan/dissectors/packet-giop.c b/epan/dissectors/packet-giop.c index 4858bd63e3..4beee5a6be 100644 --- a/epan/dissectors/packet-giop.c +++ b/epan/dissectors/packet-giop.c @@ -289,7 +289,7 @@ #include <glib.h> #include <math.h> #ifdef NEED_STRERROR_H -#include "strerror.h" +#include "wsutil/strerror.h" #endif #include "isprint.h" diff --git a/epan/dissectors/packet-sdp.c b/epan/dissectors/packet-sdp.c index 877c867fc1..9e936f4568 100644 --- a/epan/dissectors/packet-sdp.c +++ b/epan/dissectors/packet-sdp.c @@ -50,7 +50,7 @@ #endif #ifdef NEED_INET_V6DEFS_H -# include "inet_v6defs.h" +# include "wsutil/inet_v6defs.h" #endif #include <glib.h> diff --git a/epan/dissectors/packet-ssl.c b/epan/dissectors/packet-ssl.c index 2b95d9ca46..25b2aaca35 100644 --- a/epan/dissectors/packet-ssl.c +++ b/epan/dissectors/packet-ssl.c @@ -121,7 +121,9 @@ #include <epan/filesystem.h> #include <epan/report_err.h> #include <epan/expert.h> -#include "inet_v6defs.h" +#ifdef NEED_INET_V6DEFS_H +#include "wsutil/inet_v6defs.h" +#endif #include "packet-x509if.h" #include "packet-ssl.h" #include "packet-ssl-utils.h" diff --git a/epan/dissectors/packet-tacacs.c b/epan/dissectors/packet-tacacs.c index be9103a66e..898b63968a 100644 --- a/epan/dissectors/packet-tacacs.c +++ b/epan/dissectors/packet-tacacs.c @@ -59,7 +59,7 @@ #endif #ifdef NEED_INET_V6DEFS_H -# include "inet_v6defs.h" +# include "wsutil/inet_v6defs.h" #endif #include <glib.h> diff --git a/epan/ftypes/ftype-time.c b/epan/ftypes/ftype-time.c index fd81266722..b091c3bd23 100644 --- a/epan/ftypes/ftype-time.c +++ b/epan/ftypes/ftype-time.c @@ -42,7 +42,7 @@ #include <ftypes-int.h> #ifdef NEED_STRPTIME_H -#include "strptime.h" +#include "wsutil/strptime.h" #endif static gboolean @@ -175,14 +175,14 @@ relative_val_from_unparsed(fvalue_t *fv, char *s, gboolean allow_partial_value _ { char *curptr, *endptr; gboolean negative = FALSE; - + curptr = s; if(*curptr == '-') { negative = TRUE; curptr++; } - + /* * If it doesn't begin with ".", it should contain a seconds * value. @@ -313,7 +313,7 @@ value_get(fvalue_t *fv) { return &(fv->value.time); } - + static int absolute_val_repr_len(fvalue_t *fv, ftrepr_t rtype _U_) { @@ -331,7 +331,7 @@ absolute_val_to_repr(fvalue_t *fv, ftrepr_t rtype _U_, char *buf) abs_time_to_str(&fv->value.time, ABSOLUTE_TIME_LOCAL, rtype == FTREPR_DISPLAY)); } - + static int relative_val_repr_len(fvalue_t *fv, ftrepr_t rtype _U_) { diff --git a/epan/inet_aton.c b/epan/inet_aton.c deleted file mode 100644 index 48bc84124c..0000000000 --- a/epan/inet_aton.c +++ /dev/null @@ -1,154 +0,0 @@ -/* - * Copyright (c) 1983, 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * 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. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)inet_addr.c 8.1 (Berkeley) 6/17/93"; -#endif /* LIBC_SCCS and not lint */ - -#ifdef HAVE_SYS_PARAM_H -#include <sys/param.h> -#endif - -#ifdef HAVE_NETINET_IN_H -#include <netinet/in.h> -#endif - -#ifdef HAVE_WINSOCK2_H -#include <winsock2.h> -#endif - -#ifdef HAVE_ARPA_INET_H -#include <arpa/inet.h> -#endif - -#include <ctype.h> - -#include "inet_aton.h" - -/* - * Check whether "cp" is a valid ascii representation - * of an Internet address and convert to a binary address. - * Returns 1 if the address is valid, 0 if not. - * This replaces inet_addr, the return value from which - * cannot distinguish between failure and a local broadcast address. - */ -int -inet_aton(cp_arg, addr) - const char *cp_arg; - struct in_addr *addr; -{ - register const u_char *cp = cp_arg; - register u_long val; - register int base; - register size_t n; - register u_char c; - u_int parts[4]; - register u_int *pp = parts; - - for (;;) { - /* - * Collect number up to ``.''. - * Values are specified as for C: - * 0x=hex, 0=octal, other=decimal. - */ - val = 0; base = 10; - if (*cp == '0') { - if (*++cp == 'x' || *cp == 'X') - base = 16, cp++; - else - base = 8; - } - while ((c = *cp) != '\0') { - if (isascii(c) && isdigit(c)) { - val = (val * base) + (c - '0'); - cp++; - continue; - } - if (base == 16 && isascii(c) && isxdigit(c)) { - val = (val << 4) + - (c + 10 - (islower(c) ? 'a' : 'A')); - cp++; - continue; - } - break; - } - if (*cp == '.') { - /* - * Internet format: - * a.b.c.d - * a.b.c (with c treated as 16-bits) - * a.b (with b treated as 24 bits) - */ - if (pp >= parts + 3 || val > 0xff) - return (0); - *pp++ = val, cp++; - } else - break; - } - /* - * Check for trailing characters. - */ - if (*cp && (!isascii(*cp) || !isspace(*cp))) - return (0); - /* - * Concoct the address according to - * the number of parts specified. - */ - n = pp - parts + 1; - switch (n) { - - case 1: /* a -- 32 bits */ - break; - - case 2: /* a.b -- 8.24 bits */ - if (val > 0xffffff) - return (0); - val |= parts[0] << 24; - break; - - case 3: /* a.b.c -- 8.8.16 bits */ - if (val > 0xffff) - return (0); - val |= (parts[0] << 24) | (parts[1] << 16); - break; - - case 4: /* a.b.c.d -- 8.8.8.8 bits */ - if (val > 0xff) - return (0); - val |= (parts[0] << 24) | (parts[1] << 16) | (parts[2] << 8); - break; - } - if (addr) - addr->s_addr = htonl(val); - return (1); -} diff --git a/epan/inet_aton.h b/epan/inet_aton.h deleted file mode 100644 index c527ad584b..0000000000 --- a/epan/inet_aton.h +++ /dev/null @@ -1,34 +0,0 @@ -/* inet_aton.h - * - * $Id$ - * - * Wireshark - Network traffic analyzer - * By Gerald Combs <gerald@wireshark.org> - * Copyright 1998 Gerald Combs - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -/* - * Version of "inet_aton()", for the benefit of OSes that don't have it. - */ - -#ifndef __INET_ATON_H__ -#define __INET_ATON_H__ - -struct in_addr; -extern int inet_aton(const char* cp_arg, struct in_addr *addr); - -#endif |