1de0d3203SPeter Avalos /* 2de0d3203SPeter Avalos * Copyright (c) 1994, 1996 3de0d3203SPeter Avalos * The Regents of the University of California. All rights reserved. 4de0d3203SPeter Avalos * 5de0d3203SPeter Avalos * Redistribution and use in source and binary forms, with or without 6de0d3203SPeter Avalos * modification, are permitted provided that the following conditions 7de0d3203SPeter Avalos * are met: 8de0d3203SPeter Avalos * 1. Redistributions of source code must retain the above copyright 9de0d3203SPeter Avalos * notice, this list of conditions and the following disclaimer. 10de0d3203SPeter Avalos * 2. Redistributions in binary form must reproduce the above copyright 11de0d3203SPeter Avalos * notice, this list of conditions and the following disclaimer in the 12de0d3203SPeter Avalos * documentation and/or other materials provided with the distribution. 13de0d3203SPeter Avalos * 3. All advertising materials mentioning features or use of this software 14de0d3203SPeter Avalos * must display the following acknowledgement: 15de0d3203SPeter Avalos * This product includes software developed by the Computer Systems 16de0d3203SPeter Avalos * Engineering Group at Lawrence Berkeley Laboratory. 17de0d3203SPeter Avalos * 4. Neither the name of the University nor of the Laboratory may be used 18de0d3203SPeter Avalos * to endorse or promote products derived from this software without 19de0d3203SPeter Avalos * specific prior written permission. 20de0d3203SPeter Avalos * 21de0d3203SPeter Avalos * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 22de0d3203SPeter Avalos * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23de0d3203SPeter Avalos * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24de0d3203SPeter Avalos * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 25de0d3203SPeter Avalos * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26de0d3203SPeter Avalos * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27de0d3203SPeter Avalos * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28de0d3203SPeter Avalos * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29de0d3203SPeter Avalos * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30de0d3203SPeter Avalos * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31de0d3203SPeter Avalos * SUCH DAMAGE. 32de0d3203SPeter Avalos */ 33de0d3203SPeter Avalos 34de0d3203SPeter Avalos #ifndef lib_pcap_namedb_h 35de0d3203SPeter Avalos #define lib_pcap_namedb_h 36de0d3203SPeter Avalos 37de0d3203SPeter Avalos #ifdef __cplusplus 38de0d3203SPeter Avalos extern "C" { 39de0d3203SPeter Avalos #endif 40de0d3203SPeter Avalos 41de0d3203SPeter Avalos /* 42de0d3203SPeter Avalos * As returned by the pcap_next_etherent() 43de0d3203SPeter Avalos * XXX this stuff doesn't belong in this interface, but this 44de0d3203SPeter Avalos * library already must do name to address translation, so 45de0d3203SPeter Avalos * on systems that don't have support for /etc/ethers, we 4697a9217aSAntonio Huete Jimenez * export these hooks since they're already being used by 4797a9217aSAntonio Huete Jimenez * some applications (such as tcpdump) and already being 4897a9217aSAntonio Huete Jimenez * marked as exported in some OSes offering libpcap (such 4997a9217aSAntonio Huete Jimenez * as Debian). 50de0d3203SPeter Avalos */ 51de0d3203SPeter Avalos struct pcap_etherent { 52de0d3203SPeter Avalos u_char addr[6]; 53de0d3203SPeter Avalos char name[122]; 54de0d3203SPeter Avalos }; 55de0d3203SPeter Avalos #ifndef PCAP_ETHERS_FILE 56de0d3203SPeter Avalos #define PCAP_ETHERS_FILE "/etc/ethers" 57de0d3203SPeter Avalos #endif 5897a9217aSAntonio Huete Jimenez PCAP_API struct pcap_etherent *pcap_next_etherent(FILE *); 5997a9217aSAntonio Huete Jimenez PCAP_API u_char *pcap_ether_hostton(const char*); 6097a9217aSAntonio Huete Jimenez PCAP_API u_char *pcap_ether_aton(const char *); 61de0d3203SPeter Avalos 62*ea16f64eSAntonio Huete Jimenez PCAP_API bpf_u_int32 **pcap_nametoaddr(const char *) 63*ea16f64eSAntonio Huete Jimenez PCAP_DEPRECATED(pcap_nametoaddr, "this is not reentrant; use 'pcap_nametoaddrinfo' instead"); 6497a9217aSAntonio Huete Jimenez PCAP_API struct addrinfo *pcap_nametoaddrinfo(const char *); 6597a9217aSAntonio Huete Jimenez PCAP_API bpf_u_int32 pcap_nametonetaddr(const char *); 66de0d3203SPeter Avalos 6797a9217aSAntonio Huete Jimenez PCAP_API int pcap_nametoport(const char *, int *, int *); 6897a9217aSAntonio Huete Jimenez PCAP_API int pcap_nametoportrange(const char *, int *, int *, int *); 6997a9217aSAntonio Huete Jimenez PCAP_API int pcap_nametoproto(const char *); 7097a9217aSAntonio Huete Jimenez PCAP_API int pcap_nametoeproto(const char *); 7197a9217aSAntonio Huete Jimenez PCAP_API int pcap_nametollc(const char *); 72de0d3203SPeter Avalos /* 73de0d3203SPeter Avalos * If a protocol is unknown, PROTO_UNDEF is returned. 74de0d3203SPeter Avalos * Also, pcap_nametoport() returns the protocol along with the port number. 75de0d3203SPeter Avalos * If there are ambiguous entried in /etc/services (i.e. domain 76de0d3203SPeter Avalos * can be either tcp or udp) PROTO_UNDEF is returned. 77de0d3203SPeter Avalos */ 78de0d3203SPeter Avalos #define PROTO_UNDEF -1 79de0d3203SPeter Avalos 80de0d3203SPeter Avalos #ifdef __cplusplus 81de0d3203SPeter Avalos } 82de0d3203SPeter Avalos #endif 83de0d3203SPeter Avalos 84de0d3203SPeter Avalos #endif 85