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