]> The Tcpdump Group git mirrors - tcpdump/blobdiff - missing/getaddrinfo.c
don't pass on src & dst MAC adresses to the isoclns decoder as MAC adresses
[tcpdump] / missing / getaddrinfo.c
index bfd150c9178f843f8b06bc8115ae8f606e8357f7..458fe01410e1efb31e600c2f55a75baa77ad44c1 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
@@ -13,7 +13,7 @@
  * 3. Neither the name of the project 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 PROJECT 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
 
 #ifdef HAVE_CONFIG_H
 #include <config.h>
-#endif 
+#endif
 
 #ifndef lint
 static const char rcsid[] =
-     "@(#) $Header: /tcpdump/master/tcpdump/missing/getaddrinfo.c,v 1.8 2000-01-19 04:42:21 itojun Exp $";
+     "@(#) $Header: /tcpdump/master/tcpdump/missing/getaddrinfo.c,v 1.11 2002-06-11 17:13:37 itojun Exp $";
 #endif
 
 #include <sys/types.h>
@@ -74,19 +74,15 @@ static const char rcsid[] =
 #include <stdio.h>
 #include <errno.h>
 
-#ifndef HAVE_PORTABLE_PROTOTYPE
-#include "cdecl_ext.h"
-#endif 
-
 #ifndef HAVE_U_INT32_T
 #include "bittypes.h"
-#endif 
+#endif
 
 #ifndef HAVE_SOCKADDR_STORAGE
 #include "sockstorage.h"
-#endif 
+#endif
 
-#ifndef HAVE_ADDRINFO
+#ifdef NEED_ADDRINFO_H
 #include "addrinfo.h"
 #endif
 
@@ -108,7 +104,7 @@ static const char in_addrany[] = { 0, 0, 0, 0 };
 static const char in6_addrany[] = {
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
 };
-static const char in_loopback[] = { 127, 0, 0, 1 }; 
+static const char in_loopback[] = { 127, 0, 0, 1 };
 static const char in6_loopback[] = {
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1
 };
@@ -126,7 +122,7 @@ static const struct afd {
        int a_socklen;
        int a_off;
        const char *a_addrany;
-       const char *a_loopback; 
+       const char *a_loopback;
        int a_scoped;
 } afdl [] = {
 #ifdef INET6
@@ -175,24 +171,24 @@ static const struct explore explore[] = {
 #endif
 
 
-static int str_isnumber __P((const char *));
-static int explore_fqdn __P((const struct addrinfo *, const char *,
-       const char *, struct addrinfo **));
-static int explore_null __P((const struct addrinfo *, const char *,
-       const char *, struct addrinfo **));
-static int explore_numeric __P((const struct addrinfo *, const char *,
-       const char *, struct addrinfo **));
-static int explore_numeric_scope __P((const struct addrinfo *, const char *,
-       const char *, struct addrinfo **));
-static int get_name __P((const char *, const struct afd *, struct addrinfo **,
-       char *, const struct addrinfo *, const char *));
-static int get_canonname __P((const struct addrinfo *,
-       struct addrinfo *, const char *));
-static struct addrinfo *get_ai __P((const struct addrinfo *,
-       const struct afd *, const char *));
-static int get_portmatch __P((const struct addrinfo *, const char *));
-static int get_port __P((struct addrinfo *, const char *, int));
-static const struct afd *find_afd __P((int));
+static int str_isnumber (const char *);
+static int explore_fqdn (const struct addrinfo *, const char *,
+       const char *, struct addrinfo **);
+static int explore_null (const struct addrinfo *, const char *,
+       const char *, struct addrinfo **);
+static int explore_numeric (const struct addrinfo *, const char *,
+       const char *, struct addrinfo **);
+static int explore_numeric_scope (const struct addrinfo *, const char *,
+       const char *, struct addrinfo **);
+static int get_name (const char *, const struct afd *, struct addrinfo **,
+       char *, const struct addrinfo *, const char *);
+static int get_canonname (const struct addrinfo *,
+       struct addrinfo *, const char *);
+static struct addrinfo *get_ai (const struct addrinfo *,
+       const struct afd *, const char *);
+static int get_portmatch (const struct addrinfo *, const char *);
+static int get_port (struct addrinfo *, const char *, int);
+static const struct afd *find_afd (int);
 
 static char *ai_errlist[] = {
        "Success",
@@ -327,7 +323,7 @@ getaddrinfo(hostname, servname, hints, res)
        pai->ai_canonname = NULL;
        pai->ai_addr = NULL;
        pai->ai_next = NULL;
-       
+
        if (hostname == NULL && servname == NULL)
                return EAI_NONAME;
        if (hints) {
@@ -817,7 +813,7 @@ explore_numeric(pai, hostname, servname, res)
                        }
                        while (cur && cur->ai_next)
                                cur = cur->ai_next;
-               } else 
+               } else
                        ERR(EAI_FAMILY);        /*xxx*/
        }
 
@@ -952,7 +948,7 @@ get_name(addr, afd, res, numaddr, pai, servname)
                GET_AI(cur, afd, numaddr);
                GET_PORT(cur, servname);
        }
-       
+
 #ifdef USE_GETIPNODEBY
        if (hp)
                freehostent(hp);