Ignore:
Timestamp:
2015-04-06T10:47:51Z (10 years ago)
Author:
Jan Kolarik <kolarik@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
d7dadcb4
Parents:
59fa7ab
Message:

Scanning whole 2.4GHz spectrum, created supplicant for managing connection between device STA and AP, finished association process between STA and AP, handling 4way handshake protocol used for key management, written needed cryptographic algorithms (AES, SHA1, HMAC, PBKDF2) for CCMP protocol, data communication on OPEN/CCMP networks.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/drv/generic/remote_ieee80211.c

    r59fa7ab r1dcc0b9  
    4747typedef enum {
    4848        IEEE80211_GET_SCAN_RESULTS,
    49         IEEE80211_CONNECT
     49        IEEE80211_CONNECT,
     50        IEEE80211_DISCONNECT
    5051} ieee80211_funcs_t;
    5152
     
    5960 */
    6061int ieee80211_get_scan_results(async_sess_t *dev_sess,
    61         ieee80211_scan_results_t *results)
     62        ieee80211_scan_results_t *results, bool now)
    6263{
    6364        assert(results);
     
    6566        async_exch_t *exch = async_exchange_begin(dev_sess);
    6667       
    67         aid_t aid = async_send_1(exch, DEV_IFACE_ID(IEEE80211_DEV_IFACE),
    68             IEEE80211_GET_SCAN_RESULTS, NULL);
     68        aid_t aid = async_send_2(exch, DEV_IFACE_ID(IEEE80211_DEV_IFACE),
     69            IEEE80211_GET_SCAN_RESULTS, now, NULL);
    6970        int rc = async_data_read_start(exch, results, sizeof(ieee80211_scan_results_t));
    7071        async_exchange_end(exch);
     
    7374        async_wait_for(aid, &res);
    7475       
    75         if (rc != EOK)
     76        if(res != EOK)
     77                return (int) res;
     78        else
    7679                return rc;
    77        
    78         return (int) res;
    7980}
    8081
     
    8283 *
    8384 * @param[in] dev_sess Device session.
    84  * @param[in] ssid Network SSID.
     85 * @param[in] ssid_start Network SSID prefix.
    8586 * @param[in] password Network password (pass empty string if not needed).
    8687 *
     
    8889 * negative error code otherwise.
    8990 */
    90 int ieee80211_connect(async_sess_t *dev_sess, char *ssid, char *password)
    91 {
    92         assert(ssid);
     91int ieee80211_connect(async_sess_t *dev_sess, char *ssid_start, char *password)
     92{
     93        assert(ssid_start);
    9394       
    9495        sysarg_t rc_orig;
     
    99100            IEEE80211_CONNECT, NULL);
    100101       
    101         sysarg_t rc = async_data_write_start(exch, ssid, str_size(ssid) + 1);
     102        sysarg_t rc = async_data_write_start(exch, ssid_start,
     103                str_size(ssid_start) + 1);
    102104        if (rc != EOK) {
    103105                async_exchange_end(exch);
     
    132134}
    133135
     136/** Disconnect device from network.
     137 *
     138 * @param[in] dev_sess Device session.
     139 *
     140 * @return EOK If the operation was successfully completed,
     141 * negative error code otherwise.
     142 */
     143int ieee80211_disconnect(async_sess_t *dev_sess)
     144{
     145        async_exch_t *exch = async_exchange_begin(dev_sess);
     146        int rc = async_req_1_0(exch, DEV_IFACE_ID(IEEE80211_DEV_IFACE),
     147            IEEE80211_DISCONNECT);
     148        async_exchange_end(exch);
     149       
     150        return rc;
     151}
     152
    134153static void remote_ieee80211_get_scan_results(ddf_fun_t *fun, void *iface,
    135154    ipc_callid_t callid, ipc_call_t *call)
     
    141160        memset(&scan_results, 0, sizeof(ieee80211_scan_results_t));
    142161       
    143         int rc = ieee80211_iface->get_scan_results(fun, &scan_results);
     162        bool now = IPC_GET_ARG2(*call);
     163       
     164        int rc = ieee80211_iface->get_scan_results(fun, &scan_results, now);
    144165        if (rc == EOK) {
    145166                ipc_callid_t data_callid;
     
    170191        assert(ieee80211_iface->connect);
    171192       
    172         char ssid[MAX_STRING_SIZE];
     193        char ssid_start[MAX_STRING_SIZE];
    173194        char password[MAX_STRING_SIZE];
    174195       
     
    187208        }
    188209       
    189         int rc = async_data_write_finalize(data_callid, ssid, len);
     210        int rc = async_data_write_finalize(data_callid, ssid_start, len);
    190211        if (rc != EOK) {
    191212                async_answer_0(data_callid, EINVAL);
     
    213234        }
    214235       
    215         rc = ieee80211_iface->connect(fun, ssid, password);
    216        
     236        rc = ieee80211_iface->connect(fun, ssid_start, password);
     237       
     238        async_answer_0(callid, rc);
     239}
     240
     241static void remote_ieee80211_disconnect(ddf_fun_t *fun, void *iface,
     242    ipc_callid_t callid, ipc_call_t *call)
     243{
     244        ieee80211_iface_t *ieee80211_iface = (ieee80211_iface_t *) iface;
     245        assert(ieee80211_iface->disconnect);
     246        int rc = ieee80211_iface->disconnect(fun);
    217247        async_answer_0(callid, rc);
    218248}
     
    223253static const remote_iface_func_ptr_t remote_ieee80211_iface_ops[] = {
    224254        [IEEE80211_GET_SCAN_RESULTS] = remote_ieee80211_get_scan_results,
    225         [IEEE80211_CONNECT] = remote_ieee80211_connect
     255        [IEEE80211_CONNECT] = remote_ieee80211_connect,
     256        [IEEE80211_DISCONNECT] = remote_ieee80211_disconnect
    226257};
    227258
Note: See TracChangeset for help on using the changeset viewer.