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