Reformat netif subdir using astylerc

This commit is contained in:
Dirk Ziegelmeier 2017-10-03 21:22:04 +02:00
parent 47138f92d0
commit de5b693e7d
5 changed files with 152 additions and 153 deletions

View File

@ -171,7 +171,7 @@ static void
bridgeif_fdb_update_src(void *fdb_ptr, struct eth_addr *src_addr, u8_t port_idx)
{
int i;
bridgeif_dfdb_t *fdb = (bridgeif_dfdb_t*)fdb_ptr;
bridgeif_dfdb_t *fdb = (bridgeif_dfdb_t *)fdb_ptr;
BRIDGEIF_DECL_PROTECT(lev);
BRIDGEIF_READ_PROTECT(lev);
for (i = 0; i < fdb->max_fdb_entries; i++) {
@ -220,7 +220,7 @@ static bridgeif_portmask_t
bridgeif_fdb_get_dst_ports(void *fdb_ptr, struct eth_addr *dst_addr)
{
int i;
bridgeif_dfdb_t *fdb = (bridgeif_dfdb_t*)fdb_ptr;
bridgeif_dfdb_t *fdb = (bridgeif_dfdb_t *)fdb_ptr;
BRIDGEIF_DECL_PROTECT(lev);
BRIDGEIF_READ_PROTECT(lev);
for (i = 0; i < fdb->max_fdb_entries; i++) {
@ -238,15 +238,15 @@ bridgeif_fdb_get_dst_ports(void *fdb_ptr, struct eth_addr *dst_addr)
}
/** Init our simple fdb list */
static void*
static void *
bridgeif_fdb_init(u16_t max_fdb_entries)
{
bridgeif_dfdb_t *fdb;
size_t alloc_len_sizet = sizeof(bridgeif_dfdb_t) + (max_fdb_entries*sizeof(bridgeif_dfdb_entry_t));
size_t alloc_len_sizet = sizeof(bridgeif_dfdb_t) + (max_fdb_entries * sizeof(bridgeif_dfdb_entry_t));
mem_size_t alloc_len = (mem_size_t)alloc_len_sizet;
LWIP_ASSERT("alloc_len == alloc_len_sizet", alloc_len == alloc_len_sizet);
LWIP_DEBUGF(BRIDGEIF_DEBUG, ("bridgeif_fdb_init: allocating %d bytes for private FDB data\n", (int)alloc_len));
fdb = (bridgeif_dfdb_t*)mem_calloc(1, alloc_len);
fdb = (bridgeif_dfdb_t *)mem_calloc(1, alloc_len);
if (fdb == NULL) {
return NULL;
}
@ -315,7 +315,7 @@ bridgeif_fdb_add(struct netif *bridgeif, const struct eth_addr *addr, bridgeif_p
bridgeif_private_t *br;
BRIDGEIF_DECL_PROTECT(lev);
LWIP_ASSERT("invalid netif", bridgeif != NULL);
br = (bridgeif_private_t*)bridgeif->state;
br = (bridgeif_private_t *)bridgeif->state;
LWIP_ASSERT("invalid state", br != NULL);
BRIDGEIF_READ_PROTECT(lev);
@ -348,7 +348,7 @@ bridgeif_fdb_remove(struct netif *bridgeif, const struct eth_addr *addr)
bridgeif_private_t *br;
BRIDGEIF_DECL_PROTECT(lev);
LWIP_ASSERT("invalid netif", bridgeif != NULL);
br = (bridgeif_private_t*)bridgeif->state;
br = (bridgeif_private_t *)bridgeif->state;
LWIP_ASSERT("invalid state", br != NULL);
BRIDGEIF_READ_PROTECT(lev);
@ -434,7 +434,7 @@ bridgeif_send_to_port(bridgeif_private_t *br, struct pbuf *p, u8_t dstport_idx)
/* prevent sending out to rx port */
if (netif_get_index(portif) != p->if_idx) {
if (netif_is_link_up(portif)) {
LWIP_DEBUGF(BRIDGEIF_FW_DEBUG, ("br -> flood(%p:%d) -> %d\n", (void*)p, p->if_idx, netif_get_index(portif)));
LWIP_DEBUGF(BRIDGEIF_FW_DEBUG, ("br -> flood(%p:%d) -> %d\n", (void *)p, p->if_idx, netif_get_index(portif)));
return portif->linkoutput(portif, p);
}
}
@ -477,14 +477,14 @@ static err_t
bridgeif_output(struct netif *netif, struct pbuf *p)
{
err_t err;
bridgeif_private_t *br = (bridgeif_private_t*)netif->state;
bridgeif_private_t *br = (bridgeif_private_t *)netif->state;
struct eth_addr *dst = (struct eth_addr *)(p->payload);
bridgeif_portmask_t dstports = bridgeif_find_dst_ports(br, dst);
err = bridgeif_send_to_ports(br, p, dstports);
MIB2_STATS_NETIF_ADD(netif, ifoutoctets, p->tot_len);
if (((u8_t*)p->payload)[0] & 1) {
if (((u8_t *)p->payload)[0] & 1) {
/* broadcast or multicast packet*/
MIB2_STATS_NETIF_INC(netif, ifoutnucastpkts);
} else {
@ -522,8 +522,8 @@ bridgeif_input(struct pbuf *p, struct netif *netif)
/* store receive index in pbuf */
p->if_idx = rx_idx;
dst = (struct eth_addr*)p->payload;
src = (struct eth_addr*)(((u8_t*)p->payload) + sizeof(struct eth_addr));
dst = (struct eth_addr *)p->payload;
src = (struct eth_addr *)(((u8_t *)p->payload) + sizeof(struct eth_addr));
if ((src->addr[0] & 1) == 0) {
/* update src for all non-group addresses */
@ -536,7 +536,7 @@ bridgeif_input(struct pbuf *p, struct netif *netif)
bridgeif_send_to_ports(br, p, dstports);
if (dstports & (1 << BRIDGEIF_MAX_PORTS)) {
/* we pass the reference to ->input or have to free it */
LWIP_DEBUGF(BRIDGEIF_FW_DEBUG, ("br -> input(%p)\n", (void*)p));
LWIP_DEBUGF(BRIDGEIF_FW_DEBUG, ("br -> input(%p)\n", (void *)p));
if (br->netif->input(p, br->netif) != ERR_OK) {
pbuf_free(p);
}
@ -550,7 +550,7 @@ bridgeif_input(struct pbuf *p, struct netif *netif)
/* is this for one of the local ports? */
if (bridgeif_is_local_mac(br, dst)) {
/* yes, send to cpu port only */
LWIP_DEBUGF(BRIDGEIF_FW_DEBUG, ("br -> input(%p)\n", (void*)p));
LWIP_DEBUGF(BRIDGEIF_FW_DEBUG, ("br -> input(%p)\n", (void *)p));
return br->netif->input(p, br->netif);
}
@ -599,7 +599,7 @@ bridgeif_init(struct netif *netif)
LWIP_ASSERT("netif != NULL", (netif != NULL));
#if !BRIDGEIF_PORT_NETIFS_OUTPUT_DIRECT
if (netif->input == tcpip_input) {
LWIP_DEBUGF(BRIDGEIF_DEBUG|LWIP_DBG_ON, ("bridgeif does not need tcpip_input, use netif_input/ethernet_input instead"));
LWIP_DEBUGF(BRIDGEIF_DEBUG | LWIP_DBG_ON, ("bridgeif does not need tcpip_input, use netif_input/ethernet_input instead"));
}
#endif
@ -612,11 +612,11 @@ bridgeif_init(struct netif *netif)
LWIP_ASSERT("init_data->max_ports <= BRIDGEIF_MAX_PORTS",
init_data->max_ports <= BRIDGEIF_MAX_PORTS);
alloc_len_sizet = sizeof(bridgeif_private_t) + (init_data->max_ports*sizeof(bridgeif_port_t) + (init_data->max_fdb_static_entries*sizeof(bridgeif_fdb_static_entry_t)));
alloc_len_sizet = sizeof(bridgeif_private_t) + (init_data->max_ports * sizeof(bridgeif_port_t) + (init_data->max_fdb_static_entries * sizeof(bridgeif_fdb_static_entry_t)));
alloc_len = (mem_size_t)alloc_len_sizet;
LWIP_ASSERT("alloc_len == alloc_len_sizet", alloc_len == alloc_len_sizet);
LWIP_DEBUGF(BRIDGEIF_DEBUG, ("bridgeif_init: allocating %d bytes for private data\n", (int)alloc_len));
br = (bridgeif_private_t*)mem_calloc(1, alloc_len);
br = (bridgeif_private_t *)mem_calloc(1, alloc_len);
if (br == NULL) {
LWIP_DEBUGF(NETIF_DEBUG, ("bridgeif_init: out of memory\n"));
return ERR_MEM;
@ -625,10 +625,10 @@ bridgeif_init(struct netif *netif)
br->netif = netif;
br->max_ports = init_data->max_ports;
br->ports = (bridgeif_port_t*)(br + 1);
br->ports = (bridgeif_port_t *)(br + 1);
br->max_fdbs_entries = init_data->max_fdb_static_entries;
br->fdbs = (bridgeif_fdb_static_entry_t*)(((u8_t*)(br + 1)) + (init_data->max_ports*sizeof(bridgeif_port_t)));
br->fdbs = (bridgeif_fdb_static_entry_t *)(((u8_t *)(br + 1)) + (init_data->max_ports * sizeof(bridgeif_port_t)));
br->max_fdbd_entries = init_data->max_fdb_dynamic_entries;
br->fdbd = bridgeif_fdb_init(init_data->max_fdb_dynamic_entries);
@ -676,7 +676,7 @@ bridgeif_init(struct netif *netif)
/* device capabilities */
/* don't set NETIF_FLAG_ETHARP if this device is not an ethernet one */
netif->flags = NETIF_FLAG_BROADCAST | NETIF_FLAG_ETHARP | NETIF_FLAG_ETHERNET | NETIF_FLAG_IGMP | NETIF_FLAG_MLD6 |NETIF_FLAG_LINK_UP;
netif->flags = NETIF_FLAG_BROADCAST | NETIF_FLAG_ETHARP | NETIF_FLAG_ETHERNET | NETIF_FLAG_IGMP | NETIF_FLAG_MLD6 | NETIF_FLAG_LINK_UP;
#if LWIP_IPV6 && LWIP_IPV6_MLD
/*

View File

@ -60,8 +60,8 @@
#include LWIP_HOOK_FILENAME
#endif
const struct eth_addr ethbroadcast = {{0xff,0xff,0xff,0xff,0xff,0xff}};
const struct eth_addr ethzero = {{0,0,0,0,0,0}};
const struct eth_addr ethbroadcast = {{0xff, 0xff, 0xff, 0xff, 0xff, 0xff}};
const struct eth_addr ethzero = {{0, 0, 0, 0, 0, 0}};
/**
* @ingroup lwip_nosys
@ -80,7 +80,7 @@ const struct eth_addr ethzero = {{0,0,0,0,0,0}};
err_t
ethernet_input(struct pbuf *p, struct netif *netif)
{
struct eth_hdr* ethhdr;
struct eth_hdr *ethhdr;
u16_t type;
#if LWIP_ARP || ETHARP_SUPPORT_VLAN || LWIP_IPV6
u16_t next_hdr_offset = SIZEOF_ETH_HDR;
@ -111,7 +111,7 @@ ethernet_input(struct pbuf *p, struct netif *netif)
type = ethhdr->type;
#if ETHARP_SUPPORT_VLAN
if (type == PP_HTONS(ETHTYPE_VLAN)) {
struct eth_vlan_hdr *vlan = (struct eth_vlan_hdr*)(((char*)ethhdr) + SIZEOF_ETH_HDR);
struct eth_vlan_hdr *vlan = (struct eth_vlan_hdr *)(((char *)ethhdr) + SIZEOF_ETH_HDR);
if (p->len <= SIZEOF_ETH_HDR + SIZEOF_VLAN_HDR) {
/* a packet with only an ethernet/vlan header (or less) is not valid for us */
ETHARP_STATS_INC(etharp.proterr);
@ -231,7 +231,7 @@ ethernet_input(struct pbuf *p, struct netif *netif)
default:
#ifdef LWIP_HOOK_UNKNOWN_ETH_PROTOCOL
if(LWIP_HOOK_UNKNOWN_ETH_PROTOCOL(p, netif) == ERR_OK) {
if (LWIP_HOOK_UNKNOWN_ETH_PROTOCOL(p, netif) == ERR_OK) {
break;
}
#endif
@ -265,24 +265,23 @@ free_and_return:
* @return ERR_OK if the packet was sent, any other err_t on failure
*/
err_t
ethernet_output(struct netif* netif, struct pbuf* p,
const struct eth_addr* src, const struct eth_addr* dst,
u16_t eth_type)
{
struct eth_hdr* ethhdr;
ethernet_output(struct netif * netif, struct pbuf * p,
const struct eth_addr * src, const struct eth_addr * dst,
u16_t eth_type) {
struct eth_hdr *ethhdr;
u16_t eth_type_be = lwip_htons(eth_type);
#if ETHARP_SUPPORT_VLAN && defined(LWIP_HOOK_VLAN_SET)
s32_t vlan_prio_vid = LWIP_HOOK_VLAN_SET(netif, p, src, dst, eth_type);
if (vlan_prio_vid >= 0) {
struct eth_vlan_hdr* vlanhdr;
struct eth_vlan_hdr *vlanhdr;
LWIP_ASSERT("prio_vid must be <= 0xFFFF", vlan_prio_vid <= 0xFFFF);
if (pbuf_add_header(p, SIZEOF_ETH_HDR + SIZEOF_VLAN_HDR) != 0) {
goto pbuf_header_failed;
}
vlanhdr = (struct eth_vlan_hdr*)(((u8_t*)p->payload) + SIZEOF_ETH_HDR);
vlanhdr = (struct eth_vlan_hdr *)(((u8_t *)p->payload) + SIZEOF_ETH_HDR);
vlanhdr->tpid = eth_type_be;
vlanhdr->prio_vid = lwip_htons((u16_t)vlan_prio_vid);
@ -295,7 +294,7 @@ ethernet_output(struct netif* netif, struct pbuf* p,
}
}
ethhdr = (struct eth_hdr*)p->payload;
ethhdr = (struct eth_hdr *)p->payload;
ethhdr->type = eth_type_be;
SMEMCPY(&ethhdr->dest, dst, ETH_HWADDR_LEN);
SMEMCPY(&ethhdr->src, src, ETH_HWADDR_LEN);

View File

@ -155,7 +155,7 @@ low_level_output(struct netif *netif, struct pbuf *p)
signal that packet should be sent();
MIB2_STATS_NETIF_ADD(netif, ifoutoctets, p->tot_len);
if (((u8_t*)p->payload)[0] & 1) {
if (((u8_t *)p->payload)[0] & 1) {
/* broadcast or multicast packet*/
MIB2_STATS_NETIF_INC(netif, ifoutnucastpkts);
} else {
@ -221,7 +221,7 @@ low_level_input(struct netif *netif)
acknowledge that packet has been read();
MIB2_STATS_NETIF_ADD(netif, ifinoctets, p->tot_len);
if (((u8_t*)p->payload)[0] & 1) {
if (((u8_t *)p->payload)[0] & 1) {
/* broadcast or multicast packet*/
MIB2_STATS_NETIF_INC(netif, ifinnucastpkts);
} else {
@ -326,7 +326,7 @@ ethernetif_init(struct netif *netif)
#endif /* LWIP_IPV6 */
netif->linkoutput = low_level_output;
ethernetif->ethaddr = (struct eth_addr *)&(netif->hwaddr[0]);
ethernetif->ethaddr = (struct eth_addr *) & (netif->hwaddr[0]);
/* initialize the hardware */
low_level_init(netif);

View File

@ -77,7 +77,7 @@ struct lowpan6_reass_helper {
u16_t datagram_tag;
};
static struct lowpan6_reass_helper * reass_list;
static struct lowpan6_reass_helper *reass_list;
#if LWIP_6LOWPAN_NUM_CONTEXTS > 0
static ip6_addr_t lowpan6_context[LWIP_6LOWPAN_NUM_CONTEXTS];
@ -88,7 +88,7 @@ static u16_t ieee_802154_pan_id;
static const struct ieee_802154_addr ieee_802154_broadcast = {2, {0xff, 0xff}};
#if LWIP_6LOWPAN_INFER_SHORT_ADDRESS
static struct ieee_802154_addr short_mac_addr = {2, {0,0}};
static struct ieee_802154_addr short_mac_addr = {2, {0, 0}};
#endif /* LWIP_6LOWPAN_INFER_SHORT_ADDRESS */
static err_t dequeue_datagram(struct lowpan6_reass_helper *lrh);
@ -209,9 +209,9 @@ lowpan6_get_address_mode_mc(const ip6_addr_t *ip6addr)
static err_t
lowpan6_frag(struct netif *netif, struct pbuf *p, const struct ieee_802154_addr *src, const struct ieee_802154_addr *dst)
{
struct pbuf * p_frag;
struct pbuf *p_frag;
u16_t frag_len, remaining_len;
u8_t * buffer;
u8_t *buffer;
u8_t ieee_header_len;
u8_t lowpan6_header_len;
s8_t i;
@ -228,7 +228,7 @@ lowpan6_frag(struct netif *netif, struct pbuf *p, const struct ieee_802154_addr
}
/* Write IEEE 802.15.4 header. */
buffer = (u8_t*)p_frag->payload;
buffer = (u8_t *)p_frag->payload;
ieee_header_len = 0;
if (dst == &ieee_802154_broadcast) {
buffer[ieee_header_len++] = 0x01; /* data packet, no ack required. */
@ -355,10 +355,10 @@ lowpan6_frag(struct netif *netif, struct pbuf *p, const struct ieee_802154_addr
i = lowpan6_get_address_mode(ip_2_ip6(&ip_data.current_iphdr_src), src);
buffer[ieee_header_len + 1] |= (i & 0x03) << 4;
if (i == 1) {
MEMCPY(buffer + ieee_header_len + lowpan6_header_len, (u8_t*)p->payload + 16, 8);
MEMCPY(buffer + ieee_header_len + lowpan6_header_len, (u8_t *)p->payload + 16, 8);
lowpan6_header_len += 8;
} else if (i == 2) {
MEMCPY(buffer + ieee_header_len + lowpan6_header_len, (u8_t*)p->payload + 22, 2);
MEMCPY(buffer + ieee_header_len + lowpan6_header_len, (u8_t *)p->payload + 22, 2);
lowpan6_header_len += 2;
}
} else if (ip6_addr_isany(ip_2_ip6(&ip_data.current_iphdr_src))) {
@ -366,7 +366,7 @@ lowpan6_frag(struct netif *netif, struct pbuf *p, const struct ieee_802154_addr
buffer[ieee_header_len + 1] |= 0x40;
} else {
/* Append full address. */
MEMCPY(buffer + ieee_header_len + lowpan6_header_len, (u8_t*)p->payload + 8, 16);
MEMCPY(buffer + ieee_header_len + lowpan6_header_len, (u8_t *)p->payload + 8, 16);
lowpan6_header_len += 16;
}
@ -379,15 +379,15 @@ lowpan6_frag(struct netif *netif, struct pbuf *p, const struct ieee_802154_addr
i = lowpan6_get_address_mode_mc(ip_2_ip6(&ip_data.current_iphdr_dest));
buffer[ieee_header_len + 1] |= i & 0x03;
if (i == 0) {
MEMCPY(buffer + ieee_header_len + lowpan6_header_len, (u8_t*)p->payload + 24, 16);
MEMCPY(buffer + ieee_header_len + lowpan6_header_len, (u8_t *)p->payload + 24, 16);
lowpan6_header_len += 16;
} else if (i == 1) {
buffer[ieee_header_len + lowpan6_header_len++] = ((u8_t *)p->payload)[25];
MEMCPY(buffer + ieee_header_len + lowpan6_header_len, (u8_t*)p->payload + 35, 5);
MEMCPY(buffer + ieee_header_len + lowpan6_header_len, (u8_t *)p->payload + 35, 5);
lowpan6_header_len += 5;
} else if (i == 2) {
buffer[ieee_header_len + lowpan6_header_len++] = ((u8_t *)p->payload)[25];
MEMCPY(buffer + ieee_header_len + lowpan6_header_len, (u8_t*)p->payload + 37, 3);
MEMCPY(buffer + ieee_header_len + lowpan6_header_len, (u8_t *)p->payload + 37, 3);
lowpan6_header_len += 3;
} else if (i == 3) {
buffer[ieee_header_len + lowpan6_header_len++] = ((u8_t *)p->payload)[39];
@ -398,15 +398,15 @@ lowpan6_frag(struct netif *netif, struct pbuf *p, const struct ieee_802154_addr
i = lowpan6_get_address_mode(ip_2_ip6(&ip_data.current_iphdr_dest), dst);
buffer[ieee_header_len + 1] |= i & 0x03;
if (i == 1) {
MEMCPY(buffer + ieee_header_len + lowpan6_header_len, (u8_t*)p->payload + 32, 8);
MEMCPY(buffer + ieee_header_len + lowpan6_header_len, (u8_t *)p->payload + 32, 8);
lowpan6_header_len += 8;
} else if (i == 2) {
MEMCPY(buffer + ieee_header_len + lowpan6_header_len, (u8_t*)p->payload + 38, 2);
MEMCPY(buffer + ieee_header_len + lowpan6_header_len, (u8_t *)p->payload + 38, 2);
lowpan6_header_len += 2;
}
} else {
/* Append full address. */
MEMCPY(buffer + ieee_header_len + lowpan6_header_len, (u8_t*)p->payload + 24, 16);
MEMCPY(buffer + ieee_header_len + lowpan6_header_len, (u8_t *)p->payload + 24, 16);
lowpan6_header_len += 16;
}
@ -572,7 +572,7 @@ lowpan6_frag(struct netif *netif, struct pbuf *p, const struct ieee_802154_addr
}
err_t
lowpan6_set_context(u8_t idx, const ip6_addr_t * context)
lowpan6_set_context(u8_t idx, const ip6_addr_t *context)
{
if (idx >= LWIP_6LOWPAN_NUM_CONTEXTS) {
return ERR_ARG;
@ -627,7 +627,7 @@ lowpan6_output(struct netif *netif, struct pbuf *q, const ip6_addr_t *ip6addr)
struct ieee_802154_addr src, dest;
#if LWIP_6LOWPAN_INFER_SHORT_ADDRESS
ip6_addr_t ip6_src;
struct ip6_hdr * ip6_hdr;
struct ip6_hdr *ip6_hdr;
#endif /* LWIP_6LOWPAN_INFER_SHORT_ADDRESS */
#if LWIP_6LOWPAN_INFER_SHORT_ADDRESS
@ -691,10 +691,10 @@ lowpan6_output(struct netif *netif, struct pbuf *q, const ip6_addr_t *ip6addr)
}
static struct pbuf *
lowpan6_decompress(struct pbuf * p, struct ieee_802154_addr * src, struct ieee_802154_addr * dest)
lowpan6_decompress(struct pbuf *p, struct ieee_802154_addr *src, struct ieee_802154_addr *dest)
{
struct pbuf * q;
u8_t * lowpan6_buffer;
struct pbuf *q;
u8_t *lowpan6_buffer;
u16_t lowpan6_offset;
struct ip6_hdr *ip6hdr;
s8_t i;
@ -722,13 +722,13 @@ lowpan6_decompress(struct pbuf * p, struct ieee_802154_addr * src, struct ieee_8
/* Set IPv6 version, traffic class and flow label. */
if ((lowpan6_buffer[0] & 0x18) == 0x00) {
IP6H_VTCFL_SET(ip6hdr, 6, lowpan6_buffer[lowpan6_offset], ((lowpan6_buffer[lowpan6_offset+1] & 0x0f) << 16) | (lowpan6_buffer[lowpan6_offset + 2] << 8) | lowpan6_buffer[lowpan6_offset+3]);
IP6H_VTCFL_SET(ip6hdr, 6, lowpan6_buffer[lowpan6_offset], ((lowpan6_buffer[lowpan6_offset + 1] & 0x0f) << 16) | (lowpan6_buffer[lowpan6_offset + 2] << 8) | lowpan6_buffer[lowpan6_offset + 3]);
lowpan6_offset += 4;
} else if ((lowpan6_buffer[0] & 0x18) == 0x08) {
IP6H_VTCFL_SET(ip6hdr, 6, lowpan6_buffer[lowpan6_offset] & 0xc0, ((lowpan6_buffer[lowpan6_offset] & 0x0f) << 16) | (lowpan6_buffer[lowpan6_offset + 1] << 8) | lowpan6_buffer[lowpan6_offset+2]);
IP6H_VTCFL_SET(ip6hdr, 6, lowpan6_buffer[lowpan6_offset] & 0xc0, ((lowpan6_buffer[lowpan6_offset] & 0x0f) << 16) | (lowpan6_buffer[lowpan6_offset + 1] << 8) | lowpan6_buffer[lowpan6_offset + 2]);
lowpan6_offset += 3;
} else if ((lowpan6_buffer[0] & 0x18) == 0x10) {
IP6H_VTCFL_SET(ip6hdr, 6, lowpan6_buffer[lowpan6_offset],0);
IP6H_VTCFL_SET(ip6hdr, 6, lowpan6_buffer[lowpan6_offset], 0);
lowpan6_offset += 1;
} else if ((lowpan6_buffer[0] & 0x18) == 0x18) {
IP6H_VTCFL_SET(ip6hdr, 6, 0, 0);
@ -770,7 +770,7 @@ lowpan6_decompress(struct pbuf * p, struct ieee_802154_addr * src, struct ieee_8
ip6hdr->src.addr[1] = 0;
ip6hdr->src.addr[2] = PP_HTONL(0x000000ffUL);
ip6hdr->src.addr[3] = lwip_htonl(0xfe000000UL | (lowpan6_buffer[lowpan6_offset] << 8) |
lowpan6_buffer[lowpan6_offset+1]);
lowpan6_buffer[lowpan6_offset + 1]);
lowpan6_offset += 2;
} else if ((lowpan6_buffer[1] & 0x30) == 0x30) {
ip6hdr->src.addr[0] = PP_HTONL(0xfe800000UL);
@ -816,7 +816,7 @@ lowpan6_decompress(struct pbuf * p, struct ieee_802154_addr * src, struct ieee_8
lowpan6_offset += 8;
} else if ((lowpan6_buffer[1] & 0x30) == 0x20) {
ip6hdr->src.addr[2] = PP_HTONL(0x000000ffUL);
ip6hdr->src.addr[3] = lwip_htonl(0xfe000000UL | (lowpan6_buffer[lowpan6_offset] << 8) | lowpan6_buffer[lowpan6_offset+1]);
ip6hdr->src.addr[3] = lwip_htonl(0xfe000000UL | (lowpan6_buffer[lowpan6_offset] << 8) | lowpan6_buffer[lowpan6_offset + 1]);
lowpan6_offset += 2;
} else if ((lowpan6_buffer[1] & 0x30) == 0x30) {
if (src->addr_len == 2) {
@ -964,7 +964,7 @@ lowpan6_decompress(struct pbuf * p, struct ieee_802154_addr * src, struct ieee_8
/* Now we copy leftover contents from p to q, so we have all L2 and L3 headers (and L4?) in a single PBUF.
* Replace p with q, and free p */
pbuf_remove_header(p, lowpan6_offset);
MEMCPY((u8_t*)q->payload + ip6_offset, p->payload, p->len);
MEMCPY((u8_t *)q->payload + ip6_offset, p->payload, p->len);
q->len = q->tot_len = ip6_offset + p->len;
if (p->next != NULL) {
pbuf_cat(q, p->next);
@ -980,9 +980,9 @@ lowpan6_decompress(struct pbuf * p, struct ieee_802154_addr * src, struct ieee_8
}
err_t
lowpan6_input(struct pbuf * p, struct netif *netif)
lowpan6_input(struct pbuf *p, struct netif *netif)
{
u8_t * puc;
u8_t *puc;
s8_t i;
struct ieee_802154_addr src, dest;
u16_t datagram_size, datagram_offset, datagram_tag;
@ -991,7 +991,7 @@ lowpan6_input(struct pbuf * p, struct netif *netif)
MIB2_STATS_NETIF_ADD(netif, ifinoctets, p->tot_len);
/* Analyze header. @todo validate. */
puc = (u8_t*)p->payload;
puc = (u8_t *)p->payload;
datagram_offset = 5;
if ((puc[1] & 0x0c) == 0x0c) {
dest.addr_len = 8;
@ -1024,7 +1024,7 @@ lowpan6_input(struct pbuf * p, struct netif *netif)
pbuf_remove_header(p, datagram_offset); /* hide IEEE802.15.4 header. */
/* Check dispatch. */
puc = (u8_t*)p->payload;
puc = (u8_t *)p->payload;
if ((*puc & 0xf8) == 0xc0) {
/* FRAG1 dispatch. add this packet to reassembly list. */
@ -1137,12 +1137,12 @@ lowpan6_input(struct pbuf * p, struct netif *netif)
}
/* We have a complete packet, check dispatch for headers. */
puc = (u8_t*)p->payload;
puc = (u8_t *)p->payload;
if (*puc == 0x41) {
/* This is a complete IPv6 packet, just skip dispatch byte. */
pbuf_remove_header(p, 1); /* hide dispatch byte. */
} else if ((*puc & 0xe0 )== 0x60) {
} else if ((*puc & 0xe0 ) == 0x60) {
/* IPv6 headers are compressed using IPHC. */
p = lowpan6_decompress(p, &src, &dest);
if (p == NULL) {

View File

@ -203,7 +203,7 @@ slipif_output_v6(struct netif *netif, struct pbuf *p, const ip6_addr_t *ipaddr)
* return a complete packet, NULL is returned before - used for polling)
* @return The IP packet when SLIP_END is received
*/
static struct pbuf*
static struct pbuf *
slipif_rxbyte(struct netif *netif, u8_t c)
{
struct slipif_priv *priv;