xref: /freebsd/include/netconfig.h (revision 2a63c3be158216222d89a073dcbd6a72ee4aab5a)
166a2396aSPedro F. Giffuni /*	$NetBSD: netconfig.h,v 1.6 2008/04/28 20:22:54 martin Exp $	*/
28360efbdSAlfred Perlstein 
366a2396aSPedro F. Giffuni /*-
4*b61a5730SWarner Losh  * SPDX-License-Identifier: BSD-2-Clause
566a2396aSPedro F. Giffuni  *
666a2396aSPedro F. Giffuni  * Copyright (c) 2004 The NetBSD Foundation, Inc.
766a2396aSPedro F. Giffuni  * All rights reserved.
866a2396aSPedro F. Giffuni  *
966a2396aSPedro F. Giffuni  * This code is derived from software contributed to The NetBSD Foundation
1066a2396aSPedro F. Giffuni  * by Frank van der Linden.
1166a2396aSPedro F. Giffuni  *
1266a2396aSPedro F. Giffuni  * Redistribution and use in source and binary forms, with or without
1366a2396aSPedro F. Giffuni  * modification, are permitted provided that the following conditions
1466a2396aSPedro F. Giffuni  * are met:
1566a2396aSPedro F. Giffuni  * 1. Redistributions of source code must retain the above copyright
1666a2396aSPedro F. Giffuni  *    notice, this list of conditions and the following disclaimer.
1766a2396aSPedro F. Giffuni  * 2. Redistributions in binary form must reproduce the above copyright
1866a2396aSPedro F. Giffuni  *    notice, this list of conditions and the following disclaimer in the
1966a2396aSPedro F. Giffuni  *    documentation and/or other materials provided with the distribution.
2066a2396aSPedro F. Giffuni  *
2166a2396aSPedro F. Giffuni  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
2266a2396aSPedro F. Giffuni  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
2366a2396aSPedro F. Giffuni  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
2466a2396aSPedro F. Giffuni  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
2566a2396aSPedro F. Giffuni  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
2666a2396aSPedro F. Giffuni  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
2766a2396aSPedro F. Giffuni  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
2866a2396aSPedro F. Giffuni  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
2966a2396aSPedro F. Giffuni  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
3066a2396aSPedro F. Giffuni  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
3166a2396aSPedro F. Giffuni  * POSSIBILITY OF SUCH DAMAGE.
3266a2396aSPedro F. Giffuni  */
338360efbdSAlfred Perlstein 
348360efbdSAlfred Perlstein #ifndef _NETCONFIG_H_
358360efbdSAlfred Perlstein #define _NETCONFIG_H_
368360efbdSAlfred Perlstein 
378360efbdSAlfred Perlstein #include <sys/cdefs.h>
388360efbdSAlfred Perlstein 
398360efbdSAlfred Perlstein #define NETCONFIG	"/etc/netconfig"
408360efbdSAlfred Perlstein #define NETPATH		"NETPATH"
418360efbdSAlfred Perlstein 
428360efbdSAlfred Perlstein struct netconfig {
438360efbdSAlfred Perlstein 	char *nc_netid;			/* Network ID */
448360efbdSAlfred Perlstein 	unsigned long nc_semantics;	/* Semantics (see below) */
458360efbdSAlfred Perlstein 	unsigned long nc_flag;		/* Flags (see below) */
468360efbdSAlfred Perlstein 	char *nc_protofmly;		/* Protocol family */
478360efbdSAlfred Perlstein 	char *nc_proto;			/* Protocol name */
488360efbdSAlfred Perlstein 	char *nc_device;		/* Network device pathname */
498360efbdSAlfred Perlstein 	unsigned long nc_nlookups;	/* Number of directory lookup libs */
508360efbdSAlfred Perlstein 	char **nc_lookups;		/* Names of the libraries */
518360efbdSAlfred Perlstein 	unsigned long nc_unused[9];	/* reserved */
528360efbdSAlfred Perlstein };
538360efbdSAlfred Perlstein 
548360efbdSAlfred Perlstein typedef struct {
558360efbdSAlfred Perlstein 	struct netconfig **nc_head;
568360efbdSAlfred Perlstein 	struct netconfig **nc_curr;
578360efbdSAlfred Perlstein } NCONF_HANDLE;
588360efbdSAlfred Perlstein 
598360efbdSAlfred Perlstein /*
608360efbdSAlfred Perlstein  * nc_semantics values
618360efbdSAlfred Perlstein  */
6266a2396aSPedro F. Giffuni #define NC_TPI_CLTS	1	/* Connectionless transport */
6366a2396aSPedro F. Giffuni #define NC_TPI_COTS	2	/* Connection oriented transport */
6466a2396aSPedro F. Giffuni #define NC_TPI_COTS_ORD	3	/* Connection oriented, ordered transport */
6566a2396aSPedro F. Giffuni #define NC_TPI_RAW	4	/* Raw connection */
668360efbdSAlfred Perlstein 
678360efbdSAlfred Perlstein /*
688360efbdSAlfred Perlstein  * nc_flag values
698360efbdSAlfred Perlstein  */
708360efbdSAlfred Perlstein #define NC_NOFLAG	0x00
718360efbdSAlfred Perlstein #define NC_VISIBLE	0x01
728360efbdSAlfred Perlstein #define NC_BROADCAST	0x02
738360efbdSAlfred Perlstein 
748360efbdSAlfred Perlstein /*
758360efbdSAlfred Perlstein  * nc_protofmly values
768360efbdSAlfred Perlstein  */
778360efbdSAlfred Perlstein #define NC_NOPROTOFMLY	"-"
788360efbdSAlfred Perlstein #define NC_LOOPBACK	"loopback"
798360efbdSAlfred Perlstein #define NC_INET		"inet"
808360efbdSAlfred Perlstein #define NC_INET6	"inet6"
818360efbdSAlfred Perlstein #define NC_IMPLINK	"implink"
828360efbdSAlfred Perlstein #define NC_PUP		"pup"
838360efbdSAlfred Perlstein #define NC_CHAOS	"chaos"
848360efbdSAlfred Perlstein #define NC_NS		"ns"
858360efbdSAlfred Perlstein #define NC_NBS		"nbs"
868360efbdSAlfred Perlstein #define NC_ECMA		"ecma"
878360efbdSAlfred Perlstein #define NC_DATAKIT	"datakit"
888360efbdSAlfred Perlstein #define NC_CCITT	"ccitt"
898360efbdSAlfred Perlstein #define NC_SNA		"sna"
908360efbdSAlfred Perlstein #define NC_DECNET	"decnet"
918360efbdSAlfred Perlstein #define NC_DLI		"dli"
928360efbdSAlfred Perlstein #define NC_LAT		"lat"
938360efbdSAlfred Perlstein #define NC_HYLINK	"hylink"
948360efbdSAlfred Perlstein #define NC_APPLETALK	"appletalk"
958360efbdSAlfred Perlstein #define NC_NIT		"nit"
968360efbdSAlfred Perlstein #define NC_IEEE802	"ieee802"
978360efbdSAlfred Perlstein #define NC_OSI		"osi"
988360efbdSAlfred Perlstein #define NC_X25		"x25"
998360efbdSAlfred Perlstein #define NC_OSINET	"osinet"
1008360efbdSAlfred Perlstein #define NC_GOSIP	"gosip"
1018360efbdSAlfred Perlstein 
1028360efbdSAlfred Perlstein /*
1038360efbdSAlfred Perlstein  * nc_proto values
1048360efbdSAlfred Perlstein  */
1058360efbdSAlfred Perlstein #define NC_NOPROTO	"-"
1068360efbdSAlfred Perlstein #define NC_TCP		"tcp"
1078360efbdSAlfred Perlstein #define NC_UDP		"udp"
1088360efbdSAlfred Perlstein #define NC_ICMP		"icmp"
1098360efbdSAlfred Perlstein 
1108360efbdSAlfred Perlstein __BEGIN_DECLS
111bb28f3c2SWarner Losh void *setnetconfig(void);
112bb28f3c2SWarner Losh struct netconfig *getnetconfig(void *);
113bb28f3c2SWarner Losh struct netconfig *getnetconfigent(const char *);
114bb28f3c2SWarner Losh void freenetconfigent(struct netconfig *);
115bb28f3c2SWarner Losh int endnetconfig(void *);
1168360efbdSAlfred Perlstein 
117bb28f3c2SWarner Losh void *setnetpath(void);
118bb28f3c2SWarner Losh struct netconfig *getnetpath(void *);
1198360efbdSAlfred Perlstein int endnetpath(void *);
1208360efbdSAlfred Perlstein 
121bb28f3c2SWarner Losh void nc_perror(const char *);
122bb28f3c2SWarner Losh char *nc_sperror(void);
1238360efbdSAlfred Perlstein __END_DECLS
1248360efbdSAlfred Perlstein 
1258360efbdSAlfred Perlstein #endif /* _NETCONFIG_H_ */
126