pcap-namedb.h revision 75110
133965Sjdp/*
278828Sobrien * Copyright (c) 1994, 1996
3218822Sdim *	The Regents of the University of California.  All rights reserved.
4218822Sdim *
5218822Sdim * Redistribution and use in source and binary forms, with or without
678828Sobrien * modification, are permitted provided that the following conditions
778828Sobrien * are met:
878828Sobrien * 1. Redistributions of source code must retain the above copyright
978828Sobrien *    notice, this list of conditions and the following disclaimer.
1078828Sobrien * 2. Redistributions in binary form must reproduce the above copyright
1178828Sobrien *    notice, this list of conditions and the following disclaimer in the
1278828Sobrien *    documentation and/or other materials provided with the distribution.
1378828Sobrien * 3. All advertising materials mentioning features or use of this software
1478828Sobrien *    must display the following acknowledgement:
1578828Sobrien *	This product includes software developed by the Computer Systems
1678828Sobrien *	Engineering Group at Lawrence Berkeley Laboratory.
1778828Sobrien * 4. Neither the name of the University nor of the Laboratory may be used
18218822Sdim *    to endorse or promote products derived from this software without
19218822Sdim *    specific prior written permission.
20218822Sdim *
2133965Sjdp * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
2233965Sjdp * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2333965Sjdp * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2433965Sjdp * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2533965Sjdp * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2633965Sjdp * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2733965Sjdp * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2833965Sjdp * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2933965Sjdp * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3033965Sjdp * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3160484Sobrien * SUCH DAMAGE.
3260484Sobrien *
3360484Sobrien * $FreeBSD: head/contrib/libpcap/pcap-namedb.h 75110 2001-04-03 04:32:48Z fenner $
3460484Sobrien * @(#) $Header: /tcpdump/master/libpcap/pcap-namedb.h,v 1.8 2000/07/29 07:36:43 guy Exp $ (LBL)
3533965Sjdp */
3633965Sjdp
3733965Sjdp#ifndef lib_pcap_ethers_h
38218822Sdim#define lib_pcap_ethers_h
3933965Sjdp
40218822Sdim#ifdef __cplusplus
41218822Sdimextern "C" {
4233965Sjdp#endif
4333965Sjdp
4433965Sjdp/*
4533965Sjdp * As returned by the pcap_next_etherent()
4633965Sjdp * XXX this stuff doesn't belong in this interface, but this
4733965Sjdp * library already must do name to address translation, so
4833965Sjdp * on systems that don't have support for /etc/ethers, we
4933965Sjdp * export these hooks since they'll
5033965Sjdp */
5133965Sjdpstruct pcap_etherent {
52218822Sdim	u_char addr[6];
5333965Sjdp	char name[122];
5433965Sjdp};
5533965Sjdp#ifndef PCAP_ETHERS_FILE
5633965Sjdp#define PCAP_ETHERS_FILE "/etc/ethers"
5733965Sjdp#endif
5833965Sjdpstruct	pcap_etherent *pcap_next_etherent(FILE *);
5933965Sjdpu_char *pcap_ether_hostton(const char*);
6033965Sjdpu_char *pcap_ether_aton(const char *);
6133965Sjdp
62218822Sdimbpf_u_int32 **pcap_nametoaddr(const char *);
63218822Sdim#ifdef INET6
6433965Sjdpstruct addrinfo *pcap_nametoaddrinfo(const char *);
65130561Sobrien#endif
66130561Sobrienbpf_u_int32 pcap_nametonetaddr(const char *);
6733965Sjdp
6833965Sjdpint	pcap_nametoport(const char *, int *, int *);
6933965Sjdpint	pcap_nametoproto(const char *);
7033965Sjdpint	pcap_nametoeproto(const char *);
7133965Sjdp/*
7233965Sjdp * If a protocol is unknown, PROTO_UNDEF is returned.
7333965Sjdp * Also, pcap_nametoport() returns the protocol along with the port number.
7433965Sjdp * If there are ambiguous entried in /etc/services (i.e. domain
7533965Sjdp * can be either tcp or udp) PROTO_UNDEF is returned.
7633965Sjdp */
7733965Sjdp#define PROTO_UNDEF		-1
7833965Sjdp
7991041Sobrien/* XXX move these to pcap-int.h? */
8091041Sobrienint __pcap_atodn(const char *, bpf_u_int32 *);
8191041Sobrienint __pcap_atoin(const char *, bpf_u_int32 *);
8291041Sobrienu_short	__pcap_nametodnaddr(const char *);
83218822Sdim
8433965Sjdp#ifdef __cplusplus
8577298Sobrien}
8677298Sobrien#endif
8777298Sobrien
8877298Sobrien#endif
8977298Sobrien