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]
23 * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
31 #include <libsysevent.h>
41 * Wrapper structure for libnwam object, containing name, type,
42 * associated object handle and optional object data field, and uu_list_node.
45 char nwamd_object_name
[NWAM_MAX_NAME_LEN
];
46 nwam_object_type_t nwamd_object_type
;
49 * These two elements provide a reference count for the structure and
50 * a lock for the data including reference count.
52 int nwamd_object_refcount
;
53 pthread_mutex_t nwamd_object_mutex
;
55 void *nwamd_object_handle
; /* can point at ENMs, locations, etc. */
56 nwamd_ncu_t
*nwamd_object_data
;
57 struct timeval nwamd_script_time
;
58 nwam_state_t nwamd_object_state
;
59 nwam_aux_state_t nwamd_object_aux_state
;
60 uu_list_node_t nwamd_object_node
;
63 /* Object init/enqueueing */
64 extern void nwamd_object_lists_init(void);
65 extern void nwamd_object_lists_fini(void);
66 extern nwamd_object_t
nwamd_object_init(nwam_object_type_t
, const char *,
68 extern nwamd_object_t
nwamd_object_find(nwam_object_type_t
, const char *);
69 extern void nwamd_object_release_and_preserve(nwamd_object_t
);
70 extern void nwamd_object_release(nwamd_object_t
);
71 extern void nwamd_object_release_and_destroy(nwamd_object_t
);
72 extern void nwamd_object_release_after_preserve(nwamd_object_t
);
73 extern void nwamd_object_release_and_destroy_after_preserve(nwamd_object_t
);
74 extern void nwamd_object_set_state(nwam_object_type_t
, const char *,
75 nwam_state_t
, nwam_aux_state_t
);
76 extern void nwamd_object_set_state_timed(nwam_object_type_t
, const char *,
77 nwam_state_t
, nwam_aux_state_t
, uint32_t);
78 extern nwamd_event_method_t
*nwamd_object_event_methods(nwam_object_type_t
);
79 extern int nwamd_walk_objects(nwam_object_type_t
,
80 int (*)(nwamd_object_t
, void *), void *);
81 extern int nwamd_object_update(const char *, nwam_object_type_t
);
83 /* Known WLAN functions (no wlan objects, so no init/fini functions) */
85 extern void nwamd_known_wlan_handle_init_event(nwamd_event_t
);
87 /* refresh/destroy a known WLAN */
88 extern int nwamd_known_wlan_action(const char *, nwam_action_t
);
91 /* Init/fini functions for ENMs */
92 extern void nwamd_init_enms(void);
93 extern void nwamd_fini_enms(void);
95 /* ENM condition check function */
96 extern void nwamd_enm_check_conditions(void);
99 extern void nwamd_enm_handle_init_event(nwamd_event_t
);
100 extern void nwamd_enm_handle_fini_event(nwamd_event_t
);
102 /* enable/disable an enm */
103 extern int nwamd_enm_action(const char *, nwam_action_t
);
105 /* reread an enm from the repository */
106 extern int nwamd_enm_refresh(const char *);
109 /* Init/fini functions for locs */
110 extern void nwamd_init_locs(void);
111 extern void nwamd_fini_locs(void);
113 /* loc condition check function */
114 extern void nwamd_loc_check_conditions(void);
116 /* on shutdown, revert to legacy location */
117 extern void nwamd_loc_revert_to_legacy(void);
120 extern void nwamd_loc_handle_init_event(nwamd_event_t
);
121 extern void nwamd_loc_handle_fini_event(nwamd_event_t
);
123 /* enable/disable a loc */
124 extern int nwamd_loc_action(const char *, nwam_action_t
);
126 /* reread a loc from the repository */
127 extern int nwamd_loc_refresh(const char *);
130 extern void nwamd_init_ncus(void);
131 extern void nwamd_fini_ncus(void);
133 /* enable an ncp/ncu */
134 extern int nwamd_ncp_action(const char *, nwam_action_t
);
135 extern int nwamd_ncu_action(const char *, const char *, nwam_action_t
);
140 extern void nwamd_ncu_handle_init_event(nwamd_event_t
);
141 extern void nwamd_ncu_handle_fini_event(nwamd_event_t
);
142 extern void nwamd_ncu_handle_if_state_event(nwamd_event_t
);
143 extern void nwamd_ncu_handle_if_action_event(nwamd_event_t
);
144 extern void nwamd_ncu_handle_link_state_event(nwamd_event_t
);
145 extern void nwamd_ncu_handle_link_action_event(nwamd_event_t
);
146 extern void nwamd_ncu_handle_init_event(nwamd_event_t
);
147 extern void nwamd_ncu_handle_fini_event(nwamd_event_t
);
148 extern void nwamd_ncu_handle_action_event(nwamd_event_t
);
149 extern void nwamd_ncu_handle_state_event(nwamd_event_t
);
151 extern void nwamd_ncp_handle_action_event(nwamd_event_t
);
152 extern void nwamd_ncp_handle_state_event(nwamd_event_t
);
153 extern void nwamd_ncu_handle_periodic_scan_event(nwamd_event_t
);
154 extern void nwamd_ncp_handle_enable_event(nwamd_event_t
);
155 extern void nwamd_handle_upgrade(nwamd_event_t
);
157 extern void nwamd_enm_handle_action_event(nwamd_event_t
);
158 extern void nwamd_enm_handle_state_event(nwamd_event_t
);
160 extern void nwamd_loc_handle_action_event(nwamd_event_t
);
161 extern void nwamd_loc_handle_state_event(nwamd_event_t
);
163 extern void nwamd_known_wlan_handle_action_event(nwamd_event_t
);
165 extern void nwamd_add_phys_ncu_auto(nwam_ncp_handle_t
, const char *);
166 extern void nwamd_rem_phys_ncu_auto(nwam_ncp_handle_t
, const char *);
167 extern void add_auto_link(nwam_ncp_handle_t
, const char *);
168 extern void add_auto_ip(nwam_ncp_handle_t
, const char *);
169 extern void rem_auto_link(nwam_ncp_handle_t
, const char *);
170 extern void rem_auto_ip(nwam_ncp_handle_t
, const char *);
172 #endif /* _OBJECTS_H */