Rework uip.h buffer definitions

This commit is contained in:
Simon Duquennoy 2018-10-17 15:57:39 +02:00
parent a528395eb2
commit 4035d840dd
1 changed files with 10 additions and 7 deletions

View File

@ -79,16 +79,19 @@
/**
* Direct access to IPv6 header
*/
#define UIP_IP_BUF ((struct uip_ip_hdr *)&uip_buf[UIP_LLH_LEN])
#define UIP_IP_BUF_CHAR ((unsigned char *)uip_buf + UIP_LLH_LEN)
#define UIP_IP_BUF ((struct uip_ip_hdr *)UIP_IP_BUF_CHAR)
#define UIP_IP_PAYLOAD(ext) ((unsigned char *)UIP_IP_BUF_CHAR + UIP_IPH_LEN + (ext))
/**
* Direct access to ICMP, UDP, and TCP headers and payload
* Direct access to ICMP, UDP, and TCP headers and payload, with implicit ext header offset
*/
#define UIP_IP_PAYLOAD ((unsigned char *)&uip_buf[uip_l2_l3_hdr_len])
#define UIP_ICMP_BUF ((struct uip_icmp_hdr *)UIP_IP_PAYLOAD)
#define UIP_ICMP_PAYLOAD ((unsigned char *)&uip_buf[uip_l2_l3_icmp_hdr_len])
#define UIP_UDP_BUF ((struct uip_udp_hdr *)UIP_IP_PAYLOAD)
#define UIP_TCP_BUF ((struct uip_tcp_hdr *)UIP_IP_PAYLOAD)
#define UIP_ICMP_BUF ((struct uip_icmp_hdr *)UIP_IP_PAYLOAD(uip_ext_len))
#define UIP_ICMP_PAYLOAD ((unsigned char *)UIP_IP_PAYLOAD(uip_ext_len) + UIP_ICMPH_LEN)
#define UIP_UDP_BUF ((struct uip_udp_hdr *)UIP_IP_PAYLOAD(uip_ext_len))
#define UIP_UDP_PAYLOAD ((unsigned char *)UIP_IP_PAYLOAD(uip_ext_len) + UIP_UDPH_LEN)
#define UIP_TCP_BUF ((struct uip_tcp_hdr *)UIP_IP_PAYLOAD(uip_ext_len))
#define UIP_TCP_PAYLOAD ((unsigned char *)UIP_IP_PAYLOAD(uip_ext_len) + UIP_TCPH_LEN)
#include "net/ipv6/uipopt.h"
#include "net/ipv6/uipbuf.h"