namedb.h revision 285830
159191Skris/* 259191Skris * Copyright (c) 1994, 1996 359191Skris * The Regents of the University of California. All rights reserved. 459191Skris * 559191Skris * Redistribution and use in source and binary forms, with or without 659191Skris * modification, are permitted provided that the following conditions 759191Skris * are met: 859191Skris * 1. Redistributions of source code must retain the above copyright 959191Skris * notice, this list of conditions and the following disclaimer. 1059191Skris * 2. Redistributions in binary form must reproduce the above copyright 1159191Skris * notice, this list of conditions and the following disclaimer in the 1259191Skris * documentation and/or other materials provided with the distribution. 1359191Skris * 3. All advertising materials mentioning features or use of this software 1459191Skris * must display the following acknowledgement: 1559191Skris * This product includes software developed by the Computer Systems 16109998Smarkm * Engineering Group at Lawrence Berkeley Laboratory. 17109998Smarkm * 4. Neither the name of the University nor of the Laboratory may be used 18109998Smarkm * to endorse or promote products derived from this software without 19109998Smarkm * specific prior written permission. 20109998Smarkm * 2159191Skris * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 2259191Skris * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2359191Skris * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2459191Skris * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 2559191Skris * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2659191Skris * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2759191Skris * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2859191Skris * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2959191Skris * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 3059191Skris * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 3168651Skris * SUCH DAMAGE. 3259191Skris * 3359191Skris * @(#) $Header: /tcpdump/master/libpcap/pcap/namedb.h,v 1.1 2006-10-04 18:09:22 guy Exp $ (LBL) 3459191Skris */ 3559191Skris 3659191Skris#ifndef lib_pcap_namedb_h 3759191Skris#define lib_pcap_namedb_h 3859191Skris 3959191Skris#ifdef __cplusplus 4059191Skrisextern "C" { 41109998Smarkm#endif 4259191Skris 4359191Skris/* 4459191Skris * As returned by the pcap_next_etherent() 45109998Smarkm * XXX this stuff doesn't belong in this interface, but this 46111147Snectar * library already must do name to address translation, so 4759191Skris * on systems that don't have support for /etc/ethers, we 4859191Skris * export these hooks since they'll 4959191Skris */ 5059191Skrisstruct pcap_etherent { 5159191Skris u_char addr[6]; 5259191Skris char name[122]; 5359191Skris}; 5459191Skris#ifndef PCAP_ETHERS_FILE 5559191Skris#define PCAP_ETHERS_FILE "/etc/ethers" 5659191Skris#endif 5759191Skrisstruct pcap_etherent *pcap_next_etherent(FILE *); 5859191Skrisu_char *pcap_ether_hostton(const char*); 5959191Skrisu_char *pcap_ether_aton(const char *); 6059191Skris 6159191Skrisbpf_u_int32 **pcap_nametoaddr(const char *); 6259191Skris#ifdef INET6 6359191Skrisstruct addrinfo *pcap_nametoaddrinfo(const char *); 6459191Skris#endif 6589837Skrisbpf_u_int32 pcap_nametonetaddr(const char *); 6689837Skris 6789837Skrisint pcap_nametoport(const char *, int *, int *); 6889837Skrisint pcap_nametoportrange(const char *, int *, int *, int *); 6989837Skrisint pcap_nametoproto(const char *); 7059191Skrisint pcap_nametoeproto(const char *); 7159191Skrisint pcap_nametollc(const char *); 7259191Skris/* 7359191Skris * If a protocol is unknown, PROTO_UNDEF is returned. 7459191Skris * Also, pcap_nametoport() returns the protocol along with the port number. 7559191Skris * If there are ambiguous entried in /etc/services (i.e. domain 7659191Skris * can be either tcp or udp) PROTO_UNDEF is returned. 7759191Skris */ 7859191Skris#define PROTO_UNDEF -1 7959191Skris 8059191Skris/* XXX move these to pcap-int.h? */ 8159191Skrisint __pcap_atodn(const char *, bpf_u_int32 *); 82109998Smarkmint __pcap_atoin(const char *, bpf_u_int32 *); 8359191Skrisu_short __pcap_nametodnaddr(const char *); 8459191Skris 8559191Skris#ifdef __cplusplus 8659191Skris} 8759191Skris#endif 8859191Skris 8959191Skris#endif 9059191Skris