pcap-namedb.h revision 17683
117683Spst/* 217683Spst * Copyright (c) 1994, 1996 317683Spst * The Regents of the University of California. All rights reserved. 417683Spst * 517683Spst * Redistribution and use in source and binary forms, with or without 617683Spst * modification, are permitted provided that the following conditions 717683Spst * are met: 817683Spst * 1. Redistributions of source code must retain the above copyright 917683Spst * notice, this list of conditions and the following disclaimer. 1017683Spst * 2. Redistributions in binary form must reproduce the above copyright 1117683Spst * notice, this list of conditions and the following disclaimer in the 1217683Spst * documentation and/or other materials provided with the distribution. 1317683Spst * 3. All advertising materials mentioning features or use of this software 1417683Spst * must display the following acknowledgement: 1517683Spst * This product includes software developed by the Computer Systems 1617683Spst * Engineering Group at Lawrence Berkeley Laboratory. 1717683Spst * 4. Neither the name of the University nor of the Laboratory may be used 1817683Spst * to endorse or promote products derived from this software without 1917683Spst * specific prior written permission. 2017683Spst * 2117683Spst * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 2217683Spst * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2317683Spst * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2417683Spst * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 2517683Spst * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2617683Spst * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2717683Spst * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2817683Spst * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2917683Spst * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 3017683Spst * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 3117683Spst * SUCH DAMAGE. 3217683Spst * 3317683Spst * @(#) $Header: pcap-namedb.h,v 1.5 96/07/14 03:00:14 leres Exp $ (LBL) 3417683Spst */ 3517683Spst 3617683Spst#ifndef lib_pcap_ethers_h 3717683Spst#define lib_pcap_ethers_h 3817683Spst 3917683Spst/* 4017683Spst * As returned by the pcap_next_etherent() 4117683Spst * XXX this stuff doesn't belong in this interface, but this 4217683Spst * library already must do name to address translation, so 4317683Spst * on systems that don't have support for /etc/ethers, we 4417683Spst * export these hooks since they'll 4517683Spst */ 4617683Spststruct pcap_etherent { 4717683Spst u_char addr[6]; 4817683Spst char name[122]; 4917683Spst}; 5017683Spst#ifndef PCAP_ETHERS_FILE 5117683Spst#define PCAP_ETHERS_FILE "/etc/ethers" 5217683Spst#endif 5317683Spststruct pcap_etherent *pcap_next_etherent(FILE *); 5417683Spstu_char *pcap_ether_hostton(const char*); 5517683Spstu_char *pcap_ether_aton(const char *); 5617683Spst 5717683Spstbpf_u_int32 **pcap_nametoaddr(const char *); 5817683Spstbpf_u_int32 pcap_nametonetaddr(const char *); 5917683Spst 6017683Spstint pcap_nametoport(const char *, int *, int *); 6117683Spstint pcap_nametoproto(const char *); 6217683Spstint pcap_nametoeproto(const char *); 6317683Spst/* 6417683Spst * If a protocol is unknown, PROTO_UNDEF is returned. 6517683Spst * Also, pcap_nametoport() returns the protocol along with the port number. 6617683Spst * If there are ambiguous entried in /etc/services (i.e. domain 6717683Spst * can be either tcp or udp) PROTO_UNDEF is returned. 6817683Spst */ 6917683Spst#define PROTO_UNDEF -1 7017683Spst 7117683Spst/* XXX move these to pcap-int.h? */ 7217683Spstint __pcap_atodn(const char *, bpf_u_int32 *); 7317683Spstint __pcap_atoin(const char *, bpf_u_int32 *); 7417683Spstu_short __pcap_nametodnaddr(const char *); 7517683Spst 7617683Spst#endif 77