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