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