17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5fff9db26Svp  * Common Development and Distribution License (the "License").
6fff9db26Svp  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
217c478bd9Sstevel@tonic-gate /*
22*e23de8e2SGary Mills  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
237c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
247c478bd9Sstevel@tonic-gate  */
257c478bd9Sstevel@tonic-gate 
267c478bd9Sstevel@tonic-gate #ifndef _INETSVC_H
277c478bd9Sstevel@tonic-gate #define	_INETSVC_H
287c478bd9Sstevel@tonic-gate 
297c478bd9Sstevel@tonic-gate #include <libscf.h>
307c478bd9Sstevel@tonic-gate #include <sys/socket.h>
317c478bd9Sstevel@tonic-gate #include <libuutil.h>
327c478bd9Sstevel@tonic-gate #include <rpc/rpc.h>
337c478bd9Sstevel@tonic-gate 
347c478bd9Sstevel@tonic-gate /*
357c478bd9Sstevel@tonic-gate  * Interfaces shared by usr.lib/inetd and its administrative commands.
367c478bd9Sstevel@tonic-gate  */
377c478bd9Sstevel@tonic-gate 
387c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
397c478bd9Sstevel@tonic-gate extern "C" {
407c478bd9Sstevel@tonic-gate #endif
417c478bd9Sstevel@tonic-gate 
427c478bd9Sstevel@tonic-gate #define	PROTO_DELIMITERS		" ,"
437c478bd9Sstevel@tonic-gate 
447c478bd9Sstevel@tonic-gate #define	INETD_UDS_PATH			"/var/run/.inetd.uds"
457c478bd9Sstevel@tonic-gate #define	INETD_INSTANCE_FMRI		"svc:/network/inetd:default"
467c478bd9Sstevel@tonic-gate 
477c478bd9Sstevel@tonic-gate #define	PG_NAME_SERVICE_CONFIG		"inetd"
487c478bd9Sstevel@tonic-gate #define	PG_NAME_SERVICE_DEFAULTS	"defaults"
497c478bd9Sstevel@tonic-gate #define	PG_NAME_INETCONV		"inetconv"
507c478bd9Sstevel@tonic-gate 
517c478bd9Sstevel@tonic-gate #define	PR_SVC_NAME_NAME		"name"
527c478bd9Sstevel@tonic-gate #define	PR_SOCK_TYPE_NAME		"endpoint_type"
537c478bd9Sstevel@tonic-gate #define	PR_PROTO_NAME			"proto"
547c478bd9Sstevel@tonic-gate #define	PR_ISRPC_NAME			"isrpc"
557c478bd9Sstevel@tonic-gate #define	PR_RPC_LW_VER_NAME		"rpc_low_version"
567c478bd9Sstevel@tonic-gate #define	PR_RPC_HI_VER_NAME		"rpc_high_version"
577c478bd9Sstevel@tonic-gate #define	PR_ISWAIT_NAME			"wait"
587c478bd9Sstevel@tonic-gate #define	PR_CON_RATE_MAX_NAME		"max_con_rate"
597c478bd9Sstevel@tonic-gate #define	PR_CON_RATE_OFFLINE_NAME	"con_rate_offline"
607c478bd9Sstevel@tonic-gate #define	PR_BIND_ADDR_NAME		"bind_addr"
617c478bd9Sstevel@tonic-gate #define	PR_BIND_FAIL_MAX_NAME		"bind_fail_max"
627c478bd9Sstevel@tonic-gate #define	PR_BIND_FAIL_INTVL_NAME		"bind_fail_interval"
637c478bd9Sstevel@tonic-gate #define	PR_MAX_COPIES_NAME		"max_copies"
647c478bd9Sstevel@tonic-gate #define	PR_MAX_FAIL_RATE_CNT_NAME	"failrate_cnt"
657c478bd9Sstevel@tonic-gate #define	PR_MAX_FAIL_RATE_INTVL_NAME	"failrate_interval"
667c478bd9Sstevel@tonic-gate #define	PR_INHERIT_ENV_NAME		"inherit_env"
677c478bd9Sstevel@tonic-gate #define	PR_DO_TCP_WRAPPERS_NAME		"tcp_wrappers"
687c478bd9Sstevel@tonic-gate #define	PR_DO_TCP_TRACE_NAME		"tcp_trace"
69*e23de8e2SGary Mills #define	PR_DO_TCP_KEEPALIVE_NAME	"tcp_keepalive"
707c478bd9Sstevel@tonic-gate #define	PR_AUTO_CONVERTED_NAME		"converted"
717c478bd9Sstevel@tonic-gate #define	PR_VERSION_NAME			"version"
727c478bd9Sstevel@tonic-gate #define	PR_SOURCE_LINE_NAME		"source_line"
73fff9db26Svp #define	PR_CONNECTION_BACKLOG_NAME	"connection_backlog"
747c478bd9Sstevel@tonic-gate 
757c478bd9Sstevel@tonic-gate /*
767c478bd9Sstevel@tonic-gate  * Provide index values for inetd property locations in the property table, for
777c478bd9Sstevel@tonic-gate  * convenience.  If the array is modified, these values MUST be updated.
787c478bd9Sstevel@tonic-gate  */
797c478bd9Sstevel@tonic-gate #define	PT_SVC_NAME_INDEX		0
807c478bd9Sstevel@tonic-gate #define	PT_SOCK_TYPE_INDEX		1
817c478bd9Sstevel@tonic-gate #define	PT_PROTO_INDEX			2
827c478bd9Sstevel@tonic-gate #define	PT_ISRPC_INDEX			3
837c478bd9Sstevel@tonic-gate #define	PT_RPC_LW_VER_INDEX		4
847c478bd9Sstevel@tonic-gate #define	PT_RPC_HI_VER_INDEX		5
857c478bd9Sstevel@tonic-gate #define	PT_ISWAIT_INDEX			6
867c478bd9Sstevel@tonic-gate #define	PT_EXEC_INDEX			7
877c478bd9Sstevel@tonic-gate #define	PT_ARG0_INDEX			8
887c478bd9Sstevel@tonic-gate #define	PT_USER_INDEX			9
897c478bd9Sstevel@tonic-gate #define	PT_BIND_ADDR_INDEX		10
907c478bd9Sstevel@tonic-gate #define	PT_BIND_FAIL_MAX_INDEX		11
917c478bd9Sstevel@tonic-gate #define	PT_BIND_FAIL_INTVL_INDEX	12
927c478bd9Sstevel@tonic-gate #define	PT_CON_RATE_MAX_INDEX		13
937c478bd9Sstevel@tonic-gate #define	PT_MAX_COPIES_INDEX		14
947c478bd9Sstevel@tonic-gate #define	PT_CON_RATE_OFFLINE_INDEX	15
957c478bd9Sstevel@tonic-gate #define	PT_MAX_FAIL_RATE_CNT_INDEX	16
967c478bd9Sstevel@tonic-gate #define	PT_MAX_FAIL_RATE_INTVL_INDEX	17
977c478bd9Sstevel@tonic-gate #define	PT_INHERIT_ENV_INDEX		18
987c478bd9Sstevel@tonic-gate #define	PT_DO_TCP_TRACE_INDEX		19
997c478bd9Sstevel@tonic-gate #define	PT_DO_TCP_WRAPPERS_INDEX	20
100fff9db26Svp #define	PT_CONNECTION_BACKLOG_INDEX	21
101*e23de8e2SGary Mills #define	PT_DO_TCP_KEEPALIVE_INDEX	22
1027c478bd9Sstevel@tonic-gate 
1037c478bd9Sstevel@tonic-gate /*
1047c478bd9Sstevel@tonic-gate  * Names of method properties.
1057c478bd9Sstevel@tonic-gate  */
1067c478bd9Sstevel@tonic-gate #define	PR_EXEC_NAME			"exec"
1077c478bd9Sstevel@tonic-gate #define	PR_ARG0_NAME			"arg0"
1087c478bd9Sstevel@tonic-gate #define	PR_USER_NAME			"user"
1097c478bd9Sstevel@tonic-gate 
1107c478bd9Sstevel@tonic-gate /*
1117c478bd9Sstevel@tonic-gate  * Method property group names.
1127c478bd9Sstevel@tonic-gate  */
1137c478bd9Sstevel@tonic-gate #define	START_METHOD_NAME		"inetd_start"
1147c478bd9Sstevel@tonic-gate #define	OFFLINE_METHOD_NAME		"inetd_offline"
1157c478bd9Sstevel@tonic-gate #define	ONLINE_METHOD_NAME		"inetd_online"
1167c478bd9Sstevel@tonic-gate #define	DISABLE_METHOD_NAME		"inetd_disable"
1177c478bd9Sstevel@tonic-gate #define	REFRESH_METHOD_NAME		"inetd_refresh"
1187c478bd9Sstevel@tonic-gate 
1197c478bd9Sstevel@tonic-gate /*
1207c478bd9Sstevel@tonic-gate  * Valid socket type values.
1217c478bd9Sstevel@tonic-gate  */
1227c478bd9Sstevel@tonic-gate #define	SOCKTYPE_STREAM_STR	"stream"
1237c478bd9Sstevel@tonic-gate #define	SOCKTYPE_DGRAM_STR	"dgram"
1247c478bd9Sstevel@tonic-gate #define	SOCKTYPE_RAW_STR	"raw"
1257c478bd9Sstevel@tonic-gate #define	SOCKTYPE_SEQPKT_STR	"seqpacket"
1267c478bd9Sstevel@tonic-gate #define	SOCKTYPE_TLI_STR	"tli"
1277c478bd9Sstevel@tonic-gate #define	SOCKTYPE_XTI_STR	"xti"
1287c478bd9Sstevel@tonic-gate 
1297c478bd9Sstevel@tonic-gate /*
1307c478bd9Sstevel@tonic-gate  * Valid socket based service protocols.
1317c478bd9Sstevel@tonic-gate  */
1327c478bd9Sstevel@tonic-gate #define	SOCKET_PROTO_SCTP6	"sctp6"
1337c478bd9Sstevel@tonic-gate #define	SOCKET_PROTO_SCTP6_ONLY	"sctp6only"
1347c478bd9Sstevel@tonic-gate #define	SOCKET_PROTO_SCTP	"sctp"
1357c478bd9Sstevel@tonic-gate #define	SOCKET_PROTO_TCP6	"tcp6"
1367c478bd9Sstevel@tonic-gate #define	SOCKET_PROTO_TCP6_ONLY	"tcp6only"
1377c478bd9Sstevel@tonic-gate #define	SOCKET_PROTO_TCP	"tcp"
1387c478bd9Sstevel@tonic-gate #define	SOCKET_PROTO_UDP6	"udp6"
1397c478bd9Sstevel@tonic-gate #define	SOCKET_PROTO_UDP6_ONLY	"udp6only"
1407c478bd9Sstevel@tonic-gate #define	SOCKET_PROTO_UDP	"udp"
1417c478bd9Sstevel@tonic-gate 
1427c478bd9Sstevel@tonic-gate /*
1437c478bd9Sstevel@tonic-gate  * Return codes for the methods of inetd managed services.
1447c478bd9Sstevel@tonic-gate  */
1457c478bd9Sstevel@tonic-gate #define	IMRET_SUCCESS	0
1467c478bd9Sstevel@tonic-gate /*
1477c478bd9Sstevel@tonic-gate  * Set this value above the range used by unix commands so theres minimal chance
1487c478bd9Sstevel@tonic-gate  * of a non-GL cognizant command accidentally returning this code.
1497c478bd9Sstevel@tonic-gate  */
1507c478bd9Sstevel@tonic-gate #define	IMRET_FAILURE	100
1517c478bd9Sstevel@tonic-gate 
1527c478bd9Sstevel@tonic-gate /*
1537c478bd9Sstevel@tonic-gate  * Macros for differentiating between sockaddr_in & sockaddr_in6 when
1547c478bd9Sstevel@tonic-gate  * dealing with the contents of a sockaddr_storage structure.
1557c478bd9Sstevel@tonic-gate  * These differentiate based on the contents of ss_family (either AF_INET
1567c478bd9Sstevel@tonic-gate  * or AF_INET6).
1577c478bd9Sstevel@tonic-gate  */
1587c478bd9Sstevel@tonic-gate #define	SS_ADDRLEN(s)	((s).ss_family == AF_INET ? \
1597c478bd9Sstevel@tonic-gate 	sizeof (struct sockaddr_in) : sizeof (struct sockaddr_in6))
1607c478bd9Sstevel@tonic-gate #define	SS_PORT(s)	((s).ss_family == AF_INET ? \
1617c478bd9Sstevel@tonic-gate 	((struct sockaddr_in *)&(s))->sin_port : \
1627c478bd9Sstevel@tonic-gate 	((struct sockaddr_in6 *)&(s))->sin6_port)
1637c478bd9Sstevel@tonic-gate #define	SS_SETPORT(s, port)	((s).ss_family == AF_INET ? \
1647c478bd9Sstevel@tonic-gate 	(((struct sockaddr_in *)&(s))->sin_port = port) : \
1657c478bd9Sstevel@tonic-gate 	(((struct sockaddr_in6 *)&(s))->sin6_port = port))
1667c478bd9Sstevel@tonic-gate #define	SS_SINADDR(s)	((s).ss_family == AF_INET ? \
1677c478bd9Sstevel@tonic-gate 	((void *) &(((struct sockaddr_in *)&(s))->sin_addr)) : \
1687c478bd9Sstevel@tonic-gate 	((void *) &(((struct sockaddr_in6 *)&(s))->sin6_addr)))
1697c478bd9Sstevel@tonic-gate 
1707c478bd9Sstevel@tonic-gate /* Collection of information pertaining to rpc based services. */
1717c478bd9Sstevel@tonic-gate typedef struct {
1727c478bd9Sstevel@tonic-gate 	struct netbuf	netbuf;
1737c478bd9Sstevel@tonic-gate 	int		prognum;
1747c478bd9Sstevel@tonic-gate 	int		lowver;
1757c478bd9Sstevel@tonic-gate 	int		highver;
1767c478bd9Sstevel@tonic-gate 	char		*netid;
1777c478bd9Sstevel@tonic-gate 	boolean_t	is_loopback;
1787c478bd9Sstevel@tonic-gate } rpc_info_t;
1797c478bd9Sstevel@tonic-gate 
1807c478bd9Sstevel@tonic-gate /*
1817c478bd9Sstevel@tonic-gate  * Structure containing the common elements of both the socket_info_t and the
1827c478bd9Sstevel@tonic-gate  * tlx_info_t structures.
1837c478bd9Sstevel@tonic-gate  */
1847c478bd9Sstevel@tonic-gate typedef struct {
1857c478bd9Sstevel@tonic-gate 	/* proto string causing this entry */
1867c478bd9Sstevel@tonic-gate 	char		*proto;
1877c478bd9Sstevel@tonic-gate 
1887c478bd9Sstevel@tonic-gate 	/* network fd we're listening on; -1 if not listening */
1897c478bd9Sstevel@tonic-gate 	int		listen_fd;
1907c478bd9Sstevel@tonic-gate 
1917c478bd9Sstevel@tonic-gate 	/* associate RPC info structure, if any (NULL if none). */
1927c478bd9Sstevel@tonic-gate 	rpc_info_t	*ri;
1937c478bd9Sstevel@tonic-gate 
1947c478bd9Sstevel@tonic-gate 	uu_list_node_t	link;
1957c478bd9Sstevel@tonic-gate 
1967c478bd9Sstevel@tonic-gate 	/* should this fd have the v6 socket option set? */
1977c478bd9Sstevel@tonic-gate 	boolean_t	v6only;
1987c478bd9Sstevel@tonic-gate } proto_info_t;
1997c478bd9Sstevel@tonic-gate 
2007c478bd9Sstevel@tonic-gate 
2017c478bd9Sstevel@tonic-gate /* TLI/XTI connection indication list construct. */
2027c478bd9Sstevel@tonic-gate typedef struct {
2037c478bd9Sstevel@tonic-gate 	struct t_call	*call;
2047c478bd9Sstevel@tonic-gate 	uu_list_node_t	link;
2057c478bd9Sstevel@tonic-gate } tlx_conn_ind_t;
2067c478bd9Sstevel@tonic-gate 
2077c478bd9Sstevel@tonic-gate /* Collection of information pertaining to tli/xti based services. */
2087c478bd9Sstevel@tonic-gate typedef struct {
2097c478bd9Sstevel@tonic-gate 	/* protocol information common to tlx and socket based services */
2107c478bd9Sstevel@tonic-gate 	proto_info_t	pr_info;
2117c478bd9Sstevel@tonic-gate 
2127c478bd9Sstevel@tonic-gate 	/* address we're bound to */
2137c478bd9Sstevel@tonic-gate 	struct netbuf	local_addr;
2147c478bd9Sstevel@tonic-gate 
2157c478bd9Sstevel@tonic-gate 	/* device name supplied to t_open() */
2167c478bd9Sstevel@tonic-gate 	char		*dev_name;
2177c478bd9Sstevel@tonic-gate 
2187c478bd9Sstevel@tonic-gate 	/* queue of pending connection indications */
2197c478bd9Sstevel@tonic-gate 	uu_list_t	*conn_ind_queue;
2207c478bd9Sstevel@tonic-gate } tlx_info_t;
2217c478bd9Sstevel@tonic-gate 
2227c478bd9Sstevel@tonic-gate /* Collection of information pertaining to socket based services. */
2237c478bd9Sstevel@tonic-gate typedef struct {
2247c478bd9Sstevel@tonic-gate 	/* protocol information common to tlx and socket based services */
2257c478bd9Sstevel@tonic-gate 	proto_info_t		pr_info;
2267c478bd9Sstevel@tonic-gate 
2277c478bd9Sstevel@tonic-gate 	/* address we're bound to */
2287c478bd9Sstevel@tonic-gate 	struct sockaddr_storage local_addr;
2297c478bd9Sstevel@tonic-gate 
2307c478bd9Sstevel@tonic-gate 	/* SOCK_STREAM/SOCK_DGRAM/SOCK_RAW/SOCK_SEQPACKET */
2317c478bd9Sstevel@tonic-gate 	int			type;
2327c478bd9Sstevel@tonic-gate 
2337c478bd9Sstevel@tonic-gate 	int			protocol;
2347c478bd9Sstevel@tonic-gate } socket_info_t;
2357c478bd9Sstevel@tonic-gate 
2367c478bd9Sstevel@tonic-gate /* Basic configuration properties for an instance. */
2377c478bd9Sstevel@tonic-gate typedef struct {
2387c478bd9Sstevel@tonic-gate 	/* getservbyname() recognized service name */
2397c478bd9Sstevel@tonic-gate 	char		*svc_name;
2407c478bd9Sstevel@tonic-gate 
2417c478bd9Sstevel@tonic-gate 	/* TLI/XTI type service ? */
2427c478bd9Sstevel@tonic-gate 	boolean_t	istlx;
2437c478bd9Sstevel@tonic-gate 
2447c478bd9Sstevel@tonic-gate 	/* list of protocols and associated info */
2457c478bd9Sstevel@tonic-gate 	uu_list_t	*proto_list;
2467c478bd9Sstevel@tonic-gate 
2477c478bd9Sstevel@tonic-gate 	/* wait type service ? */
2487c478bd9Sstevel@tonic-gate 	boolean_t	iswait;
2497c478bd9Sstevel@tonic-gate 
2507c478bd9Sstevel@tonic-gate 	/*
2517c478bd9Sstevel@tonic-gate 	 * Properties from here onwards all have default values in the inetd
2527c478bd9Sstevel@tonic-gate 	 * service instance.
2537c478bd9Sstevel@tonic-gate 	 */
2547c478bd9Sstevel@tonic-gate 
2557c478bd9Sstevel@tonic-gate 	boolean_t	do_tcp_wrappers;
2567c478bd9Sstevel@tonic-gate 	boolean_t	do_tcp_trace;
257*e23de8e2SGary Mills 	boolean_t	do_tcp_keepalive;
2587c478bd9Sstevel@tonic-gate 
2597c478bd9Sstevel@tonic-gate 	/* inherit inetd's environment, or take an empty one */
2607c478bd9Sstevel@tonic-gate 	boolean_t	inherit_env;
2617c478bd9Sstevel@tonic-gate 
2627c478bd9Sstevel@tonic-gate 	/* failure rate configuration */
2637c478bd9Sstevel@tonic-gate 	int64_t		wait_fail_cnt;
2647c478bd9Sstevel@tonic-gate 	int		wait_fail_interval;
2657c478bd9Sstevel@tonic-gate 
2667c478bd9Sstevel@tonic-gate 	/* maximum concurrent copies limit */
2677c478bd9Sstevel@tonic-gate 	int64_t		max_copies;
2687c478bd9Sstevel@tonic-gate 
2697c478bd9Sstevel@tonic-gate 	/* connection rate configuration */
2707c478bd9Sstevel@tonic-gate 	int		conn_rate_offline;
2717c478bd9Sstevel@tonic-gate 	int64_t		conn_rate_max;
2727c478bd9Sstevel@tonic-gate 
2737c478bd9Sstevel@tonic-gate 	/* bind failure retries configuration */
2747c478bd9Sstevel@tonic-gate 	int		bind_fail_interval;
2757c478bd9Sstevel@tonic-gate 	int64_t		bind_fail_max;
2767c478bd9Sstevel@tonic-gate 
2777c478bd9Sstevel@tonic-gate 	/* specific address to bind instance to */
2787c478bd9Sstevel@tonic-gate 	char		*bind_addr;
279fff9db26Svp 
280fff9db26Svp 	/* connection backlog queue size */
281fff9db26Svp 	int64_t		conn_backlog;
2827c478bd9Sstevel@tonic-gate } basic_cfg_t;
2837c478bd9Sstevel@tonic-gate 
2847c478bd9Sstevel@tonic-gate typedef enum uds_request {
2857c478bd9Sstevel@tonic-gate 	UR_REFRESH_INETD,
2867c478bd9Sstevel@tonic-gate 	UR_STOP_INETD
2877c478bd9Sstevel@tonic-gate } uds_request_t;
2887c478bd9Sstevel@tonic-gate 
2897c478bd9Sstevel@tonic-gate typedef union {
2907c478bd9Sstevel@tonic-gate 	int64_t		iv_int;
2917c478bd9Sstevel@tonic-gate 	uint64_t	iv_cnt;
2927c478bd9Sstevel@tonic-gate 	boolean_t	iv_boolean;
293ba1637f8Smh 	char		*iv_string;
294ba1637f8Smh 	char		**iv_string_list;
2957c478bd9Sstevel@tonic-gate } inetd_value_t;
2967c478bd9Sstevel@tonic-gate 
2977c478bd9Sstevel@tonic-gate typedef enum {
2987c478bd9Sstevel@tonic-gate 	IVE_VALID,
2997c478bd9Sstevel@tonic-gate 	IVE_UNSET,
3007c478bd9Sstevel@tonic-gate 	IVE_INVALID
3017c478bd9Sstevel@tonic-gate } iv_error_t;
3027c478bd9Sstevel@tonic-gate 
303ba1637f8Smh /*
304ba1637f8Smh  * Operations on these types (like valid_default_prop()) need to be modified
305ba1637f8Smh  * when this list is changed.
306ba1637f8Smh  */
307ba1637f8Smh typedef enum {
308ba1637f8Smh 	INET_TYPE_INVALID = 0,
309ba1637f8Smh 
310ba1637f8Smh 	INET_TYPE_BOOLEAN,
311ba1637f8Smh 	INET_TYPE_COUNT,
312ba1637f8Smh 	INET_TYPE_INTEGER,
313ba1637f8Smh 	INET_TYPE_STRING,
314ba1637f8Smh 	INET_TYPE_STRING_LIST
315ba1637f8Smh } inet_type_t;
316ba1637f8Smh 
3177c478bd9Sstevel@tonic-gate typedef struct {
318ba1637f8Smh 	const char	*ip_name;
319ba1637f8Smh 	const char	*ip_pg;
320ba1637f8Smh 	inet_type_t	ip_type;
3217c478bd9Sstevel@tonic-gate 	boolean_t	ip_default;
3227c478bd9Sstevel@tonic-gate 	iv_error_t	ip_error;
3237c478bd9Sstevel@tonic-gate 	inetd_value_t	ip_value;
3247c478bd9Sstevel@tonic-gate 	boolean_t	from_inetd;
3257c478bd9Sstevel@tonic-gate } inetd_prop_t;
3267c478bd9Sstevel@tonic-gate 
3277c478bd9Sstevel@tonic-gate inetd_prop_t *get_prop_table(size_t *);
328ba1637f8Smh inetd_prop_t *find_prop(const inetd_prop_t *, const char *, inet_type_t);
329ba1637f8Smh int64_t get_prop_value_int(const inetd_prop_t *, const char *);
330ba1637f8Smh uint64_t get_prop_value_count(const inetd_prop_t *, const char *);
331ba1637f8Smh boolean_t get_prop_value_boolean(const inetd_prop_t *, const char *);
332ba1637f8Smh const char *get_prop_value_string(const inetd_prop_t *, const char *);
333ba1637f8Smh const char **get_prop_value_string_list(const inetd_prop_t *, const char *);
334ba1637f8Smh void put_prop_value_int(inetd_prop_t *, const char *, int64_t);
335ba1637f8Smh void put_prop_value_count(inetd_prop_t *, const char *, uint64_t);
336ba1637f8Smh void put_prop_value_boolean(inetd_prop_t *, const char *, boolean_t);
337ba1637f8Smh boolean_t put_prop_value_string(inetd_prop_t *, const char *, const char *);
338ba1637f8Smh void put_prop_value_string_list(inetd_prop_t *, const char *, char **);
3397c478bd9Sstevel@tonic-gate boolean_t valid_props(inetd_prop_t *, const char *fmri, basic_cfg_t **,
3407c478bd9Sstevel@tonic-gate     uu_list_pool_t *, uu_list_pool_t *);
3417c478bd9Sstevel@tonic-gate void destroy_basic_cfg(basic_cfg_t *);
3427c478bd9Sstevel@tonic-gate void destroy_proto_list(basic_cfg_t *);
343ba1637f8Smh boolean_t valid_default_prop(const char *, const void *);
3447c478bd9Sstevel@tonic-gate scf_error_t read_prop(scf_handle_t *, inetd_prop_t *, int, const char *,
3457c478bd9Sstevel@tonic-gate     const char *);
3467c478bd9Sstevel@tonic-gate inetd_prop_t *read_instance_props(scf_handle_t *, const char *, size_t *,
3477c478bd9Sstevel@tonic-gate     scf_error_t *);
3487c478bd9Sstevel@tonic-gate inetd_prop_t *read_default_props(scf_handle_t *, size_t *, scf_error_t *);
3497c478bd9Sstevel@tonic-gate void free_instance_props(inetd_prop_t *);
3507c478bd9Sstevel@tonic-gate int connect_to_inetd(void);
3517c478bd9Sstevel@tonic-gate int refresh_inetd(void);
3527c478bd9Sstevel@tonic-gate int get_sock_type_id(const char *);
3537c478bd9Sstevel@tonic-gate int get_rpc_prognum(const char *);
3547c478bd9Sstevel@tonic-gate int calculate_hash(const char *, char **);
3557c478bd9Sstevel@tonic-gate scf_error_t retrieve_inetd_hash(char **);
3567c478bd9Sstevel@tonic-gate scf_error_t store_inetd_hash(const char *);
3577c478bd9Sstevel@tonic-gate const char *inet_ntop_native(int, const void *, char *, size_t);
3587c478bd9Sstevel@tonic-gate void setproctitle(const char *, int, char **);
3597c478bd9Sstevel@tonic-gate void dg_template(
3607c478bd9Sstevel@tonic-gate     void (*)(int, const struct sockaddr *, int, const void *, size_t), int,
3617c478bd9Sstevel@tonic-gate     void *, size_t);
3627c478bd9Sstevel@tonic-gate int safe_write(int, const void *, size_t);
3637c478bd9Sstevel@tonic-gate int safe_sendto(int, const void *, size_t, int, const struct sockaddr *, int);
3647c478bd9Sstevel@tonic-gate char **get_protos(const char *);
3657c478bd9Sstevel@tonic-gate char **get_netids(char *);
3667c478bd9Sstevel@tonic-gate void destroy_strings(char **);
3677c478bd9Sstevel@tonic-gate 
3687c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
3697c478bd9Sstevel@tonic-gate }
3707c478bd9Sstevel@tonic-gate #endif
3717c478bd9Sstevel@tonic-gate 
3727c478bd9Sstevel@tonic-gate #endif /* _INETSVC_H */
373