Deleted Added
sdiff udiff text old ( 39294 ) new ( 56891 )
full compact
1/*
2 * Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that: (1) source code distributions
7 * retain the above copyright notice and this paragraph in its entirety, (2)
8 * distributions including binary code include the above copyright notice and

--- 6 unchanged lines hidden (view full) ---

15 * or promote products derived from this software without specific prior
16 * written permission.
17 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
18 * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
19 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
20 *
21 * Name to id translation routines used by the scanner.
22 * These functions are not time critical.
23 */
24
25#ifndef lint
26static const char rcsid[] =
27 "@(#) $Header: nametoaddr.c,v 1.48 98/07/12 13:15:36 leres Exp $ (LBL)";
28#endif
29
30#include <sys/param.h>
31#include <sys/types.h> /* concession to AIX */
32#include <sys/socket.h>
33#include <sys/time.h>
34
35#if __STDC__
36struct mbuf;
37struct rtentry;
38#endif
39
40#include <net/if.h>
41#include <net/ethernet.h>
42#include <netinet/in.h>
43#include <arpa/inet.h>
44
45#include <ctype.h>
46#include <errno.h>
47#include <stdlib.h>
48#include <memory.h>
49#include <netdb.h>
50#include <stdio.h>
51

--- 13 unchanged lines hidden (view full) ---

65#endif
66
67static inline int xdtoi(int);
68
69/*
70 * Convert host name to internet address.
71 * Return 0 upon failure.
72 */
73bpf_u_int32 **
74pcap_nametoaddr(const char *name)
75{
76#ifndef h_addr
77 static bpf_u_int32 *hlist[2];
78#endif
79 bpf_u_int32 **p;
80 struct hostent *hp;

--- 7 unchanged lines hidden (view full) ---

88 for (p = (bpf_u_int32 **)hp->h_addr_list; *p; ++p)
89 NTOHL(**p);
90 return (bpf_u_int32 **)hp->h_addr_list;
91#endif
92 }
93 else
94 return 0;
95}
96
97/*
98 * Convert net name to internet address.
99 * Return 0 upon failure.
100 */
101bpf_u_int32
102pcap_nametonetaddr(const char *name)
103{
104 struct netent *np;

--- 72 unchanged lines hidden (view full) ---

177
178struct eproto {
179 char *s;
180 u_short p;
181};
182
183/* Static data base of ether protocol types. */
184struct eproto eproto_db[] = {
185 { "pup", ETHERTYPE_PUP },
186 { "xns", ETHERTYPE_NS },
187 { "ip", ETHERTYPE_IP },
188 { "arp", ETHERTYPE_ARP },
189 { "rarp", ETHERTYPE_REVARP },
190 { "sprite", ETHERTYPE_SPRITE },
191 { "mopdl", ETHERTYPE_MOPDL },
192 { "moprc", ETHERTYPE_MOPRC },
193 { "decnet", ETHERTYPE_DN },
194 { "lat", ETHERTYPE_LAT },
195 { "sca", ETHERTYPE_SCA },

--- 129 unchanged lines hidden (view full) ---

325 }
326 break;
327 }
328 }
329 return (NULL);
330}
331#else
332
333#ifndef sgi
334extern int ether_hostton(char *, struct ether_addr *);
335#endif
336
337/* Use the os supplied routines */
338u_char *
339pcap_ether_hostton(const char *name)
340{
341 register u_char *ap;

--- 31 unchanged lines hidden ---