1 /* 2 * Copyright (C) 2015-2020 Alibaba Group Holding Limited 3 */ 4 5 #ifndef HTTP_CLIENT_WRAPPER_H 6 #define HTTP_CLIENT_WRAPPER_H 7 8 #define HTTP_CLIENT_DEBUG 0 9 10 #define HAL_Printf printf 11 12 #if HTTP_CLIENT_DEBUG 13 #define http_info(fmt, arg...) do { HAL_Printf("[%s %d] "fmt" \r\n", __func__, __LINE__, ##arg); } while (0) 14 #define http_err(fmt, arg...) do { HAL_Printf("[%s %d] "fmt" \r\n", __func__, __LINE__, ##arg); } while (0) 15 #define http_debug(fmt, arg...) do { HAL_Printf("[%s %d] "fmt" \r\n", __func__, __LINE__, ##arg); } while (0) 16 #else 17 #define http_info(fmt, arg...) 18 #define http_err(fmt, arg...) do { HAL_Printf("[%s %d] "fmt" \r\n", __func__, __LINE__, ##arg); } while (0) 19 #define http_debug(fmt, arg...) 20 #endif 21 22 #ifndef MIN 23 #define MIN(x,y) (((x)<(y))?(x):(y)) 24 #endif 25 #ifndef MAX 26 #define MAX(x,y) (((x)>(y))?(x):(y)) 27 #endif 28 29 int http_tcp_conn_wrapper(httpclient_t *client, const char *host); 30 int http_tcp_close_wrapper(httpclient_t *client); 31 int http_tcp_send_wrapper(httpclient_t *client, const char *data, int length); 32 int http_tcp_recv_wrapper(httpclient_t *client, char *buf, int buflen, int timeout_ms, int *p_read_len); 33 34 #if CONFIG_HTTP_SECURE 35 int http_ssl_conn_wrapper(httpclient_t *client, const char *host); 36 int http_ssl_close_wrapper(httpclient_t *client); 37 int http_ssl_send_wrapper(httpclient_t *client, const char *data, size_t length); 38 int http_ssl_recv_wrapper(httpclient_t *client, char *buf, int buflen, int timeout_ms, int *p_read_len); 39 #endif 40 41 #endif /* HTTP_CLIENT_WRAPPER_H */ 42