xref: /onnv-gate/usr/src/lib/libipadm/common/libipadm.h (revision 13125:34b1540309cc)
112016SGirish.Moodalbail@Sun.COM /*
212016SGirish.Moodalbail@Sun.COM  * CDDL HEADER START
312016SGirish.Moodalbail@Sun.COM  *
412016SGirish.Moodalbail@Sun.COM  * The contents of this file are subject to the terms of the
512016SGirish.Moodalbail@Sun.COM  * Common Development and Distribution License (the "License").
612016SGirish.Moodalbail@Sun.COM  * You may not use this file except in compliance with the License.
712016SGirish.Moodalbail@Sun.COM  *
812016SGirish.Moodalbail@Sun.COM  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
912016SGirish.Moodalbail@Sun.COM  * or http://www.opensolaris.org/os/licensing.
1012016SGirish.Moodalbail@Sun.COM  * See the License for the specific language governing permissions
1112016SGirish.Moodalbail@Sun.COM  * and limitations under the License.
1212016SGirish.Moodalbail@Sun.COM  *
1312016SGirish.Moodalbail@Sun.COM  * When distributing Covered Code, include this CDDL HEADER in each
1412016SGirish.Moodalbail@Sun.COM  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
1512016SGirish.Moodalbail@Sun.COM  * If applicable, add the following below this CDDL HEADER, with the
1612016SGirish.Moodalbail@Sun.COM  * fields enclosed by brackets "[]" replaced with your own identifying
1712016SGirish.Moodalbail@Sun.COM  * information: Portions Copyright [yyyy] [name of copyright owner]
1812016SGirish.Moodalbail@Sun.COM  *
1912016SGirish.Moodalbail@Sun.COM  * CDDL HEADER END
2012016SGirish.Moodalbail@Sun.COM  */
2112016SGirish.Moodalbail@Sun.COM /*
2212048SGirish.Moodalbail@Sun.COM  * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
2312016SGirish.Moodalbail@Sun.COM  */
2412016SGirish.Moodalbail@Sun.COM #ifndef _LIBIPADM_H
2512016SGirish.Moodalbail@Sun.COM #define	_LIBIPADM_H
2612016SGirish.Moodalbail@Sun.COM 
2712016SGirish.Moodalbail@Sun.COM #ifdef	__cplusplus
2812016SGirish.Moodalbail@Sun.COM extern "C" {
2912016SGirish.Moodalbail@Sun.COM #endif
3012016SGirish.Moodalbail@Sun.COM 
3112016SGirish.Moodalbail@Sun.COM #include <sys/types.h>
3212016SGirish.Moodalbail@Sun.COM #include <sys/socket.h>
3312016SGirish.Moodalbail@Sun.COM #include <net/if.h>
3412016SGirish.Moodalbail@Sun.COM #include <netdb.h>
3512016SGirish.Moodalbail@Sun.COM #include <ifaddrs.h>
3612016SGirish.Moodalbail@Sun.COM #include <libnvpair.h>
3712016SGirish.Moodalbail@Sun.COM #include <netinet/tcp.h>
3812016SGirish.Moodalbail@Sun.COM #include <sys/stropts.h>
3912016SGirish.Moodalbail@Sun.COM 
4012016SGirish.Moodalbail@Sun.COM #define	IPADM_AOBJ_USTRSIZ	32
4112016SGirish.Moodalbail@Sun.COM #define	IPADM_AOBJSIZ		(LIFNAMSIZ + IPADM_AOBJ_USTRSIZ)
4212016SGirish.Moodalbail@Sun.COM #define	MAXPROPVALLEN		512
4312016SGirish.Moodalbail@Sun.COM #define	LOOPBACK_IF		"lo0"
4412016SGirish.Moodalbail@Sun.COM 
4512016SGirish.Moodalbail@Sun.COM /* special timeout values for dhcp operations */
4612016SGirish.Moodalbail@Sun.COM #define	IPADM_DHCP_WAIT_DEFAULT	(-1)
4712016SGirish.Moodalbail@Sun.COM #define	IPADM_DHCP_WAIT_FOREVER	(-2)
4812016SGirish.Moodalbail@Sun.COM 
4912016SGirish.Moodalbail@Sun.COM /*
5012016SGirish.Moodalbail@Sun.COM  * Specifies that the string passed to ipadm_str2nvlist() is a string of comma
5112016SGirish.Moodalbail@Sun.COM  * separated names and that each name does not have values associated with it.
5212016SGirish.Moodalbail@Sun.COM  */
5312016SGirish.Moodalbail@Sun.COM #define	IPADM_NORVAL		0x00000001
5412016SGirish.Moodalbail@Sun.COM 
5512016SGirish.Moodalbail@Sun.COM /* error codes */
5612016SGirish.Moodalbail@Sun.COM typedef enum {
5712016SGirish.Moodalbail@Sun.COM 	IPADM_SUCCESS,		/* No error occurred */
5812016SGirish.Moodalbail@Sun.COM 	IPADM_FAILURE,		/* Generic failure */
5912016SGirish.Moodalbail@Sun.COM 	IPADM_EAUTH,		/* Insufficient user authorizations */
6012016SGirish.Moodalbail@Sun.COM 	IPADM_EPERM,		/* Permission denied */
6112016SGirish.Moodalbail@Sun.COM 	IPADM_NO_BUFS,		/* No Buffer space available */
6212016SGirish.Moodalbail@Sun.COM 	IPADM_NO_MEMORY,	/* Insufficient memory */
6312016SGirish.Moodalbail@Sun.COM 	IPADM_BAD_ADDR,		/* Invalid address */
6412016SGirish.Moodalbail@Sun.COM 	IPADM_BAD_PROTOCOL,	/* Wrong protocol family for operation */
6512016SGirish.Moodalbail@Sun.COM 	IPADM_DAD_FOUND,	/* Duplicate address detected */
6612016SGirish.Moodalbail@Sun.COM 	IPADM_EXISTS,		/* Already exists */
6712016SGirish.Moodalbail@Sun.COM 	IPADM_IF_EXISTS,	/* Interface already exists */
6812016SGirish.Moodalbail@Sun.COM 	IPADM_ADDROBJ_EXISTS,	/* Address object already exists */
6912016SGirish.Moodalbail@Sun.COM 	IPADM_ADDRCONF_EXISTS,	/* Addrconf already in progress */
7012016SGirish.Moodalbail@Sun.COM 	IPADM_ENXIO,		/* Interface does not exist */
7112016SGirish.Moodalbail@Sun.COM 	IPADM_GRP_NOTEMPTY,	/* IPMP Group non-empty on unplumb */
7212016SGirish.Moodalbail@Sun.COM 	IPADM_INVALID_ARG,	/* Invalid argument */
7312016SGirish.Moodalbail@Sun.COM 	IPADM_INVALID_NAME,	/* Invalid name */
7412016SGirish.Moodalbail@Sun.COM 	IPADM_DLPI_FAILURE,	/* Could not open DLPI link */
7512016SGirish.Moodalbail@Sun.COM 	IPADM_DLADM_FAILURE,	/* DLADM error encountered */
7612016SGirish.Moodalbail@Sun.COM 	IPADM_PROP_UNKNOWN,	/* Unknown property */
7712016SGirish.Moodalbail@Sun.COM 	IPADM_ERANGE,		/* Value is outside the allowed range */
7812016SGirish.Moodalbail@Sun.COM 	IPADM_ESRCH,		/* Value does not exist */
7912016SGirish.Moodalbail@Sun.COM 	IPADM_EOVERFLOW,	/* Number of values exceed the allowed limit */
8012016SGirish.Moodalbail@Sun.COM 	IPADM_NOTFOUND,		/* Object not found */
8112016SGirish.Moodalbail@Sun.COM 	IPADM_IF_INUSE,		/* Interface already in use */
8212016SGirish.Moodalbail@Sun.COM 	IPADM_ADDR_INUSE,	/* Address alrelady in use */
8312016SGirish.Moodalbail@Sun.COM 	IPADM_BAD_HOSTNAME,	/* hostname maps to multiple IP addresses */
8412016SGirish.Moodalbail@Sun.COM 	IPADM_ADDR_NOTAVAIL,	/* Can't assign requested address */
8512016SGirish.Moodalbail@Sun.COM 	IPADM_ALL_ADDRS_NOT_ENABLED, /* All addresses could not be enabled */
8612016SGirish.Moodalbail@Sun.COM 	IPADM_NDPD_NOT_RUNNING,	/* in.ndpd not running */
8712016SGirish.Moodalbail@Sun.COM 	IPADM_DHCP_START_ERROR,	/* Cannot start dhcpagent */
8812016SGirish.Moodalbail@Sun.COM 	IPADM_DHCP_IPC_ERROR,	/* Cannot communicate with dhcpagent */
8912016SGirish.Moodalbail@Sun.COM 	IPADM_DHCP_IPC_TIMEOUT,	/* Communication with dhcpagent timed out */
9012016SGirish.Moodalbail@Sun.COM 	IPADM_TEMPORARY_OBJ,	/* Permanent operation on temporary object */
9112016SGirish.Moodalbail@Sun.COM 	IPADM_IPC_ERROR,	/* Cannot communicate with ipmgmtd */
9212016SGirish.Moodalbail@Sun.COM 	IPADM_OP_DISABLE_OBJ,	/* Operation on disable object */
9312016SGirish.Moodalbail@Sun.COM 	IPADM_NOTSUP,		/* Operation not supported */
9412748SSowmini.Varadhan@oracle.COM 	IPADM_EBADE,		/* Invalid data exchange with ipmgmtd */
9512748SSowmini.Varadhan@oracle.COM 	IPADM_GZ_PERM		/* Operation not permitted on from-gz intf */
9612016SGirish.Moodalbail@Sun.COM } ipadm_status_t;
9712016SGirish.Moodalbail@Sun.COM 
9812016SGirish.Moodalbail@Sun.COM /*
9912016SGirish.Moodalbail@Sun.COM  * option flags taken by the libipadm functions
10012016SGirish.Moodalbail@Sun.COM  *
10112016SGirish.Moodalbail@Sun.COM  *  - IPADM_OPT_PERSIST:
10212016SGirish.Moodalbail@Sun.COM  *	For all the create/delete/up/down/set/get functions,
10312016SGirish.Moodalbail@Sun.COM  * 	requests to persist the configuration so that it can be
10412016SGirish.Moodalbail@Sun.COM  *	re-enabled or reapplied on boot.
10512016SGirish.Moodalbail@Sun.COM  *
10612016SGirish.Moodalbail@Sun.COM  *  - IPADM_OPT_ACTIVE:
10712016SGirish.Moodalbail@Sun.COM  *	Requests to apply configuration without persisting it and
10812016SGirish.Moodalbail@Sun.COM  *	used by show-* subcommands to retrieve current values.
10912016SGirish.Moodalbail@Sun.COM  *
11012016SGirish.Moodalbail@Sun.COM  *  - IPADM_OPT_DEFAULT:
11112016SGirish.Moodalbail@Sun.COM  *	retrieves the default value for a given property
11212016SGirish.Moodalbail@Sun.COM  *
11312016SGirish.Moodalbail@Sun.COM  *  - IPADM_OPT_PERM
11412016SGirish.Moodalbail@Sun.COM  *	retrieves the permission for a given property
11512016SGirish.Moodalbail@Sun.COM  *
11612016SGirish.Moodalbail@Sun.COM  *  - IPADM_OPT_POSSIBLE
11712016SGirish.Moodalbail@Sun.COM  *	retrieves the range of values for a given property
11812016SGirish.Moodalbail@Sun.COM  *
11912016SGirish.Moodalbail@Sun.COM  *  - IPADM_OPT_APPEND
12012016SGirish.Moodalbail@Sun.COM  *	for multi-valued properties, appends a new value.
12112016SGirish.Moodalbail@Sun.COM  *
12212016SGirish.Moodalbail@Sun.COM  *  - IPADM_OPT_REMOVE
12312016SGirish.Moodalbail@Sun.COM  *	for multi-valued properties, removes the specified value
12412016SGirish.Moodalbail@Sun.COM  *
12512016SGirish.Moodalbail@Sun.COM  *  - IPADM_OPT_IPMP
12612016SGirish.Moodalbail@Sun.COM  *	Used in ipadm_create_if() to plumb ipmp interfaces.
12712016SGirish.Moodalbail@Sun.COM  *
12812016SGirish.Moodalbail@Sun.COM  *  - IPADM_OPT_GENPPA
12912016SGirish.Moodalbail@Sun.COM  *	Used in ipadm_create_if() to generate a ppa for the given interface.
13012016SGirish.Moodalbail@Sun.COM  *
13112016SGirish.Moodalbail@Sun.COM  *  - IPADM_OPT_ZEROADDR
13212016SGirish.Moodalbail@Sun.COM  *	return :: or INADDR_ANY
13312016SGirish.Moodalbail@Sun.COM  *
13412016SGirish.Moodalbail@Sun.COM  *  - IPADM_OPT_RELEASE
13512016SGirish.Moodalbail@Sun.COM  *	Used to release the lease on a dhcp address object
13612016SGirish.Moodalbail@Sun.COM  *
13712016SGirish.Moodalbail@Sun.COM  *  - IPADM_OPT_INFORM
13812016SGirish.Moodalbail@Sun.COM  *	Used to perform DHCP_INFORM on a specified static address object
13912016SGirish.Moodalbail@Sun.COM  *
14012016SGirish.Moodalbail@Sun.COM  *  - IPADM_OPT_UP
14112016SGirish.Moodalbail@Sun.COM  *	Used to bring up a static address on creation
14212576SAnurag.Maskey@Oracle.COM  *
14312576SAnurag.Maskey@Oracle.COM  *  - IPADM_OPT_V46
14412576SAnurag.Maskey@Oracle.COM  *      Used to plumb both IPv4 and IPv6 interfaces by ipadm_create_addr()
14512016SGirish.Moodalbail@Sun.COM  */
14612016SGirish.Moodalbail@Sun.COM #define	IPADM_OPT_PERSIST	0x00000001
14712016SGirish.Moodalbail@Sun.COM #define	IPADM_OPT_ACTIVE	0x00000002
14812016SGirish.Moodalbail@Sun.COM #define	IPADM_OPT_DEFAULT	0x00000004
14912016SGirish.Moodalbail@Sun.COM #define	IPADM_OPT_PERM		0x00000008
15012016SGirish.Moodalbail@Sun.COM #define	IPADM_OPT_POSSIBLE	0x00000010
15112016SGirish.Moodalbail@Sun.COM #define	IPADM_OPT_APPEND	0x00000020
15212016SGirish.Moodalbail@Sun.COM #define	IPADM_OPT_REMOVE	0x00000040
15312016SGirish.Moodalbail@Sun.COM #define	IPADM_OPT_IPMP		0x00000080
15412016SGirish.Moodalbail@Sun.COM #define	IPADM_OPT_GENPPA	0x00000100
15512016SGirish.Moodalbail@Sun.COM #define	IPADM_OPT_ZEROADDR	0x00000200
15612016SGirish.Moodalbail@Sun.COM #define	IPADM_OPT_RELEASE	0x00000400
15712016SGirish.Moodalbail@Sun.COM #define	IPADM_OPT_INFORM	0x00000800
15812016SGirish.Moodalbail@Sun.COM #define	IPADM_OPT_UP		0x00001000
15912576SAnurag.Maskey@Oracle.COM #define	IPADM_OPT_V46		0x00002000
16012016SGirish.Moodalbail@Sun.COM 
16112016SGirish.Moodalbail@Sun.COM /* IPADM property class */
16212016SGirish.Moodalbail@Sun.COM #define	IPADMPROP_CLASS_MODULE	0x00000001	/* on 'protocol' only */
16312016SGirish.Moodalbail@Sun.COM #define	IPADMPROP_CLASS_IF	0x00000002	/* on 'IP interface' only */
16412016SGirish.Moodalbail@Sun.COM #define	IPADMPROP_CLASS_ADDR	0x00000004	/* on 'IP address' only */
16512016SGirish.Moodalbail@Sun.COM /* protocol property that can be applied on interface too */
16612016SGirish.Moodalbail@Sun.COM #define	IPADMPROP_CLASS_MODIF	(IPADMPROP_CLASS_MODULE | IPADMPROP_CLASS_IF)
16712016SGirish.Moodalbail@Sun.COM 
16812016SGirish.Moodalbail@Sun.COM /* opaque ipadm handle to libipadm functions */
16912016SGirish.Moodalbail@Sun.COM struct ipadm_handle;
17012016SGirish.Moodalbail@Sun.COM typedef struct ipadm_handle	*ipadm_handle_t;
17112016SGirish.Moodalbail@Sun.COM 
17212016SGirish.Moodalbail@Sun.COM /* ipadm_handle flags */
17312016SGirish.Moodalbail@Sun.COM #define	IPH_VRRP		0x00000001	/* Caller is VRRP */
17412016SGirish.Moodalbail@Sun.COM #define	IPH_LEGACY		0x00000002	/* Caller is legacy app */
17512748SSowmini.Varadhan@oracle.COM #define	IPH_IPMGMTD		0x00000004	/* Caller is ipmgmtd itself */
176*13125SGirish.Moodalbail@oracle.COM /*
177*13125SGirish.Moodalbail@oracle.COM  * Indicates that the operation being invoked is in 'init' context. This is
178*13125SGirish.Moodalbail@oracle.COM  * a library private flag.
179*13125SGirish.Moodalbail@oracle.COM  */
180*13125SGirish.Moodalbail@oracle.COM #define	IPH_INIT		0x10000000
18112016SGirish.Moodalbail@Sun.COM 
18212016SGirish.Moodalbail@Sun.COM /* opaque address object structure */
18312016SGirish.Moodalbail@Sun.COM typedef struct ipadm_addrobj_s	*ipadm_addrobj_t;
18412016SGirish.Moodalbail@Sun.COM 
18512016SGirish.Moodalbail@Sun.COM /* ipadm_if_info_t states */
18612016SGirish.Moodalbail@Sun.COM typedef enum {
18712016SGirish.Moodalbail@Sun.COM 	IFIS_OK,		/* Interface is usable */
18812016SGirish.Moodalbail@Sun.COM 	IFIS_DOWN,		/* Interface has no UP addresses */
18912016SGirish.Moodalbail@Sun.COM 	IFIS_FAILED,		/* Interface has failed. */
19012016SGirish.Moodalbail@Sun.COM 	IFIS_OFFLINE,		/* Interface has been offlined */
19112016SGirish.Moodalbail@Sun.COM 	IFIS_DISABLED		/* Interface has been disabled. */
19212016SGirish.Moodalbail@Sun.COM } ipadm_if_state_t;
19312016SGirish.Moodalbail@Sun.COM 
19412016SGirish.Moodalbail@Sun.COM typedef struct ipadm_if_info_s {
19512016SGirish.Moodalbail@Sun.COM 	struct ipadm_if_info_s	*ifi_next;
19612016SGirish.Moodalbail@Sun.COM 	char			ifi_name[LIFNAMSIZ];	/* interface name */
19712016SGirish.Moodalbail@Sun.COM 	ipadm_if_state_t	ifi_state;		/* see above */
19812016SGirish.Moodalbail@Sun.COM 	uint_t			ifi_cflags;		/* current flags */
19912016SGirish.Moodalbail@Sun.COM 	uint_t			ifi_pflags;		/* persistent flags */
20012016SGirish.Moodalbail@Sun.COM } ipadm_if_info_t;
20112016SGirish.Moodalbail@Sun.COM 
20212016SGirish.Moodalbail@Sun.COM /* ipadm_if_info_t flags */
20312016SGirish.Moodalbail@Sun.COM #define	IFIF_BROADCAST		0x00000001
20412016SGirish.Moodalbail@Sun.COM #define	IFIF_MULTICAST		0x00000002
20512016SGirish.Moodalbail@Sun.COM #define	IFIF_POINTOPOINT	0x00000004
20612016SGirish.Moodalbail@Sun.COM #define	IFIF_VIRTUAL		0x00000008
20712016SGirish.Moodalbail@Sun.COM #define	IFIF_IPMP		0x00000010
20812016SGirish.Moodalbail@Sun.COM #define	IFIF_STANDBY		0x00000020
20912016SGirish.Moodalbail@Sun.COM #define	IFIF_INACTIVE		0x00000040
21012016SGirish.Moodalbail@Sun.COM #define	IFIF_VRRP		0x00000080
21112016SGirish.Moodalbail@Sun.COM #define	IFIF_NOACCEPT		0x00000100
21212016SGirish.Moodalbail@Sun.COM #define	IFIF_IPV4		0x00000200
21312016SGirish.Moodalbail@Sun.COM #define	IFIF_IPV6		0x00000400
21412748SSowmini.Varadhan@oracle.COM #define	IFIF_L3PROTECT		0x00000800
21512016SGirish.Moodalbail@Sun.COM 
21612016SGirish.Moodalbail@Sun.COM /* ipadm_addr_info_t state */
21712016SGirish.Moodalbail@Sun.COM typedef enum {
21812016SGirish.Moodalbail@Sun.COM 	IFA_DISABLED,		/* Address not in active configuration. */
21912016SGirish.Moodalbail@Sun.COM 	IFA_DUPLICATE,		/* DAD failed. */
22012016SGirish.Moodalbail@Sun.COM 	IFA_DOWN,		/* Address is not IFF_UP */
22112016SGirish.Moodalbail@Sun.COM 	IFA_TENTATIVE,		/* DAD verification initiated */
22212016SGirish.Moodalbail@Sun.COM 	IFA_OK,			/* Address is usable */
22312016SGirish.Moodalbail@Sun.COM 	IFA_INACCESSIBLE	/* Interface has failed */
22412016SGirish.Moodalbail@Sun.COM } ipadm_addr_state_t;
22512016SGirish.Moodalbail@Sun.COM 
22612016SGirish.Moodalbail@Sun.COM /* possible address types */
22712016SGirish.Moodalbail@Sun.COM typedef enum  {
22812016SGirish.Moodalbail@Sun.COM 	IPADM_ADDR_NONE,
22912016SGirish.Moodalbail@Sun.COM 	IPADM_ADDR_STATIC,
23012016SGirish.Moodalbail@Sun.COM 	IPADM_ADDR_IPV6_ADDRCONF,
23112016SGirish.Moodalbail@Sun.COM 	IPADM_ADDR_DHCP
23212016SGirish.Moodalbail@Sun.COM } ipadm_addr_type_t;
23312016SGirish.Moodalbail@Sun.COM 
23412016SGirish.Moodalbail@Sun.COM typedef struct ipadm_addr_info_s {
23512016SGirish.Moodalbail@Sun.COM 	struct ifaddrs		ia_ifa;		/* list of addresses */
23612016SGirish.Moodalbail@Sun.COM 	char			ia_sname[NI_MAXHOST];	/* local hostname */
23712016SGirish.Moodalbail@Sun.COM 	char			ia_dname[NI_MAXHOST];	/* remote hostname */
23812016SGirish.Moodalbail@Sun.COM 	char			ia_aobjname[IPADM_AOBJSIZ];
23912016SGirish.Moodalbail@Sun.COM 	uint_t			ia_cflags;	/* active flags */
24012016SGirish.Moodalbail@Sun.COM 	uint_t			ia_pflags;	/* persistent flags */
24112016SGirish.Moodalbail@Sun.COM 	ipadm_addr_type_t	ia_atype;	/* see above */
24212016SGirish.Moodalbail@Sun.COM 	ipadm_addr_state_t	ia_state;	/* see above */
24312016SGirish.Moodalbail@Sun.COM } ipadm_addr_info_t;
24412016SGirish.Moodalbail@Sun.COM #define	IA_NEXT(ia)		((ipadm_addr_info_t *)(ia->ia_ifa.ifa_next))
24512016SGirish.Moodalbail@Sun.COM 
24612016SGirish.Moodalbail@Sun.COM /* ipadm_addr_info_t flags */
24712016SGirish.Moodalbail@Sun.COM #define	IA_UP			0x00000001
24812016SGirish.Moodalbail@Sun.COM #define	IA_UNNUMBERED		0x00000002
24912016SGirish.Moodalbail@Sun.COM #define	IA_PRIVATE		0x00000004
25012016SGirish.Moodalbail@Sun.COM #define	IA_TEMPORARY		0x00000008
25112016SGirish.Moodalbail@Sun.COM #define	IA_DEPRECATED		0x00000010
25212016SGirish.Moodalbail@Sun.COM 
25312016SGirish.Moodalbail@Sun.COM /* open/close libipadm handle */
25412016SGirish.Moodalbail@Sun.COM extern ipadm_status_t	ipadm_open(ipadm_handle_t *, uint32_t);
25512016SGirish.Moodalbail@Sun.COM extern void		ipadm_close(ipadm_handle_t);
25612016SGirish.Moodalbail@Sun.COM 
25712016SGirish.Moodalbail@Sun.COM /* Check authorization for network configuration */
25812016SGirish.Moodalbail@Sun.COM extern boolean_t	ipadm_check_auth(void);
25912016SGirish.Moodalbail@Sun.COM /*
26012016SGirish.Moodalbail@Sun.COM  * Interface mangement functions
26112016SGirish.Moodalbail@Sun.COM  */
26212016SGirish.Moodalbail@Sun.COM extern ipadm_status_t	ipadm_create_if(ipadm_handle_t, char *, sa_family_t,
26312016SGirish.Moodalbail@Sun.COM 			    uint32_t);
26412016SGirish.Moodalbail@Sun.COM extern ipadm_status_t	ipadm_disable_if(ipadm_handle_t, const char *,
26512016SGirish.Moodalbail@Sun.COM 			    uint32_t);
26612016SGirish.Moodalbail@Sun.COM extern ipadm_status_t	ipadm_enable_if(ipadm_handle_t, const char *, uint32_t);
26712016SGirish.Moodalbail@Sun.COM extern ipadm_status_t	ipadm_if_info(ipadm_handle_t, const char *,
26812016SGirish.Moodalbail@Sun.COM 			    ipadm_if_info_t **, uint32_t, int64_t);
26912016SGirish.Moodalbail@Sun.COM extern void		ipadm_free_if_info(ipadm_if_info_t *);
27012016SGirish.Moodalbail@Sun.COM extern ipadm_status_t	ipadm_delete_if(ipadm_handle_t, const char *,
27112016SGirish.Moodalbail@Sun.COM 			    sa_family_t, uint32_t);
27212048SGirish.Moodalbail@Sun.COM extern void		ipadm_if_move(ipadm_handle_t, const char *);
27312016SGirish.Moodalbail@Sun.COM 
27412016SGirish.Moodalbail@Sun.COM /*
27512016SGirish.Moodalbail@Sun.COM  * Address management functions
27612016SGirish.Moodalbail@Sun.COM  */
27712016SGirish.Moodalbail@Sun.COM extern ipadm_status_t	ipadm_create_addr(ipadm_handle_t, ipadm_addrobj_t,
27812016SGirish.Moodalbail@Sun.COM 			    uint32_t);
27912016SGirish.Moodalbail@Sun.COM extern ipadm_status_t	ipadm_disable_addr(ipadm_handle_t, const char *,
28012016SGirish.Moodalbail@Sun.COM 			    uint32_t);
28112016SGirish.Moodalbail@Sun.COM extern ipadm_status_t	ipadm_enable_addr(ipadm_handle_t, const char *,
28212016SGirish.Moodalbail@Sun.COM 			    uint32_t);
28312016SGirish.Moodalbail@Sun.COM extern ipadm_status_t	ipadm_addr_info(ipadm_handle_t, const char *,
28412016SGirish.Moodalbail@Sun.COM 			    ipadm_addr_info_t **, uint32_t, int64_t);
28512016SGirish.Moodalbail@Sun.COM extern void		ipadm_free_addr_info(ipadm_addr_info_t *);
28612016SGirish.Moodalbail@Sun.COM extern ipadm_status_t	ipadm_up_addr(ipadm_handle_t, const char *,
28712016SGirish.Moodalbail@Sun.COM 			    uint32_t);
28812016SGirish.Moodalbail@Sun.COM extern ipadm_status_t	ipadm_down_addr(ipadm_handle_t, const char *,
28912016SGirish.Moodalbail@Sun.COM 			    uint32_t);
29012016SGirish.Moodalbail@Sun.COM extern ipadm_status_t	ipadm_refresh_addr(ipadm_handle_t, const char *,
29112016SGirish.Moodalbail@Sun.COM 			    uint32_t);
29212016SGirish.Moodalbail@Sun.COM extern ipadm_status_t	ipadm_delete_addr(ipadm_handle_t, const char *,
29312016SGirish.Moodalbail@Sun.COM 			    uint32_t);
29412016SGirish.Moodalbail@Sun.COM 
29512016SGirish.Moodalbail@Sun.COM /* Functions related to creating/deleting/modifying opaque address object */
29612016SGirish.Moodalbail@Sun.COM extern ipadm_status_t	ipadm_create_addrobj(ipadm_addr_type_t, const char *,
29712016SGirish.Moodalbail@Sun.COM 			    ipadm_addrobj_t *);
29812016SGirish.Moodalbail@Sun.COM extern void		ipadm_destroy_addrobj(ipadm_addrobj_t);
29912576SAnurag.Maskey@Oracle.COM extern ipadm_status_t   ipadm_get_aobjname(const ipadm_addrobj_t, char *,
30012576SAnurag.Maskey@Oracle.COM 			    size_t);
30112016SGirish.Moodalbail@Sun.COM 
30212016SGirish.Moodalbail@Sun.COM /* Functions to set fields in addrobj for static addresses */
30312016SGirish.Moodalbail@Sun.COM extern ipadm_status_t	ipadm_set_addr(ipadm_addrobj_t, const char *,
30412016SGirish.Moodalbail@Sun.COM 			    sa_family_t);
30512016SGirish.Moodalbail@Sun.COM extern ipadm_status_t	ipadm_set_dst_addr(ipadm_addrobj_t, const char *,
30612016SGirish.Moodalbail@Sun.COM 			    sa_family_t);
30712576SAnurag.Maskey@Oracle.COM extern ipadm_status_t   ipadm_get_addr(const ipadm_addrobj_t,
30812576SAnurag.Maskey@Oracle.COM 			    struct sockaddr_storage *);
30912016SGirish.Moodalbail@Sun.COM 
31012016SGirish.Moodalbail@Sun.COM /* Functions to set fields in addrobj for IPv6 addrconf */
31112016SGirish.Moodalbail@Sun.COM extern ipadm_status_t	ipadm_set_interface_id(ipadm_addrobj_t, const char *);
31212016SGirish.Moodalbail@Sun.COM extern ipadm_status_t	ipadm_set_stateless(ipadm_addrobj_t, boolean_t);
31312016SGirish.Moodalbail@Sun.COM extern ipadm_status_t	ipadm_set_stateful(ipadm_addrobj_t, boolean_t);
31412016SGirish.Moodalbail@Sun.COM 
31512016SGirish.Moodalbail@Sun.COM /* Functions to set fields in addrobj for DHCP */
31612016SGirish.Moodalbail@Sun.COM extern ipadm_status_t	ipadm_set_primary(ipadm_addrobj_t, boolean_t);
31712016SGirish.Moodalbail@Sun.COM extern ipadm_status_t	ipadm_set_wait_time(ipadm_addrobj_t, int32_t);
31812016SGirish.Moodalbail@Sun.COM 
31912016SGirish.Moodalbail@Sun.COM /*
32012016SGirish.Moodalbail@Sun.COM  * Property management functions
32112016SGirish.Moodalbail@Sun.COM  */
32212016SGirish.Moodalbail@Sun.COM /* call back function for the property walker */
32312016SGirish.Moodalbail@Sun.COM typedef boolean_t	ipadm_prop_wfunc_t(void *, const char *, uint_t);
32412016SGirish.Moodalbail@Sun.COM extern ipadm_status_t	ipadm_walk_proptbl(uint_t, uint_t, ipadm_prop_wfunc_t *,
32512016SGirish.Moodalbail@Sun.COM 			    void *);
32612016SGirish.Moodalbail@Sun.COM extern ipadm_status_t	ipadm_walk_prop(const char *, uint_t, uint_t,
32712016SGirish.Moodalbail@Sun.COM 			    ipadm_prop_wfunc_t *, void *);
32812016SGirish.Moodalbail@Sun.COM 
32912016SGirish.Moodalbail@Sun.COM /* Interface property management - set, reset and get */
33012016SGirish.Moodalbail@Sun.COM extern ipadm_status_t	ipadm_set_ifprop(ipadm_handle_t, const char *,
33112016SGirish.Moodalbail@Sun.COM 			    const char *, const char *, uint_t, uint_t);
33212016SGirish.Moodalbail@Sun.COM extern ipadm_status_t	ipadm_get_ifprop(ipadm_handle_t, const char *,
33312016SGirish.Moodalbail@Sun.COM 			    const char *, char *, uint_t *, uint_t, uint_t);
33412016SGirish.Moodalbail@Sun.COM 
33512016SGirish.Moodalbail@Sun.COM /* Address property management - set, reset and get */
33612016SGirish.Moodalbail@Sun.COM extern ipadm_status_t	ipadm_set_addrprop(ipadm_handle_t, const char *,
33712016SGirish.Moodalbail@Sun.COM 			    const char *, const char *, uint_t);
33812016SGirish.Moodalbail@Sun.COM extern ipadm_status_t	ipadm_get_addrprop(ipadm_handle_t, const char *, char *,
33912016SGirish.Moodalbail@Sun.COM 			    uint_t *, const char *, uint_t);
34012016SGirish.Moodalbail@Sun.COM 
34112016SGirish.Moodalbail@Sun.COM /* Protoocl property management - set, reset and get */
34212016SGirish.Moodalbail@Sun.COM extern ipadm_status_t	ipadm_set_prop(ipadm_handle_t, const char *,
34312016SGirish.Moodalbail@Sun.COM 			    const char *, uint_t, uint_t);
34412016SGirish.Moodalbail@Sun.COM extern ipadm_status_t	ipadm_get_prop(ipadm_handle_t, const char *, char *,
34512016SGirish.Moodalbail@Sun.COM 			    uint_t *, uint_t, uint_t);
34612016SGirish.Moodalbail@Sun.COM 
34712016SGirish.Moodalbail@Sun.COM /*
34812016SGirish.Moodalbail@Sun.COM  * miscellaneous helper functions.
34912016SGirish.Moodalbail@Sun.COM  */
35012016SGirish.Moodalbail@Sun.COM extern const char 	*ipadm_status2str(ipadm_status_t);
35112016SGirish.Moodalbail@Sun.COM extern int		ipadm_str2nvlist(const char *, nvlist_t **, uint_t);
35212016SGirish.Moodalbail@Sun.COM extern size_t		ipadm_nvlist2str(nvlist_t *, char *, size_t);
35312016SGirish.Moodalbail@Sun.COM extern char		*ipadm_proto2str(uint_t);
35412016SGirish.Moodalbail@Sun.COM extern uint_t		ipadm_str2proto(const char *);
35512016SGirish.Moodalbail@Sun.COM extern ipadm_status_t	ipadm_open_arp_on_udp(const char *, int *);
356*13125SGirish.Moodalbail@oracle.COM extern int		ipadm_legacy2new_propname(const char *, char *,
357*13125SGirish.Moodalbail@oracle.COM 			    uint_t, uint_t *);
358*13125SGirish.Moodalbail@oracle.COM extern int		ipadm_new2legacy_propname(const char *, char *,
359*13125SGirish.Moodalbail@oracle.COM 			    uint_t, uint_t);
36012016SGirish.Moodalbail@Sun.COM 
36112016SGirish.Moodalbail@Sun.COM #ifdef	__cplusplus
36212016SGirish.Moodalbail@Sun.COM }
36312016SGirish.Moodalbail@Sun.COM #endif
36412016SGirish.Moodalbail@Sun.COM 
36512016SGirish.Moodalbail@Sun.COM #endif	/* _LIBIPADM_H */
366