| 1 |
// License: BSD/LGPL |
| 2 |
// Copyright (C) 2011-2018 Thomas d'Otreppe |
| 3 |
using System; |
| 4 |
using System.Collections.Generic; |
| 5 |
|
| 6 |
namespace WirelessPanda |
| 7 |
{ |
| 8 |
public class AccessPoint : WirelessDevice, IEquatable<AccessPoint> |
| 9 |
{ |
| 10 |
#region Properties |
| 11 |
/// <summary> |
| 12 |
/// Max Rate |
| 13 |
/// </summary> |
| 14 |
public double MaxRate |
| 15 |
{ |
| 16 |
get |
| 17 |
{ |
| 18 |
return (double)this.getDictValue("Max Rate"); |
| 19 |
} |
| 20 |
set |
| 21 |
{ |
| 22 |
this.setDictValue("Max Rate", value); |
| 23 |
} |
| 24 |
} |
| 25 |
|
| 26 |
/// <summary> |
| 27 |
/// Max Seen Rate |
| 28 |
/// </summary> |
| 29 |
public double MaxSeenRate |
| 30 |
{ |
| 31 |
get |
| 32 |
{ |
| 33 |
return (double)this.getDictValue("Max Seen Rate"); |
| 34 |
} |
| 35 |
set |
| 36 |
{ |
| 37 |
this.setDictValue("Max Seen Rate", value); |
| 38 |
} |
| 39 |
} |
| 40 |
|
| 41 |
/// <summary> |
| 42 |
/// Privacy |
| 43 |
/// </summary> |
| 44 |
public string Privacy |
| 45 |
{ |
| 46 |
get |
| 47 |
{ |
| 48 |
return (string)this.getDictValue("Privacy"); |
| 49 |
} |
| 50 |
set |
| 51 |
{ |
| 52 |
this.setDictValue("Privacy", value); |
| 53 |
} |
| 54 |
} |
| 55 |
|
| 56 |
/// <summary> |
| 57 |
/// Cipher |
| 58 |
/// </summary> |
| 59 |
public string Cipher |
| 60 |
{ |
| 61 |
get |
| 62 |
{ |
| 63 |
return (string)this.getDictValue("Cipher"); |
| 64 |
} |
| 65 |
set |
| 66 |
{ |
| 67 |
this.setDictValue("Cipher", value); |
| 68 |
} |
| 69 |
} |
| 70 |
|
| 71 |
/// <summary> |
| 72 |
/// Authentication |
| 73 |
/// </summary> |
| 74 |
public string Authentication |
| 75 |
{ |
| 76 |
get |
| 77 |
{ |
| 78 |
return (string)this.getDictValue("Authentication"); |
| 79 |
} |
| 80 |
set |
| 81 |
{ |
| 82 |
this.setDictValue("Authentication", value); |
| 83 |
} |
| 84 |
} |
| 85 |
|
| 86 |
/// <summary> |
| 87 |
/// # Data Frames |
| 88 |
/// </summary> |
| 89 |
public ulong DataFrames |
| 90 |
{ |
| 91 |
get |
| 92 |
{ |
| 93 |
return (ulong)this.getDictValue("Data"); |
| 94 |
} |
| 95 |
set |
| 96 |
{ |
| 97 |
this.setDictValue("Data", value); |
| 98 |
} |
| 99 |
} |
| 100 |
|
| 101 |
/// <summary> |
| 102 |
/// Beacons |
| 103 |
/// </summary> |
| 104 |
public long Beacons |
| 105 |
{ |
| 106 |
get |
| 107 |
{ |
| 108 |
return (long)this.getDictValue("Beacons"); |
| 109 |
} |
| 110 |
set |
| 111 |
{ |
| 112 |
this.setDictValue("Beacons", value); |
| 113 |
} |
| 114 |
} |
| 115 |
|
| 116 |
/// <summary> |
| 117 |
/// IP Address |
| 118 |
/// </summary> |
| 119 |
public string IP |
| 120 |
{ |
| 121 |
get |
| 122 |
{ |
| 123 |
return (string)this.getDictValue("IP"); |
| 124 |
} |
| 125 |
set |
| 126 |
{ |
| 127 |
this.setDictValue("IP", value); |
| 128 |
} |
| 129 |
} |
| 130 |
|
| 131 |
/// <summary> |
| 132 |
/// IP Type |
| 133 |
/// </summary> |
| 134 |
public int IPType |
| 135 |
{ |
| 136 |
get |
| 137 |
{ |
| 138 |
return (int)this.getDictValue("IP Type"); |
| 139 |
} |
| 140 |
set |
| 141 |
{ |
| 142 |
this.setDictValue("IP Type", value); |
| 143 |
} |
| 144 |
} |
| 145 |
|
| 146 |
/// <summary> |
| 147 |
/// ESSID |
| 148 |
/// </summary> |
| 149 |
public string ESSID |
| 150 |
{ |
| 151 |
get |
| 152 |
{ |
| 153 |
return (string)this.getDictValue("ESSID"); |
| 154 |
} |
| 155 |
set |
| 156 |
{ |
| 157 |
this.setDictValue("ESSID", value); |
| 158 |
} |
| 159 |
} |
| 160 |
|
| 161 |
/// <summary> |
| 162 |
/// ESSID Length |
| 163 |
/// </summary> |
| 164 |
public byte ESSIDLength |
| 165 |
{ |
| 166 |
get |
| 167 |
{ |
| 168 |
return (byte)this.getDictValue("ESSID Length"); |
| 169 |
} |
| 170 |
set |
| 171 |
{ |
| 172 |
this.setDictValue("ESSID Length", value); |
| 173 |
} |
| 174 |
} |
| 175 |
|
| 176 |
/// <summary> |
| 177 |
/// Key |
| 178 |
/// </summary> |
| 179 |
public string Key |
| 180 |
{ |
| 181 |
get |
| 182 |
{ |
| 183 |
return (string)this.getDictValue("Key"); |
| 184 |
} |
| 185 |
set |
| 186 |
{ |
| 187 |
this.setDictValue("Key", value); |
| 188 |
} |
| 189 |
} |
| 190 |
|
| 191 |
/// <summary> |
| 192 |
/// Network Type |
| 193 |
/// </summary> |
| 194 |
public string NetworkType |
| 195 |
{ |
| 196 |
get |
| 197 |
{ |
| 198 |
return (string)this.getDictValue("Network Type"); |
| 199 |
} |
| 200 |
set |
| 201 |
{ |
| 202 |
this.setDictValue("Network Type", value); |
| 203 |
} |
| 204 |
} |
| 205 |
|
| 206 |
/// <summary> |
| 207 |
/// Info |
| 208 |
/// </summary> |
| 209 |
public string Info |
| 210 |
{ |
| 211 |
get |
| 212 |
{ |
| 213 |
return (string)this.getDictValue("Info"); |
| 214 |
} |
| 215 |
set |
| 216 |
{ |
| 217 |
this.setDictValue("Info", value); |
| 218 |
} |
| 219 |
} |
| 220 |
|
| 221 |
/// <summary> |
| 222 |
/// Encoding |
| 223 |
/// </summary> |
| 224 |
public string Encoding |
| 225 |
{ |
| 226 |
get |
| 227 |
{ |
| 228 |
return (string)this.getDictValue("Encoding"); |
| 229 |
} |
| 230 |
set |
| 231 |
{ |
| 232 |
this.setDictValue("Encoding", value); |
| 233 |
} |
| 234 |
} |
| 235 |
|
| 236 |
/// <summary> |
| 237 |
/// Cloaked ? |
| 238 |
/// </summary> |
| 239 |
public bool Cloaked |
| 240 |
{ |
| 241 |
get |
| 242 |
{ |
| 243 |
return (bool)this.getDictValue("Cloaked"); |
| 244 |
} |
| 245 |
set |
| 246 |
{ |
| 247 |
this.setDictValue("Cloaked", value); |
| 248 |
} |
| 249 |
} |
| 250 |
|
| 251 |
/// <summary> |
| 252 |
/// Encryption |
| 253 |
/// </summary> |
| 254 |
public string Encryption |
| 255 |
{ |
| 256 |
get |
| 257 |
{ |
| 258 |
return (string)this.getDictValue("Encryption"); |
| 259 |
} |
| 260 |
set |
| 261 |
{ |
| 262 |
this.setDictValue("Encryption", value); |
| 263 |
} |
| 264 |
} |
| 265 |
|
| 266 |
/// <summary> |
| 267 |
/// Is the traffic decrypted? |
| 268 |
/// </summary> |
| 269 |
public bool Decrypted |
| 270 |
{ |
| 271 |
get |
| 272 |
{ |
| 273 |
return (bool)this.getDictValue("Decrypted"); |
| 274 |
} |
| 275 |
set |
| 276 |
{ |
| 277 |
this.setDictValue("Decrypted", value); |
| 278 |
} |
| 279 |
} |
| 280 |
|
| 281 |
/// <summary> |
| 282 |
/// # Beacon Frames |
| 283 |
/// </summary> |
| 284 |
public ulong Beacon |
| 285 |
{ |
| 286 |
get |
| 287 |
{ |
| 288 |
return (ulong)this.getDictValue("Beacon"); |
| 289 |
} |
| 290 |
set |
| 291 |
{ |
| 292 |
this.setDictValue("Beacon", value); |
| 293 |
} |
| 294 |
} |
| 295 |
|
| 296 |
/// <summary> |
| 297 |
/// # LLC Frames |
| 298 |
/// </summary> |
| 299 |
public ulong LLC |
| 300 |
{ |
| 301 |
get |
| 302 |
{ |
| 303 |
return (ulong)this.getDictValue("LLC"); |
| 304 |
} |
| 305 |
set |
| 306 |
{ |
| 307 |
this.setDictValue("LLC", value); |
| 308 |
} |
| 309 |
} |
| 310 |
|
| 311 |
/// <summary> |
| 312 |
/// # Crypt Frames |
| 313 |
/// </summary> |
| 314 |
public ulong Crypt |
| 315 |
{ |
| 316 |
get |
| 317 |
{ |
| 318 |
return (ulong)this.getDictValue("Crypt"); |
| 319 |
} |
| 320 |
set |
| 321 |
{ |
| 322 |
this.setDictValue("Crypt", value); |
| 323 |
} |
| 324 |
} |
| 325 |
|
| 326 |
/// <summary> |
| 327 |
/// # Weak Frames |
| 328 |
/// </summary> |
| 329 |
public ulong Weak |
| 330 |
{ |
| 331 |
get |
| 332 |
{ |
| 333 |
return (ulong)this.getDictValue("Weak"); |
| 334 |
} |
| 335 |
set |
| 336 |
{ |
| 337 |
this.setDictValue("Weak", value); |
| 338 |
} |
| 339 |
} |
| 340 |
|
| 341 |
/// <summary> |
| 342 |
/// Total Nb of Frames |
| 343 |
/// </summary> |
| 344 |
public ulong Total |
| 345 |
{ |
| 346 |
get |
| 347 |
{ |
| 348 |
return (ulong)this.getDictValue("Total"); |
| 349 |
} |
| 350 |
set |
| 351 |
{ |
| 352 |
this.setDictValue("Total", value); |
| 353 |
} |
| 354 |
} |
| 355 |
|
| 356 |
/// <summary> |
| 357 |
/// Carrier |
| 358 |
/// </summary> |
| 359 |
public string Carrier |
| 360 |
{ |
| 361 |
get |
| 362 |
{ |
| 363 |
return (string)this.getDictValue("Carrier"); |
| 364 |
} |
| 365 |
set |
| 366 |
{ |
| 367 |
this.setDictValue("Carrier", value); |
| 368 |
} |
| 369 |
} |
| 370 |
|
| 371 |
/// <summary> |
| 372 |
/// Best Quality |
| 373 |
/// </summary> |
| 374 |
public int BestQuality |
| 375 |
{ |
| 376 |
get |
| 377 |
{ |
| 378 |
return (int)this.getDictValue("BestQuality"); |
| 379 |
} |
| 380 |
set |
| 381 |
{ |
| 382 |
this.setDictValue("BestQuality", value); |
| 383 |
} |
| 384 |
} |
| 385 |
|
| 386 |
/// <summary> |
| 387 |
/// Best Signal |
| 388 |
/// </summary> |
| 389 |
public int BestSignal |
| 390 |
{ |
| 391 |
get |
| 392 |
{ |
| 393 |
return (int)this.getDictValue("Best Signal"); |
| 394 |
} |
| 395 |
set |
| 396 |
{ |
| 397 |
this.setDictValue("Best Signal", value); |
| 398 |
} |
| 399 |
} |
| 400 |
|
| 401 |
/// <summary> |
| 402 |
/// Best Noise |
| 403 |
/// </summary> |
| 404 |
public int BestNoise |
| 405 |
{ |
| 406 |
get |
| 407 |
{ |
| 408 |
return (int)this.getDictValue("Best Noise"); |
| 409 |
} |
| 410 |
set |
| 411 |
{ |
| 412 |
this.setDictValue("Best Noise", value); |
| 413 |
} |
| 414 |
} |
| 415 |
|
| 416 |
/// <summary> |
| 417 |
/// Min Location |
| 418 |
/// </summary> |
| 419 |
public Coordinates MinLocation |
| 420 |
{ |
| 421 |
get |
| 422 |
{ |
| 423 |
return (Coordinates)this.getDictValue("Min Location"); |
| 424 |
} |
| 425 |
set |
| 426 |
{ |
| 427 |
this.setDictValue("Min Location", value); |
| 428 |
} |
| 429 |
} |
| 430 |
|
| 431 |
/// <summary> |
| 432 |
/// Best Location |
| 433 |
/// </summary> |
| 434 |
public Coordinates BestLocation |
| 435 |
{ |
| 436 |
get |
| 437 |
{ |
| 438 |
return (Coordinates)this.getDictValue("Best Location"); |
| 439 |
} |
| 440 |
set |
| 441 |
{ |
| 442 |
this.setDictValue("Best Location", value); |
| 443 |
} |
| 444 |
} |
| 445 |
|
| 446 |
/// <summary> |
| 447 |
/// Max Location |
| 448 |
/// </summary> |
| 449 |
public Coordinates MaxLocation |
| 450 |
{ |
| 451 |
get |
| 452 |
{ |
| 453 |
return (Coordinates)this.getDictValue("Max Location"); |
| 454 |
} |
| 455 |
set |
| 456 |
{ |
| 457 |
this.setDictValue("Max Location", value); |
| 458 |
} |
| 459 |
} |
| 460 |
|
| 461 |
/// <summary> |
| 462 |
/// Data Size |
| 463 |
/// </summary> |
| 464 |
public ulong DataSize |
| 465 |
{ |
| 466 |
get |
| 467 |
{ |
| 468 |
return (ulong)this.getDictValue("Data Size"); |
| 469 |
} |
| 470 |
set |
| 471 |
{ |
| 472 |
this.setDictValue("Data Size", value); |
| 473 |
} |
| 474 |
} |
| 475 |
#endregion |
| 476 |
|
| 477 |
/// <summary> |
| 478 |
/// Internal list of client |
| 479 |
/// </summary> |
| 480 |
private List<Station> _clientList = new List<Station>(); |
| 481 |
|
| 482 |
/// <summary> |
| 483 |
/// Add a client to our list |
| 484 |
/// </summary> |
| 485 |
/// <param name="sta"></param> |
| 486 |
public void addClient(Station sta) |
| 487 |
{ |
| 488 |
this._clientList.Add(sta); |
| 489 |
sta.AP = this; |
| 490 |
} |
| 491 |
|
| 492 |
/// <summary> |
| 493 |
/// Returns the client list |
| 494 |
/// </summary> |
| 495 |
public List<Station> ClientList |
| 496 |
{ |
| 497 |
get |
| 498 |
{ |
| 499 |
return this._clientList; |
| 500 |
} |
| 501 |
} |
| 502 |
|
| 503 |
/// <summary> |
| 504 |
/// Implements IEquatable |
| 505 |
/// </summary> |
| 506 |
/// <param name="other">Other AccessPoint to compare to</param> |
| 507 |
/// <returns>true if equals, false if not</returns> |
| 508 |
public bool Equals(AccessPoint other) |
| 509 |
{ |
| 510 |
try |
| 511 |
{ |
| 512 |
if (this.BSSID == other.BSSID) |
| 513 |
{ |
| 514 |
return true; |
| 515 |
} |
| 516 |
} |
| 517 |
catch { } |
| 518 |
|
| 519 |
return false; |
| 520 |
} |
| 521 |
} |
| 522 |
} |