1 /*
2  * Copyright (C) 2019-2020 Alibaba Group Holding Limited
3  */
4 
5 
6 #include <stdio.h>
7 #include <string.h>
8 
9 #include <errno.h>
10 #include <sys/types.h>
11 #include <sys/socket.h>
12 #include <sys/time.h>
13 #include <unistd.h>
14 #include <fcntl.h>
15 #include <lwip/netdb.h>
16 
17 #include <aos/debug.h>
18 #include "linkkit/wrappers/wrappers_tcp.h"
19 
20 #define PLATFORM_LOG(format, ...)                                         \
21     do {                                                                  \
22         HAL_Printf("SOCK %u %s() | " format "\n", __LINE__, __FUNCTION__, \
23                    ##__VA_ARGS__);                                        \
24     } while (0);
25 
26 /*
27  * mqtt does not call these functions,
28  * but has been used in IoT libraries,
29  * so implement empty functions and optimize footprint
30  */
HAL_TCP_Establish(const char * host,uint16_t port)31 uintptr_t HAL_TCP_Establish(const char *host, uint16_t port)
32 {
33     aos_assert(0);
34     return 0;
35 }
HAL_TCP_Destroy(uintptr_t fd)36 int HAL_TCP_Destroy(uintptr_t fd)
37 {
38     aos_assert(0);
39     return 0;
40 }
HAL_TCP_Write(uintptr_t fd,const char * buf,uint32_t len,uint32_t timeout_ms)41 int32_t HAL_TCP_Write(uintptr_t fd, const char *buf, uint32_t len,
42                       uint32_t timeout_ms)
43 {
44     aos_assert(0);
45     return 0;
46 }
HAL_TCP_Read(uintptr_t fd,char * buf,uint32_t len,uint32_t timeout_ms)47 int32_t HAL_TCP_Read(uintptr_t fd, char *buf, uint32_t len, uint32_t timeout_ms)
48 {
49     aos_assert(0);
50     return 0;
51 }
52 
53