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