/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
*/
#ifndef _LIBIPADM_H
#define _LIBIPADM_H
#ifdef __cplusplus
extern "C" {
#endif
#include <netdb.h>
#include <ifaddrs.h>
#include <libnvpair.h>
/* special timeout values for dhcp operations */
/*
* Specifies that the string passed to ipadm_str2nvlist() is a string of comma
* separated names and that each name does not have values associated with it.
*/
/* error codes */
typedef enum {
/*
* option flags taken by the libipadm functions
*
* - IPADM_OPT_PERSIST:
* requests to persist the configuration so that it can be
* re-enabled or reapplied on boot.
*
* - IPADM_OPT_ACTIVE:
* Requests to apply configuration without persisting it and
* used by show-* subcommands to retrieve current values.
*
* - IPADM_OPT_DEFAULT:
* retrieves the default value for a given property
*
* - IPADM_OPT_PERM
* retrieves the permission for a given property
*
* - IPADM_OPT_POSSIBLE
* retrieves the range of values for a given property
*
* - IPADM_OPT_APPEND
* for multi-valued properties, appends a new value.
*
* - IPADM_OPT_REMOVE
* for multi-valued properties, removes the specified value
*
* - IPADM_OPT_IPMP
* Used in ipadm_create_if() to plumb ipmp interfaces.
*
* - IPADM_OPT_GENPPA
* Used in ipadm_create_if() to generate a ppa for the given interface.
*
* - IPADM_OPT_ZEROADDR
* return :: or INADDR_ANY
*
* - IPADM_OPT_RELEASE
* Used to release the lease on a dhcp address object
*
* - IPADM_OPT_INFORM
* Used to perform DHCP_INFORM on a specified static address object
*
* - IPADM_OPT_UP
* Used to bring up a static address on creation
*
* - IPADM_OPT_V46
* Used to plumb both IPv4 and IPv6 interfaces by ipadm_create_addr()
*/
/* IPADM property class */
/* protocol property that can be applied on interface too */
/* opaque ipadm handle to libipadm functions */
struct ipadm_handle;
/* ipadm_handle flags */
/*
* Indicates that the operation being invoked is in 'init' context. This is
* a library private flag.
*/
/* opaque address object structure */
/* ipadm_if_info_t states */
typedef enum {
typedef struct ipadm_if_info_s {
/* ipadm_if_info_t flags */
/* ipadm_addr_info_t state */
typedef enum {
/* possible address types */
typedef enum {
typedef struct ipadm_addr_info_s {
/* ipadm_addr_info_t flags */
extern void ipadm_close(ipadm_handle_t);
/* Check authorization for network configuration */
extern boolean_t ipadm_check_auth(void);
/*
* Interface mangement functions
*/
uint32_t);
uint32_t);
extern void ipadm_free_if_info(ipadm_if_info_t *);
extern void ipadm_if_move(ipadm_handle_t, const char *);
/*
* Address management functions
*/
uint32_t);
uint32_t);
uint32_t);
extern void ipadm_free_addr_info(ipadm_addr_info_t *);
uint32_t);
uint32_t);
uint32_t);
uint32_t);
ipadm_addrobj_t *);
extern void ipadm_destroy_addrobj(ipadm_addrobj_t);
size_t);
/* Functions to set fields in addrobj for static addresses */
struct sockaddr_storage *);
/* Functions to set fields in addrobj for IPv6 addrconf */
/* Functions to set fields in addrobj for DHCP */
/*
* Property management functions
*/
/* call back function for the property walker */
void *);
ipadm_prop_wfunc_t *, void *);
/* Interface property management - set, reset and get */
/* Address property management - set, reset and get */
const char *, const char *, uint_t);
/* Protoocl property management - set, reset and get */
/*
* miscellaneous helper functions.
*/
extern const char *ipadm_status2str(ipadm_status_t);
extern char *ipadm_proto2str(uint_t);
extern uint_t ipadm_str2proto(const char *);
extern ipadm_status_t ipadm_open_arp_on_udp(const char *, int *);
extern int ipadm_legacy2new_propname(const char *, char *,
extern int ipadm_new2legacy_propname(const char *, char *,
#ifdef __cplusplus
}
#endif
#endif /* _LIBIPADM_H */