/*
* 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
* or http://www.opensolaris.org/os/licensing.
* 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
*/
/*
* Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
*/
/*
* This file contains private data structures and APIs of libnwam.
* Current consumers include:
* - nwamd (nwam_event_*() and nwam_record_audit_event()), supporting the
* event messaging and audit that nwamd supply.
*
* - libipadm, libdladm use nwam db-related definitions for profile access
*
* Implementation is MT safe.
*/
#ifndef _LIBNWAM_PRIV_H
#define _LIBNWAM_PRIV_H
#ifdef __cplusplus
extern "C" {
#endif
#include <libnetcfg.h>
#include <libnvpair.h>
#include <libnwam.h>
/*
* Flag used by nwamd to override read-only restrictions. This flag belongs
* to the set of bit-flags defined in libnwam.h. It is defined here so that
* only nwamd can use it.
*/
#define NWAM_FLAG_OVERRIDE_READ_ONLY 0x00000008
/* Name of door used to communicate with nwamd */
#define NWAM_DOOR NETCFG_DOOR_DIR "/nwam_door"
/* Requests to nwamd door */
typedef enum {
NWAM_REQUEST_TYPE_NOOP,
NWAM_REQUEST_TYPE_EVENT_REGISTER,
NWAM_REQUEST_TYPE_EVENT_UNREGISTER,
NWAM_REQUEST_TYPE_ACTION,
NWAM_REQUEST_TYPE_STATE,
NWAM_REQUEST_TYPE_PRIORITY_GROUP,
NWAM_REQUEST_TYPE_WLAN_SCAN,
NWAM_REQUEST_TYPE_WLAN_SCAN_RESULTS,
NWAM_REQUEST_TYPE_WLAN_SELECT,
NWAM_REQUEST_TYPE_WLAN_SET_KEY
} nwam_request_type_t;
/* Status returned by nwamd door */
typedef enum {
NWAM_REQUEST_STATUS_OK,
NWAM_REQUEST_STATUS_FAILED,
NWAM_REQUEST_STATUS_UNKNOWN,
NWAM_REQUEST_STATUS_ALREADY
} nwam_request_status_t;
#define NWAMD_MAX_NUM_WLANS 64
typedef union {
/* Used for EVENT_[UN]REGISTER requests */
struct {
char nwdad_name[MAXPATHLEN];
} nwdad_register_info;
/* Used for ACTION requests */
struct {
nwam_object_type_t nwdad_object_type;
char nwdad_name[NWAM_MAX_NAME_LEN];
char nwdad_parent[NWAM_MAX_NAME_LEN];
nwam_action_t nwdad_action;
} nwdad_object_action;
/* Used for STATE requests */
struct {
nwam_object_type_t nwdad_object_type;
char nwdad_name[NWAM_MAX_NAME_LEN];
char nwdad_parent[NWAM_MAX_NAME_LEN];
nwam_state_t nwdad_state;
nwam_aux_state_t nwdad_aux_state;
} nwdad_object_state;
/* Used for PRIORITY_GROUP requests */
struct {
int64_t nwdad_priority;
} nwdad_priority_group_info;
/* Used for WLAN request/responses */
struct {
char nwdad_name[NWAM_MAX_NAME_LEN];
char nwdad_essid[NWAM_MAX_NAME_LEN];
char nwdad_bssid[NWAM_MAX_NAME_LEN];
uint32_t nwdad_security_mode;
char nwdad_key[NWAM_MAX_NAME_LEN];
uint_t nwdad_keyslot;
boolean_t nwdad_add_to_known_wlans;
uint_t nwdad_num_wlans;
nwam_wlan_t nwdad_wlans[NWAMD_MAX_NUM_WLANS];
} nwdad_wlan_info;
} nwamd_door_arg_data_t;
typedef struct {
nwam_request_type_t nwda_type;
nwam_request_status_t nwda_status;
nwam_error_t nwda_error;
nwamd_door_arg_data_t nwda_data;
} nwamd_door_arg_t;
/*
* create audit session, report event, end session. Used by nwamd.
*/
extern void nwam_record_audit_event(const ucred_t *, au_event_t, char *, char *,
int, int);
/*
* NWAM daemon functions, used to send, stop sending, initialize or finish
* event IPC. Used by nwamd.
*/
extern nwam_error_t nwam_event_send(nwam_event_t);
extern void nwam_event_send_fini(void);
extern nwam_error_t nwam_event_queue_init(const char *);
extern void nwam_event_queue_fini(const char *);
/*
* NWAM DB-related definitions
*/
#define NWAM_CONF_DIR "/etc/nwam/"
#define NWAM_LOC_CONF_FILE NWAM_CONF_DIR "loc.conf"
#define NWAM_ENM_CONF_FILE NWAM_CONF_DIR "enm.conf"
#define NWAM_KNOWN_WLAN_CONF_FILE NWAM_CONF_DIR "known-wlan.conf"
/* new filename for NCPs is ncp.conf, old was ncp-<profile>.conf */
#define NWAM_NCP_CONF_FILE NWAM_CONF_DIR "ncp.conf"
/* link NCUs are stored in /etc/dladm/datalink-<profile>.conf */
#define NWAM_DATALINK_CONF_FILE_PRE "/etc/dladm/datalink-"
/* interface NCUs are stored in /etc/ipadm/ipadm-<profile>.conf */
#define NWAM_IPADM_CONF_FILE_PRE "/etc/ipadm/ipadm-"
#define NWAM_CONF_FILE_SUF ".conf"
/*
* Add a property list formatted as an nvlist to an object handle.
* The passed-in list will be merged with any existing properties;
* if duplicates exist, the passed-in value will take precedence.
*/
extern nwam_error_t nwam_ncu_add_data(nwam_ncu_handle_t, nvlist_t *);
extern nwam_error_t nwam_ncu_get_data(nwam_ncu_handle_t, nvlist_t **);
extern nwam_error_t nwam_enm_add_data(nwam_enm_handle_t, nvlist_t *);
extern nwam_error_t nwam_known_wlan_add_data(nwam_known_wlan_handle_t,
nvlist_t *);
#ifdef __cplusplus
}
#endif
#endif /* _LIBNWAM_PRIV_H */