Define UIP_IP_BUF globally in uip.h
This commit is contained in:
parent
ee5b722c65
commit
caa02ae51e
|
@ -10,8 +10,6 @@
|
|||
#define LOG_MODULE "App"
|
||||
#define LOG_LEVEL LOG_LEVEL_INFO
|
||||
|
||||
#define UIP_IP_BUF ((struct uip_ip_hdr *)&uip_buf[UIP_LLH_LEN])
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
PROCESS(ipv6_hooks_process, "IPv6 Hooks");
|
||||
AUTOSTART_PROCESSES(&ipv6_hooks_process);
|
||||
|
|
|
@ -55,8 +55,6 @@
|
|||
static struct uip_udp_conn *sink_conn;
|
||||
static uint16_t count;
|
||||
|
||||
#define UIP_IP_BUF ((struct uip_ip_hdr *)&uip_buf[UIP_LLH_LEN])
|
||||
|
||||
#if !NETSTACK_CONF_WITH_IPV6 || !UIP_CONF_ROUTER || !UIP_IPV6_MULTICAST || !UIP_CONF_IPV6_RPL
|
||||
#error "This example can not work with the current contiki configuration"
|
||||
#error "Check the values of: NETSTACK_CONF_WITH_IPV6, UIP_CONF_ROUTER, UIP_CONF_IPV6_RPL"
|
||||
|
|
|
@ -50,8 +50,6 @@
|
|||
#define DEBUG DEBUG_PRINT
|
||||
#include "net/ipv6/uip-debug.h"
|
||||
|
||||
#define UIP_IP_BUF ((struct uip_ip_hdr *)&uip_buf[UIP_LLH_LEN])
|
||||
|
||||
#define INTERVAL (10)
|
||||
#define BLINK_TIME (CLOCK_SECOND/4)
|
||||
|
||||
|
|
|
@ -78,7 +78,6 @@
|
|||
#define SERVER_LISTEN_SECURE_PORT UIP_HTONS(COAP_DEFAULT_SECURE_PORT)
|
||||
|
||||
/* direct access into the buffer */
|
||||
#define UIP_IP_BUF ((struct uip_ip_hdr *)&uip_buf[UIP_LLH_LEN])
|
||||
#define UIP_UDP_BUF ((struct uip_udp_hdr *)&uip_buf[uip_l2_l3_hdr_len])
|
||||
|
||||
#ifdef WITH_DTLS
|
||||
|
|
|
@ -105,7 +105,6 @@ static uip_ipaddr_t des_ip;
|
|||
/*---------------------------------------------------------------------------*/
|
||||
/* uIPv6 Pointers */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#define UIP_IP_BUF ((struct uip_ip_hdr *)&uip_buf[UIP_LLH_LEN])
|
||||
#define UIP_ICMP_BUF ((struct uip_icmp_hdr *)&uip_buf[uip_l2_l3_hdr_len])
|
||||
#define UIP_ICMP_PAYLOAD ((unsigned char *)&uip_buf[uip_l2_l3_icmp_hdr_len])
|
||||
#define UIP_UDP_BUF ((struct uip_udp_hdr *)&uip_buf[UIP_LLH_LEN + UIP_IPH_LEN])
|
||||
|
|
|
@ -461,7 +461,6 @@ static uint16_t last_seq;
|
|||
#define UIP_EXT_BUF ((struct uip_ext_hdr *)&uip_buf[UIP_LLH_LEN + UIP_IPH_LEN])
|
||||
#define UIP_EXT_BUF_NEXT ((uint8_t *)&uip_buf[UIP_LLH_LEN + UIP_IPH_LEN + HBHO_TOTAL_LEN])
|
||||
#define UIP_EXT_OPT_FIRST ((struct hbho_mcast *)&uip_buf[UIP_LLH_LEN + UIP_IPH_LEN + 2])
|
||||
#define UIP_IP_BUF ((struct uip_ip_hdr *)&uip_buf[UIP_LLH_LEN])
|
||||
#define UIP_ICMP_BUF ((struct uip_icmp_hdr *)&uip_buf[uip_l2_l3_hdr_len])
|
||||
#define UIP_ICMP_PAYLOAD ((unsigned char *)&uip_buf[uip_l2_l3_icmp_hdr_len])
|
||||
extern uint16_t uip_slen;
|
||||
|
|
|
@ -77,10 +77,6 @@ static uip_buf_t mcast_buf;
|
|||
static uint8_t fwd_delay;
|
||||
static uint8_t fwd_spread;
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* uIPv6 Pointers */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#define UIP_IP_BUF ((struct uip_ip_hdr *)&uip_buf[UIP_LLH_LEN])
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static void
|
||||
mcast_fwd(void *p)
|
||||
{
|
||||
|
|
|
@ -121,8 +121,6 @@
|
|||
#define SICSLOWPAN_UDP_BUF(buf) ((struct uip_udp_hdr *)&buf[UIP_IPH_LEN])
|
||||
#define SICSLOWPAN_IPPAYLOAD_BUF(buf) (&buf[UIP_IPH_LEN])
|
||||
|
||||
|
||||
#define UIP_IP_BUF ((struct uip_ip_hdr *)&uip_buf[UIP_LLH_LEN])
|
||||
#define UIP_UDP_BUF(p) ((struct uip_udp_hdr *)&uip_buf[UIP_LLIPH_LEN + p])
|
||||
#define UIP_TCP_BUF ((struct uip_tcp_hdr *)&uip_buf[UIP_LLIPH_LEN])
|
||||
#define UIP_ICMP_BUF ((struct uip_icmp_hdr *)&uip_buf[UIP_LLIPH_LEN])
|
||||
|
|
|
@ -52,7 +52,7 @@ PROCESS(simple_udp_process, "Simple UDP process");
|
|||
static uint8_t started = 0;
|
||||
static uint8_t databuffer[UIP_BUFSIZE];
|
||||
|
||||
#define UIP_IP_BUF ((struct uip_udpip_hdr *)&uip_buf[UIP_LLH_LEN])
|
||||
#define UIP_UDPIP_BUF ((struct uip_udpip_hdr *)&uip_buf[UIP_LLH_LEN])
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static void
|
||||
|
@ -134,7 +134,7 @@ PROCESS_THREAD(simple_udp_process, ev, data)
|
|||
{
|
||||
struct simple_udp_connection *c;
|
||||
PROCESS_BEGIN();
|
||||
|
||||
|
||||
while(1) {
|
||||
PROCESS_WAIT_EVENT();
|
||||
if(ev == tcpip_event) {
|
||||
|
@ -164,10 +164,10 @@ PROCESS_THREAD(simple_udp_process, ev, data)
|
|||
if(c->receive_callback != NULL) {
|
||||
PROCESS_CONTEXT_BEGIN(c->client_process);
|
||||
c->receive_callback(c,
|
||||
&(UIP_IP_BUF->srcipaddr),
|
||||
UIP_HTONS(UIP_IP_BUF->srcport),
|
||||
&(UIP_IP_BUF->destipaddr),
|
||||
UIP_HTONS(UIP_IP_BUF->destport),
|
||||
&(UIP_UDPIP_BUF->srcipaddr),
|
||||
UIP_HTONS(UIP_UDPIP_BUF->srcport),
|
||||
&(UIP_UDPIP_BUF->destipaddr),
|
||||
UIP_HTONS(UIP_UDPIP_BUF->destport),
|
||||
databuffer, uip_datalen());
|
||||
PROCESS_CONTEXT_END();
|
||||
}
|
||||
|
|
|
@ -56,7 +56,6 @@
|
|||
#define LOG_LEVEL LOG_LEVEL_TCPIP
|
||||
|
||||
#define UIP_ICMP_BUF ((struct uip_icmp_hdr *)&uip_buf[UIP_LLIPH_LEN + uip_ext_len])
|
||||
#define UIP_IP_BUF ((struct uip_ip_hdr *)&uip_buf[UIP_LLH_LEN])
|
||||
#define UIP_TCP_BUF ((struct uip_tcpip_hdr *)&uip_buf[UIP_LLH_LEN])
|
||||
|
||||
#ifdef UIP_FALLBACK_INTERFACE
|
||||
|
|
|
@ -38,8 +38,7 @@ PROCESS(udp_socket_process, "UDP socket process");
|
|||
|
||||
static uint8_t buf[UIP_BUFSIZE];
|
||||
|
||||
#define UIP_IP_BUF ((struct uip_udpip_hdr *)&uip_buf[UIP_LLH_LEN])
|
||||
|
||||
#define UIP_UDPIP_BUF ((struct uip_udpip_hdr *)&uip_buf[UIP_LLH_LEN])
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static void
|
||||
|
@ -181,10 +180,10 @@ PROCESS_THREAD(udp_socket_process, ev, data)
|
|||
if(c->input_callback != NULL) {
|
||||
PROCESS_CONTEXT_BEGIN(c->p);
|
||||
c->input_callback(c, c->ptr,
|
||||
&(UIP_IP_BUF->srcipaddr),
|
||||
UIP_HTONS(UIP_IP_BUF->srcport),
|
||||
&(UIP_IP_BUF->destipaddr),
|
||||
UIP_HTONS(UIP_IP_BUF->destport),
|
||||
&(UIP_UDPIP_BUF->srcipaddr),
|
||||
UIP_HTONS(UIP_UDPIP_BUF->srcport),
|
||||
&(UIP_UDPIP_BUF->destipaddr),
|
||||
UIP_HTONS(UIP_UDPIP_BUF->destport),
|
||||
buf, uip_datalen());
|
||||
PROCESS_CONTEXT_END();
|
||||
}
|
||||
|
|
|
@ -53,7 +53,6 @@
|
|||
#define LOG_MODULE "ICMPv6"
|
||||
#define LOG_LEVEL LOG_LEVEL_IPV6
|
||||
|
||||
#define UIP_IP_BUF ((struct uip_ip_hdr *)&uip_buf[UIP_LLH_LEN])
|
||||
#define UIP_ICMP_BUF ((struct uip_icmp_hdr *)&uip_buf[uip_l2_l3_hdr_len])
|
||||
#define UIP_ICMP6_ERROR_BUF ((struct uip_icmp6_error *)&uip_buf[uip_l2_l3_icmp_hdr_len])
|
||||
#define UIP_EXT_BUF ((struct uip_ext_hdr *)&uip_buf[uip_l2_l3_hdr_len])
|
||||
|
|
|
@ -94,7 +94,6 @@
|
|||
* value of these length variables
|
||||
*/
|
||||
|
||||
#define UIP_IP_BUF ((struct uip_ip_hdr *)&uip_buf[UIP_LLH_LEN]) /**< Pointer to IP header */
|
||||
#define UIP_ICMP_BUF ((struct uip_icmp_hdr *)&uip_buf[uip_l2_l3_hdr_len]) /**< Pointer to ICMP header*/
|
||||
/**@{ Pointers to messages just after icmp header */
|
||||
#define UIP_ND6_RS_BUF ((uip_nd6_rs *)&uip_buf[uip_l2_l3_icmp_hdr_len])
|
||||
|
|
|
@ -76,6 +76,11 @@
|
|||
#define uip_l2_l3_icmp_hdr_len (UIP_LLH_LEN + UIP_IPH_LEN + uip_ext_len + UIP_ICMPH_LEN)
|
||||
#define uip_l3_icmp_hdr_len (UIP_IPH_LEN + uip_ext_len + UIP_ICMPH_LEN)
|
||||
|
||||
/**
|
||||
* Direct access to IPv6 header
|
||||
*/
|
||||
#define UIP_IP_BUF ((struct uip_ip_hdr *)&uip_buf[UIP_LLH_LEN])
|
||||
|
||||
#include "net/ipv6/uipopt.h"
|
||||
#include "net/ipv6/uipbuf.h"
|
||||
#include "net/linkaddr.h"
|
||||
|
|
|
@ -142,7 +142,6 @@ uint8_t uip_ext_opt_offset = 0;
|
|||
* @{
|
||||
*/
|
||||
#define FBUF ((struct uip_tcpip_hdr *)&uip_reassbuf[0])
|
||||
#define UIP_IP_BUF ((struct uip_ip_hdr *)&uip_buf[UIP_LLH_LEN])
|
||||
#define UIP_ICMP_BUF ((struct uip_icmp_hdr *)&uip_buf[uip_l2_l3_hdr_len])
|
||||
#define UIP_UDP_BUF ((struct uip_udp_hdr *)&uip_buf[UIP_LLH_LEN + UIP_IPH_LEN])
|
||||
#define UIP_TCP_BUF ((struct uip_tcp_hdr *)&uip_buf[UIP_LLH_LEN + UIP_IPH_LEN])
|
||||
|
|
|
@ -61,7 +61,6 @@
|
|||
#include <string.h>
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#define UIP_IP_BUF ((struct uip_ip_hdr *)&uip_buf[UIP_LLH_LEN])
|
||||
#define UIP_EXT_BUF ((struct uip_ext_hdr *)&uip_buf[uip_l2_l3_hdr_len])
|
||||
#define UIP_HBHO_BUF ((struct uip_hbho_hdr *)&uip_buf[uip_l2_l3_hdr_len])
|
||||
#define UIP_HBHO_NEXT_BUF ((struct uip_ext_hdr *)&uip_buf[uip_l2_l3_hdr_len + RPL_HOP_BY_HOP_LEN])
|
||||
|
|
|
@ -70,7 +70,6 @@
|
|||
#define RPL_DIO_MOP_MASK 0x38
|
||||
#define RPL_DIO_PREFERENCE_MASK 0x07
|
||||
|
||||
#define UIP_IP_BUF ((struct uip_ip_hdr *)&uip_buf[UIP_LLH_LEN])
|
||||
#define UIP_ICMP_BUF ((struct uip_icmp_hdr *)&uip_buf[uip_l2_l3_hdr_len])
|
||||
#define UIP_ICMP_PAYLOAD ((unsigned char *)&uip_buf[uip_l2_l3_icmp_hdr_len])
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
|
|
@ -65,7 +65,6 @@
|
|||
* neighbors and are not only MAC neighbors.
|
||||
*/
|
||||
#define MAX_CHILDREN (NBR_TABLE_MAX_NEIGHBORS - 2)
|
||||
#define UIP_IP_BUF ((struct uip_ip_hdr *)&uip_buf[UIP_LLH_LEN])
|
||||
|
||||
static int num_parents; /* any node that are possible parents */
|
||||
static int num_children; /* all children that we have as nexthop */
|
||||
|
|
|
@ -54,7 +54,6 @@
|
|||
#define LOG_LEVEL LOG_LEVEL_RPL
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#define UIP_IP_BUF ((struct uip_ip_hdr *)&uip_buf[UIP_LLH_LEN])
|
||||
#define UIP_EXT_BUF ((struct uip_ext_hdr *)&uip_buf[uip_l2_l3_hdr_len])
|
||||
#define UIP_HBHO_BUF ((struct uip_hbho_hdr *)&uip_buf[uip_l2_l3_hdr_len])
|
||||
#define UIP_HBHO_NEXT_BUF ((struct uip_ext_hdr *)&uip_buf[uip_l2_l3_hdr_len + RPL_HOP_BY_HOP_LEN])
|
||||
|
|
|
@ -62,7 +62,6 @@
|
|||
#define RPL_DIO_MOP_MASK 0x38
|
||||
#define RPL_DIO_PREFERENCE_MASK 0x07
|
||||
|
||||
#define UIP_IP_BUF ((struct uip_ip_hdr *)&uip_buf[UIP_LLH_LEN])
|
||||
#define UIP_ICMP_BUF ((struct uip_icmp_hdr *)&uip_buf[uip_l2_l3_hdr_len])
|
||||
#define UIP_ICMP_PAYLOAD ((unsigned char *)&uip_buf[uip_l2_l3_icmp_hdr_len])
|
||||
|
||||
|
|
|
@ -59,7 +59,6 @@
|
|||
* NOTE: this policy assumes that all neighbors end up being IPv6
|
||||
* neighbors and are not only MAC neighbors.
|
||||
*/
|
||||
#define UIP_IP_BUF ((struct uip_ip_hdr *)&uip_buf[UIP_LLH_LEN])
|
||||
|
||||
static int num_parents; /* all nodes that are possible parents */
|
||||
static int num_free;
|
||||
|
|
|
@ -39,8 +39,6 @@
|
|||
|
||||
#include <string.h>
|
||||
|
||||
#define UIP_IP_BUF ((struct uip_ip_hdr *)&uip_buf[UIP_LLH_LEN])
|
||||
|
||||
#define DEBUG DEBUG_NONE
|
||||
#include "net/ipv6/uip-debug.h"
|
||||
#define printf(...)
|
||||
|
|
|
@ -38,8 +38,6 @@
|
|||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#define UIP_IP_BUF ((struct uip_ip_hdr *)&uip_buf[UIP_LLH_LEN])
|
||||
|
||||
#define DEBUG DEBUG_NONE
|
||||
#include "net/ipv6/uip-debug.h"
|
||||
|
||||
|
@ -88,12 +86,12 @@ input_callback(void)
|
|||
}
|
||||
uip_clear_buf();
|
||||
} else {
|
||||
|
||||
|
||||
/* Save the last sender received over SLIP to avoid bouncing the
|
||||
packet back if no route is found */
|
||||
uip_ipaddr_copy(&last_sender, &UIP_IP_BUF->srcipaddr);
|
||||
|
||||
uint16_t len = ip64_4to6(&uip_buf[UIP_LLH_LEN], uip_len,
|
||||
|
||||
uint16_t len = ip64_4to6(&uip_buf[UIP_LLH_LEN], uip_len,
|
||||
ip64_packet_buffer);
|
||||
if(len > 0) {
|
||||
memcpy(&uip_buf[UIP_LLH_LEN], ip64_packet_buffer, len);
|
||||
|
|
|
@ -43,8 +43,6 @@
|
|||
#include "dev/slip.h"
|
||||
#include <string.h>
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#define UIP_IP_BUF ((struct uip_ip_hdr *)&uip_buf[UIP_LLH_LEN])
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* Log configuration */
|
||||
#include "sys/log.h"
|
||||
#define LOG_MODULE "SLIP"
|
||||
|
|
|
@ -8,8 +8,6 @@
|
|||
#include "net/ipv6/uip-ds6.h"
|
||||
#include <string.h>
|
||||
|
||||
#define UIP_IP_BUF ((struct uip_ip_hdr *)&uip_buf[UIP_LLH_LEN])
|
||||
|
||||
uip_buf_t uip_aligned_buf;
|
||||
|
||||
uint16_t uip_len;
|
||||
|
|
|
@ -155,7 +155,6 @@
|
|||
//#define PRINTF printf
|
||||
#define PRINTF(...)
|
||||
|
||||
#define UIP_IP_BUF ((struct uip_ip_hdr *)&uip_buf[UIP_LLH_LEN])
|
||||
#define ETHBUF(x) ((struct uip_eth_hdr *)x)
|
||||
|
||||
//For little endian, such as our friend mr. AVR
|
||||
|
|
|
@ -48,8 +48,6 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#define UIP_IP_BUF ((struct uip_ip_hdr *)&uip_buf[UIP_LLH_LEN])
|
||||
|
||||
PROCESS(uip6_bridge, "IPv6/6lowpan TAP bridge");
|
||||
PROCESS(tcpip_process, "tcpip dummy");
|
||||
AUTOSTART_PROCESSES(&uip6_bridge);
|
||||
|
|
Loading…
Reference in New Issue