34 #include "net/ipv6/uipbuf.h" 39 static uint16_t uipbuf_attrs[UIPBUF_ATTR_MAX];
45 uipbuf_get_next_header(uint8_t *buffer, uint16_t size, uint8_t *protocol, uint8_t
start)
48 struct uip_ip_hdr *ipbuf = (
struct uip_ip_hdr *) buffer;
49 struct uip_ext_hdr *ext = NULL;
53 *protocol = ipbuf->proto;
54 return buffer + UIP_IPH_LEN;
57 ext = (
struct uip_ext_hdr *) buffer;
58 *protocol = ext->next;
60 ext_len = (ext->len << 3) + 8;
61 return buffer + ext_len;
68 uipbuf_get_last_header(uint8_t *buffer, uint16_t size, uint8_t *protocol)
72 nbuf = uipbuf_get_next_header(buffer, size, protocol, 1);
73 while(uip_is_proto_ext_hdr(*protocol)) {
75 nbuf = uipbuf_get_next_header(nbuf, size - (nbuf - buffer), protocol, 0);
86 uipbuf_get_attr(uint8_t type)
88 if(type < UIPBUF_ATTR_MAX) {
89 return uipbuf_attrs[type];
95 uipbuf_set_attr(uint8_t type, uint16_t value)
97 if(type < UIPBUF_ATTR_MAX) {
98 uipbuf_attrs[type] = value;
105 uipbuf_clear_attr(
void)
108 memset(uipbuf_attrs, 0,
sizeof(uipbuf_attrs));
111 uipbuf_set_attr(UIPBUF_ATTR_MAX_MAC_TRANSMISSIONS,
116 uipbuf_set_attr_flag(uint16_t flag)
119 uipbuf_attrs[UIPBUF_ATTR_FLAGS] |= flag;
123 uipbuf_clr_attr_flag(uint16_t flag)
125 uipbuf_attrs[UIPBUF_ATTR_FLAGS] &= ~flag;
129 uipbuf_is_attr_flag(uint16_t flag)
131 return (uipbuf_attrs[UIPBUF_ATTR_FLAGS] & flag) == flag;
static bool start(void)
Start measurement.
#define UIP_MAX_MAC_TRANSMISSIONS_UNDEFINED
This is the default value of MAC-layer transmissons for uIPv6.
Header file for the uIP TCP/IP stack.