1*76404edcSAsim Jamshed /*
2*76404edcSAsim Jamshed  * Copyright (c) 1994, 1996
3*76404edcSAsim Jamshed  *	The Regents of the University of California.  All rights reserved.
4*76404edcSAsim Jamshed  *
5*76404edcSAsim Jamshed  * Redistribution and use in source and binary forms, with or without
6*76404edcSAsim Jamshed  * modification, are permitted provided that the following conditions
7*76404edcSAsim Jamshed  * are met:
8*76404edcSAsim Jamshed  * 1. Redistributions of source code must retain the above copyright
9*76404edcSAsim Jamshed  *    notice, this list of conditions and the following disclaimer.
10*76404edcSAsim Jamshed  * 2. Redistributions in binary form must reproduce the above copyright
11*76404edcSAsim Jamshed  *    notice, this list of conditions and the following disclaimer in the
12*76404edcSAsim Jamshed  *    documentation and/or other materials provided with the distribution.
13*76404edcSAsim Jamshed  * 3. All advertising materials mentioning features or use of this software
14*76404edcSAsim Jamshed  *    must display the following acknowledgement:
15*76404edcSAsim Jamshed  *	This product includes software developed by the Computer Systems
16*76404edcSAsim Jamshed  *	Engineering Group at Lawrence Berkeley Laboratory.
17*76404edcSAsim Jamshed  * 4. Neither the name of the University nor of the Laboratory may be used
18*76404edcSAsim Jamshed  *    to endorse or promote products derived from this software without
19*76404edcSAsim Jamshed  *    specific prior written permission.
20*76404edcSAsim Jamshed  *
21*76404edcSAsim Jamshed  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22*76404edcSAsim Jamshed  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23*76404edcSAsim Jamshed  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24*76404edcSAsim Jamshed  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25*76404edcSAsim Jamshed  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26*76404edcSAsim Jamshed  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27*76404edcSAsim Jamshed  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28*76404edcSAsim Jamshed  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29*76404edcSAsim Jamshed  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30*76404edcSAsim Jamshed  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31*76404edcSAsim Jamshed  * SUCH DAMAGE.
32*76404edcSAsim Jamshed  *
33*76404edcSAsim Jamshed  * @(#) $Header: /usr/cvsroot/sfeng/ims/src/libraries/daq/daq/sfbpf/namedb.h,v 1.2 2010/05/06 19:13:25 maltizer Exp $ (LBL)
34*76404edcSAsim Jamshed  */
35*76404edcSAsim Jamshed 
36*76404edcSAsim Jamshed #ifndef lib_pcap_namedb_h
37*76404edcSAsim Jamshed #define lib_pcap_namedb_h
38*76404edcSAsim Jamshed 
39*76404edcSAsim Jamshed #include "sf-redefines.h"
40*76404edcSAsim Jamshed 
41*76404edcSAsim Jamshed #ifdef __cplusplus
42*76404edcSAsim Jamshed extern "C"
43*76404edcSAsim Jamshed {
44*76404edcSAsim Jamshed #endif
45*76404edcSAsim Jamshed 
46*76404edcSAsim Jamshed /*
47*76404edcSAsim Jamshed  * As returned by the pcap_next_etherent()
48*76404edcSAsim Jamshed  * XXX this stuff doesn't belong in this interface, but this
49*76404edcSAsim Jamshed  * library already must do name to address translation, so
50*76404edcSAsim Jamshed  * on systems that don't have support for /etc/ethers, we
51*76404edcSAsim Jamshed  * export these hooks since they'll
52*76404edcSAsim Jamshed  */
53*76404edcSAsim Jamshed     struct pcap_etherent
54*76404edcSAsim Jamshed     {
55*76404edcSAsim Jamshed         u_char addr[6];
56*76404edcSAsim Jamshed         char name[122];
57*76404edcSAsim Jamshed     };
58*76404edcSAsim Jamshed #ifndef PCAP_ETHERS_FILE
59*76404edcSAsim Jamshed #define PCAP_ETHERS_FILE "/etc/ethers"
60*76404edcSAsim Jamshed #endif
61*76404edcSAsim Jamshed     struct pcap_etherent *pcap_next_etherent(FILE *);
62*76404edcSAsim Jamshed     u_char *pcap_ether_hostton(const char *);
63*76404edcSAsim Jamshed     u_char *pcap_ether_aton(const char *);
64*76404edcSAsim Jamshed 
65*76404edcSAsim Jamshed     bpf_u_int32 **pcap_nametoaddr(const char *);
66*76404edcSAsim Jamshed #ifdef INET6
67*76404edcSAsim Jamshed     struct addrinfo *pcap_nametoaddrinfo(const char *);
68*76404edcSAsim Jamshed #endif
69*76404edcSAsim Jamshed     bpf_u_int32 pcap_nametonetaddr(const char *);
70*76404edcSAsim Jamshed 
71*76404edcSAsim Jamshed     int pcap_nametoport(const char *, int *, int *);
72*76404edcSAsim Jamshed     int pcap_nametoportrange(const char *, int *, int *, int *);
73*76404edcSAsim Jamshed     int pcap_nametoproto(const char *);
74*76404edcSAsim Jamshed     int pcap_nametoeproto(const char *);
75*76404edcSAsim Jamshed     int pcap_nametollc(const char *);
76*76404edcSAsim Jamshed /*
77*76404edcSAsim Jamshed  * If a protocol is unknown, PROTO_UNDEF is returned.
78*76404edcSAsim Jamshed  * Also, pcap_nametoport() returns the protocol along with the port number.
79*76404edcSAsim Jamshed  * If there are ambiguous entried in /etc/services (i.e. domain
80*76404edcSAsim Jamshed  * can be either tcp or udp) PROTO_UNDEF is returned.
81*76404edcSAsim Jamshed  */
82*76404edcSAsim Jamshed #define PROTO_UNDEF		-1
83*76404edcSAsim Jamshed 
84*76404edcSAsim Jamshed /* XXX move these to pcap-int.h? */
85*76404edcSAsim Jamshed     int __pcap_atodn(const char *, bpf_u_int32 *);
86*76404edcSAsim Jamshed     int __pcap_atoin(const char *, bpf_u_int32 *);
87*76404edcSAsim Jamshed     u_short __pcap_nametodnaddr(const char *);
88*76404edcSAsim Jamshed 
89*76404edcSAsim Jamshed #ifdef __cplusplus
90*76404edcSAsim Jamshed }
91*76404edcSAsim Jamshed #endif
92*76404edcSAsim Jamshed 
93*76404edcSAsim Jamshed #endif
94