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