Example program with HTTPServer and sensor data streaming over TCPSockets, using Donatien Garnier's Net APIs and services code on top of LWIP. Files StreamServer.h and .cpp encapsulate streaming over TCPSockets. Broadcast is done by sendToAll(), and all incoming data is echoed back to the client. Echo code can be replaced with some remote control of the streaming interface. See main() that shows how to periodically send some data to all subscribed clients. To subscribe, a client should open a socket at <mbed_ip> port 123. I used few lines in TCL code to set up a quick sink for the data. HTTP files are served on port 80 concurrently to the streaming.

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

icmp.c File Reference

icmp.c File Reference

ICMP - Internet Control Message Protocol. More...

Go to the source code of this file.

Functions

static void icmp_send_response (struct pbuf *p, u8_t type, u8_t code)
 Send an icmp packet in response to an incoming packet.
void icmp_input (struct pbuf *p, struct netif *inp)
 Processes ICMP input packets, called from ip_input().
void icmp_dest_unreach (struct pbuf *p, enum icmp_dur_type t)
 Send an icmp 'destination unreachable' packet, called from ip_input() if the transport layer protocol is unknown and from udp_input() if the local port is not bound.
void icmp_time_exceeded (struct pbuf *p, enum icmp_te_type t)
 Send a 'time exceeded' packet, called from ip_forward() if TTL is 0.

Detailed Description

ICMP - Internet Control Message Protocol.

Definition in file icmp.c.


Function Documentation

void icmp_dest_unreach ( struct pbuf *  p,
enum icmp_dur_type  t 
)

Send an icmp 'destination unreachable' packet, called from ip_input() if the transport layer protocol is unknown and from udp_input() if the local port is not bound.

Parameters:
pthe input packet for which the 'unreachable' should be sent, p->payload pointing to the IP header
ttype of the 'unreachable' packet

Definition at line 258 of file icmp.c.

void icmp_input ( struct pbuf *  p,
struct netif inp 
)

Processes ICMP input packets, called from ip_input().

Currently only processes icmp echo requests and sends out the echo response.

Parameters:
pthe icmp echo request packet, p->payload pointing to the ip header
inpthe netif on which this packet was received

Definition at line 77 of file icmp.c.

static void icmp_send_response ( struct pbuf *  p,
u8_t  type,
u8_t  code 
) [static]

Send an icmp packet in response to an incoming packet.

Parameters:
pthe input packet for which the 'unreachable' should be sent, p->payload pointing to the IP header
typeType of the ICMP header
codeCode of the ICMP header

Definition at line 288 of file icmp.c.

void icmp_time_exceeded ( struct pbuf *  p,
enum icmp_te_type  t 
)

Send a 'time exceeded' packet, called from ip_forward() if TTL is 0.

Parameters:
pthe input packet for which the 'time exceeded' should be sent, p->payload pointing to the IP header
ttype of the 'time exceeded' packet

Definition at line 272 of file icmp.c.