11541Srgrimes/*	$NetBSD: netconfig.h,v 1.6 2008/04/28 20:22:54 martin Exp $	*/
21541Srgrimes
31541Srgrimes/*-
41541Srgrimes * SPDX-License-Identifier: BSD-2-Clause
51541Srgrimes *
61541Srgrimes * Copyright (c) 2004 The NetBSD Foundation, Inc.
71541Srgrimes * All rights reserved.
81541Srgrimes *
91541Srgrimes * This code is derived from software contributed to The NetBSD Foundation
101541Srgrimes * by Frank van der Linden.
111541Srgrimes *
121541Srgrimes * Redistribution and use in source and binary forms, with or without
131541Srgrimes * modification, are permitted provided that the following conditions
141541Srgrimes * are met:
151541Srgrimes * 1. Redistributions of source code must retain the above copyright
161541Srgrimes *    notice, this list of conditions and the following disclaimer.
171541Srgrimes * 2. Redistributions in binary form must reproduce the above copyright
181541Srgrimes *    notice, this list of conditions and the following disclaimer in the
191541Srgrimes *    documentation and/or other materials provided with the distribution.
201541Srgrimes *
211541Srgrimes * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
221541Srgrimes * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
231541Srgrimes * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
241541Srgrimes * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
251541Srgrimes * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
261541Srgrimes * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
271541Srgrimes * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
281541Srgrimes * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
291541Srgrimes * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
301541Srgrimes * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
311541Srgrimes * POSSIBILITY OF SUCH DAMAGE.
321541Srgrimes */
331541Srgrimes
341541Srgrimes#ifndef _NETCONFIG_H_
351541Srgrimes#define _NETCONFIG_H_
361541Srgrimes
371541Srgrimes#include <sys/cdefs.h>
3815311Sbde
391541Srgrimes#define NETCONFIG	"/etc/netconfig"
401541Srgrimes#define NETPATH		"NETPATH"
411541Srgrimes
421541Srgrimesstruct netconfig {
431541Srgrimes	char *nc_netid;			/* Network ID */
441541Srgrimes	unsigned long nc_semantics;	/* Semantics (see below) */
451541Srgrimes	unsigned long nc_flag;		/* Flags (see below) */
461541Srgrimes	char *nc_protofmly;		/* Protocol family */
471541Srgrimes	char *nc_proto;			/* Protocol name */
481541Srgrimes	char *nc_device;		/* Network device pathname */
491541Srgrimes	unsigned long nc_nlookups;	/* Number of directory lookup libs */
501541Srgrimes	char **nc_lookups;		/* Names of the libraries */
511541Srgrimes	unsigned long nc_unused[9];	/* reserved */
521541Srgrimes};
531541Srgrimes
541541Srgrimestypedef struct {
551541Srgrimes	struct netconfig **nc_head;
561541Srgrimes	struct netconfig **nc_curr;
5715311Sbde} NCONF_HANDLE;
581541Srgrimes
591541Srgrimes/*
601541Srgrimes * nc_semantics values
611541Srgrimes */
621541Srgrimes#define NC_TPI_CLTS	1	/* Connectionless transport */
631541Srgrimes#define NC_TPI_COTS	2	/* Connection oriented transport */
641541Srgrimes#define NC_TPI_COTS_ORD	3	/* Connection oriented, ordered transport */
651541Srgrimes#define NC_TPI_RAW	4	/* Raw connection */
661541Srgrimes
671541Srgrimes/*
681541Srgrimes * nc_flag values
691541Srgrimes */
701541Srgrimes#define NC_NOFLAG	0x00
711541Srgrimes#define NC_VISIBLE	0x01
721541Srgrimes#define NC_BROADCAST	0x02
731541Srgrimes
741541Srgrimes/*
751541Srgrimes * nc_protofmly values
761541Srgrimes */
771541Srgrimes#define NC_NOPROTOFMLY	"-"
781541Srgrimes#define NC_LOOPBACK	"loopback"
791541Srgrimes#define NC_INET		"inet"
801541Srgrimes#define NC_INET6	"inet6"
811541Srgrimes#define NC_IMPLINK	"implink"
821541Srgrimes#define NC_PUP		"pup"
831541Srgrimes#define NC_CHAOS	"chaos"
841541Srgrimes#define NC_NS		"ns"
851541Srgrimes#define NC_NBS		"nbs"
861541Srgrimes#define NC_ECMA		"ecma"
871541Srgrimes#define NC_DATAKIT	"datakit"
881541Srgrimes#define NC_CCITT	"ccitt"
891541Srgrimes#define NC_SNA		"sna"
901541Srgrimes#define NC_DECNET	"decnet"
911541Srgrimes#define NC_DLI		"dli"
921541Srgrimes#define NC_LAT		"lat"
931541Srgrimes#define NC_HYLINK	"hylink"
941541Srgrimes#define NC_APPLETALK	"appletalk"
951541Srgrimes#define NC_NIT		"nit"
961541Srgrimes#define NC_IEEE802	"ieee802"
971541Srgrimes#define NC_OSI		"osi"
981541Srgrimes#define NC_X25		"x25"
991541Srgrimes#define NC_OSINET	"osinet"
10013030Sbde#define NC_GOSIP	"gosip"
10113030Sbde
10213030Sbde/*
10313030Sbde * nc_proto values
10413030Sbde */
1051541Srgrimes#define NC_NOPROTO	"-"
1061541Srgrimes#define NC_TCP		"tcp"
1071541Srgrimes#define NC_UDP		"udp"
1081541Srgrimes#define NC_ICMP		"icmp"
1091541Srgrimes
1101541Srgrimes__BEGIN_DECLS
1111541Srgrimesvoid *setnetconfig(void);
1121541Srgrimesstruct netconfig *getnetconfig(void *);
1131541Srgrimesstruct netconfig *getnetconfigent(const char *);
1141541Srgrimesvoid freenetconfigent(struct netconfig *);
1151541Srgrimesint endnetconfig(void *);
1161541Srgrimes
117void *setnetpath(void);
118struct netconfig *getnetpath(void *);
119int endnetpath(void *);
120
121void nc_perror(const char *);
122char *nc_sperror(void);
123__END_DECLS
124
125#endif /* _NETCONFIG_H_ */
126