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