ZuluSCSI_platform_network.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. #include <stddef.h>
  20. #ifdef __cplusplus
  21. extern "C" {
  22. #endif
  23. struct __attribute__((packed)) wifi_network_entry {
  24. char ssid[64];
  25. char bssid[6];
  26. int8_t rssi;
  27. uint8_t channel;
  28. uint8_t flags;
  29. uint8_t _padding;
  30. #define WIFI_NETWORK_FLAGS_AUTH 0x1
  31. };
  32. #define WIFI_NETWORK_LIST_ENTRY_COUNT 10
  33. extern struct wifi_network_entry wifi_network_list[WIFI_NETWORK_LIST_ENTRY_COUNT];
  34. struct __attribute__((packed)) wifi_join_request {
  35. char ssid[64];
  36. char key[64];
  37. uint8_t channel;
  38. uint8_t _padding;
  39. };
  40. bool platform_network_supported();
  41. void platform_network_poll();
  42. int platform_network_init(char *mac);
  43. void platform_network_add_multicast_address(uint8_t *mac);
  44. bool platform_network_wifi_join(char *ssid, char *password);
  45. int platform_network_wifi_start_scan();
  46. int platform_network_wifi_scan_finished();
  47. void platform_network_wifi_dump_scan_list();
  48. int platform_network_wifi_rssi();
  49. char * platform_network_wifi_ssid();
  50. char * platform_network_wifi_bssid();
  51. int platform_network_wifi_channel();
  52. int platform_network_send(uint8_t *buf, size_t len);
  53. # ifdef __cplusplus
  54. }
  55. # endif
  56. #endif // ZULUSCSI_NETWORK