summaryrefslogtreecommitdiff
path: root/epan/inet_pton.c
diff options
context:
space:
mode:
authorJörg Mayer <jmayer@loplof.de>2002-08-02 21:29:45 +0000
committerJörg Mayer <jmayer@loplof.de>2002-08-02 21:29:45 +0000
commit3105ee542f89cd986d0f81d2cd70ce385021d1ce (patch)
tree8ffc7d7c256c3f3e72a0be7cc31aa2a69cdaed81 /epan/inet_pton.c
parent9630bf353e2ca03bdce5d7ce00f184c898ba40cd (diff)
downloadwireshark-3105ee542f89cd986d0f81d2cd70ce385021d1ce.tar.gz
Replace the types from sys/types.h and netinet/in.h by their glib.h
equivalents for the epan/ directory but leave winsock2.h in inet_pton.c and inet_ntop.c for now (can't estimate the consequences). svn path=/trunk/; revision=5928
Diffstat (limited to 'epan/inet_pton.c')
-rw-r--r--epan/inet_pton.c34
1 files changed, 13 insertions, 21 deletions
diff --git a/epan/inet_pton.c b/epan/inet_pton.c
index 07d7c1af7c..47df162d96 100644
--- a/epan/inet_pton.c
+++ b/epan/inet_pton.c
@@ -20,17 +20,13 @@
#endif
#if defined(LIBC_SCCS) && !defined(lint)
-static char rcsid[] = "$Id: inet_pton.c,v 1.2 2002/06/23 10:32:32 guy Exp $";
+static char rcsid[] = "$Id: inet_pton.c,v 1.3 2002/08/02 21:29:39 jmayer Exp $";
#endif /* LIBC_SCCS and not lint */
#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
-#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-
#ifdef HAVE_WINSOCK2_H
#include <winsock2.h>
#define EAFNOSUPPORT WSAEAFNOSUPPORT
@@ -40,10 +36,6 @@ static char rcsid[] = "$Id: inet_pton.c,v 1.2 2002/06/23 10:32:32 guy Exp $";
#include <sys/socket.h>
#endif
-#ifdef HAVE_NETINET_IN_H
-#include <netinet/in.h>
-#endif
-
#ifdef HAVE_ARPA_INET_H
#include <arpa/inet.h>
#endif
@@ -73,10 +65,10 @@ static char rcsid[] = "$Id: inet_pton.c,v 1.2 2002/06/23 10:32:32 guy Exp $";
*/
#ifdef AF_INET
-static int inet_pton4 __P((const char *src, u_char *dst));
+static int inet_pton4 __P((const char *src, guchar *dst));
#endif
#ifdef AF_INET6
-static int inet_pton6 __P((const char *src, u_char *dst));
+static int inet_pton6 __P((const char *src, guchar *dst));
#endif
/* int
@@ -126,11 +118,11 @@ inet_pton(af, src, dst)
static int
inet_pton4(src, dst)
const char *src;
- u_char *dst;
+ guchar *dst;
{
static const char digits[] = "0123456789";
int saw_digit, octets, ch;
- u_char tmp[NS_INADDRSZ], *tp;
+ guchar tmp[NS_INADDRSZ], *tp;
saw_digit = 0;
octets = 0;
@@ -139,7 +131,7 @@ inet_pton4(src, dst)
const char *pch;
if ((pch = strchr(digits, ch)) != NULL) {
- u_int new = *tp * 10 + (pch - digits);
+ guint new = *tp * 10 + (pch - digits);
if (new > 255)
return (0);
@@ -181,14 +173,14 @@ inet_pton4(src, dst)
static int
inet_pton6(src, dst)
const char *src;
- u_char *dst;
+ guchar *dst;
{
static const char xdigits_l[] = "0123456789abcdef",
xdigits_u[] = "0123456789ABCDEF";
- u_char tmp[NS_IN6ADDRSZ], *tp, *endp, *colonp;
+ guchar tmp[NS_IN6ADDRSZ], *tp, *endp, *colonp;
const char *xdigits, *curtok;
int ch, saw_xdigit;
- u_int val;
+ guint val;
memset((tp = tmp), '\0', NS_IN6ADDRSZ);
endp = tp + NS_IN6ADDRSZ;
@@ -225,8 +217,8 @@ inet_pton6(src, dst)
}
if (tp + NS_INT16SZ > endp)
return (0);
- *tp++ = (u_char) (val >> 8) & 0xff;
- *tp++ = (u_char) val & 0xff;
+ *tp++ = (guchar) (val >> 8) & 0xff;
+ *tp++ = (guchar) val & 0xff;
saw_xdigit = 0;
val = 0;
continue;
@@ -242,8 +234,8 @@ inet_pton6(src, dst)
if (saw_xdigit) {
if (tp + NS_INT16SZ > endp)
return (0);
- *tp++ = (u_char) (val >> 8) & 0xff;
- *tp++ = (u_char) val & 0xff;
+ *tp++ = (guchar) (val >> 8) & 0xff;
+ *tp++ = (guchar) val & 0xff;
}
if (colonp != NULL) {
/*