NetworkAccessHandlerStub.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. #pragma once
  2. #if !IL2CPP_USE_NETWORK_ACCESS_HANDLER
  3. #include <stdint.h>
  4. namespace il2cpp
  5. {
  6. namespace os
  7. {
  8. // Define a stub for platforms that don't require requesting access to network hardware
  9. class NetworkAccessHandler
  10. {
  11. public:
  12. typedef int SocketDescriptor;
  13. void InheritNetworkAccessState(SocketDescriptor _fd) {}
  14. void CancelNetworkAccess() {}
  15. bool RequestNetwork(SocketDescriptor _fd, const struct sockaddr *sa = NULL, int32_t sa_size = 0) { return true; }
  16. bool PrepareForBind(SocketDescriptor _fd, const struct sockaddr *sa = NULL, int32_t sa_size = 0) { return true; }
  17. #if IL2CPP_SUPPORT_IPV6
  18. bool PrepareForBind(SocketDescriptor _fd, const struct sockaddr_in6* sa = NULL, int32_t sa_size = 0) { return true; }
  19. #endif
  20. bool PrepareForConnect(SocketDescriptor _fd, const struct sockaddr *sa = NULL, int32_t sa_size = 0) { return true; }
  21. bool WaitForNetworkStatus(SocketDescriptor _fd, bool isConnect = false) { return true; }
  22. int32_t GetError() { return 0; }
  23. class Auto
  24. {
  25. public:
  26. bool RequestAccessForAddressInfo(bool isLocalNetworkMode = false) { return true; }
  27. int32_t GetError() { return 0; }
  28. };
  29. };
  30. }
  31. }
  32. #endif