2 * Copyright 2010, Haiku, Inc. All Rights Reserved.
3 * Distributed under the terms of the MIT License.
5 #ifndef _NETWORK_DEVICE_H
6 #define _NETWORK_DEVICE_H
11 #include <NetworkAddress.h>
14 class BNetworkAddress
;
17 struct wireless_network
{
19 BNetworkAddress address
;
21 uint8 signal_strength
;
23 uint32 authentication_mode
;
30 #define B_NETWORK_IS_ENCRYPTED 0x01
31 #define B_NETWORK_IS_PERSISTENT 0x02
33 // authentication modes
35 B_NETWORK_AUTHENTICATION_NONE
= 0,
36 B_NETWORK_AUTHENTICATION_WEP
= 1,
37 B_NETWORK_AUTHENTICATION_WPA
= 2,
38 B_NETWORK_AUTHENTICATION_WPA2
= 3,
39 B_NETWORK_AUTHENTICATION_EAP
= 4
44 B_NETWORK_CIPHER_NONE
= 0x01,
45 B_NETWORK_CIPHER_WEP_40
= 0x02,
46 B_NETWORK_CIPHER_WEP_104
= 0x04,
47 B_NETWORK_CIPHER_TKIP
= 0x08,
48 B_NETWORK_CIPHER_CCMP
= 0x10,
49 B_NETWORK_CIPHER_AES_128_CMAC
= 0x20
54 B_KEY_MODE_IEEE802_1X
= 0x0001,
55 B_KEY_MODE_PSK
= 0x0002,
56 B_KEY_MODE_NONE
= 0x0004,
57 B_KEY_MODE_FT_IEEE802_1X
= 0x0020,
58 B_KEY_MODE_FT_PSK
= 0x0040,
59 B_KEY_MODE_IEEE802_1X_SHA256
= 0x0080,
60 B_KEY_MODE_PSK_SHA256
= 0x0100,
61 B_KEY_MODE_WPS
= 0x0200
64 // eap encapsulation method (IEEE 802.1x)
66 B_NETWORK_EAP_ENCAPSULATION_NONE
= 0x0000,
67 B_NETWORK_EAP_ENCAPSULATION_PEAP
= 0x0001,
68 B_NETWORK_EAP_ENCAPSULATION_TLS
= 0x0002
72 class BNetworkDevice
{
75 BNetworkDevice(const char* name
);
79 void SetTo(const char* name
);
81 const char* Name() const;
88 int32
CountMedia() const;
89 int32
GetMediaAt(int32 index
) const;
92 status_t
SetMedia(int32 media
);
94 status_t
GetHardwareAddress(BNetworkAddress
& address
);
99 status_t
Control(int option
, void* request
);
101 status_t
Scan(bool wait
= true,
102 bool forceRescan
= true);
104 status_t
GetNextNetwork(uint32
& cookie
,
105 wireless_network
& network
);
106 status_t
GetNetwork(const char* name
,
107 wireless_network
& network
);
108 status_t
GetNetwork(const BNetworkAddress
& address
,
109 wireless_network
& network
);
111 status_t
JoinNetwork(const char* name
,
112 const char* password
= NULL
);
113 status_t
JoinNetwork(const wireless_network
& network
,
114 const char* password
= NULL
);
115 status_t
JoinNetwork(const BNetworkAddress
& address
,
116 const char* password
= NULL
);
118 status_t
LeaveNetwork(const char* name
);
119 status_t
LeaveNetwork(const wireless_network
& network
);
120 status_t
LeaveNetwork(const BNetworkAddress
& address
);
122 status_t
GetNextAssociatedNetwork(uint32
& cookie
,
123 wireless_network
& network
);
124 status_t
GetNextAssociatedNetwork(uint32
& cookie
,
125 BNetworkAddress
& address
);
128 char fName
[IF_NAMESIZE
];
132 #endif // _NETWORK_DEVICE_H