Adapted to Lora Semtech + Nucleo

Dependencies:   DebugLib

Dependents:   LoRaWAN-lmic-app LoRaWAN-lmic-app LoRaWAN-test-10secs LoRaPersonalizedDeviceForEverynet ... more

Fork of lwip_ppp_ethernet by Donatien Garnier

Embed: (wiki syntax)

« Back to documentation index

api_msg.c File Reference

api_msg.c File Reference

Sequential API Internal module. More...

Go to the source code of this file.

Functions

static u8_t recv_raw (void *arg, struct raw_pcb *pcb, struct pbuf *p, ip_addr_t *addr)
 Receive callback function for RAW netconns.
static void recv_udp (void *arg, struct udp_pcb *pcb, struct pbuf *p, ip_addr_t *addr, u16_t port)
 Receive callback function for UDP netconns.

Detailed Description

Sequential API Internal module.

Definition in file api_msg.c.


Function Documentation

static u8_t recv_raw ( void *  arg,
struct raw_pcb *  pcb,
struct pbuf *  p,
ip_addr_t *  addr 
) [static]

Receive callback function for RAW netconns.

Doesn't 'eat' the packet, only references it and sends it to conn->recvmbox

See also:
raw.h (struct raw_pcb.recv) for parameters and return value

Definition at line 78 of file api_msg.c.

static void recv_udp ( void *  arg,
struct udp_pcb *  pcb,
struct pbuf *  p,
ip_addr_t *  addr,
u16_t  port 
) [static]

Receive callback function for UDP netconns.

Posts the packet to conn->recvmbox or deletes it on memory error.

See also:
udp.h (struct udp_pcb.recv) for parameters

Receive callback function for TCP netconns. Posts the packet to conn->recvmbox, but doesn't delete it on errors.

See also:
tcp.h (struct tcp_pcb.recv) for parameters and return value

Poll callback function for TCP netconns. Wakes up an application thread that waits for a connection to close or data to be sent. The application thread then takes the appropriate action to go on.

Signals the conn->sem. netconn_close waits for conn->sem if closing failed.

See also:
tcp.h (struct tcp_pcb.poll) for parameters and return value

Sent callback function for TCP netconns. Signals the conn->sem and calls API_EVENT. netconn_write waits for conn->sem if send buffer is low.

See also:
tcp.h (struct tcp_pcb.sent) for parameters and return value

Error callback function for TCP netconns. Signals conn->sem, posts to all conn mboxes and calls API_EVENT. The application thread has then to decide what to do.

See also:
tcp.h (struct tcp_pcb.err) for parameters

Setup a tcp_pcb with the correct callback function pointers and their arguments.

Parameters:
connthe TCP netconn to setup

Accept callback function for TCP netconns. Allocates a new netconn and posts that to conn->acceptmbox.

See also:
tcp.h (struct tcp_pcb_listen.accept) for parameters and return value

Create a new pcb of a specific type. Called from do_newconn().

Parameters:
msgthe api_msg_msg describing the connection type
Returns:
msg->conn->err, but the return value is currently ignored

Create a new pcb of a specific type inside a netconn. Called from netconn_new_with_proto_and_callback.

Parameters:
msgthe api_msg_msg describing the connection type

Create a new netconn (of a specific type) that has a callback function. The corresponding pcb is NOT created!

Parameters:
tthe type of 'connection' to create (
See also:
enum netconn_type)
Parameters:
protothe IP protocol for RAW IP pcbs
callbacka function to call on status changes (RX available, TX'ed)
Returns:
a newly allocated struct netconn or NULL on memory error

Delete a netconn and all its resources. The pcb is NOT freed (since we might not be in the right thread context do this).

Parameters:
connthe netconn to free

Delete rcvmbox and acceptmbox of a netconn and free the left-over data in these mboxes

Parameters:
connthe netconn to free bytes drained from recvmbox pending connections drained from acceptmbox

Internal helper function to close a TCP netconn: since this sometimes doesn't work at the first attempt, this function is called from multiple places.

Parameters:
connthe TCP netconn to close

Delete the pcb inside a netconn. Called from netconn_delete.

Parameters:
msgthe api_msg_msg pointing to the connection

Bind a pcb contained in a netconn Called from netconn_bind.

Parameters:
msgthe api_msg_msg pointing to the connection and containing the IP address and port to bind to

TCP callback function if a connection (opened by tcp_connect/do_connect) has been established (or reset by the remote host).

See also:
tcp.h (struct tcp_pcb.connected) for parameters and return values

Connect a pcb contained inside a netconn Called from netconn_connect.

Parameters:
msgthe api_msg_msg pointing to the connection and containing the IP address and port to connect to

Connect a pcb contained inside a netconn Only used for UDP netconns. Called from netconn_disconnect.

Parameters:
msgthe api_msg_msg pointing to the connection to disconnect

Set a TCP pcb contained in a netconn into listen mode Called from netconn_listen.

Parameters:
msgthe api_msg_msg pointing to the connection

Send some data on a RAW or UDP pcb contained in a netconn Called from netconn_send

Parameters:
msgthe api_msg_msg pointing to the connection

Indicate data has been received from a TCP pcb contained in a netconn Called from netconn_recv

Parameters:
msgthe api_msg_msg pointing to the connection

See if more data needs to be written from a previous call to netconn_write. Called initially from do_write. If the first call can't send all data (because of low memory or empty send-buffer), this function is called again from sent_tcp() or poll_tcp() to send more data. If all data is sent, the blocking application thread (waiting in netconn_write) is released.

Parameters:
connnetconn (that is currently in state NETCONN_WRITE) to process
Returns:
ERR_OK ERR_MEM if LWIP_TCPIP_CORE_LOCKING=1 and sending hasn't yet finished

Send some data on a TCP pcb contained in a netconn Called from netconn_write

Parameters:
msgthe api_msg_msg pointing to the connection

Return a connection's local or remote address Called from netconn_getaddr

Parameters:
msgthe api_msg_msg pointing to the connection

Close a TCP pcb contained in a netconn Called from netconn_close

Parameters:
msgthe api_msg_msg pointing to the connection

Join multicast groups for UDP netconns. Called from netconn_join_leave_group

Parameters:
msgthe api_msg_msg pointing to the connection

Callback function that is called when DNS name is resolved (or on timeout). A waiting application thread is waked up by signaling the semaphore.

Execute a DNS query Called from netconn_gethostbyname

Parameters:
argthe dns_api_msg pointing to the query

Definition at line 144 of file api_msg.c.