16ba597c5SAnurag S. Maskey /* 26ba597c5SAnurag S. Maskey * CDDL HEADER START 36ba597c5SAnurag S. Maskey * 46ba597c5SAnurag S. Maskey * The contents of this file are subject to the terms of the 56ba597c5SAnurag S. Maskey * Common Development and Distribution License (the "License"). 66ba597c5SAnurag S. Maskey * You may not use this file except in compliance with the License. 76ba597c5SAnurag S. Maskey * 86ba597c5SAnurag S. Maskey * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 96ba597c5SAnurag S. Maskey * or http://www.opensolaris.org/os/licensing. 106ba597c5SAnurag S. Maskey * See the License for the specific language governing permissions 116ba597c5SAnurag S. Maskey * and limitations under the License. 126ba597c5SAnurag S. Maskey * 136ba597c5SAnurag S. Maskey * When distributing Covered Code, include this CDDL HEADER in each 146ba597c5SAnurag S. Maskey * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 156ba597c5SAnurag S. Maskey * If applicable, add the following below this CDDL HEADER, with the 166ba597c5SAnurag S. Maskey * fields enclosed by brackets "[]" replaced with your own identifying 176ba597c5SAnurag S. Maskey * information: Portions Copyright [yyyy] [name of copyright owner] 186ba597c5SAnurag S. Maskey * 196ba597c5SAnurag S. Maskey * CDDL HEADER END 206ba597c5SAnurag S. Maskey */ 216ba597c5SAnurag S. Maskey 226ba597c5SAnurag S. Maskey /* 236ba597c5SAnurag S. Maskey * Copyright 2010 Sun Microsystems, Inc. All rights reserved. 246ba597c5SAnurag S. Maskey * Use is subject to license terms. 256ba597c5SAnurag S. Maskey */ 266ba597c5SAnurag S. Maskey 276ba597c5SAnurag S. Maskey #ifndef _OBJECTS_H 286ba597c5SAnurag S. Maskey #define _OBJECTS_H 296ba597c5SAnurag S. Maskey 306ba597c5SAnurag S. Maskey #include <door.h> 316ba597c5SAnurag S. Maskey #include <libsysevent.h> 326ba597c5SAnurag S. Maskey #include <libuutil.h> 336ba597c5SAnurag S. Maskey #include <pthread.h> 346ba597c5SAnurag S. Maskey 356ba597c5SAnurag S. Maskey #include <libnwam.h> 366ba597c5SAnurag S. Maskey #include "events.h" 376ba597c5SAnurag S. Maskey #include "ncp.h" 386ba597c5SAnurag S. Maskey #include "ncu.h" 396ba597c5SAnurag S. Maskey 406ba597c5SAnurag S. Maskey /* 416ba597c5SAnurag S. Maskey * Wrapper structure for libnwam object, containing name, type, 426ba597c5SAnurag S. Maskey * associated object handle and optional object data field, and uu_list_node. 436ba597c5SAnurag S. Maskey */ 446ba597c5SAnurag S. Maskey struct nwamd_object { 456ba597c5SAnurag S. Maskey char nwamd_object_name[NWAM_MAX_NAME_LEN]; 466ba597c5SAnurag S. Maskey nwam_object_type_t nwamd_object_type; 476ba597c5SAnurag S. Maskey 486ba597c5SAnurag S. Maskey /* 496ba597c5SAnurag S. Maskey * These two elements provide a reference count for the structure and 506ba597c5SAnurag S. Maskey * a lock for the data including reference count. 516ba597c5SAnurag S. Maskey */ 526ba597c5SAnurag S. Maskey int nwamd_object_refcount; 536ba597c5SAnurag S. Maskey pthread_mutex_t nwamd_object_mutex; 546ba597c5SAnurag S. Maskey 556ba597c5SAnurag S. Maskey void *nwamd_object_handle; /* can point at ENMs, locations, etc. */ 566ba597c5SAnurag S. Maskey nwamd_ncu_t *nwamd_object_data; 57*874067a0SAnurag S. Maskey struct timeval nwamd_script_time; 586ba597c5SAnurag S. Maskey nwam_state_t nwamd_object_state; 596ba597c5SAnurag S. Maskey nwam_aux_state_t nwamd_object_aux_state; 606ba597c5SAnurag S. Maskey uu_list_node_t nwamd_object_node; 616ba597c5SAnurag S. Maskey }; 626ba597c5SAnurag S. Maskey 636ba597c5SAnurag S. Maskey /* Object init/enqueueing */ 646ba597c5SAnurag S. Maskey extern void nwamd_object_lists_init(void); 656ba597c5SAnurag S. Maskey extern void nwamd_object_lists_fini(void); 666ba597c5SAnurag S. Maskey extern nwamd_object_t nwamd_object_init(nwam_object_type_t, const char *, 676ba597c5SAnurag S. Maskey void *, void *); 686ba597c5SAnurag S. Maskey extern nwamd_object_t nwamd_object_find(nwam_object_type_t, const char *); 696ba597c5SAnurag S. Maskey extern void nwamd_object_release_and_preserve(nwamd_object_t); 706ba597c5SAnurag S. Maskey extern void nwamd_object_release(nwamd_object_t); 716ba597c5SAnurag S. Maskey extern void nwamd_object_release_and_destroy(nwamd_object_t); 726ba597c5SAnurag S. Maskey extern void nwamd_object_release_after_preserve(nwamd_object_t); 736ba597c5SAnurag S. Maskey extern void nwamd_object_release_and_destroy_after_preserve(nwamd_object_t); 746ba597c5SAnurag S. Maskey extern void nwamd_object_set_state(nwam_object_type_t, const char *, 756ba597c5SAnurag S. Maskey nwam_state_t, nwam_aux_state_t); 766ba597c5SAnurag S. Maskey extern void nwamd_object_set_state_timed(nwam_object_type_t, const char *, 776ba597c5SAnurag S. Maskey nwam_state_t, nwam_aux_state_t, uint32_t); 786ba597c5SAnurag S. Maskey extern nwamd_event_method_t *nwamd_object_event_methods(nwam_object_type_t); 796ba597c5SAnurag S. Maskey extern int nwamd_walk_objects(nwam_object_type_t, 806ba597c5SAnurag S. Maskey int (*)(nwamd_object_t, void *), void *); 816ba597c5SAnurag S. Maskey extern int nwamd_object_update(const char *, nwam_object_type_t); 826ba597c5SAnurag S. Maskey 836ba597c5SAnurag S. Maskey /* Known WLAN functions (no wlan objects, so no init/fini functions) */ 846ba597c5SAnurag S. Maskey /* event methods */ 856ba597c5SAnurag S. Maskey extern void nwamd_known_wlan_handle_init_event(nwamd_event_t); 866ba597c5SAnurag S. Maskey 876ba597c5SAnurag S. Maskey /* refresh/destroy a known WLAN */ 886ba597c5SAnurag S. Maskey extern int nwamd_known_wlan_action(const char *, nwam_action_t); 896ba597c5SAnurag S. Maskey 906ba597c5SAnurag S. Maskey /* ENM functions */ 916ba597c5SAnurag S. Maskey /* Init/fini functions for ENMs */ 926ba597c5SAnurag S. Maskey extern void nwamd_init_enms(void); 936ba597c5SAnurag S. Maskey extern void nwamd_fini_enms(void); 946ba597c5SAnurag S. Maskey 956ba597c5SAnurag S. Maskey /* ENM condition check function */ 966ba597c5SAnurag S. Maskey extern void nwamd_enm_check_conditions(void); 976ba597c5SAnurag S. Maskey 986ba597c5SAnurag S. Maskey /* event methods */ 996ba597c5SAnurag S. Maskey extern void nwamd_enm_handle_init_event(nwamd_event_t); 1006ba597c5SAnurag S. Maskey extern void nwamd_enm_handle_fini_event(nwamd_event_t); 1016ba597c5SAnurag S. Maskey 1026ba597c5SAnurag S. Maskey /* enable/disable an enm */ 1036ba597c5SAnurag S. Maskey extern int nwamd_enm_action(const char *, nwam_action_t); 1046ba597c5SAnurag S. Maskey 1056ba597c5SAnurag S. Maskey /* reread an enm from the repository */ 1066ba597c5SAnurag S. Maskey extern int nwamd_enm_refresh(const char *); 1076ba597c5SAnurag S. Maskey 1086ba597c5SAnurag S. Maskey /* loc functions */ 1096ba597c5SAnurag S. Maskey /* Init/fini functions for locs */ 1106ba597c5SAnurag S. Maskey extern void nwamd_init_locs(void); 1116ba597c5SAnurag S. Maskey extern void nwamd_fini_locs(void); 1126ba597c5SAnurag S. Maskey 1136ba597c5SAnurag S. Maskey /* loc condition check function */ 1146ba597c5SAnurag S. Maskey extern void nwamd_loc_check_conditions(void); 1156ba597c5SAnurag S. Maskey 1166ba597c5SAnurag S. Maskey /* on shutdown, revert to legacy location */ 1176ba597c5SAnurag S. Maskey extern void nwamd_loc_revert_to_legacy(void); 1186ba597c5SAnurag S. Maskey 1196ba597c5SAnurag S. Maskey /* event methods */ 1206ba597c5SAnurag S. Maskey extern void nwamd_loc_handle_init_event(nwamd_event_t); 1216ba597c5SAnurag S. Maskey extern void nwamd_loc_handle_fini_event(nwamd_event_t); 1226ba597c5SAnurag S. Maskey 1236ba597c5SAnurag S. Maskey /* enable/disable a loc */ 1246ba597c5SAnurag S. Maskey extern int nwamd_loc_action(const char *, nwam_action_t); 1256ba597c5SAnurag S. Maskey 1266ba597c5SAnurag S. Maskey /* reread a loc from the repository */ 1276ba597c5SAnurag S. Maskey extern int nwamd_loc_refresh(const char *); 1286ba597c5SAnurag S. Maskey 1296ba597c5SAnurag S. Maskey /* NCU functions */ 1306ba597c5SAnurag S. Maskey extern void nwamd_init_ncus(void); 1316ba597c5SAnurag S. Maskey extern void nwamd_fini_ncus(void); 1326ba597c5SAnurag S. Maskey 1336ba597c5SAnurag S. Maskey /* enable an ncp/ncu */ 1346ba597c5SAnurag S. Maskey extern int nwamd_ncp_action(const char *, nwam_action_t); 1356ba597c5SAnurag S. Maskey extern int nwamd_ncu_action(const char *, const char *, nwam_action_t); 1366ba597c5SAnurag S. Maskey 1376ba597c5SAnurag S. Maskey /* 1386ba597c5SAnurag S. Maskey * Event callbacks. 1396ba597c5SAnurag S. Maskey */ 1406ba597c5SAnurag S. Maskey extern void nwamd_ncu_handle_init_event(nwamd_event_t); 1416ba597c5SAnurag S. Maskey extern void nwamd_ncu_handle_fini_event(nwamd_event_t); 1426ba597c5SAnurag S. Maskey extern void nwamd_ncu_handle_if_state_event(nwamd_event_t); 1436ba597c5SAnurag S. Maskey extern void nwamd_ncu_handle_if_action_event(nwamd_event_t); 1446ba597c5SAnurag S. Maskey extern void nwamd_ncu_handle_link_state_event(nwamd_event_t); 1456ba597c5SAnurag S. Maskey extern void nwamd_ncu_handle_link_action_event(nwamd_event_t); 1466ba597c5SAnurag S. Maskey extern void nwamd_ncu_handle_init_event(nwamd_event_t); 1476ba597c5SAnurag S. Maskey extern void nwamd_ncu_handle_fini_event(nwamd_event_t); 1486ba597c5SAnurag S. Maskey extern void nwamd_ncu_handle_action_event(nwamd_event_t); 1496ba597c5SAnurag S. Maskey extern void nwamd_ncu_handle_state_event(nwamd_event_t); 1506ba597c5SAnurag S. Maskey 1516ba597c5SAnurag S. Maskey extern void nwamd_ncp_handle_action_event(nwamd_event_t); 1526ba597c5SAnurag S. Maskey extern void nwamd_ncp_handle_state_event(nwamd_event_t); 1536ba597c5SAnurag S. Maskey extern void nwamd_ncu_handle_periodic_scan_event(nwamd_event_t); 1546ba597c5SAnurag S. Maskey extern void nwamd_ncp_handle_enable_event(nwamd_event_t); 1556ba597c5SAnurag S. Maskey extern void nwamd_handle_upgrade(nwamd_event_t); 1566ba597c5SAnurag S. Maskey 1576ba597c5SAnurag S. Maskey extern void nwamd_enm_handle_action_event(nwamd_event_t); 1586ba597c5SAnurag S. Maskey extern void nwamd_enm_handle_state_event(nwamd_event_t); 1596ba597c5SAnurag S. Maskey 1606ba597c5SAnurag S. Maskey extern void nwamd_loc_handle_action_event(nwamd_event_t); 1616ba597c5SAnurag S. Maskey extern void nwamd_loc_handle_state_event(nwamd_event_t); 1626ba597c5SAnurag S. Maskey 1636ba597c5SAnurag S. Maskey extern void nwamd_known_wlan_handle_action_event(nwamd_event_t); 1646ba597c5SAnurag S. Maskey 1656ba597c5SAnurag S. Maskey extern void nwamd_add_phys_ncu_auto(nwam_ncp_handle_t, const char *); 1666ba597c5SAnurag S. Maskey extern void nwamd_rem_phys_ncu_auto(nwam_ncp_handle_t, const char *); 1676ba597c5SAnurag S. Maskey extern void add_auto_link(nwam_ncp_handle_t, const char *); 1686ba597c5SAnurag S. Maskey extern void add_auto_ip(nwam_ncp_handle_t, const char *); 1696ba597c5SAnurag S. Maskey extern void rem_auto_link(nwam_ncp_handle_t, const char *); 1706ba597c5SAnurag S. Maskey extern void rem_auto_ip(nwam_ncp_handle_t, const char *); 1716ba597c5SAnurag S. Maskey 1726ba597c5SAnurag S. Maskey #endif /* _OBJECTS_H */ 173