18 #ifndef AT_CELLULAR_STACK_H_ 19 #define AT_CELLULAR_STACK_H_ 21 #include "AT_CellularBase.h" 23 #include "PlatformMutex.h" 31 #define PDP_IPV6_SIZE 63+1 105 remoteAddress(
"", 0),
122 nsapi_protocol_t proto;
217 char _ip[PDP_IPV6_SIZE];
223 nsapi_ip_stack_t _stack_type;
226 nsapi_version_t _ip_ver_sendto;
230 int get_socket_index_by_port(uint16_t port);
238 #endif // AT_CELLULAR_STACK_H_ virtual nsapi_size_or_error_t socket_sendto_impl(CellularSocket *socket, const SocketAddress &address, const void *data, nsapi_size_t size)=0
Implements modem specific AT command set for sending data.
virtual nsapi_size_or_error_t socket_recvfrom(nsapi_socket_t handle, SocketAddress *address, void *buffer, nsapi_size_t size)
Receive a packet over a UDP socket.
virtual nsapi_size_or_error_t socket_recv(nsapi_socket_t handle, void *data, nsapi_size_t size)
Receive data over a TCP socket.
virtual nsapi_size_or_error_t socket_sendto(nsapi_socket_t handle, const SocketAddress &address, const void *data, nsapi_size_t size)
Send a packet over a UDP socket.
virtual nsapi_size_or_error_t socket_send(nsapi_socket_t handle, const void *data, nsapi_size_t size)
Send data over a TCP socket.
virtual nsapi_error_t socket_bind(nsapi_socket_t handle, const SocketAddress &address)
Bind a specific address to a socket.
virtual bool is_protocol_supported(nsapi_protocol_t protocol)=0
Checks if modem supports the given protocol.
void * nsapi_socket_t
Opaque handle for network sockets.
int find_socket_index(nsapi_socket_t handle)
Find the index of the given CellularSocket handle.
virtual nsapi_error_t socket_close_impl(int sock_id)=0
Implements modem specific AT command set for socket closing.
signed int nsapi_error_t
Type used to represent error codes.
virtual nsapi_error_t socket_stack_init()
Modem specific socket stack initialization.
signed int nsapi_size_or_error_t
Type used to represent either a size or error passed through sockets.
virtual nsapi_error_t socket_listen(nsapi_socket_t handle, int backlog)
Listen for connections on a TCP socket.
virtual nsapi_error_t socket_open(nsapi_socket_t *handle, nsapi_protocol_t proto)
Note: Socket_open does not actually open socket on all drivers, but that's deferred until calling sen...
virtual void socket_attach(nsapi_socket_t handle, void(*callback)(void *), void *data)
Register a callback on state change of the socket.
void set_cid(int cid)
Set PDP context ID for this stack.
virtual int get_max_socket_count()=0
Gets maximum number of sockets modem supports.
virtual nsapi_size_or_error_t socket_recvfrom_impl(CellularSocket *socket, SocketAddress *address, void *buffer, nsapi_size_t size)=0
Implements modem specific AT command set for receiving data.
CellularSocket * find_socket(int index)
Find the socket handle based on the index of the socket construct in the socket container.
bool is_addr_stack_compatible(const SocketAddress &addr)
Checks if send to address is valid and if current stack type supports sending to that address type...
virtual nsapi_error_t create_socket_impl(CellularSocket *socket)=0
Implements modem specific AT command set for creating socket.
unsigned int nsapi_size_t
Type used to represent the size of data passed through sockets.
virtual nsapi_error_t socket_accept(nsapi_socket_t server, nsapi_socket_t *handle, SocketAddress *address=0)
Accepts a connection on a TCP socket.
virtual nsapi_error_t socket_close(nsapi_socket_t handle)
Close the socket.
virtual nsapi_error_t socket_connect(nsapi_socket_t handle, const SocketAddress &address)
Connects TCP socket to a remote host.
virtual const char * get_ip_address()
Get the local IP address.
Class for sending AT commands and parsing AT responses.