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 */ 33190214Srpaulo 34190214Srpaulo#ifndef lib_pcap_namedb_h 35190214Srpaulo#define lib_pcap_namedb_h 36190214Srpaulo 37190214Srpaulo#ifdef __cplusplus 38190214Srpauloextern "C" { 39190214Srpaulo#endif 40190214Srpaulo 41190214Srpaulo/* 42190214Srpaulo * As returned by the pcap_next_etherent() 43190214Srpaulo * XXX this stuff doesn't belong in this interface, but this 44190214Srpaulo * library already must do name to address translation, so 45190214Srpaulo * on systems that don't have support for /etc/ethers, we 46190214Srpaulo * export these hooks since they'll 47190214Srpaulo */ 48190214Srpaulostruct pcap_etherent { 49190214Srpaulo u_char addr[6]; 50190214Srpaulo char name[122]; 51190214Srpaulo}; 52190214Srpaulo#ifndef PCAP_ETHERS_FILE 53190214Srpaulo#define PCAP_ETHERS_FILE "/etc/ethers" 54190214Srpaulo#endif 55190214Srpaulostruct pcap_etherent *pcap_next_etherent(FILE *); 56190214Srpaulou_char *pcap_ether_hostton(const char*); 57190214Srpaulou_char *pcap_ether_aton(const char *); 58190214Srpaulo 59190214Srpaulobpf_u_int32 **pcap_nametoaddr(const char *); 60190214Srpaulo#ifdef INET6 61190214Srpaulostruct addrinfo *pcap_nametoaddrinfo(const char *); 62190214Srpaulo#endif 63190214Srpaulobpf_u_int32 pcap_nametonetaddr(const char *); 64190214Srpaulo 65190214Srpauloint pcap_nametoport(const char *, int *, int *); 66190214Srpauloint pcap_nametoportrange(const char *, int *, int *, int *); 67190214Srpauloint pcap_nametoproto(const char *); 68190214Srpauloint pcap_nametoeproto(const char *); 69190214Srpauloint pcap_nametollc(const char *); 70190214Srpaulo/* 71190214Srpaulo * If a protocol is unknown, PROTO_UNDEF is returned. 72190214Srpaulo * Also, pcap_nametoport() returns the protocol along with the port number. 73190214Srpaulo * If there are ambiguous entried in /etc/services (i.e. domain 74190214Srpaulo * can be either tcp or udp) PROTO_UNDEF is returned. 75190214Srpaulo */ 76190214Srpaulo#define PROTO_UNDEF -1 77190214Srpaulo 78190214Srpaulo/* XXX move these to pcap-int.h? */ 79190214Srpauloint __pcap_atodn(const char *, bpf_u_int32 *); 80190214Srpauloint __pcap_atoin(const char *, bpf_u_int32 *); 81190214Srpaulou_short __pcap_nametodnaddr(const char *); 82190214Srpaulo 83190214Srpaulo#ifdef __cplusplus 84190214Srpaulo} 85190214Srpaulo#endif 86190214Srpaulo 87190214Srpaulo#endif 88