1190214Srpaulo/*
2190214Srpaulo * Copyright (c) 1994, 1996
3190214Srpaulo *	The Regents of the University of California.  All rights reserved.
4190214Srpaulo *
5190214Srpaulo * Redistribution and use in source and binary forms, with or without
6190214Srpaulo * modification, are permitted provided that the following conditions
7190214Srpaulo * are met:
8190214Srpaulo * 1. Redistributions of source code must retain the above copyright
9190214Srpaulo *    notice, this list of conditions and the following disclaimer.
10190214Srpaulo * 2. Redistributions in binary form must reproduce the above copyright
11190214Srpaulo *    notice, this list of conditions and the following disclaimer in the
12190214Srpaulo *    documentation and/or other materials provided with the distribution.
13190214Srpaulo * 3. All advertising materials mentioning features or use of this software
14190214Srpaulo *    must display the following acknowledgement:
15190214Srpaulo *	This product includes software developed by the Computer Systems
16190214Srpaulo *	Engineering Group at Lawrence Berkeley Laboratory.
17190214Srpaulo * 4. Neither the name of the University nor of the Laboratory may be used
18190214Srpaulo *    to endorse or promote products derived from this software without
19190214Srpaulo *    specific prior written permission.
20190214Srpaulo *
21190214Srpaulo * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22190214Srpaulo * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23190214Srpaulo * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24190214Srpaulo * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25190214Srpaulo * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26190214Srpaulo * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27190214Srpaulo * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28190214Srpaulo * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29190214Srpaulo * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30190214Srpaulo * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31190214Srpaulo * SUCH DAMAGE.
32190214Srpaulo *
33214518Srpaulo * @(#) $Header: /tcpdump/master/libpcap/pcap/namedb.h,v 1.1 2006-10-04 18:09:22 guy Exp $ (LBL)
34190214Srpaulo */
35190214Srpaulo
36190214Srpaulo#ifndef lib_pcap_namedb_h
37190214Srpaulo#define lib_pcap_namedb_h
38190214Srpaulo
39190214Srpaulo#ifdef __cplusplus
40190214Srpauloextern "C" {
41190214Srpaulo#endif
42190214Srpaulo
43190214Srpaulo/*
44190214Srpaulo * As returned by the pcap_next_etherent()
45190214Srpaulo * XXX this stuff doesn't belong in this interface, but this
46190214Srpaulo * library already must do name to address translation, so
47190214Srpaulo * on systems that don't have support for /etc/ethers, we
48190214Srpaulo * export these hooks since they'll
49190214Srpaulo */
50190214Srpaulostruct pcap_etherent {
51190214Srpaulo	u_char addr[6];
52190214Srpaulo	char name[122];
53190214Srpaulo};
54190214Srpaulo#ifndef PCAP_ETHERS_FILE
55190214Srpaulo#define PCAP_ETHERS_FILE "/etc/ethers"
56190214Srpaulo#endif
57190214Srpaulostruct	pcap_etherent *pcap_next_etherent(FILE *);
58190214Srpaulou_char *pcap_ether_hostton(const char*);
59190214Srpaulou_char *pcap_ether_aton(const char *);
60190214Srpaulo
61190214Srpaulobpf_u_int32 **pcap_nametoaddr(const char *);
62190214Srpaulo#ifdef INET6
63190214Srpaulostruct addrinfo *pcap_nametoaddrinfo(const char *);
64190214Srpaulo#endif
65190214Srpaulobpf_u_int32 pcap_nametonetaddr(const char *);
66190214Srpaulo
67190214Srpauloint	pcap_nametoport(const char *, int *, int *);
68190214Srpauloint	pcap_nametoportrange(const char *, int *, int *, int *);
69190214Srpauloint	pcap_nametoproto(const char *);
70190214Srpauloint	pcap_nametoeproto(const char *);
71190214Srpauloint	pcap_nametollc(const char *);
72190214Srpaulo/*
73190214Srpaulo * If a protocol is unknown, PROTO_UNDEF is returned.
74190214Srpaulo * Also, pcap_nametoport() returns the protocol along with the port number.
75190214Srpaulo * If there are ambiguous entried in /etc/services (i.e. domain
76190214Srpaulo * can be either tcp or udp) PROTO_UNDEF is returned.
77190214Srpaulo */
78190214Srpaulo#define PROTO_UNDEF		-1
79190214Srpaulo
80190214Srpaulo/* XXX move these to pcap-int.h? */
81190214Srpauloint __pcap_atodn(const char *, bpf_u_int32 *);
82190214Srpauloint __pcap_atoin(const char *, bpf_u_int32 *);
83190214Srpaulou_short	__pcap_nametodnaddr(const char *);
84190214Srpaulo
85190214Srpaulo#ifdef __cplusplus
86190214Srpaulo}
87190214Srpaulo#endif
88190214Srpaulo
89190214Srpaulo#endif
90