1*2fe8fb19SBen Gras /* $NetBSD: netconfig.h,v 1.6 2008/04/28 20:22:54 martin Exp $ */ 2*2fe8fb19SBen Gras 3*2fe8fb19SBen Gras /*- 4*2fe8fb19SBen Gras * Copyright (c) 2004 The NetBSD Foundation, Inc. 5*2fe8fb19SBen Gras * All rights reserved. 6*2fe8fb19SBen Gras * 7*2fe8fb19SBen Gras * This code is derived from software contributed to The NetBSD Foundation 8*2fe8fb19SBen Gras * by Frank van der Linden. 9*2fe8fb19SBen Gras * 10*2fe8fb19SBen Gras * Redistribution and use in source and binary forms, with or without 11*2fe8fb19SBen Gras * modification, are permitted provided that the following conditions 12*2fe8fb19SBen Gras * are met: 13*2fe8fb19SBen Gras * 1. Redistributions of source code must retain the above copyright 14*2fe8fb19SBen Gras * notice, this list of conditions and the following disclaimer. 15*2fe8fb19SBen Gras * 2. Redistributions in binary form must reproduce the above copyright 16*2fe8fb19SBen Gras * notice, this list of conditions and the following disclaimer in the 17*2fe8fb19SBen Gras * documentation and/or other materials provided with the distribution. 18*2fe8fb19SBen Gras * 19*2fe8fb19SBen Gras * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 20*2fe8fb19SBen Gras * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 21*2fe8fb19SBen Gras * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 22*2fe8fb19SBen Gras * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 23*2fe8fb19SBen Gras * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24*2fe8fb19SBen Gras * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25*2fe8fb19SBen Gras * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26*2fe8fb19SBen Gras * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27*2fe8fb19SBen Gras * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28*2fe8fb19SBen Gras * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29*2fe8fb19SBen Gras * POSSIBILITY OF SUCH DAMAGE. 30*2fe8fb19SBen Gras */ 31*2fe8fb19SBen Gras 32*2fe8fb19SBen Gras #ifndef _NETCONFIG_H_ 33*2fe8fb19SBen Gras #define _NETCONFIG_H_ 34*2fe8fb19SBen Gras 35*2fe8fb19SBen Gras #include <sys/cdefs.h> 36*2fe8fb19SBen Gras 37*2fe8fb19SBen Gras #define NETCONFIG "/etc/netconfig" 38*2fe8fb19SBen Gras #define NETPATH "NETPATH" 39*2fe8fb19SBen Gras 40*2fe8fb19SBen Gras struct netconfig { 41*2fe8fb19SBen Gras char *nc_netid; /* Network ID */ 42*2fe8fb19SBen Gras unsigned long nc_semantics; /* Semantics (see below) */ 43*2fe8fb19SBen Gras unsigned long nc_flag; /* Flags (see below) */ 44*2fe8fb19SBen Gras char *nc_protofmly; /* Protocol family */ 45*2fe8fb19SBen Gras char *nc_proto; /* Protocol name */ 46*2fe8fb19SBen Gras char *nc_device; /* Network device pathname */ 47*2fe8fb19SBen Gras unsigned long nc_nlookups; /* Number of directory lookup libs */ 48*2fe8fb19SBen Gras char **nc_lookups; /* Names of the libraries */ 49*2fe8fb19SBen Gras unsigned long nc_unused[9]; /* reserved */ 50*2fe8fb19SBen Gras }; 51*2fe8fb19SBen Gras 52*2fe8fb19SBen Gras typedef struct { 53*2fe8fb19SBen Gras struct netconfig **nc_head; 54*2fe8fb19SBen Gras struct netconfig **nc_curr; 55*2fe8fb19SBen Gras } NCONF_HANDLE; 56*2fe8fb19SBen Gras 57*2fe8fb19SBen Gras /* 58*2fe8fb19SBen Gras * nc_semantics values 59*2fe8fb19SBen Gras */ 60*2fe8fb19SBen Gras #define NC_TPI_CLTS 1 /* Connectionless transport */ 61*2fe8fb19SBen Gras #define NC_TPI_COTS 2 /* Connection oriented transport */ 62*2fe8fb19SBen Gras #define NC_TPI_COTS_ORD 3 /* Connection oriented, ordered transport */ 63*2fe8fb19SBen Gras #define NC_TPI_RAW 4 /* Raw connection */ 64*2fe8fb19SBen Gras 65*2fe8fb19SBen Gras /* 66*2fe8fb19SBen Gras * nc_flag values 67*2fe8fb19SBen Gras */ 68*2fe8fb19SBen Gras #define NC_NOFLAG 0x00 69*2fe8fb19SBen Gras #define NC_VISIBLE 0x01 70*2fe8fb19SBen Gras #define NC_BROADCAST 0x02 71*2fe8fb19SBen Gras 72*2fe8fb19SBen Gras /* 73*2fe8fb19SBen Gras * nc_protofmly values 74*2fe8fb19SBen Gras */ 75*2fe8fb19SBen Gras #define NC_NOPROTOFMLY "-" 76*2fe8fb19SBen Gras #define NC_LOOPBACK "loopback" 77*2fe8fb19SBen Gras #define NC_INET "inet" 78*2fe8fb19SBen Gras #define NC_INET6 "inet6" 79*2fe8fb19SBen Gras #define NC_IMPLINK "implink" 80*2fe8fb19SBen Gras #define NC_PUP "pup" 81*2fe8fb19SBen Gras #define NC_CHAOS "chaos" 82*2fe8fb19SBen Gras #define NC_NS "ns" 83*2fe8fb19SBen Gras #define NC_NBS "nbs" 84*2fe8fb19SBen Gras #define NC_ECMA "ecma" 85*2fe8fb19SBen Gras #define NC_DATAKIT "datakit" 86*2fe8fb19SBen Gras #define NC_CCITT "ccitt" 87*2fe8fb19SBen Gras #define NC_SNA "sna" 88*2fe8fb19SBen Gras #define NC_DECNET "decnet" 89*2fe8fb19SBen Gras #define NC_DLI "dli" 90*2fe8fb19SBen Gras #define NC_LAT "lat" 91*2fe8fb19SBen Gras #define NC_HYLINK "hylink" 92*2fe8fb19SBen Gras #define NC_APPLETALK "appletalk" 93*2fe8fb19SBen Gras #define NC_NIT "nit" 94*2fe8fb19SBen Gras #define NC_IEEE802 "ieee802" 95*2fe8fb19SBen Gras #define NC_OSI "osi" 96*2fe8fb19SBen Gras #define NC_X25 "x25" 97*2fe8fb19SBen Gras #define NC_OSINET "osinet" 98*2fe8fb19SBen Gras #define NC_GOSIP "gosip" 99*2fe8fb19SBen Gras 100*2fe8fb19SBen Gras /* 101*2fe8fb19SBen Gras * nc_proto values 102*2fe8fb19SBen Gras */ 103*2fe8fb19SBen Gras #define NC_NOPROTO "-" 104*2fe8fb19SBen Gras #define NC_TCP "tcp" 105*2fe8fb19SBen Gras #define NC_UDP "udp" 106*2fe8fb19SBen Gras #define NC_ICMP "icmp" 107*2fe8fb19SBen Gras 108*2fe8fb19SBen Gras __BEGIN_DECLS 109*2fe8fb19SBen Gras void *setnetconfig(void); 110*2fe8fb19SBen Gras struct netconfig *getnetconfig(void *); 111*2fe8fb19SBen Gras struct netconfig *getnetconfigent(const char *); 112*2fe8fb19SBen Gras void freenetconfigent(struct netconfig *); 113*2fe8fb19SBen Gras int endnetconfig(void *); 114*2fe8fb19SBen Gras 115*2fe8fb19SBen Gras void *setnetpath(void); 116*2fe8fb19SBen Gras struct netconfig *getnetpath(void *); 117*2fe8fb19SBen Gras int endnetpath(void *); 118*2fe8fb19SBen Gras 119*2fe8fb19SBen Gras void nc_perror(const char *); 120*2fe8fb19SBen Gras char *nc_sperror(void); 121*2fe8fb19SBen Gras __END_DECLS 122*2fe8fb19SBen Gras 123*2fe8fb19SBen Gras #endif /* _NETCONFIG_H_ */ 124