1330632Seadler/*	$NetBSD: netconfig.h,v 1.6 2008/04/28 20:22:54 martin Exp $	*/
274462Salfred/*	$FreeBSD: stable/11/include/netconfig.h 330632 2018-03-08 06:51:17Z eadler $ */
374462Salfred
4330632Seadler/*-
5330632Seadler * SPDX-License-Identifier: BSD-2-Clause-NetBSD
6330632Seadler *
7330632Seadler * Copyright (c) 2004 The NetBSD Foundation, Inc.
8330632Seadler * All rights reserved.
9330632Seadler *
10330632Seadler * This code is derived from software contributed to The NetBSD Foundation
11330632Seadler * by Frank van der Linden.
12330632Seadler *
13330632Seadler * Redistribution and use in source and binary forms, with or without
14330632Seadler * modification, are permitted provided that the following conditions
15330632Seadler * are met:
16330632Seadler * 1. Redistributions of source code must retain the above copyright
17330632Seadler *    notice, this list of conditions and the following disclaimer.
18330632Seadler * 2. Redistributions in binary form must reproduce the above copyright
19330632Seadler *    notice, this list of conditions and the following disclaimer in the
20330632Seadler *    documentation and/or other materials provided with the distribution.
21330632Seadler *
22330632Seadler * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
23330632Seadler * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
24330632Seadler * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
25330632Seadler * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
26330632Seadler * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27330632Seadler * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28330632Seadler * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
29330632Seadler * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
30330632Seadler * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
31330632Seadler * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32330632Seadler * POSSIBILITY OF SUCH DAMAGE.
33330632Seadler */
3474462Salfred
3574462Salfred#ifndef _NETCONFIG_H_
3674462Salfred#define _NETCONFIG_H_
3774462Salfred
3874462Salfred#include <sys/cdefs.h>
3974462Salfred
4074462Salfred#define NETCONFIG	"/etc/netconfig"
4174462Salfred#define NETPATH		"NETPATH"
4274462Salfred
4374462Salfredstruct netconfig {
4474462Salfred	char *nc_netid;			/* Network ID */
4574462Salfred	unsigned long nc_semantics;	/* Semantics (see below) */
4674462Salfred	unsigned long nc_flag;		/* Flags (see below) */
4774462Salfred	char *nc_protofmly;		/* Protocol family */
4874462Salfred	char *nc_proto;			/* Protocol name */
4974462Salfred	char *nc_device;		/* Network device pathname */
5074462Salfred	unsigned long nc_nlookups;	/* Number of directory lookup libs */
5174462Salfred	char **nc_lookups;		/* Names of the libraries */
5274462Salfred	unsigned long nc_unused[9];	/* reserved */
5374462Salfred};
5474462Salfred
5574462Salfredtypedef struct {
5674462Salfred	struct netconfig **nc_head;
5774462Salfred	struct netconfig **nc_curr;
5874462Salfred} NCONF_HANDLE;
5974462Salfred
6074462Salfred/*
6174462Salfred * nc_semantics values
6274462Salfred */
63330632Seadler#define NC_TPI_CLTS	1	/* Connectionless transport */
64330632Seadler#define NC_TPI_COTS	2	/* Connection oriented transport */
65330632Seadler#define NC_TPI_COTS_ORD	3	/* Connection oriented, ordered transport */
66330632Seadler#define NC_TPI_RAW	4	/* Raw connection */
6774462Salfred
6874462Salfred/*
6974462Salfred * nc_flag values
7074462Salfred */
7174462Salfred#define NC_NOFLAG	0x00
7274462Salfred#define NC_VISIBLE	0x01
7374462Salfred#define NC_BROADCAST	0x02
7474462Salfred
7574462Salfred/*
7674462Salfred * nc_protofmly values
7774462Salfred */
7874462Salfred#define NC_NOPROTOFMLY	"-"
7974462Salfred#define NC_LOOPBACK	"loopback"
8074462Salfred#define NC_INET		"inet"
8174462Salfred#define NC_INET6	"inet6"
8274462Salfred#define NC_IMPLINK	"implink"
8374462Salfred#define NC_PUP		"pup"
8474462Salfred#define NC_CHAOS	"chaos"
8574462Salfred#define NC_NS		"ns"
8674462Salfred#define NC_NBS		"nbs"
8774462Salfred#define NC_ECMA		"ecma"
8874462Salfred#define NC_DATAKIT	"datakit"
8974462Salfred#define NC_CCITT	"ccitt"
9074462Salfred#define NC_SNA		"sna"
9174462Salfred#define NC_DECNET	"decnet"
9274462Salfred#define NC_DLI		"dli"
9374462Salfred#define NC_LAT		"lat"
9474462Salfred#define NC_HYLINK	"hylink"
9574462Salfred#define NC_APPLETALK	"appletalk"
9674462Salfred#define NC_NIT		"nit"
9774462Salfred#define NC_IEEE802	"ieee802"
9874462Salfred#define NC_OSI		"osi"
9974462Salfred#define NC_X25		"x25"
10074462Salfred#define NC_OSINET	"osinet"
10174462Salfred#define NC_GOSIP	"gosip"
10274462Salfred
10374462Salfred/*
10474462Salfred * nc_proto values
10574462Salfred */
10674462Salfred#define NC_NOPROTO	"-"
10774462Salfred#define NC_TCP		"tcp"
10874462Salfred#define NC_UDP		"udp"
10974462Salfred#define NC_ICMP		"icmp"
11074462Salfred
11174462Salfred__BEGIN_DECLS
11293032Simpvoid *setnetconfig(void);
11393032Simpstruct netconfig *getnetconfig(void *);
11493032Simpstruct netconfig *getnetconfigent(const char *);
11593032Simpvoid freenetconfigent(struct netconfig *);
11693032Simpint endnetconfig(void *);
11774462Salfred
11893032Simpvoid *setnetpath(void);
11993032Simpstruct netconfig *getnetpath(void *);
12074462Salfredint endnetpath(void *);
12174462Salfred
12293032Simpvoid nc_perror(const char *);
12393032Simpchar *nc_sperror(void);
12474462Salfred__END_DECLS
12574462Salfred
12674462Salfred#endif /* _NETCONFIG_H_ */
127