90 lines
		
	
	
		
			2.5 KiB
		
	
	
	
		
			C
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			90 lines
		
	
	
		
			2.5 KiB
		
	
	
	
		
			C
		
	
	
		
			Executable File
		
	
	
	
	
| /****************************************************************************
 | |
| 
 | |
| Copyright(c) 2019 by Aerospace C.Power (Chongqing) Microelectronics. ALL RIGHTS RESERVED.
 | |
| 
 | |
| This Information is proprietary to Aerospace C.Power (Chongqing) Microelectronics and MAY NOT
 | |
| be copied by any method or incorporated into another program without
 | |
| the express written consent of Aerospace C.Power. This Information or any portion
 | |
| thereof remains the property of Aerospace C.Power. The Information contained herein
 | |
| is believed to be accurate and Aerospace C.Power assumes no responsibility or
 | |
| liability for its use in any way and conveys no license or title under
 | |
| any patent or copyright and makes no representation or warranty that this
 | |
| Information is free from patent or copyright infringement.
 | |
| 
 | |
| ****************************************************************************/
 | |
| #ifndef CLI_LWIP_API_H
 | |
| #define CLI_LWIP_API_H
 | |
| 
 | |
| #include "iot_config.h"
 | |
| 
 | |
| #ifdef __cplusplus
 | |
| extern "C" {
 | |
| #endif
 | |
| 
 | |
| #if (IOT_CLI_INF_MODE == IOT_CLI_INF_MODE_LWIP_SOCKET)
 | |
| /* to avoid definition conflict with windows raw socket/freertos socket, */
 | |
| /* use this interface to wrap */
 | |
| /*
 | |
| * @brief:  open lwip udp socket
 | |
| * @param bind_ip:  the ip will be binded to this socket
 | |
| * @param port:     the port binded to this socket
 | |
| */
 | |
| int cli_open_lwip_udp_socket(const char* bind_ip, uint32_t port);
 | |
| 
 | |
| /*
 | |
| * @brief: lwip udp send
 | |
| * @param s:  the socket to send data
 | |
| * @param data:  buffer to send
 | |
| * @param size:  buffer len
 | |
| * @param remote_ip:  the dest ip
 | |
| * @param port:  the dest port
 | |
| */
 | |
| int cli_lwip_sendto(int s, const void *data, size_t size,
 | |
|     const char* remote_ip, uint32_t port);
 | |
| 
 | |
| /*
 | |
| * @brief: lwip udp recv
 | |
| * @param s:  the socket to send data
 | |
| * @param mem:  buffer to recv
 | |
| * @param size:  buffer len
 | |
| * @param flags:  flags to pass to lwip recvfrom
 | |
| * @param from:  the sender addr info
 | |
| * @param addrlen:  len of sender addr info
 | |
| */
 | |
| int cli_lwip_recvfrom(int s, void *mem, size_t len, int flags,
 | |
|     void *from, uint32_t addrlen);
 | |
| 
 | |
| /*
 | |
| * @brief: open lwip tcp socket
 | |
| * @param port:  the port to bind to the socket
 | |
| */
 | |
| int cli_open_lwip_tcp_socket(uint32_t port);
 | |
| 
 | |
| /*
 | |
| * @brief: accept connection from remote
 | |
| * @param s:  socket
 | |
| */
 | |
| int cli_lwip_accept(int s);
 | |
| 
 | |
| /*
 | |
| * @brief: tcp socket read
 | |
| * @param s:  socket
 | |
| * @param men:  buffer to recv
 | |
| * @param len:  buffer len
 | |
| */
 | |
| int cli_lwip_read(int s, void*men, size_t len);
 | |
| 
 | |
| /*
 | |
| * @brief: tcp socket send
 | |
| * @param s:  socket
 | |
| * @param men:  buffer to send
 | |
| * @param len:  buffer len
 | |
| */
 | |
| int cli_lwip_send(int s, void*buf, size_t len);
 | |
| 
 | |
| #endif
 | |
| #ifdef __cplusplus
 | |
| }
 | |
| #endif
 | |
| #endif
 |