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