platform_net_socket.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /*
  2. * @Author: jiejie
  3. * @Github: https://github.com/jiejieTop
  4. * @Date: 2019-12-15 13:39:00
  5. * @LastEditTime: 2020-10-17 14:17:45
  6. * @Description: the code belongs to jiejie, please keep the author
  7. * information and source code according to the license.
  8. */
  9. #ifndef _PLATFORM_NET_SOCKET_H_
  10. #define _PLATFORM_NET_SOCKET_H_
  11. #include "../socket/PikaPlatform_socket.h"
  12. #include "PikaObj.h"
  13. #ifdef __cplusplus
  14. extern "C" {
  15. #endif
  16. #define PLATFORM_NET_PROTO_TCP 0 /**< The TCP transport protocol */
  17. #define PLATFORM_NET_PROTO_UDP 1 /**< The UDP transport protocol */
  18. int platform_net_socket_connect(const char* host, const char* port, int proto);
  19. int platform_net_socket_recv(int fd, void* buf, size_t len, int flags);
  20. int platform_net_socket_recv_timeout(int fd,
  21. unsigned char* buf,
  22. int len,
  23. int timeout);
  24. int platform_net_socket_write(int fd, void* buf, size_t len);
  25. int platform_net_socket_write_timeout(int fd,
  26. unsigned char* buf,
  27. int len,
  28. int timeout);
  29. int platform_net_socket_close(int fd);
  30. int platform_net_socket_set_block(int fd);
  31. int platform_net_socket_set_nonblock(int fd);
  32. int platform_net_socket_setsockopt(int fd,
  33. int level,
  34. int optname,
  35. const void* optval,
  36. socklen_t optlen);
  37. #ifdef __cplusplus
  38. }
  39. #endif
  40. #endif /* _PLATFORM_NET_SOCKET_H_ */