socket_descriptor.h 969 B

1234567891011121314151617181920212223242526272829303132
  1. // Copyright 2013 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef NET_SOCKET_SOCKET_DESCRIPTOR_H_
  5. #define NET_SOCKET_SOCKET_DESCRIPTOR_H_
  6. #include "build/build_config.h"
  7. #include "net/base/net_export.h"
  8. #if BUILDFLAG(IS_WIN)
  9. #include "base/win/windows_types.h"
  10. #endif
  11. namespace net {
  12. #if BUILDFLAG(IS_WIN)
  13. typedef UINT_PTR SocketDescriptor;
  14. const SocketDescriptor kInvalidSocket = (SocketDescriptor)(~0);
  15. #elif BUILDFLAG(IS_POSIX) || BUILDFLAG(IS_FUCHSIA)
  16. typedef int SocketDescriptor;
  17. const SocketDescriptor kInvalidSocket = -1;
  18. #endif
  19. // Creates socket. See WSASocket/socket documentation of parameters.
  20. SocketDescriptor NET_EXPORT CreatePlatformSocket(int family,
  21. int type,
  22. int protocol);
  23. } // namespace net
  24. #endif // NET_SOCKET_SOCKET_DESCRIPTOR_H_