4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
22 * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
27 * This file contains private data structures and APIs of libnwam. Currently
28 * these are used by nwamd (nwam_event_*() and nwam_record_audit_event()) and
29 * netcfgd (nwam_backend_*()) only, supporting the event messaging, audit
30 * and backend configuration access that nwamd and netcfgd supply.
32 * Implementation is MT safe.
34 #ifndef _LIBNWAM_PRIV_H
35 #define _LIBNWAM_PRIV_H
43 /* Name of directory containing the doors */
44 #define NWAM_DOOR_DIR "/etc/svc/volatile/nwam"
46 /* Name of door used to communicate with libnwam backend (in netcfgd) */
47 #define NWAM_BACKEND_DOOR_FILE NWAM_DOOR_DIR "/nwam_backend_door"
49 /* Name of door used to communicate with nwamd */
50 #define NWAM_DOOR NWAM_DOOR_DIR "/nwam_door"
52 /* Requests to nwamd door */
54 NWAM_REQUEST_TYPE_NOOP
,
55 NWAM_REQUEST_TYPE_EVENT_REGISTER
,
56 NWAM_REQUEST_TYPE_EVENT_UNREGISTER
,
57 NWAM_REQUEST_TYPE_ACTION
,
58 NWAM_REQUEST_TYPE_STATE
,
59 NWAM_REQUEST_TYPE_PRIORITY_GROUP
,
60 NWAM_REQUEST_TYPE_WLAN_SCAN
,
61 NWAM_REQUEST_TYPE_WLAN_SCAN_RESULTS
,
62 NWAM_REQUEST_TYPE_WLAN_SELECT
,
63 NWAM_REQUEST_TYPE_WLAN_SET_KEY
64 } nwam_request_type_t
;
66 /* Status returned by nwamd door */
68 NWAM_REQUEST_STATUS_OK
,
69 NWAM_REQUEST_STATUS_FAILED
,
70 NWAM_REQUEST_STATUS_UNKNOWN
,
71 NWAM_REQUEST_STATUS_ALREADY
72 } nwam_request_status_t
;
74 #define NWAMD_MAX_NUM_WLANS 64
77 /* Used for EVENT_[UN]REGISTER requests */
79 char nwdad_name
[MAXPATHLEN
];
80 } nwdad_register_info
;
82 /* Used for ACTION requests */
84 nwam_object_type_t nwdad_object_type
;
85 char nwdad_name
[NWAM_MAX_NAME_LEN
];
86 char nwdad_parent
[NWAM_MAX_NAME_LEN
];
87 nwam_action_t nwdad_action
;
88 } nwdad_object_action
;
90 /* Used for STATE requests */
92 nwam_object_type_t nwdad_object_type
;
93 char nwdad_name
[NWAM_MAX_NAME_LEN
];
94 char nwdad_parent
[NWAM_MAX_NAME_LEN
];
95 nwam_state_t nwdad_state
;
96 nwam_aux_state_t nwdad_aux_state
;
99 /* Used for PRIORITY_GROUP requests */
101 int64_t nwdad_priority
;
102 } nwdad_priority_group_info
;
104 /* Used for WLAN request/responses */
106 char nwdad_name
[NWAM_MAX_NAME_LEN
];
107 char nwdad_essid
[NWAM_MAX_NAME_LEN
];
108 char nwdad_bssid
[NWAM_MAX_NAME_LEN
];
109 uint32_t nwdad_security_mode
;
110 char nwdad_key
[NWAM_MAX_NAME_LEN
];
111 uint_t nwdad_keyslot
;
112 boolean_t nwdad_add_to_known_wlans
;
113 uint_t nwdad_num_wlans
;
114 nwam_wlan_t nwdad_wlans
[NWAMD_MAX_NUM_WLANS
];
117 } nwamd_door_arg_data_t
;
120 nwam_request_type_t nwda_type
;
121 nwam_request_status_t nwda_status
;
122 nwam_error_t nwda_error
;
123 nwamd_door_arg_data_t nwda_data
;
127 NWAM_BACKEND_DOOR_CMD_READ_REQ
,
128 NWAM_BACKEND_DOOR_CMD_UPDATE_REQ
,
129 NWAM_BACKEND_DOOR_CMD_REMOVE_REQ
130 } nwam_backend_door_cmd_t
;
132 typedef struct nwam_backend_door_arg
{
133 nwam_backend_door_cmd_t nwbda_cmd
;
134 char nwbda_dbname
[MAXPATHLEN
]; /* config filename */
135 char nwbda_object
[NWAM_MAX_NAME_LEN
]; /* config object */
136 size_t nwbda_datalen
; /* data follows arg */
137 nwam_error_t nwbda_result
; /* return code */
138 uint64_t nwbda_flags
;
139 } nwam_backend_door_arg_t
;
142 * Functions needed to initialize/stop processing of libnwam backend data
145 extern nwam_error_t
nwam_backend_init(void);
146 extern void nwam_backend_fini(void);
149 * create audit session, report event, end session. Used by nwamd.
151 extern void nwam_record_audit_event(const ucred_t
*, au_event_t
, char *, char *,
155 * NWAM daemon functions, used to send, stop sending, initialize or finish
156 * event IPC. Used by nwamd.
158 extern nwam_error_t
nwam_event_send(nwam_event_t
);
159 extern void nwam_event_send_fini(void);
160 extern nwam_error_t
nwam_event_queue_init(const char *);
161 extern void nwam_event_queue_fini(const char *);
167 #endif /* _LIBNWAM_PRIV_H */