pcap-namedb.h revision 1.3
134355Sjb/* $OpenBSD */ 234355Sjb/* $NetBSD: pcap-namedb.h,v 1.2.6.1 1996/06/05 18:04:40 cgd Exp $ */ 389985Sbde 4244174Skib/* 534355Sjb * Copyright (c) 1994 634355Sjb * The Regents of the University of California. All rights reserved. 764002Speter * 834355Sjb * Redistribution and use in source and binary forms, with or without 934355Sjb * modification, are permitted provided that the following conditions 1034355Sjb * are met: 1134355Sjb * 1. Redistributions of source code must retain the above copyright 1234355Sjb * notice, this list of conditions and the following disclaimer. 1334355Sjb * 2. Redistributions in binary form must reproduce the above copyright 1434355Sjb * notice, this list of conditions and the following disclaimer in the 1534355Sjb * documentation and/or other materials provided with the distribution. 1634355Sjb * 3. All advertising materials mentioning features or use of this software 1734355Sjb * must display the following acknowledgement: 1834355Sjb * This product includes software developed by the Computer Systems 1934355Sjb * Engineering Group at Lawrence Berkeley Laboratory. 2034355Sjb * 4. Neither the name of the University nor of the Laboratory may be used 2134355Sjb * to endorse or promote products derived from this software without 22171210Speter * specific prior written permission. 2334355Sjb * 2434355Sjb * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 2534355Sjb * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2634355Sjb * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2734355Sjb * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 2834355Sjb * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2934355Sjb * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 3034355Sjb * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 3134355Sjb * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 3234355Sjb * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 3334355Sjb * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 3434355Sjb * SUCH DAMAGE. 3534355Sjb * 3634355Sjb * @(#) Header: pcap-namedb.h,v 1.2 94/06/14 20:03:34 leres Exp (LBL) 3734355Sjb */ 3834355Sjb 3934355Sjb#ifndef lib_pcap_ethers_h 4034355Sjb#define lib_pcap_ethers_h 4134355Sjb 4234355Sjb/* 4334355Sjb * As returned by the pcap_next_etherent() 4434355Sjb * XXX this stuff doesn't belong in this inteface, but this 4534355Sjb * library already must do name to address translation, so 4634355Sjb * on systems that don't have support for /etc/ethers, we 4734355Sjb * export these hooks since they'll 4834355Sjb */ 4934355Sjbstruct pcap_etherent { 5034355Sjb u_char addr[6]; 5134355Sjb char name[122]; 5234355Sjb}; 5334355Sjb#ifndef PCAP_ETHERS_FILE 5434355Sjb#define PCAP_ETHERS_FILE "/etc/ethers" 5534355Sjb#endif 5634355Sjbstruct pcap_etherent *pcap_next_etherent(FILE *); 5734355Sjbu_char *pcap_ether_hostton(const char*); 5834355Sjbu_char *pcap_ether_aton(const char *); 5934355Sjb 6034355Sjbu_int32_t **pcap_nametoaddr(const char *); 6134355Sjbu_long pcap_nametonetaddr(const char *); 6234355Sjb 6334355Sjbint pcap_nametoport(const char *, int *, int *); 6434355Sjbint pcap_nametoproto(const char *); 6534355Sjbint pcap_nametoeproto(const char *); 6634355Sjb/* 6734355Sjb * If a protocol is unknown, PROTO_UNDEF is returned. 6834355Sjb * Also, pcap_nametoport() returns the protocol along with the port number. 6934355Sjb * If there are ambiguous entried in /etc/services (i.e. domain 7034355Sjb * can be either tcp or udp) PROTO_UNDEF is returned. 7134355Sjb */ 7234355Sjb#define PROTO_UNDEF -1 7334355Sjb 7434355Sjb/* XXX move these to pcap-int.h? */ 7534355Sjbu_long __pcap_atodn(const char *); 7634355Sjbu_long __pcap_atoin(const char *); 7734355Sjbu_short __pcap_nametodnaddr(const char *); 7834355Sjb 7934355Sjb#endif 8034355Sjb