port.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. // Copyright 2021 The gRPC Authors
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. #ifndef GRPC_EVENT_ENGINE_PORT_H
  15. #define GRPC_EVENT_ENGINE_PORT_H
  16. #include <grpc/support/port_platform.h>
  17. // Platform-specific sockaddr includes
  18. #if defined(GPR_ANDROID) || defined(GPR_LINUX) || defined(GPR_APPLE) || \
  19. defined(GPR_FREEBSD) || defined(GPR_OPENBSD) || defined(GPR_SOLARIS) || \
  20. defined(GPR_AIX) || defined(GPR_NACL) || defined(GPR_FUCHSIA) || \
  21. defined(GRPC_POSIX_SOCKET)
  22. #define GRPC_EVENT_ENGINE_POSIX
  23. #include <arpa/inet.h>
  24. #include <netdb.h>
  25. #include <netinet/in.h>
  26. #include <sys/socket.h>
  27. #include <unistd.h>
  28. #elif defined(GPR_WINDOWS)
  29. #include <winsock2.h>
  30. #include <ws2tcpip.h>
  31. // must be included after the above
  32. #include <mswsock.h>
  33. #else
  34. #error UNKNOWN PLATFORM
  35. #endif
  36. #endif // GRPC_EVENT_ENGINE_PORT_H