aboutsummaryrefslogtreecommitdiffstats
path: root/nexus/WifiNetwork.cpp
blob: ef013c09c7c069205ff8ee6f4da898e1d6a661be (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
/*
 * Copyright (C) 2008 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#include <errno.h>
#include <string.h>
#include <sys/types.h>

#include "WifiNetwork.h"
#include "Supplicant.h"

WifiNetwork::WifiNetwork(Supplicant *suppl) {
    mSuppl = suppl;
    mNetid = -1;
    mSsid = NULL;
    mBssid = NULL;
    mPsk = NULL;
    memset(mWepKeys, 0, sizeof(mWepKeys));
    mDefaultKeyIndex = -1;
    mPriority = -1;
    mHiddenSsid = NULL;
    mAllowedKeyManagement = 0;
    mAllowedProtocols = 0;
    mAllowedAuthAlgorithms = 0;
    mAllowedPairwiseCiphers = 0;
    mAllowedGroupCiphers = 0;
}

WifiNetwork::~WifiNetwork() {
    if (mSsid)
        free(mSsid);
    if (mBssid)
        free(mBssid);
    if (mPsk)
        free(mPsk);
    for (int i = 0; i < 4; i++) {
        if (mWepKeys[i])
            free(mWepKeys[i]);
    }
    if (mHiddenSsid)
        free(mHiddenSsid);
}

int WifiNetwork::setSsid(char *ssid) {
    errno = ENOSYS;
    return -1;
}

int WifiNetwork::setBssid(char *bssid) {
    errno = ENOSYS;
    return -1;
}

int WifiNetwork::setPsk(char *psk) {
    errno = ENOSYS;
    return -1;
}

int WifiNetwork::setWepKey(int idx, char *key) {
    errno = ENOSYS;
    return -1;
}

int WifiNetwork::setDefaultKeyIndex(int idx) {
    errno = ENOSYS;
    return -1;
}

int WifiNetwork::setPriority(int idx) {
    errno = ENOSYS;
    return -1;
}

int WifiNetwork::setHiddenSsid(char *ssid) {
    errno = ENOSYS;
    return -1;
}

int WifiNetwork::setAllowedKeyManagement(uint32_t mask) {
    errno = ENOSYS;
    return -1;
}

int WifiNetwork::setAllowedProtocols(uint32_t mask) {
    errno = ENOSYS;
    return -1;
}

int WifiNetwork::setAllowedPairwiseCiphers(uint32_t mask) {
    errno = ENOSYS;
    return -1;
}

int WifiNetwork::setAllowedGroupCiphers(uint32_t mask) {
    errno = ENOSYS;
    return -1;
}