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