Free (GPLv2) TCP/IP stack developed by TASS Belgium

Dependents:   lpc1768-picotcp-demo ZeroMQ_PicoTCP_Publisher_demo TCPSocket_HelloWorld_PicoTCP Pico_TCP_UDP_Test ... more

PicoTCP. Copyright (c) 2013 TASS Belgium NV.

Released under the GNU General Public License, version 2.

Different licensing models may exist, at the sole discretion of the Copyright holders.

Official homepage: http://www.picotcp.com

Bug tracker: https://github.com/tass-belgium/picotcp/issues

Development steps:

  • initial integration with mbed RTOS
  • generic mbed Ethernet driver
  • high performance NXP LPC1768 specific Ethernet driver
  • Multi-threading support for mbed RTOS
  • Berkeley sockets and integration with the New Socket API
  • Fork of the apps running on top of the New Socket API
  • Scheduling optimizations
  • Debugging/benchmarking/testing

Demo application (measuring TCP sender performance):

Import programlpc1768-picotcp-demo

A PicoTCP demo app testing the ethernet throughput on the lpc1768 mbed board.

Files at this revision

API Documentation at this revision

Comitter:
tass
Date:
Mon Sep 28 14:14:17 2015 +0200
Parent:
153:5e8a725dbd6e
Child:
155:a70f34550c34
Commit message:
To latest development.

Changed in this revision

include/pico_config.h Show annotated file Show diff for this revision Revisions of this file
include/pico_socket.h Show annotated file Show diff for this revision Revisions of this file
modules/pico_arp.c Show annotated file Show diff for this revision Revisions of this file
modules/pico_dhcp_client.c Show annotated file Show diff for this revision Revisions of this file
modules/pico_dhcp_common.h Show annotated file Show diff for this revision Revisions of this file
modules/pico_dhcp_server.c Show annotated file Show diff for this revision Revisions of this file
modules/pico_icmp6.h Show annotated file Show diff for this revision Revisions of this file
modules/pico_igmp.c Show annotated file Show diff for this revision Revisions of this file
modules/pico_ipfilter.c Show annotated file Show diff for this revision Revisions of this file
modules/pico_ipv6.h Show annotated file Show diff for this revision Revisions of this file
modules/pico_slaacv4.c Show annotated file Show diff for this revision Revisions of this file
modules/pico_tcp.c Show annotated file Show diff for this revision Revisions of this file
stack/pico_device.c Show annotated file Show diff for this revision Revisions of this file
stack/pico_frame.c Show annotated file Show diff for this revision Revisions of this file
stack/pico_protocol.c Show annotated file Show diff for this revision Revisions of this file
stack/pico_socket_multicast.c Show annotated file Show diff for this revision Revisions of this file
stack/pico_stack.c Show annotated file Show diff for this revision Revisions of this file
--- a/include/pico_config.h	Mon Sep 28 14:02:27 2015 +0200
+++ b/include/pico_config.h	Mon Sep 28 14:14:17 2015 +0200
@@ -19,6 +19,11 @@
 #   define PEDANTIC_STRUCT_DEF __packed struct
 #   define PACKED_UNION_DEF  __packed union
 #   define WEAK
+#elif defined __WATCOMC__
+#   define PACKED_STRUCT_DEF   _Packed struct
+#   define PEDANTIC_STRUCT_DEF struct
+#   define PACKED_UNION_DEF    _Packed union
+#   define WEAK
 #else
 #   define PACKED_STRUCT_DEF struct __attribute__((packed))
 #   define PEDANTIC_STRUCT_DEF struct
--- a/include/pico_socket.h	Mon Sep 28 14:02:27 2015 +0200
+++ b/include/pico_socket.h	Mon Sep 28 14:14:17 2015 +0200
@@ -90,25 +90,11 @@
 };
 
 
-/* request struct for multicast socket opt */
-// Deprecated!
 struct pico_ip_mreq {
-    struct pico_ip4 mcast_group_addr;
-    struct pico_ip4 mcast_link_addr;
-};
-
-struct pico_ip_mreq_source {
-    struct pico_ip4 mcast_group_addr;
-    struct pico_ip4 mcast_source_addr;
-    struct pico_ip4 mcast_link_addr;
-};
-// [end] Deprecated
-// Use this instead:
-struct pico_mreq {
     union pico_address mcast_group_addr;
     union pico_address mcast_link_addr;
 };
