1*6ba597c5SAnurag S. Maskey /* 2*6ba597c5SAnurag S. Maskey * CDDL HEADER START 3*6ba597c5SAnurag S. Maskey * 4*6ba597c5SAnurag S. Maskey * The contents of this file are subject to the terms of the 5*6ba597c5SAnurag S. Maskey * Common Development and Distribution License (the "License"). 6*6ba597c5SAnurag S. Maskey * You may not use this file except in compliance with the License. 7*6ba597c5SAnurag S. Maskey * 8*6ba597c5SAnurag S. Maskey * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9*6ba597c5SAnurag S. Maskey * or http://www.opensolaris.org/os/licensing. 10*6ba597c5SAnurag S. Maskey * See the License for the specific language governing permissions 11*6ba597c5SAnurag S. Maskey * and limitations under the License. 12*6ba597c5SAnurag S. Maskey * 13*6ba597c5SAnurag S. Maskey * When distributing Covered Code, include this CDDL HEADER in each 14*6ba597c5SAnurag S. Maskey * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15*6ba597c5SAnurag S. Maskey * If applicable, add the following below this CDDL HEADER, with the 16*6ba597c5SAnurag S. Maskey * fields enclosed by brackets "[]" replaced with your own identifying 17*6ba597c5SAnurag S. Maskey * information: Portions Copyright [yyyy] [name of copyright owner] 18*6ba597c5SAnurag S. Maskey * 19*6ba597c5SAnurag S. Maskey * CDDL HEADER END 20*6ba597c5SAnurag S. Maskey */ 21*6ba597c5SAnurag S. Maskey 22*6ba597c5SAnurag S. Maskey /* 23*6ba597c5SAnurag S. Maskey * Copyright 2010 Sun Microsystems, Inc. All rights reserved. 24*6ba597c5SAnurag S. Maskey * Use is subject to license terms. 25*6ba597c5SAnurag S. Maskey */ 26*6ba597c5SAnurag S. Maskey 27*6ba597c5SAnurag S. Maskey #include "libnwam_impl.h" 28*6ba597c5SAnurag S. Maskey #include <libnwam.h> 29*6ba597c5SAnurag S. Maskey 30*6ba597c5SAnurag S. Maskey /* 31*6ba597c5SAnurag S. Maskey * Functions that request WLAN-specific actions (scan, WLAN selection 32*6ba597c5SAnurag S. Maskey * and key setting). 33*6ba597c5SAnurag S. Maskey */ 34*6ba597c5SAnurag S. Maskey 35*6ba597c5SAnurag S. Maskey /* 36*6ba597c5SAnurag S. Maskey * Launch scan on specified link linkname. 37*6ba597c5SAnurag S. Maskey */ 38*6ba597c5SAnurag S. Maskey nwam_error_t 39*6ba597c5SAnurag S. Maskey nwam_wlan_scan(const char *linkname) 40*6ba597c5SAnurag S. Maskey { 41*6ba597c5SAnurag S. Maskey return (nwam_request_wlan(NWAM_REQUEST_TYPE_WLAN_SCAN, linkname, 42*6ba597c5SAnurag S. Maskey NULL, NULL, 0, 0, NULL, B_FALSE)); 43*6ba597c5SAnurag S. Maskey } 44*6ba597c5SAnurag S. Maskey 45*6ba597c5SAnurag S. Maskey /* 46*6ba597c5SAnurag S. Maskey * Get most-recently-cached scan results for link linkname. 47*6ba597c5SAnurag S. Maskey */ 48*6ba597c5SAnurag S. Maskey nwam_error_t 49*6ba597c5SAnurag S. Maskey nwam_wlan_get_scan_results(const char *linkname, uint_t *num_wlansp, 50*6ba597c5SAnurag S. Maskey nwam_wlan_t **wlansp) 51*6ba597c5SAnurag S. Maskey { 52*6ba597c5SAnurag S. Maskey return (nwam_request_wlan_scan_results(linkname, num_wlansp, 53*6ba597c5SAnurag S. Maskey wlansp)); 54*6ba597c5SAnurag S. Maskey } 55*6ba597c5SAnurag S. Maskey 56*6ba597c5SAnurag S. Maskey /* 57*6ba597c5SAnurag S. Maskey * Select specified WLAN <essid, bssid> for link linkname. 58*6ba597c5SAnurag S. Maskey */ 59*6ba597c5SAnurag S. Maskey nwam_error_t 60*6ba597c5SAnurag S. Maskey nwam_wlan_select(const char *linkname, const char *essid, const char *bssid, 61*6ba597c5SAnurag S. Maskey uint32_t secmode, boolean_t add_to_known_wlans) 62*6ba597c5SAnurag S. Maskey { 63*6ba597c5SAnurag S. Maskey return (nwam_request_wlan(NWAM_REQUEST_TYPE_WLAN_SELECT, 64*6ba597c5SAnurag S. Maskey linkname, essid, bssid, secmode, 0, NULL, add_to_known_wlans)); 65*6ba597c5SAnurag S. Maskey } 66*6ba597c5SAnurag S. Maskey 67*6ba597c5SAnurag S. Maskey /* 68*6ba597c5SAnurag S. Maskey * Create/update security key for WLAN <essid, bssid>. 69*6ba597c5SAnurag S. Maskey */ 70*6ba597c5SAnurag S. Maskey nwam_error_t 71*6ba597c5SAnurag S. Maskey nwam_wlan_set_key(const char *linkname, const char *essid, const char *bssid, 72*6ba597c5SAnurag S. Maskey uint32_t secmode, uint_t keyslot, const char *key) 73*6ba597c5SAnurag S. Maskey { 74*6ba597c5SAnurag S. Maskey return (nwam_request_wlan(NWAM_REQUEST_TYPE_WLAN_SET_KEY, 75*6ba597c5SAnurag S. Maskey linkname, essid, bssid, secmode, keyslot, key, B_FALSE)); 76*6ba597c5SAnurag S. Maskey } 77