ipadm_ipmgmt.h revision 9b5bf10ab04b9be5564d70a57980cfb68b6372e7
/*
* 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 _IPADM_IPMGMT_H
#define _IPADM_IPMGMT_H
#ifdef __cplusplus
extern "C" {
#endif
#include <fcntl.h>
#include <door.h>
#include <libipadm.h>
#include <inet/tunables.h>
/*
* Function declarations and data structures shared by libipadm.so and
* the IP management daemon.
*/
/* Authorization required to configure network interfaces */
/*
*/
/* Permanent data store for ipadm */
#define IPADM_DB_FILE "/etc/ipadm/ipadm.conf"
/*
* For more information on these definitions please refer to the top of
* ipadm_persist.c. These are the name of the nvpairs which hold the
* respective values. All nvpairs private to ipadm have names that begin
* with "_". Note below that 'prefixlen' is an address property and therefore
* not a private nvpair name.
*/
#define IPADM_PRIV_NVP(s) ((s)[0] == '_')
/* data-store operations */
typedef enum {
IPADM_DB_WRITE = 0, /* Writes to DB */
IPADM_DB_DELETE, /* Deletes an entry from DB */
IPADM_DB_READ /* Read from DB */
/*
* callback arg used by db_wfunc_t that writes to DB. The contents to be
* written to DB are captured in `dbw_nvl'.
*/
typedef struct ipadm_dbwrite_cbarg_s {
/*
* door related function declarations and data structures.
*/
/* The door file for the ipmgmt (ip-interface management) daemon */
#define IPMGMT_DOOR "/etc/svc/volatile/ipadm/ipmgmt_door"
#define MAXPROTONAMELEN 32
/* door call command type */
typedef enum {
IPMGMT_CMD_SETIF, /* persist interface */
IPMGMT_CMD_SETADDR, /* persist address */
IPMGMT_CMD_GETPROP, /* retrieve persisted property value */
IPMGMT_CMD_GETIF, /* retrieve persisted interface conf. */
IPMGMT_CMD_GETADDR, /* retrieve persisted addresses */
IPMGMT_CMD_RESETIF, /* purge interface configuration */
IPMGMT_CMD_RESETADDR, /* purge address configuration */
IPMGMT_CMD_RESETPROP, /* purge property configuration */
IPMGMT_CMD_INITIF, /* retrieve interfaces to initialize */
IPMGMT_CMD_ADDROBJ_LOOKUPADD, /* addr. object lookup & add */
IPMGMT_CMD_ADDROBJ_SETLIFNUM, /* set lifnum on the addrobj */
IPMGMT_CMD_ADDROBJ_ADD, /* add addr. object to addrobj map */
IPMGMT_CMD_LIF2ADDROBJ, /* lifname to addrobj mapping */
IPMGMT_CMD_AOBJNAME2ADDROBJ /* aobjname to addrobj mapping */
/*
* Note: We need to keep the size of the structure the same on amd64 and i386
* for all door_call arguments and door_return structures.
*/
/* door_call argument */
typedef struct ipmgmt_arg {
} ipmgmt_arg_t;
/* IPMGMT_CMD_{SETPROP|GETPROP|RESETPROP} door_call argument */
typedef struct ipmgmt_prop_arg_s {
char ia_aobjname[IPADM_AOBJSIZ];
char ia_module[MAXPROTONAMELEN];
char ia_pname[MAXPROPNAMELEN];
char ia_pval[MAXPROPVALLEN];
/*
* ia_flags used in ipmgmt_prop_arg_t.
* - APPEND updates the multi-valued property entry with a new value
* - REDUCE updates the multi-valued property entry by removing a value
*/
#define IPMGMT_APPEND 0x00000001
#define IPMGMT_REMOVE 0x00000002
/* IPMGMT_CMD_GETIF door_call argument structure */
typedef struct ipmgmt_getif_arg_s {
/* IPMGMT_CMD_RESETIF, IPMGMT_CMD_SETIF door_call argument structure */
typedef struct ipmgmt_if_arg_s {
/* IPMGMT_CMD_INITIF door_call argument structure */
typedef struct ipmgmt_initif_arg_s {
/* packed nvl follows */
/* IPMGMT_CMD_SETADDR door_call argument */
typedef struct ipmgmt_setaddr_arg_s {
/* packed nvl follows */
/* IPMGMT_CMD_GETADDR door_call argument */
typedef struct ipmgmt_getaddr_arg_s {
char ia_aobjname[IPADM_AOBJSIZ];
/* IPMGMT_CMD_RESETADDR door_call argument */
typedef struct ipmgmt_addr_arg_s {
char ia_aobjname[IPADM_AOBJSIZ];
/*
* IPMGMT_CMD_{ADDROBJ_ADD|ADDROBJ_LOOKUPADD|LIFNUM2ADDROBJ|
* ADDROBJ2LIFNUM} door_call argument.
*/
typedef struct ipmgmt_aobjop_arg_s {
char ia_aobjname[IPADM_AOBJSIZ];
/*
* - ACTIVE updates the running configuration
* - PERSIST updates the permanent data store
* - INIT indicates that operation being performed is under init
* context
*/
#define IPMGMT_ACTIVE 0x00000001
#define IPMGMT_PERSIST 0x00000002
#define IPMGMT_INIT 0x00000004
/* door call return value */
typedef struct ipmgmt_retval_s {
/* IPMGMT_CMD_GETADDR door_return value */
typedef struct ipmgmt_get_rval_s {
/* packed nvl follows */
/* IPMGMT_CMD_GETPROP door_return value */
typedef struct ipmgmt_getprop_rval_s {
char ir_pval[MAXPROPVALLEN];
/* IPMGMT_CMD_GETIF door_return value */
typedef struct ipmgmt_getif_rval_s {
/* IPMGMT_CMD_{LOOKUPADD|LIFNUM2ADDROBJ|ADDROBJ2LIFNUM} door_return value */
typedef struct ipmgmt_aobjop_rval_s {
char ir_aobjname[IPADM_AOBJSIZ];
struct sockaddr_storage ir_ifid;
/* DB walk callback functions */
/* zone related functions */
/*
* callback function to persist an interface in ipmgmtd data store
*/
/*
*/
#ifdef __cplusplus
}
#endif
#endif /* _IPADM_IPMGMT_H */