platform_net_socket.h 995 B

12345678910111213141516171819202122232425
  1. /*
  2. * @Author: jiejie
  3. * @Github: https://github.com/jiejieTop
  4. * @Date: 2019-12-15 13:39:00
  5. * @LastEditTime: 2020-02-19 01:02:51
  6. * @Description: the code belongs to jiejie, please keep the author information and source code according to the license.
  7. */
  8. #ifndef _PLATFORM_NET_SOCKET_H_
  9. #define _PLATFORM_NET_SOCKET_H_
  10. #include "network.h"
  11. #include "mqtt_error.h"
  12. #include "stddef.h"
  13. #define PLATFORM_NET_PROTO_TCP 0 /**< The TCP transport protocol */
  14. #define PLATFORM_NET_PROTO_UDP 1 /**< The UDP transport protocol */
  15. int platform_net_socket_connect(const char *host, const char *port, int proto);
  16. int platform_net_socket_recv(int fd, void *buf, size_t len, int flags);
  17. int platform_net_socket_recv_timeout(int fd, unsigned char *buf, int len, int timeout);
  18. int platform_net_socket_write(int fd, void *buf, size_t len);
  19. int platform_net_socket_write_timeout(int fd, unsigned char *buf, int len, int timeout);
  20. int platform_net_socket_close(int fd);
  21. #endif /* _PLATFORM_NET_SOCKET_H_ */