xref: /titanic_52/usr/src/lib/libnwam/common/libnwam_wlan.c (revision ac88567a7a5bb7f01cf22cf366bc9d6203e24d7a)
1 /*
2  * CDDL HEADER START
3  *
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.
7  *
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.
12  *
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]
18  *
19  * CDDL HEADER END
20  */
21 
22 /*
23  * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #include "libnwam_impl.h"
28 #include <libnwam.h>
29 
30 /*
31  * Functions that request WLAN-specific actions (scan, WLAN selection
32  * and key setting).
33  */
34 
35 /*
36  * Launch scan on specified link linkname.
37  */
38 nwam_error_t
39 nwam_wlan_scan(const char *linkname)
40 {
41 	return (nwam_request_wlan(NWAM_REQUEST_TYPE_WLAN_SCAN, linkname,
42 	    NULL, NULL, 0, 0, NULL, B_FALSE));
43 }
44 
45 /*
46  * Get most-recently-cached scan results for link linkname.
47  */
48 nwam_error_t
49 nwam_wlan_get_scan_results(const char *linkname, uint_t *num_wlansp,
50     nwam_wlan_t **wlansp)
51 {
52 	return (nwam_request_wlan_scan_results(linkname, num_wlansp,
53 	    wlansp));
54 }
55 
56 /*
57  * Select specified WLAN <essid, bssid> for link linkname.
58  */
59 nwam_error_t
60 nwam_wlan_select(const char *linkname, const char *essid, const char *bssid,
61     uint32_t secmode, boolean_t add_to_known_wlans)
62 {
63 	return (nwam_request_wlan(NWAM_REQUEST_TYPE_WLAN_SELECT,
64 	    linkname, essid, bssid, secmode, 0, NULL, add_to_known_wlans));
65 }
66 
67 /*
68  * Create/update security key for WLAN <essid, bssid>.
69  */
70 nwam_error_t
71 nwam_wlan_set_key(const char *linkname, const char *essid, const char *bssid,
72     uint32_t secmode, uint_t keyslot, const char *key)
73 {
74 	return (nwam_request_wlan(NWAM_REQUEST_TYPE_WLAN_SET_KEY,
75 	    linkname, essid, bssid, secmode, keyslot, key, B_FALSE));
76 }
77