ipmgmt_impl.h revision 8887b57dc579de11464fc6c74163d2595ce073af
/*
* 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 _IPMGMT_IMPL_H
#define _IPMGMT_IMPL_H
#ifdef __cplusplus
extern "C" {
#endif
#include <libnvpair.h>
#include <libipadm.h>
#include <ipadm_ipmgmt.h>
#include <syslog.h>
#include <pthread.h>
#include <libscf.h>
#define IPMGMT_STRSIZE 256
#define IPMGMTD_FMRI "svc:/network/ip-interface-management:default"
/* ipmgmt_door.c */
/* ipmgmt_util.c */
extern void ipmgmt_log(int, const char *, ...);
extern int ipmgmt_cpfile(const char *, const char *, boolean_t);
/* ipmgmt_persist.c */
/*
* following are the list of DB walker callback functions and the callback
* arguments for each of the callback functions used by the daemon
*/
/* following functions take 'ipmgmt_prop_arg_t' as the callback argument */
/* following functions take ipadm_dbwrite_cbarg_t as callback argument */
typedef struct {
char *cb_ifname;
extern db_wfunc_t ipmgmt_db_getif;
typedef struct {
char *cb_aobjname;
char *cb_ifname;
int cb_ocnt;
extern db_wfunc_t ipmgmt_db_getaddr;
typedef struct {
char *cb_ifname;
typedef struct {
char *cb_aobjname;
extern db_wfunc_t ipmgmt_db_resetaddr;
typedef struct {
int cb_ocnt;
extern db_wfunc_t ipmgmt_db_initif;
/*
* A linked list of address object nodes. Each node in the list tracks
* following information for the address object identified by `am_aobjname'.
* - interface on which the address is created
* - logical interface number on which the address is created
* - address family
* - `am_nextnum' identifies the next number to use to generate user part
* of `aobjname'.
* - address type (static, dhcp or addrconf)
* - if `am_atype' is IPADM_ADDR_IPV6_ADDRCONF then `am_ifid' holds the
* interface-id used to configure auto-configured addresses
*/
typedef struct ipmgmt_aobjmap_s {
struct ipmgmt_aobjmap_s *am_next;
char am_aobjname[IPADM_AOBJSIZ];
struct sockaddr_storage am_ifid;
/* linked list of `aobjmap' nodes, protected by RW lock */
typedef struct ipmgmt_aobjmap_list_s {
/* global `aobjmap' defined in ipmgmt_main.c */
extern ipmgmt_aobjmap_list_t aobjmap;
/* operations on the `aobjmap' linked list */
#define ADDROBJ_ADD 0x00000001
#define ADDROBJ_DELETE 0x00000002
#define ADDROBJ_LOOKUPADD 0x00000004
#define ADDROBJ_SETLIFNUM 0x00000008
/* Permanent data store for ipadm */
#define IPADM_DB_FILE "/etc/ipadm/ipadm.conf"
/*
* With the initial integration of the daemon (PSARC 2010/080), the version
* of the ipadm data-store (/etc/ipadm/ipadm.conf) was 0. A subsequent fix
* needed an upgrade to the data-store and we bumped the version to 1.
*/
#define IPADM_DB_VERSION 1
/*
* A temporary file created in SMF volatile filesystem. This file captures the
* in-memory copy of list `aobjmap' on disk. This is done to recover from
* daemon reboot (using svcadm) or crashes.
*/
#define IPADM_TMPFS_DIR "/etc/svc/volatile/ipadm"
/*
* A temporary copy of the ipadm configuration file might need
* to be created if write requests are encountered during boottime
* and the root filesystem is mounted read-only.
*/
/* SCF resources required to interact with svc.configd */
typedef struct scf_resources {
size_t, int *);
extern int ipmgmt_persist_aobjmap(ipmgmt_aobjmap_t *,
extern boolean_t ipmgmt_ngz_firstboot_postinstall();
extern int ipmgmt_persist_if(ipmgmt_if_arg_t *);
extern void ipmgmt_init_prop();
size_t, int *);
extern int ipmgmt_create_scf_resources(const char *,
scf_resources_t *);
extern void ipmgmt_release_scf_resources(scf_resources_t *);
extern void ipmgmt_update_dbver(scf_resources_t *);
#ifdef __cplusplus
}
#endif
#endif /* _IPMGMT_IMPL_H */