-struct pico_mreq_source {
+struct pico_ip_mreq_source {
     union pico_address mcast_group_addr;
     union pico_address mcast_source_addr;
     union pico_address mcast_link_addr;
--- a/modules/pico_arp.c	Mon Sep 28 14:02:27 2015 +0200
+++ b/modules/pico_arp.c	Mon Sep 28 14:14:17 2015 +0200
@@ -27,7 +27,7 @@
 #endif
 
 static int max_arp_reqs = PICO_ARP_MAX_RATE;
-static struct pico_frame *frames_queued[PICO_ARP_MAX_PENDING] = { };
+static struct pico_frame *frames_queued[PICO_ARP_MAX_PENDING] = { 0 };
 
 static void pico_arp_queued_trigger(void)
 {
--- a/modules/pico_dhcp_client.c	Mon Sep 28 14:02:27 2015 +0200
+++ b/modules/pico_dhcp_client.c	Mon Sep 28 14:14:17 2015 +0200
@@ -491,7 +491,7 @@
 static int recv_offer(struct pico_dhcp_client_cookie *dhcpc, uint8_t *buf)
 {
     struct pico_dhcp_hdr *hdr = (struct pico_dhcp_hdr *)buf;
-    struct pico_dhcp_opt *opt = (struct pico_dhcp_opt *)hdr->options;
+    struct pico_dhcp_opt *opt = DHCP_OPT(hdr,0);
 
     pico_dhcp_client_recv_params(dhcpc, opt);
     if ((dhcpc->event != PICO_DHCP_MSG_OFFER) || !dhcpc->server_id.addr || !dhcpc->netmask.addr || !dhcpc->lease_time)
@@ -510,7 +510,7 @@
 static int recv_ack(struct pico_dhcp_client_cookie *dhcpc, uint8_t *buf)
 {
     struct pico_dhcp_hdr *hdr = (struct pico_dhcp_hdr *)buf;
-    struct pico_dhcp_opt *opt = (struct pico_dhcp_opt *)hdr->options;
+    struct pico_dhcp_opt *opt = DHCP_OPT(hdr,0);
     struct pico_ip4 address = {
         0
     };
@@ -767,15 +767,14 @@
 {
     uint32_t optlen = len - (uint32_t)sizeof(struct pico_dhcp_hdr);
     struct pico_dhcp_hdr *hdr = (struct pico_dhcp_hdr *)ptr;
-    struct pico_dhcp_opt *opt = NULL;
+    struct pico_dhcp_opt *opt = DHCP_OPT(hdr,0);
 
     if (hdr->dhcp_magic != PICO_DHCPD_MAGIC_COOKIE)
         return -1;
 
-    if (!pico_dhcp_are_options_valid(hdr->options, (int32_t)optlen))
+    if (!pico_dhcp_are_options_valid(opt, (int32_t)optlen))
         return -1;
 
-    opt = (struct pico_dhcp_opt *)hdr->options;
     do {
         if (opt->code == PICO_DHCP_OPT_MSGTYPE)
             return opt->ext.msg_type.type;
@@ -811,7 +810,7 @@
         }
 
         /* specific options */
-        offset = (uint16_t)(offset + pico_dhcp_opt_maxmsgsize(&hdr->options[offset], DHCP_CLIENT_MAXMSGZISE));
+        offset = (uint16_t)(offset + pico_dhcp_opt_maxmsgsize(DHCP_OPT(hdr,offset), DHCP_CLIENT_MAXMSGZISE));
         break;
 
     case PICO_DHCP_MSG_REQUEST:
@@ -824,10 +823,10 @@
         }
 
         /* specific options */
-        offset = (uint16_t)(offset + pico_dhcp_opt_maxmsgsize(&hdr->options[offset], DHCP_CLIENT_MAXMSGZISE));
+        offset = (uint16_t)(offset + pico_dhcp_opt_maxmsgsize(DHCP_OPT(hdr,offset), DHCP_CLIENT_MAXMSGZISE));
         if (dhcpc->state == DHCP_CLIENT_STATE_REQUESTING) {
-            offset = (uint16_t)(offset + pico_dhcp_opt_reqip(&hdr->options[offset], &dhcpc->address));
-            offset = (uint16_t)(offset + pico_dhcp_opt_serverid(&hdr->options[offset], &dhcpc->server_id));
+            offset = (uint16_t)(offset + pico_dhcp_opt_reqip(DHCP_OPT(hdr,offset), &dhcpc->address));
+            offset = (uint16_t)(offset + pico_dhcp_opt_serverid(DHCP_OPT(hdr,offset), &dhcpc->server_id));
         }
 
         break;
@@ -837,9 +836,9 @@
     }
 
     /* common options */
-    offset = (uint16_t)(offset + pico_dhcp_opt_msgtype(&hdr->options[offset], msg_type));
-    offset = (uint16_t)(offset + pico_dhcp_opt_paramlist(&hdr->options[offset]));
-    offset = (uint16_t)(offset + pico_dhcp_opt_end(&hdr->options[offset]));
+    offset = (uint16_t)(offset + pico_dhcp_opt_msgtype(DHCP_OPT(hdr,offset), msg_type));
+    offset = (uint16_t)(offset + pico_dhcp_opt_paramlist(DHCP_OPT(hdr,offset)));
+    offset = (uint16_t)(offset + pico_dhcp_opt_end(DHCP_OPT(hdr,offset)));
 
     switch (dhcpc->state)
     {
--- a/modules/pico_dhcp_common.h	Mon Sep 28 14:02:27 2015 +0200
+++ b/modules/pico_dhcp_common.h	Mon Sep 28 14:14:17 2015 +0200
@@ -15,6 +15,9 @@
 #define PICO_DHCPD_MAGIC_COOKIE (long_be(0x63825363))
 #define PICO_DHCP_HTYPE_ETH 1
 
+/* Macro to get DHCP option field */
+#define DHCP_OPT(hdr,off)              ((struct pico_dhcp_opt *)(((uint8_t *)hdr)+sizeof(struct pico_dhcp_hdr) + off))
+
 /* flags */
 #define PICO_DHCP_FLAG_BROADCAST        0x8000
 
@@ -102,7 +105,6 @@
     char hostname[64];
     char bootp_filename[128];
     uint32_t dhcp_magic;
-    uint8_t options[0];
 };
 
 PACKED_STRUCT_DEF pico_dhcp_opt
--- a/modules/pico_dhcp_server.c	Mon Sep 28 14:02:27 2015 +0200
+++ b/modules/pico_dhcp_server.c	Mon Sep 28 14:14:17 2015 +0200
@@ -256,14 +256,14 @@
     memcpy(hdr->hwaddr, dhcpn->hwaddr.addr, PICO_SIZE_ETH);
 
     /* options */
-    offset += pico_dhcp_opt_msgtype(&hdr->options[offset], msg_type);
-    offset += pico_dhcp_opt_serverid(&hdr->options[offset], &dhcpn->dhcps->server_ip);
-    offset += pico_dhcp_opt_leasetime(&hdr->options[offset], dhcpn->dhcps->lease_time);
-    offset += pico_dhcp_opt_netmask(&hdr->options[offset], &dhcpn->dhcps->netmask);
-    offset += pico_dhcp_opt_router(&hdr->options[offset], &dhcpn->dhcps->server_ip);
-    offset += pico_dhcp_opt_broadcast(&hdr->options[offset], &broadcast);
-    offset += pico_dhcp_opt_dns(&hdr->options[offset], &dns);
-    offset += pico_dhcp_opt_end(&hdr->options[offset]);
+    offset += pico_dhcp_opt_msgtype(DHCP_OPT(hdr,offset), msg_type);
+    offset += pico_dhcp_opt_serverid(DHCP_OPT(hdr,offset), &dhcpn->dhcps->server_ip);
+    offset += pico_dhcp_opt_leasetime(DHCP_OPT(hdr,offset), dhcpn->dhcps->lease_time);
+    offset += pico_dhcp_opt_netmask(DHCP_OPT(hdr,offset), &dhcpn->dhcps->netmask);
+    offset += pico_dhcp_opt_router(DHCP_OPT(hdr,offset), &dhcpn->dhcps->server_ip);
+    offset += pico_dhcp_opt_broadcast(DHCP_OPT(hdr,offset), &broadcast);
+    offset += pico_dhcp_opt_dns(DHCP_OPT(hdr,offset), &dns);
+    offset += pico_dhcp_opt_end(DHCP_OPT(hdr,offset));
 
     if (dhcpn->bcast == 0)
         destination.addr = hdr->yiaddr;
@@ -324,7 +324,7 @@
 
 static inline void dhcps_parse_options_loop(struct pico_dhcp_server_negotiation *dhcpn, struct pico_dhcp_hdr *hdr)
 {
-    struct pico_dhcp_opt *opt = (struct pico_dhcp_opt *)hdr->options;
+    struct pico_dhcp_opt *opt = DHCP_OPT(hdr,0);
     uint8_t msgtype = 0;
     struct pico_ip4 reqip = {
         0
@@ -347,7 +347,7 @@
     struct pico_dhcp_server_negotiation *dhcpn = NULL;
     struct pico_device *dev = NULL;
 
-    if (!pico_dhcp_are_options_valid(hdr->options, optlen))
+    if (!pico_dhcp_are_options_valid(DHCP_OPT(hdr,0), optlen))
         return;
 
     dev = pico_ipv4_link_find(&s->local_addr.ip4);
@@ -395,9 +395,8 @@
 
 int pico_dhcp_server_destroy(struct pico_device *dev)
 {
-    struct pico_dhcp_server_setting *found, test = {
-        .dev = dev,
-    };
+    struct pico_dhcp_server_setting *found, test = { 0 };
+    test.dev = dev;
     found = pico_tree_findKey(&DHCPSettings, &test);
     if (!found) {
         pico_err = PICO_ERR_ENOENT;
--- a/modules/pico_icmp6.h	Mon Sep 28 14:02:27 2015 +0200
+++ b/modules/pico_icmp6.h	Mon Sep 28 14:14:17 2015 +0200
@@ -111,19 +111,15 @@
         PACKED_UNION_DEF icmp6_err_u {
             PEDANTIC_STRUCT_DEF dest_unreach_s {
                 uint32_t unused;
-                uint8_t data[0];
             } dest_unreach;
             PEDANTIC_STRUCT_DEF pkt_too_big_s {
                 uint32_t mtu;
-                uint8_t data[0];
             } pkt_too_big;
             PEDANTIC_STRUCT_DEF time_exceeded_s {
                 uint32_t unused;
-                uint8_t data[0];
             } time_exceeded;
             PEDANTIC_STRUCT_DEF param_problem_s {
                 uint32_t ptr;
-                uint8_t data[0];
             } param_problem;
         } err;
 
@@ -132,16 +128,13 @@
             PEDANTIC_STRUCT_DEF echo_request_s {
                 uint16_t id;
                 uint16_t seq;
-                uint8_t data[0];
             } echo_request;
             PEDANTIC_STRUCT_DEF echo_reply_s {
                 uint16_t id;
                 uint16_t seq;
-                uint8_t data[0];
             } echo_reply;
             PEDANTIC_STRUCT_DEF router_sol_s {
                 uint32_t unused;
-                uint8_t options[0];
             } router_sol;
             PEDANTIC_STRUCT_DEF router_adv_s {
                 uint8_t hop;
@@ -149,23 +142,19 @@
                 uint16_t life_time;
                 uint32_t reachable_time;
                 uint32_t retrans_time;
-                uint8_t options[0];
             } router_adv;
             PEDANTIC_STRUCT_DEF neigh_sol_s {
                 uint32_t unused;
                 struct pico_ip6 target;
-                uint8_t options[0];
             } neigh_sol;
             PEDANTIC_STRUCT_DEF neigh_adv_s {
                 uint32_t rsor;
                 struct pico_ip6 target;
-                uint8_t options[0];
             } neigh_adv;
             PEDANTIC_STRUCT_DEF redirect_s {
                 uint32_t reserved;
                 struct pico_ip6 target;
                 struct pico_ip6 dest;
-                uint8_t options[0];
             } redirect;
             PEDANTIC_STRUCT_DEF mld_s { 
                 uint16_t max_resp_time;
@@ -218,7 +207,6 @@
     uint8_t len;
     uint16_t res0;
     uint32_t res1;
-    uint8_t data[0];
 };
 
 PACKED_STRUCT_DEF pico_icmp6_opt_rdnss
@@ -227,14 +215,13 @@
     uint8_t len;
     uint16_t res0;
     uint32_t lifetime;
-    struct pico_ip6 addr[];
+    struct pico_ip6 *addr;
 };
 
 PACKED_STRUCT_DEF pico_icmp6_opt_na
 {
     uint8_t type;
     uint8_t len;
-    uint8_t options[0];
 };
 
 struct pico_icmp6_stats
--- a/modules/pico_igmp.c	Mon Sep 28 14:02:27 2015 +0200
+++ b/modules/pico_igmp.c	Mon Sep 28 14:14:17 2015 +0200
@@ -96,7 +96,6 @@
     uint8_t rsq;
     uint8_t qqic;
     uint16_t sources;
-    uint32_t source_addr[0];
 };
 
 PACKED_STRUCT_DEF igmpv3_group_record {
@@ -104,7 +103,6 @@
     uint8_t aux;
     uint16_t sources;
     uint32_t mcast_group;
-    uint32_t source_addr[0];
 };
 
 PACKED_STRUCT_DEF igmpv3_report {
@@ -113,7 +111,6 @@
     uint16_t crc;
     uint16_t res1;
     uint16_t groups;
-    struct igmpv3_group_record record[0];
 };
 
 struct igmp_parameters {
@@ -918,16 +915,17 @@
         report->res1 = 0;
         report->groups = short_be(1);
 
-        record = &report->record[0];
+        record = (struct igmpv3_group_record *)(((uint8_t *)report) + sizeof(struct igmpv3_report));
         record->type = record_type;
         record->aux = 0;
         record->sources = short_be(sources);
         record->mcast_group = p->mcast_group.addr;
         if (IGMPFilter && !pico_tree_empty(IGMPFilter)) {
+            uint32_t *source_addr = (uint32_t *)((uint8_t *)record + sizeof(struct igmpv3_group_record));
             i = 0;
             pico_tree_foreach(index, IGMPFilter)
             {
-                record->source_addr[i] = ((struct pico_ip4 *)index->keyValue)->addr;
+                source_addr[i] = ((struct pico_ip4 *)index->keyValue)->addr;
                 i++;
             }
         }
--- a/modules/pico_ipfilter.c	Mon Sep 28 14:02:27 2015 +0200
+++ b/modules/pico_ipfilter.c	Mon Sep 28 14:14:17 2015 +0200
@@ -401,9 +401,9 @@
 int pico_ipv4_filter_del(uint32_t filter_id)
 {
     struct filter_node *node = NULL;
-    struct filter_node dummy = {
-        .filter_id = filter_id
-    };
+    struct filter_node dummy = { 0 };
+
+    dummy.filter_id = filter_id;
     if((node = pico_tree_delete(&filter_tree, &dummy)) == NULL)
     {
         ipf_dbg("ipfilter> failed to delete filter :%d\n", filter_id);
--- a/modules/pico_ipv6.h	Mon Sep 28 14:02:27 2015 +0200
+++ b/modules/pico_ipv6.h	Mon Sep 28 14:14:17 2015 +0200
@@ -40,7 +40,6 @@
     uint8_t hop;
     struct pico_ip6 src;
     struct pico_ip6 dst;
-    uint8_t extensions[0];
 };
 
 PACKED_STRUCT_DEF pico_ipv6_pseudo_hdr
@@ -77,7 +76,6 @@
 struct pico_ipv6_hbhoption {
     uint8_t type;
     uint8_t len;
-    uint8_t options[0];
 };
 #ifdef PICO_SUPPORT_MCAST
 struct pico_ipv6_mcast_group {
@@ -90,7 +88,6 @@
 struct pico_ipv6_destoption {
     uint8_t type;
     uint8_t len;
-    uint8_t options[0];
 };
 
 struct pico_ipv6_route
@@ -108,12 +105,10 @@
     PACKED_UNION_DEF ipv6_ext_u {
         PEDANTIC_STRUCT_DEF hopbyhop_s {
             uint8_t len;
-            uint8_t options[0];
         } hopbyhop;
 
         PEDANTIC_STRUCT_DEF destopt_s {
             uint8_t len;
-            uint8_t options[0];
         } destopt;
 
         PEDANTIC_STRUCT_DEF routing_s {
--- a/modules/pico_slaacv4.c	Mon Sep 28 14:02:27 2015 +0200
+++ b/modules/pico_slaacv4.c	Mon Sep 28 14:14:17 2015 +0200
@@ -88,9 +88,9 @@
 static void pico_slaacv4_send_announce_timer(pico_time now, void *arg)
 {
     struct slaacv4_cookie *tmp = (struct slaacv4_cookie *)arg;
-    struct pico_ip4 netmask = {
-        .addr = long_be(0xFFFF0000)
-    };
+    struct pico_ip4 netmask = { 0 };
+    netmask.addr = long_be(0xFFFF0000);
+
     (void)now;
 
     if (tmp->announce_nb < ANNOUNCE_NB)
--- a/modules/pico_tcp.c	Mon Sep 28 14:02:27 2015 +0200
+++ b/modules/pico_tcp.c	Mon Sep 28 14:14:17 2015 +0200
@@ -132,9 +132,8 @@
     }
     else
     {
-        struct tcp_input_segment dummy = {
-            .seq = seq
-        };
+        struct tcp_input_segment dummy = { 0 };
+        dummy.seq = seq;
 
         return pico_tree_findKey(&tq->pool, &dummy);
     }
--- a/stack/pico_device.c	Mon Sep 28 14:02:27 2015 +0200
+++ b/stack/pico_device.c	Mon Sep 28 14:14:17 2015 +0200
@@ -234,7 +234,7 @@
 {
     struct pico_frame *f;
     while(loop_score > 0) {
-        if (dev->q_in->frames <= 0)
+        if (dev->q_in->frames == 0)
             break;
 
         /* Receive */
@@ -270,7 +270,7 @@
 {
     struct pico_frame *f;
     while(loop_score > 0) {
-        if (dev->q_out->frames <= 0)
+        if (dev->q_out->frames == 0)
             break;
 
         /* Device dequeue + send */
--- a/stack/pico_frame.c	Mon Sep 28 14:02:27 2015 +0200
+++ b/stack/pico_frame.c	Mon Sep 28 14:14:17 2015 +0200
@@ -24,7 +24,7 @@
         return;
 
     (*f->usage_count)--;
-    if (*f->usage_count <= 0) {
+    if (*f->usage_count == 0) {
         if (f->flags & PICO_FRAME_FLAG_EXT_USAGE_COUNTER)
             PICO_FREE(f->usage_count);
 
--- a/stack/pico_protocol.c	Mon Sep 28 14:02:27 2015 +0200
+++ b/stack/pico_protocol.c	Mon Sep 28 14:14:17 2015 +0200
@@ -53,7 +53,7 @@
 {
     struct pico_frame *f;
     while(loop_score > 0) {
-        if (proto->q_in->frames <= 0)
+        if (proto->q_in->frames == 0)
             break;
 
         f = pico_dequeue(proto->q_in);
@@ -68,7 +68,7 @@
 {
     struct pico_frame *f;
     while(loop_score > 0) {
-        if (proto->q_out->frames <= 0)
+        if (proto->q_out->frames == 0)
             break;
 
         f = pico_dequeue(proto->q_out);
--- a/stack/pico_socket_multicast.c	Mon Sep 28 14:02:27 2015 +0200
+++ b/stack/pico_socket_multicast.c	Mon Sep 28 14:14:17 2015 +0200
@@ -37,8 +37,8 @@
 struct pico_mcast 
 {
     struct pico_socket *s;
-    struct pico_mreq *mreq;
-    struct pico_mreq_source *mreq_s;
+    struct pico_ip_mreq *mreq;
+    struct pico_ip_mreq_source *mreq_s;
     union pico_address *address;
     union pico_link *mcast_link;
     struct pico_mcast_listen *listen;
@@ -555,7 +555,7 @@
 }
 #endif
 
-static int pico_socket_setoption_pre_validation(struct pico_mreq *mreq)
+static int pico_socket_setoption_pre_validation(struct pico_ip_mreq *mreq)
     {
     if (!mreq) 
         return -1;
@@ -566,7 +566,7 @@
     return 0;
 }
 #ifdef PICO_SUPPORT_IPV6
-static int pico_socket_setoption_pre_validation_ipv6(struct pico_mreq *mreq)
+static int pico_socket_setoption_pre_validation_ipv6(struct pico_ip_mreq *mreq)
 {
     if (!mreq)
         return -1;
@@ -578,7 +578,7 @@
 }
 #endif
 
-static struct pico_ipv4_link *pico_socket_setoption_validate_mreq(struct pico_mreq *mreq)
+static struct pico_ipv4_link *pico_socket_setoption_validate_mreq(struct pico_ip_mreq *mreq)
 {
     if (pico_socket_setoption_pre_validation(mreq) < 0)  
         return NULL;
@@ -590,7 +590,7 @@
 }
 
 #ifdef PICO_SUPPORT_IPV6
-static struct pico_ipv6_link *pico_socket_setoption_validate_mreq_ipv6(struct pico_mreq *mreq)
+static struct pico_ipv6_link *pico_socket_setoption_validate_mreq_ipv6(struct pico_ip_mreq *mreq)
 {
     if (pico_socket_setoption_pre_validation_ipv6(mreq) < 0)
         return NULL;
@@ -601,7 +601,7 @@
 }
 #endif
 
-static int pico_socket_setoption_pre_validation_s(struct pico_mreq_source *mreq)
+static int pico_socket_setoption_pre_validation_s(struct pico_ip_mreq_source *mreq)
 {
     if (!mreq)
         return -1;
@@ -612,7 +612,7 @@
     return 0;
 }
 #ifdef PICO_SUPPORT_IPV6
-static int pico_socket_setoption_pre_validation_s_ipv6(struct pico_mreq_source *mreq)
+static int pico_socket_setoption_pre_validation_s_ipv6(struct pico_ip_mreq_source *mreq)
 {
     if (!mreq)
         return -1;
@@ -624,7 +624,7 @@
 }
 #endif
 
-static struct pico_ipv4_link *pico_socket_setoption_validate_s_mreq(struct pico_mreq_source *mreq)
+static struct pico_ipv4_link *pico_socket_setoption_validate_s_mreq(struct pico_ip_mreq_source *mreq)
 {
     if (pico_socket_setoption_pre_validation_s(mreq) < 0)
         return NULL;
@@ -638,7 +638,7 @@
     return get_mcast_link((union pico_address *)&mreq->mcast_link_addr);
 }
 #ifdef PICO_SUPPORT_IPV6
-static struct pico_ipv6_link *pico_socket_setoption_validate_s_mreq_ipv6(struct pico_mreq_source *mreq)
+static struct pico_ipv6_link *pico_socket_setoption_validate_s_mreq_ipv6(struct pico_ip_mreq_source *mreq)
 {
     if (pico_socket_setoption_pre_validation_s_ipv6(mreq) < 0) {
         return NULL;
@@ -657,18 +657,18 @@
 static struct pico_ipv4_link *setop_multicast_link_search(void *value, int bysource)
 {
 
-    struct pico_mreq *mreq = NULL;
+    struct pico_ip_mreq *mreq = NULL;
     struct pico_ipv4_link *mcast_link = NULL;
-    struct pico_mreq_source *mreq_src = NULL;
+    struct pico_ip_mreq_source *mreq_src = NULL;
     if (!bysource) {
-        mreq = (struct pico_mreq *)value;
+        mreq = (struct pico_ip_mreq *)value;
         mcast_link = pico_socket_setoption_validate_mreq(mreq);
         if (!mcast_link) 
            return NULL;
         if (!mreq->mcast_link_addr.ip4.addr)
             mreq->mcast_link_addr.ip4.addr = mcast_link->address.addr;
     } else {
-        mreq_src = (struct pico_mreq_source *)value;
+        mreq_src = (struct pico_ip_mreq_source *)value;
         if (!mreq_src) {
              return NULL;
         }
@@ -687,11 +687,11 @@
 #ifdef PICO_SUPPORT_IPV6
 static struct pico_ipv6_link *setop_multicast_link_search_ipv6(void *value, int bysource)
 {
-    struct pico_mreq *mreq = NULL;
+    struct pico_ip_mreq *mreq = NULL;
     struct pico_ipv6_link *mcast_link = NULL;
-    struct pico_mreq_source *mreq_src = NULL;
+    struct pico_ip_mreq_source *mreq_src = NULL;
     if (!bysource) {
-        mreq = (struct pico_mreq *)value;
+        mreq = (struct pico_ip_mreq *)value;
         mcast_link = pico_socket_setoption_validate_mreq_ipv6(mreq);
         if (!mcast_link) {
            return NULL;
@@ -699,7 +699,7 @@
         if (pico_ipv6_is_null_address(&mreq->mcast_link_addr.ip6))
             mreq->mcast_link_addr.ip6 = mcast_link->address;
     } else {
-        mreq_src = (struct pico_mreq_source *)value;
+        mreq_src = (struct pico_ip_mreq_source *)value;
         if (!mreq_src) {
             return NULL;
         }
@@ -867,9 +867,9 @@
 }
 static int mcast_get_param(struct pico_mcast *mcast, struct pico_socket *s, void *value,int alloc, int by_source) {
     if(by_source)
-        mcast->mreq_s = (struct pico_mreq_source *)value;
+        mcast->mreq_s = (struct pico_ip_mreq_source *)value;
     else    
-        mcast->mreq = (struct pico_mreq *)value;
+        mcast->mreq = (struct pico_ip_mreq *)value;
     mcast->mcast_link = setopt_multicast_check(s, value, alloc, by_source);
     if (!mcast->mcast_link)
         return -1;
@@ -1288,18 +1288,25 @@
 #else
 int pico_udp_set_mc_ttl(struct pico_socket *s, void  *_ttl)
 {
+    IGNORE_PARAMETER(s);
+    IGNORE_PARAMETER(_ttl);
     pico_err = PICO_ERR_EPROTONOSUPPORT;
     return -1;
 }
 
 int pico_udp_get_mc_ttl(struct pico_socket *s, uint8_t *ttl)
 {
+    IGNORE_PARAMETER(s);
+    IGNORE_PARAMETER(ttl);
     pico_err = PICO_ERR_EPROTONOSUPPORT;
     return -1;
 }
 
 int pico_socket_mcast_filter(struct pico_socket *s, union pico_address *mcast_group, union pico_address *src)
 {
+    IGNORE_PARAMETER(s);
+    IGNORE_PARAMETER(mcast_group);
+    IGNORE_PARAMETER(src);
     pico_err = PICO_ERR_EPROTONOSUPPORT;
     return -1;
 }
--- a/stack/pico_stack.c	Mon Sep 28 14:02:27 2015 +0200
+++ b/stack/pico_stack.c	Mon Sep 28 14:14:17 2015 +0200
@@ -726,7 +726,7 @@
 {
     struct pico_frame *f;
     int32_t ret;
-    if (len <= 0)
+    if (len == 0)
         return -1;
 
     f = pico_frame_alloc(len);
@@ -762,7 +762,7 @@
 {
     struct pico_frame *f;
     int ret;
-    if (len <= 0)
+    if (len == 0)
         return -1;
 
     f = pico_frame_alloc_skeleton(len, ext_buffer);