ZuluSCSI_platform_network.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /*
  2. * Copyright (c) 2023 joshua stein <jcs@jcs.org>
  3. *
  4. * Permission to use, copy, modify, and distribute this software for any
  5. * purpose with or without fee is hereby granted, provided that the above
  6. * copyright notice and this permission notice appear in all copies.
  7. *
  8. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  9. * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  10. * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  11. * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  12. * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  13. * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  14. * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  15. */
  16. #pragma once
  17. #ifdef ZULUSCSI_NETWORK
  18. #include <stdint.h>
  19. #ifdef __cplusplus
  20. extern "C" {
  21. #endif
  22. struct __attribute__((packed)) wifi_network_entry {
  23. char ssid[64];
  24. char bssid[6];
  25. int8_t rssi;
  26. uint8_t channel;
  27. uint8_t flags;
  28. uint8_t _padding;
  29. #define WIFI_NETWORK_FLAGS_AUTH 0x1
  30. };
  31. #define WIFI_NETWORK_LIST_ENTRY_COUNT 10
  32. extern struct wifi_network_entry wifi_network_list[WIFI_NETWORK_LIST_ENTRY_COUNT];
  33. struct __attribute__((packed)) wifi_join_request {
  34. char ssid[64];
  35. char key[64];
  36. uint8_t channel;
  37. uint8_t _padding;
  38. };
  39. bool platform_network_supported();
  40. void platform_network_poll();
  41. int platform_network_init(char *mac);
  42. void platform_network_add_multicast_address(uint8_t *mac);
  43. bool platform_network_wifi_join(char *ssid, char *password);
  44. int platform_network_wifi_start_scan();
  45. int platform_network_wifi_scan_finished();
  46. void platform_network_wifi_dump_scan_list();
  47. int platform_network_wifi_rssi();
  48. char * platform_network_wifi_ssid();
  49. char * platform_network_wifi_bssid();
  50. int platform_network_wifi_channel();
  51. # ifdef __cplusplus
  52. }
  53. # endif
  54. #endif // ZULUSCSI_NETWORK