You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by ad...@apache.org on 2017/04/19 18:18:18 UTC
[22/30] incubator-mynewt-core git commit: net/ip/lwip_base;
update to LwIP to tag STABLE-2_0_2_RELEASE
net/ip/lwip_base; update to LwIP to tag STABLE-2_0_2_RELEASE
Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/commit/f52033e9
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/f52033e9
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/f52033e9
Branch: refs/heads/master
Commit: f52033e9a02b2e8e6a378023977543facb29378d
Parents: 0429ee5
Author: Marko Kiiskila <ma...@runtime.io>
Authored: Fri Apr 14 17:35:31 2017 -0700
Committer: Marko Kiiskila <ma...@runtime.io>
Committed: Fri Apr 14 17:35:31 2017 -0700
----------------------------------------------------------------------
net/ip/lwip_base/CHANGELOG | 146 ++
net/ip/lwip_base/UPGRADING | 16 +-
net/ip/lwip_base/doc/NO_SYS_SampleCode.c | 16 +-
net/ip/lwip_base/doc/doxygen/generate.sh | 2 +
net/ip/lwip_base/doc/doxygen/lwip.Doxyfile | 7 +-
net/ip/lwip_base/doc/doxygen/main_page.h | 75 +-
net/ip/lwip_base/doc/mqtt_client.txt | 162 +++
net/ip/lwip_base/doc/ppp.txt | 6 +-
net/ip/lwip_base/doc/rawapi.txt | 8 +-
net/ip/lwip_base/doc/sys_arch.txt | 2 +-
net/ip/lwip_base/include/lwip/api.h | 31 +-
net/ip/lwip_base/include/lwip/apps/httpd_opts.h | 30 -
net/ip/lwip_base/include/lwip/apps/mdns.h | 10 +-
net/ip/lwip_base/include/lwip/apps/mdns_opts.h | 10 +-
net/ip/lwip_base/include/lwip/apps/mdns_priv.h | 10 +-
net/ip/lwip_base/include/lwip/apps/mqtt.h | 244 ++++
net/ip/lwip_base/include/lwip/apps/mqtt_opts.h | 103 ++
net/ip/lwip_base/include/lwip/apps/netbiosns.h | 8 -
.../include/lwip/apps/netbiosns_opts.h | 18 -
net/ip/lwip_base/include/lwip/apps/snmp_opts.h | 8 -
net/ip/lwip_base/include/lwip/apps/snmpv3.h | 8 -
net/ip/lwip_base/include/lwip/apps/sntp_opts.h | 8 -
net/ip/lwip_base/include/lwip/apps/tftp_opts.h | 105 ++
.../lwip_base/include/lwip/apps/tftp_server.h | 94 ++
net/ip/lwip_base/include/lwip/arch.h | 299 ++--
net/ip/lwip_base/include/lwip/autoip.h | 2 +
net/ip/lwip_base/include/lwip/debug.h | 81 +-
net/ip/lwip_base/include/lwip/def.h | 95 +-
net/ip/lwip_base/include/lwip/dhcp.h | 2 +
net/ip/lwip_base/include/lwip/dhcp6.h | 8 -
net/ip/lwip_base/include/lwip/dns.h | 18 +-
net/ip/lwip_base/include/lwip/err.h | 4 +
net/ip/lwip_base/include/lwip/errno.h | 193 +++
net/ip/lwip_base/include/lwip/icmp.h | 2 +-
net/ip/lwip_base/include/lwip/icmp6.h | 89 +-
net/ip/lwip_base/include/lwip/igmp.h | 6 +-
net/ip/lwip_base/include/lwip/inet.h | 8 +-
net/ip/lwip_base/include/lwip/inet_chksum.h | 8 +-
net/ip/lwip_base/include/lwip/init.h | 4 +-
net/ip/lwip_base/include/lwip/ip4_addr.h | 36 +-
net/ip/lwip_base/include/lwip/ip6_addr.h | 66 +-
net/ip/lwip_base/include/lwip/ip_addr.h | 73 +-
net/ip/lwip_base/include/lwip/mem.h | 3 +-
net/ip/lwip_base/include/lwip/mld6.h | 7 +-
net/ip/lwip_base/include/lwip/nd6.h | 93 +-
net/ip/lwip_base/include/lwip/netdb.h | 3 +-
net/ip/lwip_base/include/lwip/netif.h | 10 +-
net/ip/lwip_base/include/lwip/netifapi.h | 12 +-
net/ip/lwip_base/include/lwip/opt.h | 116 +-
net/ip/lwip_base/include/lwip/pbuf.h | 20 +-
net/ip/lwip_base/include/lwip/priv/api_msg.h | 3 +-
net/ip/lwip_base/include/lwip/priv/memp_std.h | 8 -
net/ip/lwip_base/include/lwip/priv/nd6_priv.h | 144 ++
net/ip/lwip_base/include/lwip/priv/tcp_priv.h | 27 +-
net/ip/lwip_base/include/lwip/priv/tcpip_priv.h | 4 +-
net/ip/lwip_base/include/lwip/prot/dns.h | 18 +
net/ip/lwip_base/include/lwip/prot/ethernet.h | 2 +-
net/ip/lwip_base/include/lwip/prot/icmp6.h | 87 ++
net/ip/lwip_base/include/lwip/prot/ip.h | 8 -
net/ip/lwip_base/include/lwip/prot/ip4.h | 16 +
net/ip/lwip_base/include/lwip/prot/ip6.h | 27 +-
net/ip/lwip_base/include/lwip/prot/mld6.h | 2 +-
net/ip/lwip_base/include/lwip/prot/nd6.h | 24 +
net/ip/lwip_base/include/lwip/prot/tcp.h | 14 +-
net/ip/lwip_base/include/lwip/raw.h | 2 +
net/ip/lwip_base/include/lwip/sockets.h | 5 +-
net/ip/lwip_base/include/lwip/stats.h | 4 +-
net/ip/lwip_base/include/lwip/sys.h | 44 +-
net/ip/lwip_base/include/lwip/tcp.h | 12 +-
net/ip/lwip_base/include/lwip/tcpip.h | 2 +
net/ip/lwip_base/include/lwip/timeouts.h | 2 +-
net/ip/lwip_base/include/netif/lowpan6_opts.h | 8 -
net/ip/lwip_base/include/netif/ppp/ccp.h | 8 -
net/ip/lwip_base/include/netif/ppp/chap-new.h | 8 -
net/ip/lwip_base/include/netif/ppp/chap_ms.h | 8 -
net/ip/lwip_base/include/netif/ppp/eui64.h | 10 +-
net/ip/lwip_base/include/netif/ppp/fsm.h | 8 -
net/ip/lwip_base/include/netif/ppp/ipcp.h | 8 -
net/ip/lwip_base/include/netif/ppp/ipv6cp.h | 8 -
net/ip/lwip_base/include/netif/ppp/lcp.h | 8 -
net/ip/lwip_base/include/netif/ppp/magic.h | 8 -
net/ip/lwip_base/include/netif/ppp/mppe.h | 10 +-
net/ip/lwip_base/include/netif/ppp/ppp.h | 12 +-
net/ip/lwip_base/include/netif/ppp/ppp_impl.h | 12 +-
net/ip/lwip_base/include/netif/ppp/ppp_opts.h | 8 -
net/ip/lwip_base/include/netif/ppp/pppcrypt.h | 8 -
net/ip/lwip_base/include/netif/ppp/pppdebug.h | 8 -
net/ip/lwip_base/include/netif/ppp/pppoe.h | 8 -
net/ip/lwip_base/include/netif/ppp/pppol2tp.h | 8 -
net/ip/lwip_base/include/netif/ppp/pppos.h | 8 -
net/ip/lwip_base/include/netif/ppp/upap.h | 8 -
net/ip/lwip_base/include/netif/ppp/vj.h | 8 -
net/ip/lwip_base/include/posix/errno.h | 33 +
net/ip/lwip_base/src/Filelists.mk | 10 +-
net/ip/lwip_base/src/api/api_lib.c | 69 +-
net/ip/lwip_base/src/api/api_msg.c | 127 +-
net/ip/lwip_base/src/api/err.c | 40 +
net/ip/lwip_base/src/api/netdb.c | 10 +-
net/ip/lwip_base/src/api/netifapi.c | 14 +-
net/ip/lwip_base/src/api/sockets.c | 204 +--
net/ip/lwip_base/src/api/tcpip.c | 3 +-
net/ip/lwip_base/src/apps/httpd/fsdata.h | 8 -
net/ip/lwip_base/src/apps/httpd/httpd.c | 180 +--
net/ip/lwip_base/src/apps/httpd/httpd_structs.h | 8 -
net/ip/lwip_base/src/apps/lwiperf/lwiperf.c | 16 +-
net/ip/lwip_base/src/apps/mdns/mdns.c | 161 +--
net/ip/lwip_base/src/apps/mqtt/mqtt.c | 1341 ++++++++++++++++++
net/ip/lwip_base/src/apps/netbiosns/netbiosns.c | 5 +-
net/ip/lwip_base/src/apps/snmp/snmp_asn1.c | 8 +-
net/ip/lwip_base/src/apps/snmp/snmp_core.c | 84 +-
net/ip/lwip_base/src/apps/snmp/snmp_mib2_ip.c | 12 +-
net/ip/lwip_base/src/apps/snmp/snmp_mib2_tcp.c | 6 +-
net/ip/lwip_base/src/apps/snmp/snmp_msg.c | 11 +-
net/ip/lwip_base/src/apps/snmp/snmp_netconn.c | 5 +-
net/ip/lwip_base/src/apps/snmp/snmp_raw.c | 2 +-
.../lwip_base/src/apps/snmp/snmp_threadsync.c | 1 +
net/ip/lwip_base/src/apps/snmp/snmp_traps.c | 9 +-
net/ip/lwip_base/src/apps/snmp/snmpv3_priv.h | 8 -
net/ip/lwip_base/src/apps/sntp/sntp.c | 9 +-
net/ip/lwip_base/src/apps/tftp/tftp_server.c | 417 ++++++
net/ip/lwip_base/src/core/def.c | 177 ++-
net/ip/lwip_base/src/core/dns.c | 239 +++-
net/ip/lwip_base/src/core/inet_chksum.c | 15 +-
net/ip/lwip_base/src/core/init.c | 12 +-
net/ip/lwip_base/src/core/ipv4/autoip.c | 16 +-
net/ip/lwip_base/src/core/ipv4/dhcp.c | 114 +-
net/ip/lwip_base/src/core/ipv4/etharp.c | 69 +-
net/ip/lwip_base/src/core/ipv4/icmp.c | 14 +-
net/ip/lwip_base/src/core/ipv4/igmp.c | 75 +-
net/ip/lwip_base/src/core/ipv4/ip4.c | 57 +-
net/ip/lwip_base/src/core/ipv4/ip4_addr.c | 10 +-
net/ip/lwip_base/src/core/ipv4/ip4_frag.c | 88 +-
net/ip/lwip_base/src/core/ipv6/ethip6.c | 42 +-
net/ip/lwip_base/src/core/ipv6/ip6.c | 62 +-
net/ip/lwip_base/src/core/ipv6/ip6_addr.c | 10 +-
net/ip/lwip_base/src/core/ipv6/ip6_frag.c | 49 +-
net/ip/lwip_base/src/core/ipv6/mld6.c | 7 +-
net/ip/lwip_base/src/core/ipv6/nd6.c | 355 +++--
net/ip/lwip_base/src/core/mem.c | 8 +-
net/ip/lwip_base/src/core/memp.c | 25 +-
net/ip/lwip_base/src/core/netif.c | 127 +-
net/ip/lwip_base/src/core/pbuf.c | 91 +-
net/ip/lwip_base/src/core/raw.c | 51 +-
net/ip/lwip_base/src/core/stats.c | 6 +-
net/ip/lwip_base/src/core/sys.c | 38 +
net/ip/lwip_base/src/core/tcp.c | 149 +-
net/ip/lwip_base/src/core/tcp_in.c | 88 +-
net/ip/lwip_base/src/core/tcp_out.c | 195 ++-
net/ip/lwip_base/src/core/timeouts.c | 4 +-
net/ip/lwip_base/src/core/udp.c | 72 +-
net/ip/lwip_base/src/netif/ethernet.c | 20 +-
net/ip/lwip_base/src/netif/lowpan6.c | 103 +-
net/ip/lwip_base/src/netif/ppp/auth.c | 10 +-
net/ip/lwip_base/src/netif/ppp/ipcp.c | 120 +-
net/ip/lwip_base/src/netif/ppp/ipv6cp.c | 4 +-
net/ip/lwip_base/src/netif/ppp/multilink.c | 4 +-
net/ip/lwip_base/src/netif/ppp/ppp.c | 19 +-
net/ip/lwip_base/src/netif/ppp/pppapi.c | 5 +
net/ip/lwip_base/src/netif/ppp/pppoe.c | 19 +-
net/ip/lwip_base/src/netif/ppp/pppol2tp.c | 9 +-
net/ip/lwip_base/src/netif/ppp/pppos.c | 40 +-
net/ip/lwip_base/src/netif/ppp/utils.c | 4 +-
net/ip/lwip_base/src/netif/ppp/vj.c | 62 +-
net/ip/lwip_base/src/netif/slipif.c | 2 +-
net/ip/lwip_base/test/fuzz/Makefile | 53 +
net/ip/lwip_base/test/fuzz/README | 34 +
net/ip/lwip_base/test/fuzz/config.h | 0
net/ip/lwip_base/test/fuzz/fuzz.c | 136 ++
.../lwip_base/test/fuzz/inputs/arp/arp_req.bin | Bin 0 -> 42 bytes
.../test/fuzz/inputs/icmp/icmp_ping.bin | Bin 0 -> 98 bytes
.../fuzz/inputs/ipv6/neighbor_solicitation.bin | Bin 0 -> 86 bytes
.../test/fuzz/inputs/ipv6/router_adv.bin | Bin 0 -> 118 bytes
.../lwip_base/test/fuzz/inputs/tcp/tcp_syn.bin | Bin 0 -> 74 bytes
.../test/fuzz/inputs/udp/udp_port_5000.bin | Bin 0 -> 50 bytes
net/ip/lwip_base/test/fuzz/lwipopts.h | 68 +
net/ip/lwip_base/test/fuzz/output_to_pcap.sh | 31 +
net/ip/lwip_base/test/unit/core/test_mem.h | 8 -
net/ip/lwip_base/test/unit/core/test_pbuf.h | 8 -
net/ip/lwip_base/test/unit/dhcp/test_dhcp.c | 113 +-
net/ip/lwip_base/test/unit/dhcp/test_dhcp.h | 8 -
net/ip/lwip_base/test/unit/etharp/test_etharp.h | 8 -
net/ip/lwip_base/test/unit/lwip_check.h | 8 -
net/ip/lwip_base/test/unit/lwipopts.h | 8 -
net/ip/lwip_base/test/unit/mdns/test_mdns.c | 71 +-
net/ip/lwip_base/test/unit/mdns/test_mdns.h | 8 -
net/ip/lwip_base/test/unit/tcp/tcp_helper.c | 23 +-
net/ip/lwip_base/test/unit/tcp/tcp_helper.h | 8 -
net/ip/lwip_base/test/unit/tcp/test_tcp.c | 18 +-
net/ip/lwip_base/test/unit/tcp/test_tcp.h | 8 -
net/ip/lwip_base/test/unit/tcp/test_tcp_oos.h | 8 -
net/ip/lwip_base/test/unit/udp/test_udp.h | 8 -
191 files changed, 6551 insertions(+), 2591 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/f52033e9/net/ip/lwip_base/CHANGELOG
----------------------------------------------------------------------
diff --git a/net/ip/lwip_base/CHANGELOG b/net/ip/lwip_base/CHANGELOG
index 8f030fd..3a27719 100644
--- a/net/ip/lwip_base/CHANGELOG
+++ b/net/ip/lwip_base/CHANGELOG
@@ -4,6 +4,152 @@ HISTORY
* [Enter new changes just after this line - do not remove this line]
+(STABLE-2.0.2)
+
+ ++ New features:
+
+ 2017-02-10: Dirk Ziegelmeier
+ * Implement task #14367: Hooks need a better place to be defined:
+ We now have a #define for a header file name that is #included in every .c
+ file that provides hooks.
+
+ ++ Bugfixes:
+
+ 2017-03-08
+ * tcp: do not keep sending SYNs when getting ACKs
+
+ 2017-03-08: Joel Cunningham
+ * tcp: Initialize ssthresh to TCP_SND_BUF (bug #50476)
+
+ 2017-03-01: Simon Goldschmidt
+ * httpd: LWIP_HTTPD_POST_MANUAL_WND: fixed double-free when httpd_post_data_recved
+ is called nested from httpd_post_receive_data() (bug #50424)
+
+ 2017-02-28: David van Moolenbroek/Simon Goldschmidt
+ * tcp: fixed bug #50418: LWIP_EVENT_API: fix invalid calbacks for SYN_RCVD pcb
+
+ 2017-02-17: Simon Goldschmidt
+ * dns: Improved DNS_LOCAL_HOSTLIST interface (bug #50325)
+
+ 2017-02-16: Simon Goldschmidt
+ * LWIP_NETCONN_FULLDUPLEX: fixed shutdown during write (bug #50274)
+
+ 2017-02-13: Simon Goldschmidt/Dirk Ziegelmeier
+ * For tiny targtes, LWIP_RAND is optional (fix compile time checks)
+
+ 2017-02-10: Simon Goldschmidt
+ * tcp: Fixed bug #47485 (tcp_close() should not fail on memory error) by retrying
+ to send FIN from tcp_fasttmr
+
+ 2017-02-09: Simon Goldschmidt
+ * sockets: Fixed bug #44032 (LWIP_NETCONN_FULLDUPLEX: select might work on
+ invalid/reused socket) by not allowing to reallocate a socket that has
+ "select_waiting != 0"
+
+ 2017-02-09: Simon Goldschmidt
+ * httpd: Fixed bug #50059 (httpd LWIP_HTTPD_SUPPORT_11_KEEPALIVE vs.
+ LWIP_HTTPD_KILL_OLD_ON_CONNECTIONS_EXCEEDED)
+
+ 2017-02-08: Dirk Ziegelmeier
+ * Rename "IPv6 mapped IPv4 addresses" to their correct name from RFC4191:
+ "IPv4-mapped IPv6 address"
+
+ 2017-02-08: Luc Revardel
+ * mld6.c: Fix bug #50220 (mld6_leavegroup does not send ICMP6_TYPE_MLD, even
+ if last reporter)
+
+ 2017-02-08: David van Moolenbroek
+ * ip6.c: Patch #9250: fix source substitution in ip6_output_if()
+
+ 2017-02-08: Simon Goldschmidt
+ * tcp_out.c: Fixed bug #50090 (last_unsent->oversize_left can become wrong value
+ in tcp_write error path)
+
+ 2017-02-02: Dirk Ziegelmeier
+ * Fix bug #50206: UDP Netconn bind to IP6_ADDR_ANY fails
+
+ 2017-01-18: Dirk Ziegelmeier
+ * Fix zero-copy RX, see bug bug #50064. PBUF_REFs were not supported as ARP requests.
+
+ 2017-01-15: Axel Lin, Dirk Ziegelmeier
+ * minor bug fixes in mqtt
+
+ 2017-01-11: Knut Andre Tidemann
+ * sockets/netconn: fix broken default ICMPv6 handling of checksums
+
+(STABLE-2.0.1)
+
+ ++ New features:
+
+ 2016-12-31: Simon Goldschmidt
+ * tcp.h/.c: added function tcp_listen_with_backlog_and_err() to get the error
+ reason when listening fails (bug #49861)
+
+ 2016-12-20: Erik Andersen
+ * Add MQTT client
+
+ 2016-12-14: Jan Breuer:
+ * opt.h, ndc.h/.c: add support for RDNSS option (as per RFC 6106)
+
+ 2016-12-14: David van Moolenbroek
+ * opt.h, nd6.c: Added LWIP_HOOK_ND6_GET_GW()
+
+ 2016-12-09: Dirk Ziegelmeier
+ * ip6_frag.c: Implemented support for LWIP_NETIF_TX_SINGLE_PBUF
+
+ 2016-12-09: Simon Goldschmidt
+ * dns.c: added one-shot multicast DNS queries
+
+ 2016-11-24: Ambroz Bizjak, David van Moolenbroek
+ * tcp_out.c: Optimize passing contiguous nocopy buffers to tcp_write (bug #46290)
+
+ 2016-11-16: Dirk Ziegelmeier
+ * sockets.c: added support for IPv6 mapped IPv4 addresses
+
+ ++ Bugfixes:
+
+ 2016-12-16: Thomas Mueller
+ * api_lib.c: fixed race condition in return value of netconn_gethostbyname()
+ (and thus also lwip_gethostbyname/_r() and lwip_getaddrinfo())
+
+ 2016-12-15: David van Moolenbroek
+ * opt.h, tcp: added LWIP_HOOK_TCP_ISN() to implement less predictable initial
+ sequence numbers (see contrib/addons/tcp_isn for an example implementation)
+
+ 2016-12-05: Dirk Ziegelmeier
+ * fixed compiling with IPv4 disabled (IPv6 only case)
+
+ 2016-11-28: Simon Goldschmidt
+ * api_lib.c: fixed bug #49725 (send-timeout: netconn_write() can return
+ ERR_OK without all bytes being written)
+
+ 2016-11-28: Ambroz Bizjak
+ * tcpi_in.c: fixed bug #49717 (window size in received SYN and SYN-ACK
+ assumed scaled)
+
+ 2016-11-25: Simon Goldschmidt
+ * dhcp.c: fixed bug #49676 (Possible endless loop when parsing dhcp options)
+
+ 2016-11-23: Dirk Ziegelmeier
+ * udp.c: fixed bug #49662: multicast traffic is now only received on a UDP PCB
+ (and therefore on a UDP socket/netconn) when the PCB is bound to IP_ADDR_ANY
+
+ 2016-11-16: Dirk Ziegelmeier
+ * *: Fixed dual-stack behaviour, IPv6 mapped IPv4 support in socket API
+
+ 2016-11-14: Joel Cunningham
+ * tcp_out.c: fixed bug #49533 (start persist timer when unsent seg can't fit
+ in window)
+
+ 2016-11-16: Roberto Barbieri Carrera
+ * autoip.c: fixed bug #49610 (sometimes AutoIP fails to reuse the same address)
+
+ 2016-11-11: Dirk Ziegelmeier
+ * sockets.c: fixed bug #49578 (dropping multicast membership does not work
+ with LWIP_SOCKET_OFFSET)
+
+(STABLE-2.0.0)
+
++ New features:
2016-07-27: Simon Goldschmidt
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/f52033e9/net/ip/lwip_base/UPGRADING
----------------------------------------------------------------------
diff --git a/net/ip/lwip_base/UPGRADING b/net/ip/lwip_base/UPGRADING
index 2190ec9..f48f591 100644
--- a/net/ip/lwip_base/UPGRADING
+++ b/net/ip/lwip_base/UPGRADING
@@ -8,7 +8,14 @@ with newer versions.
* [Enter new changes just after this line - do not remove this line]
- * TODO
+(2.0.1)
+
+ ++ Application changes:
+
+ * UDP does NOT receive multicast traffic from ALL netifs on an UDP PCB bound to a specific
+ netif any more. Users need to bind to IP_ADDR_ANY to receive multicast traffic and compare
+ ip_current_netif() to the desired netif for every packet.
+ See bug #49662 for an explanation.
(2.0.0)
@@ -46,6 +53,13 @@ with newer versions.
* Added LWIP_NETCONN_SEM_PER_THREAD to use one "op_completed" semaphore per thread
instead of using one per netconn (these semaphores are used even with core locking
enabled as some longer lasting functions like big writes still need to delay)
+ * Added generalized abstraction for itoa(), strnicmp(), stricmp() and strnstr()
+ in def.h (to be overridden in cc.h) instead of config
+ options for netbiosns, httpd, dns, etc. ...
+ * New abstraction for hton* and ntoh* functions in def.h.
+ To override them, use the following in cc.h:
+ #define lwip_htons(x) <your_htons>
+ #define lwip_htonl(x) <your_htonl>
+++ new options:
* TODO
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/f52033e9/net/ip/lwip_base/doc/NO_SYS_SampleCode.c
----------------------------------------------------------------------
diff --git a/net/ip/lwip_base/doc/NO_SYS_SampleCode.c b/net/ip/lwip_base/doc/NO_SYS_SampleCode.c
index f20106f..f5c6c10 100644
--- a/net/ip/lwip_base/doc/NO_SYS_SampleCode.c
+++ b/net/ip/lwip_base/doc/NO_SYS_SampleCode.c
@@ -46,12 +46,10 @@ static void netif_status_callback(struct netif *netif)
static err_t netif_init(struct netif *netif)
{
netif->linkoutput = netif_output;
- netif->output = etharp_output;
- netif->name[0] = 'e';
- netif->name[1] = '0';
- netif->mtu = ETHERNET_MTU;
-
- netif->flags = NETIF_FLAG_BROADCAST | NETIF_FLAG_ETHARP | NETIF_FLAG_ETHERNET | NETIF_FLAG_IGMP;
+ netif->output = etharp_output;
+ netif->output_ip6 = ethip6_output;
+ netif->mtu = ETHERNET_MTU;
+ netif->flags = NETIF_FLAG_BROADCAST | NETIF_FLAG_ETHARP | NETIF_FLAG_ETHERNET | NETIF_FLAG_IGMP | NETIF_FLAG_MLD6;
MIB2_INIT_NETIF(netif, snmp_ifType_ethernet_csmacd, 100000000);
SMEMCPY(netif->hwaddr, your_mac_address_goes_here, sizeof(netif->hwaddr));
@@ -66,7 +64,11 @@ void main(void)
lwip_init();
- netif_add(&netif, IPADDR_ANY, IPADDR_ANY, IPADDR_ANY, NULL, netif_init, netif_input);
+ netif_add(&netif, IP4_ADDR_ANY, IP4_ADDR_ANY, IP4_ADDR_ANY, NULL, netif_init, netif_input);
+ netif.name[0] = 'e';
+ netif.name[1] = '0';
+ netif_create_ip6_linklocal_address(&netif, 1);
+ netif.ip6_autoconfig_enabled = 1;
netif_set_status_callback(&netif, netif_status_callback);
netif_set_default(&netif);
netif_set_up(&netif);
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/f52033e9/net/ip/lwip_base/doc/doxygen/generate.sh
----------------------------------------------------------------------
diff --git a/net/ip/lwip_base/doc/doxygen/generate.sh b/net/ip/lwip_base/doc/doxygen/generate.sh
index 99afb12..89344b0 100755
--- a/net/ip/lwip_base/doc/doxygen/generate.sh
+++ b/net/ip/lwip_base/doc/doxygen/generate.sh
@@ -1 +1,3 @@
+#!/bin/sh
+
doxygen lwip.Doxyfile
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/f52033e9/net/ip/lwip_base/doc/doxygen/lwip.Doxyfile
----------------------------------------------------------------------
diff --git a/net/ip/lwip_base/doc/doxygen/lwip.Doxyfile b/net/ip/lwip_base/doc/doxygen/lwip.Doxyfile
index c86326b..0e3349a 100644
--- a/net/ip/lwip_base/doc/doxygen/lwip.Doxyfile
+++ b/net/ip/lwip_base/doc/doxygen/lwip.Doxyfile
@@ -32,19 +32,19 @@ DOXYFILE_ENCODING = UTF-8
# title of most generated pages and in a few other places.
# The default value is: My Project.
-PROJECT_NAME = "lwIP 2.0.0"
+PROJECT_NAME = "lwIP"
# The PROJECT_NUMBER tag can be used to enter a project or revision number. This
# could be handy for archiving the generated documentation or if some version
# control system is used.
-PROJECT_NUMBER = "lwIP 2.0.0"
+PROJECT_NUMBER = "2.0.2"
# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a
# quick idea about the purpose of the project. Keep the description short.
-PROJECT_BRIEF = Lightweight IP stack
+PROJECT_BRIEF = "Lightweight IP stack"
# With the PROJECT_LOGO tag one can specify a logo or an icon that is included
# in the documentation. The maximum height of the logo should not exceed 55
@@ -2071,6 +2071,7 @@ INCLUDE_FILE_PATTERNS = *.h
PREDEFINED = __DOXYGEN__=1 \
NO_SYS=0 \
SYS_LIGHTWEIGHT_PROT=1 \
+ LWIP_TCPIP_CORE_LOCKING=1 \
LWIP_IPV4=1 \
LWIP_IPV6=1 \
LWIP_ICMP=1 \
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/f52033e9/net/ip/lwip_base/doc/doxygen/main_page.h
----------------------------------------------------------------------
diff --git a/net/ip/lwip_base/doc/doxygen/main_page.h b/net/ip/lwip_base/doc/doxygen/main_page.h
index 6486a17..d35d16e 100644
--- a/net/ip/lwip_base/doc/doxygen/main_page.h
+++ b/net/ip/lwip_base/doc/doxygen/main_page.h
@@ -1,4 +1,4 @@
-/**
+\ufeff/**
* @defgroup lwip lwIP
*
* @defgroup infrastructure Infrastructure
@@ -7,8 +7,8 @@
* Non thread-safe APIs, callback style for maximum performance and minimum
* memory footprint.
*
- * @defgroup threadsafe_api Thread-safe APIs
- * Thread-safe APIs, blocking functions. More overhead, but can be called
+ * @defgroup sequential_api Sequential-style APIs
+ * Sequential-style APIs, blocking functions. More overhead, but can be called
* from any thread except TCPIP thread.
*
* @defgroup addons Addons
@@ -27,11 +27,73 @@
*/
/**
+ * @page changelog Changelog
+ * @verbinclude "CHANGELOG"
+ */
+
+/**
* @page contrib How to contribute to lwIP
* @verbinclude "contrib.txt"
*/
/**
+ * @page pitfalls Common pitfalls
+ *
+ * Multiple Execution Contexts in lwIP code
+ * ========================================
+ *
+ * The most common source of lwIP problems is to have multiple execution contexts
+ * inside the lwIP code.
+ *
+ * lwIP can be used in two basic modes: @ref lwip_nosys (no OS/RTOS
+ * running on target system) or @ref lwip_os (there is an OS running
+ * on the target system).
+ *
+ * Mainloop Mode
+ * -------------
+ * In mainloop mode, only @ref callbackstyle_api can be used.
+ * The user has two possibilities to ensure there is only one
+ * exection context at a time in lwIP:
+ *
+ * 1) Deliver RX ethernet packets directly in interrupt context to lwIP
+ * by calling netif->input directly in interrupt. This implies all lwIP
+ * callback functions are called in IRQ context, which may cause further
+ * problems in application code: IRQ is blocked for a long time, multiple
+ * execution contexts in application code etc. When the application wants
+ * to call lwIP, it only needs to disable interrupts during the call.
+ * If timers are involved, even more locking code is needed to lock out
+ * timer IRQ and ethernet IRQ from each other, assuming these may be nested.
+ *
+ * 2) Run lwIP in a mainloop. There is example code here: @ref lwip_nosys.
+ * lwIP is _ONLY_ called from mainloop callstacks here. The ethernet IRQ
+ * has to put received telegrams into a queue which is polled in the
+ * mainloop. Ensure lwIP is _NEVER_ called from an interrupt, e.g.
+ * some SPI IRQ wants to forward data to udp_send() or tcp_write()!
+ *
+ * OS Mode
+ * -------
+ * In OS mode, @ref callbackstyle_api AND @ref sequential_api can be used.
+ * @ref sequential_api are designed to be called from threads other than
+ * the TCPIP thread, so there is nothing to consider here.
+ * But @ref callbackstyle_api functions must _ONLY_ be called from
+ * TCPIP thread. It is a common error to call these from other threads
+ * or from IRQ contexts. \u200bEthernet RX needs to deliver incoming packets
+ * in the correct way by sending a message to TCPIP thread, this is
+ * implemented in tcpip_input().\u200b\u200b
+ * Again, ensure lwIP is _NEVER_ called from an interrupt, e.g.
+ * some SPI IRQ wants to forward data to udp_send() or tcp_write()!
+ *
+ * 1) tcpip_callback() can be used get called back from TCPIP thread,
+ * it is safe to call any @ref callbackstyle_api from there.
+ *
+ * 2) Use @ref LWIP_TCPIP_CORE_LOCKING. All @ref callbackstyle_api
+ * functions can be called when lwIP core lock is aquired, see
+ * @ref LOCK_TCPIP_CORE() and @ref UNLOCK_TCPIP_CORE().
+ * These macros cannot be used in an interrupt context!
+ * Note the OS must correctly handle priority inversion for this.
+ */
+
+/**
* @page bugs Reporting bugs
* Please report bugs in the lwIP bug tracker at savannah.\n
* BEFORE submitting, please check if the bug has already been reported!\n
@@ -46,10 +108,11 @@
* *not* *from* *interrupt* *context*. You can allocate a @ref pbuf in interrupt
* context and put them into a queue which is processed from mainloop.\n
* Call sys_check_timeouts() periodically in the mainloop.\n
- * Porting: implement all functions in @ref sys_time and @ref sys_prot.\n
+ * Porting: implement all functions in @ref sys_time, @ref sys_prot and
+ * @ref compiler_abstraction.\n
* You can only use @ref callbackstyle_api in this mode.\n
* Sample code:\n
- * @verbinclude NO_SYS_SampleCode.c
+ * @include NO_SYS_SampleCode.c
*/
/**
@@ -60,7 +123,7 @@
* to use @ref LWIP_TCPIP_CORE_LOCKING.\n
* Porting: implement all functions in @ref sys_layer.\n
* You can use @ref callbackstyle_api together with @ref tcpip_callback,
- * and all @ref threadsafe_api.
+ * and all @ref sequential_api.
*/
/**
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/f52033e9/net/ip/lwip_base/doc/mqtt_client.txt
----------------------------------------------------------------------
diff --git a/net/ip/lwip_base/doc/mqtt_client.txt b/net/ip/lwip_base/doc/mqtt_client.txt
new file mode 100644
index 0000000..3e67def
--- /dev/null
+++ b/net/ip/lwip_base/doc/mqtt_client.txt
@@ -0,0 +1,162 @@
+MQTT client for lwIP
+
+Author: Erik Andersson
+
+Details of the MQTT protocol can be found at:
+http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3.1.1-os.html
+
+-----------------------------------------------------------------
+1. Initial steps, reserve memory and make connection to server:
+
+1.1: Provide storage
+
+Static allocation:
+ mqtt_client_t static_client;
+ example_do_connect(&static_client);
+
+Dynamic allocation:
+ mqtt_client_t *client = mqtt_client_new();
+ if(client != NULL) {
+ example_do_connect(&client);
+ }
+
+1.2: Establish Connection with server
+
+void example_do_connect(mqtt_client_t *client)
+{
+ struct mqtt_connect_client_info_t ci;
+ err_t err;
+
+ /* Setup an empty client info structure */
+ memset(&ci, 0, sizeof(ci));
+
+ /* Minimal amount of information required is client identifier, so set it here */
+ ci.client_id = "lwip_test";
+
+ /* Initiate client and connect to server, if this fails immediately an error code is returned
+ otherwise mqtt_connection_cb will be called with connection result after attempting
+ to establish a connection with the server.
+ For now MQTT version 3.1.1 is always used */
+
+ err = mqtt_client_connect(client, ip_addr, MQTT_PORT, mqtt_connection_cb, 0, &ci);
+
+ /* For now just print the result code if something goes wrong
+ if(err != ERR_OK) {
+ printf("mqtt_connect return %d\n", err);
+ }
+}
+
+Connection to server can also be probed by calling mqtt_client_is_connected(client)
+
+-----------------------------------------------------------------
+2. Implementing the connection status callback
+
+
+static void mqtt_connection_cb(mqtt_client_t *client, void *arg, mqtt_connection_status_t status)
+{
+ err_t err;
+ if(status == MQTT_CONNECT_ACCEPTED) {
+ printf("mqtt_connection_cb: Successfully connected\n");
+
+ /* Setup callback for incoming publish requests */
+ mqtt_set_inpub_callback(client, mqtt_incoming_publish_cb, mqtt_incoming_data_cb, arg);
+
+ /* Subscribe to a topic named "subtopic" with QoS level 1, call mqtt_sub_request_cb with result */
+ err = mqtt_subscribe(client, "subtopic", 1, mqtt_sub_request_cb, arg);
+
+ if(err != ERR_OK) {
+ printf("mqtt_subscribe return: %d\n", err);
+ }
+ } else {
+ printf("mqtt_connection_cb: Disconnected, reason: %d\n", status);
+
+ /* Its more nice to be connected, so try to reconnect */
+ example_do_connect(client);
+ }
+}
+
+static void mqtt_sub_request_cb(void *arg, err_t result)
+{
+ /* Just print the result code here for simplicity,
+ normal behaviour would be to take some action if subscribe fails like
+ notifying user, retry subscribe or disconnect from server */
+ printf("Subscribe result: %d\n", result);
+}
+
+-----------------------------------------------------------------
+3. Implementing callbacks for incoming publish and data
+
+/* The idea is to demultiplex topic and create some reference to be used in data callbacks
+ Example here uses a global variable, better would be to use a member in arg
+ If RAM and CPU budget allows it, the easiest implementation might be to just take a copy of
+ the topic string and use it in mqtt_incoming_data_cb
+*/
+static int inpub_id;
+static void mqtt_incoming_publish_cb(void *arg, const char *topic, u32_t tot_len)
+{
+ printf("Incoming publish at topic %s with total length %u\n", topic, (unsigned int)tot_len);
+
+ /* Decode topic string into a user defined reference */
+ if(strcmp(topic, "print_payload") == 0) {
+ inpub_id = 0;
+ } else if(topic[0] == 'A') {
+ /* All topics starting with 'A' might be handled at the same way */
+ inpub_id = 1;
+ } else {
+ /* For all other topics */
+ inpub_id = 2;
+ }
+}
+
+static void mqtt_incoming_data_cb(void *arg, const u8_t *data, u16_t len, u8_t flags)
+{
+ printf("Incoming publish payload with length %d, flags %u\n", len, (unsigned int)flags);
+
+ if(flags & MQTT_DATA_FLAG_LAST) {
+ /* Last fragment of payload received (or whole part if payload fits receive buffer
+ See MQTT_VAR_HEADER_BUFFER_LEN) */
+
+ /* Call function or do action depending on reference, in this case inpub_id */
+ if(inpub_id == 0) {
+ /* Don't trust the publisher, check zero termination */
+ if(data[len-1] == 0) {
+ printf("mqtt_incoming_data_cb: %s\n", (const char *)data);
+ }
+ } else if(inpub_id == 1) {
+ /* Call an 'A' function... */
+ } else {
+ printf("mqtt_incoming_data_cb: Ignoring payload...\n");
+ }
+ } else {
+ /* Handle fragmented payload, store in buffer, write to file or whatever */
+ }
+}
+
+-----------------------------------------------------------------
+4. Using outgoing publish
+
+
+void example_publish(mqtt_client_t *client, void *arg)
+{
+ const char *pub_payload= "PubSubHubLubJub";
+ err_t err;
+ u8_t qos = 2; /* 0 1 or 2, see MQTT specification */
+ u8_t retain = 0; /* No don't retain such crappy payload... */
+ err = mqtt_publish(client, "pub_topic", pub_payload, strlen(pub_payload), qos, retain, mqtt_pub_request_cb, arg);
+ if(err != ERR_OK) {
+ printf("Publish err: %d\n", err);
+ }
+}
+
+/* Called when publish is complete either with sucess or failure */
+static void mqtt_pub_request_cb(void *arg, err_t result)
+{
+ if(result != ERR_OK) {
+ printf("Publish result: %d\n", result);
+ }
+}
+
+-----------------------------------------------------------------
+5. Disconnecting
+
+Simply call mqtt_disconnect(client)
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/f52033e9/net/ip/lwip_base/doc/ppp.txt
----------------------------------------------------------------------
diff --git a/net/ip/lwip_base/doc/ppp.txt b/net/ip/lwip_base/doc/ppp.txt
index e40c012..8b88b3a 100644
--- a/net/ip/lwip_base/doc/ppp.txt
+++ b/net/ip/lwip_base/doc/ppp.txt
@@ -79,7 +79,7 @@ static void status_cb(ppp_pcb *pcb, int err_code, void *ctx) {
switch(err_code) {
case PPPERR_NONE: {
#if LWIP_DNS
- ip_addr_t ns;
+ const ip_addr_t *ns;
#endif /* LWIP_DNS */
printf("status_cb: Connected\n");
#if PPP_IPV4_SUPPORT
@@ -88,9 +88,9 @@ static void status_cb(ppp_pcb *pcb, int err_code, void *ctx) {
printf(" netmask = %s\n", ipaddr_ntoa(&pppif->netmask));
#if LWIP_DNS
ns = dns_getserver(0);
- printf(" dns1 = %s\n", ipaddr_ntoa(&ns));
+ printf(" dns1 = %s\n", ipaddr_ntoa(ns));
ns = dns_getserver(1);
- printf(" dns2 = %s\n", ipaddr_ntoa(&ns));
+ printf(" dns2 = %s\n", ipaddr_ntoa(ns));
#endif /* LWIP_DNS */
#endif /* PPP_IPV4_SUPPORT */
#if PPP_IPV6_SUPPORT
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/f52033e9/net/ip/lwip_base/doc/rawapi.txt
----------------------------------------------------------------------
diff --git a/net/ip/lwip_base/doc/rawapi.txt b/net/ip/lwip_base/doc/rawapi.txt
index 763a0ef..0cdfdce 100644
--- a/net/ip/lwip_base/doc/rawapi.txt
+++ b/net/ip/lwip_base/doc/rawapi.txt
@@ -456,9 +456,11 @@ introduction to this subject.
Other significant improvements can be made by supplying
assembly or inline replacements for htons() and htonl()
if you're using a little-endian architecture.
-#define LWIP_PLATFORM_BYTESWAP 1
-#define LWIP_PLATFORM_HTONS(x) <your_htons>
-#define LWIP_PLATFORM_HTONL(x) <your_htonl>
+#define lwip_htons(x) <your_htons>
+#define lwip_htonl(x) <your_htonl>
+If you #define them to htons() and htonl(), you should
+#define LWIP_DONT_PROVIDE_BYTEORDER_FUNCTIONS to prevent lwIP from
+defining hton*/ntoh* compatibility macros.
Check your network interface driver if it reads at
a higher speed than the maximum wire-speed. If the
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/f52033e9/net/ip/lwip_base/doc/sys_arch.txt
----------------------------------------------------------------------
diff --git a/net/ip/lwip_base/doc/sys_arch.txt b/net/ip/lwip_base/doc/sys_arch.txt
index 333946d..4dc727b 100644
--- a/net/ip/lwip_base/doc/sys_arch.txt
+++ b/net/ip/lwip_base/doc/sys_arch.txt
@@ -29,7 +29,7 @@ in a mailbox is just a pointer, nothing more.
Semaphores are represented by the type "sys_sem_t" which is typedef'd
in the sys_arch.h file. Mailboxes are equivalently represented by the
-type "sys_mbox_t". Mutexes are represented ny the type "sys_mutex_t".
+type "sys_mbox_t". Mutexes are represented by the type "sys_mutex_t".
lwIP does not place any restrictions on how these types are represented
internally.
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/f52033e9/net/ip/lwip_base/include/lwip/api.h
----------------------------------------------------------------------
diff --git a/net/ip/lwip_base/include/lwip/api.h b/net/ip/lwip_base/include/lwip/api.h
index b821841..516bd16 100644
--- a/net/ip/lwip_base/include/lwip/api.h
+++ b/net/ip/lwip_base/include/lwip/api.h
@@ -43,8 +43,7 @@
/* Note: Netconn API is always available when sockets are enabled -
* sockets are implemented on top of them */
-#include <stddef.h> /* for size_t */
-
+#include "lwip/arch.h"
#include "lwip/netbuf.h"
#include "lwip/sys.h"
#include "lwip/ip_addr.h"
@@ -90,6 +89,7 @@ extern "C" {
#define NETCONNTYPE_ISUDPLITE(t) (((t)&0xF3) == NETCONN_UDPLITE)
#define NETCONNTYPE_ISUDPNOCHKSUM(t) (((t)&0xF3) == NETCONN_UDPNOCHKSUM)
#else /* LWIP_IPV6 */
+#define NETCONNTYPE_ISIPV6(t) (0)
#define NETCONNTYPE_ISUDPLITE(t) ((t) == NETCONN_UDPLITE)
#define NETCONNTYPE_ISUDPNOCHKSUM(t) ((t) == NETCONN_UDPNOCHKSUM)
#endif /* LWIP_IPV6 */
@@ -139,7 +139,32 @@ enum netconn_state {
NETCONN_CLOSE
};
-/** Use to inform the callback function about changes */
+/** Used to inform the callback function about changes
+ *
+ * Event explanation:
+ *
+ * In the netconn implementation, there are three ways to block a client:
+ *
+ * - accept mbox (sys_arch_mbox_fetch(&conn->acceptmbox, &accept_ptr, 0); in netconn_accept())
+ * - receive mbox (sys_arch_mbox_fetch(&conn->recvmbox, &buf, 0); in netconn_recv_data())
+ * - send queue is full (sys_arch_sem_wait(LWIP_API_MSG_SEM(msg), 0); in lwip_netconn_do_write())
+ *
+ * The events have to be seen as events signaling the state of these mboxes/semaphores. For non-blocking
+ * connections, you need to know in advance whether a call to a netconn function call would block or not,
+ * and these events tell you about that.
+ *
+ * RCVPLUS events say: Safe to perform a potentially blocking call call once more.
+ * They are counted in sockets - three RCVPLUS events for accept mbox means you are safe
+ * to call netconn_accept 3 times without being blocked.
+ * Same thing for receive mbox.
+ *
+ * RCVMINUS events say: Your call to to a possibly blocking function is "acknowledged".
+ * Socket implementation decrements the counter.
+ *
+ * For TX, there is no need to count, its merely a flag. SENDPLUS means you may send something.
+ * SENDPLUS occurs when enough data was delivered to peer so netconn_send() can be called again.
+ * A SENDMINUS event occurs when the next call to a netconn_send() would be blocking.
+ */
enum netconn_evt {
NETCONN_EVT_RCVPLUS,
NETCONN_EVT_RCVMINUS,
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/f52033e9/net/ip/lwip_base/include/lwip/apps/httpd_opts.h
----------------------------------------------------------------------
diff --git a/net/ip/lwip_base/include/lwip/apps/httpd_opts.h b/net/ip/lwip_base/include/lwip/apps/httpd_opts.h
index 424d3d2..340db15 100644
--- a/net/ip/lwip_base/include/lwip/apps/httpd_opts.h
+++ b/net/ip/lwip_base/include/lwip/apps/httpd_opts.h
@@ -43,10 +43,6 @@
#include "lwip/opt.h"
-#ifdef __cplusplus
-extern "C" {
-#endif
-
/**
* @defgroup httpd_opts Options
* @ingroup httpd
@@ -165,28 +161,6 @@ extern "C" {
#define HTTPD_DEBUG_TIMING LWIP_DBG_OFF
#endif
-/** Set this to 1 on platforms where strnstr is not available */
-#if !defined LWIP_HTTPD_STRNSTR_PRIVATE || defined __DOXYGEN__
-#define LWIP_HTTPD_STRNSTR_PRIVATE 1
-#endif
-
-/** Set this to 1 on platforms where stricmp is not available */
-#if !defined LWIP_HTTPD_STRICMP_PRIVATE || defined __DOXYGEN__
-#define LWIP_HTTPD_STRICMP_PRIVATE 0
-#endif
-
-/** Define this to a smaller function if you have itoa() at hand... */
-#if !defined LWIP_HTTPD_ITOA || defined __DOXYGEN__
-#if !defined LWIP_HTTPD_ITOA_PRIVATE || defined __DOXYGEN__
-#define LWIP_HTTPD_ITOA_PRIVATE 1
-#endif
-#if LWIP_HTTPD_ITOA_PRIVATE
-#define LWIP_HTTPD_ITOA(buffer, bufsize, number) httpd_itoa(number, buffer)
-#else
-#define LWIP_HTTPD_ITOA(buffer, bufsize, number) snprintf(buffer, bufsize, "%d", number)
-#endif
-#endif
-
/** Set this to one to show error pages when parsing a request fails instead
of simply closing the connection. */
#if !defined LWIP_HTTPD_SUPPORT_EXTSTATUS || defined __DOXYGEN__
@@ -346,8 +320,4 @@ extern "C" {
* @}
*/
-#ifdef __cplusplus
-}
-#endif
-
#endif /* LWIP_HDR_APPS_HTTPD_OPTS_H */
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/f52033e9/net/ip/lwip_base/include/lwip/apps/mdns.h
----------------------------------------------------------------------
diff --git a/net/ip/lwip_base/include/lwip/apps/mdns.h b/net/ip/lwip_base/include/lwip/apps/mdns.h
index 1d4e3c8..d036816 100644
--- a/net/ip/lwip_base/include/lwip/apps/mdns.h
+++ b/net/ip/lwip_base/include/lwip/apps/mdns.h
@@ -31,7 +31,7 @@
*
* This file is part of the lwIP TCP/IP stack.
*
- * Author: Erik Ekman <er...@verisure.com>
+ * Author: Erik Ekman <er...@kryo.se>
*
*/
#ifndef LWIP_HDR_MDNS_H
@@ -40,10 +40,6 @@
#include "lwip/apps/mdns_opts.h"
#include "lwip/netif.h"
-#ifdef __cplusplus
-extern "C" {
-#endif
-
#if LWIP_MDNS_RESPONDER
enum mdns_sd_proto {
@@ -70,8 +66,4 @@ void mdns_resp_netif_settings_changed(struct netif *netif);
#endif /* LWIP_MDNS_RESPONDER */
-#ifdef __cplusplus
-}
-#endif
-
#endif /* LWIP_HDR_MDNS_H */
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/f52033e9/net/ip/lwip_base/include/lwip/apps/mdns_opts.h
----------------------------------------------------------------------
diff --git a/net/ip/lwip_base/include/lwip/apps/mdns_opts.h b/net/ip/lwip_base/include/lwip/apps/mdns_opts.h
index d55ecff..bf186bc 100644
--- a/net/ip/lwip_base/include/lwip/apps/mdns_opts.h
+++ b/net/ip/lwip_base/include/lwip/apps/mdns_opts.h
@@ -31,7 +31,7 @@
*
* This file is part of the lwIP TCP/IP stack.
*
- * Author: Erik Ekman <er...@verisure.com>
+ * Author: Erik Ekman <er...@kryo.se>
*
*/
@@ -40,10 +40,6 @@
#include "lwip/opt.h"
-#ifdef __cplusplus
-extern "C" {
-#endif
-
/**
* @defgroup mdns_opts Options
* @ingroup mdns
@@ -74,9 +70,5 @@ extern "C" {
* @}
*/
-#ifdef __cplusplus
-}
-#endif
-
#endif /* LWIP_HDR_APPS_MDNS_OPTS_H */
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/f52033e9/net/ip/lwip_base/include/lwip/apps/mdns_priv.h
----------------------------------------------------------------------
diff --git a/net/ip/lwip_base/include/lwip/apps/mdns_priv.h b/net/ip/lwip_base/include/lwip/apps/mdns_priv.h
index 6dc7884..8ee6db8 100644
--- a/net/ip/lwip_base/include/lwip/apps/mdns_priv.h
+++ b/net/ip/lwip_base/include/lwip/apps/mdns_priv.h
@@ -31,7 +31,7 @@
*
* This file is part of the lwIP TCP/IP stack.
*
- * Author: Erik Ekman <er...@verisure.com>
+ * Author: Erik Ekman <er...@kryo.se>
*
*/
#ifndef LWIP_HDR_MDNS_PRIV_H
@@ -40,10 +40,6 @@
#include "lwip/apps/mdns_opts.h"
#include "lwip/pbuf.h"
-#ifdef __cplusplus
-extern "C" {
-#endif
-
#if LWIP_MDNS_RESPONDER
/* Domain struct and methods - visible for unit tests */
@@ -67,8 +63,4 @@ u16_t mdns_compress_domain(struct pbuf *pbuf, u16_t *offset, struct mdns_domain
#endif /* LWIP_MDNS_RESPONDER */
-#ifdef __cplusplus
-}
-#endif
-
#endif /* LWIP_HDR_MDNS_PRIV_H */
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/f52033e9/net/ip/lwip_base/include/lwip/apps/mqtt.h
----------------------------------------------------------------------
diff --git a/net/ip/lwip_base/include/lwip/apps/mqtt.h b/net/ip/lwip_base/include/lwip/apps/mqtt.h
new file mode 100644
index 0000000..34b230b
--- /dev/null
+++ b/net/ip/lwip_base/include/lwip/apps/mqtt.h
@@ -0,0 +1,244 @@
+/**
+ * @file
+ * MQTT client
+ */
+
+/*
+ * Copyright (c) 2016 Erik Andersson
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
+ * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
+ * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
+ * OF SUCH DAMAGE.
+ *
+ * This file is part of the lwIP TCP/IP stack.
+ *
+ * Author: Erik Andersson
+ *
+ */
+#ifndef LWIP_HDR_APPS_MQTT_CLIENT_H
+#define LWIP_HDR_APPS_MQTT_CLIENT_H
+
+#include "lwip/apps/mqtt_opts.h"
+#include "lwip/err.h"
+#include "lwip/ip_addr.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct mqtt_client_t mqtt_client_t;
+
+/** @ingroup mqtt
+ * Default MQTT port */
+#define MQTT_PORT 1883
+
+/*---------------------------------------------------------------------------------------------- */
+/* Connection with server */
+
+/**
+ * @ingroup mqtt
+ * Client information and connection parameters */
+struct mqtt_connect_client_info_t {
+ /** Client identifier, must be set by caller */
+ const char *client_id;
+ /** User name and password, set to NULL if not used */
+ const char* client_user;
+ const char* client_pass;
+ /** keep alive time in seconds, 0 to disable keep alive functionality*/
+ u16_t keep_alive;
+ /** will topic, set to NULL if will is not to be used,
+ will_msg, will_qos and will retain are then ignored */
+ const char* will_topic;
+ const char* will_msg;
+ u8_t will_qos;
+ u8_t will_retain;
+};
+
+/**
+ * @ingroup mqtt
+ * Connection status codes */
+typedef enum
+{
+ MQTT_CONNECT_ACCEPTED = 0,
+ MQTT_CONNECT_REFUSED_PROTOCOL_VERSION = 1,
+ MQTT_CONNECT_REFUSED_IDENTIFIER = 2,
+ MQTT_CONNECT_REFUSED_SERVER = 3,
+ MQTT_CONNECT_REFUSED_USERNAME_PASS = 4,
+ MQTT_CONNECT_REFUSED_NOT_AUTHORIZED_ = 5,
+ MQTT_CONNECT_DISCONNECTED = 256,
+ MQTT_CONNECT_TIMEOUT = 257
+} mqtt_connection_status_t;
+
+/**
+ * @ingroup mqtt
+ * Function prototype for mqtt connection status callback. Called when
+ * client has connected to the server after initiating a mqtt connection attempt by
+ * calling mqtt_connect() or when connection is closed by server or an error
+ *
+ * @param client MQTT client itself
+ * @param arg Additional argument to pass to the callback function
+ * @param status Connect result code or disconnection notification @see mqtt_connection_status_t
+ *
+ */
+typedef void (*mqtt_connection_cb_t)(mqtt_client_t *client, void *arg, mqtt_connection_status_t status);
+
+
+/**
+ * @ingroup mqtt
+ * Data callback flags */
+enum {
+ /** Flag set when last fragment of data arrives in data callback */
+ MQTT_DATA_FLAG_LAST = 1
+};
+
+/**
+ * @ingroup mqtt
+ * Function prototype for MQTT incoming publish data callback function. Called when data
+ * arrives to a subscribed topic @see mqtt_subscribe
+ *
+ * @param arg Additional argument to pass to the callback function
+ * @param data User data, pointed object, data may not be referenced after callback return,
+ NULL is passed when all publish data are delivered
+ * @param len Length of publish data fragment
+ * @param flags MQTT_DATA_FLAG_LAST set when this call contains the last part of data from publish message
+ *
+ */
+typedef void (*mqtt_incoming_data_cb_t)(void *arg, const u8_t *data, u16_t len, u8_t flags);
+
+
+/**
+ * @ingroup mqtt
+ * Function prototype for MQTT incoming publish function. Called when an incoming publish
+ * arrives to a subscribed topic @see mqtt_subscribe
+ *
+ * @param arg Additional argument to pass to the callback function
+ * @param topic Zero terminated Topic text string, topic may not be referenced after callback return
+ * @param tot_len Total length of publish data, if set to 0 (no publish payload) data callback will not be invoked
+ */
+typedef void (*mqtt_incoming_publish_cb_t)(void *arg, const char *topic, u32_t tot_len);
+
+
+/**
+ * @ingroup mqtt
+ * Function prototype for mqtt request callback. Called when a subscribe, unsubscribe
+ * or publish request has completed
+ * @param arg Pointer to user data supplied when invoking request
+ * @param err ERR_OK on success
+ * ERR_TIMEOUT if no response was received within timeout,
+ * ERR_ABRT if (un)subscribe was denied
+ */
+typedef void (*mqtt_request_cb_t)(void *arg, err_t err);
+
+
+/**
+ * Pending request item, binds application callback to pending server requests
+ */
+struct mqtt_request_t
+{
+ /** Next item in list, NULL means this is the last in chain,
+ next pointing at itself means request is unallocated */
+ struct mqtt_request_t *next;
+ /** Callback to upper layer */
+ mqtt_request_cb_t cb;
+ void *arg;
+ /** MQTT packet identifier */
+ u16_t pkt_id;
+ /** Expire time relative to element before this */
+ u16_t timeout_diff;
+};
+
+/** Ring buffer */
+struct mqtt_ringbuf_t {
+ u16_t put;
+ u16_t get;
+ u8_t buf[MQTT_OUTPUT_RINGBUF_SIZE];
+};
+
+/** MQTT client */
+struct mqtt_client_t
+{
+ /** Timers and timeouts */
+ u16_t cyclic_tick;
+ u16_t keep_alive;
+ u16_t server_watchdog;
+ /** Packet identifier generator*/
+ u16_t pkt_id_seq;
+ /** Packet identifier of pending incoming publish */
+ u16_t inpub_pkt_id;
+ /** Connection state */
+ u8_t conn_state;
+ struct tcp_pcb *conn;
+ /** Connection callback */
+ void *connect_arg;
+ mqtt_connection_cb_t connect_cb;
+ /** Pending requests to server */
+ struct mqtt_request_t *pend_req_queue;
+ struct mqtt_request_t req_list[MQTT_REQ_MAX_IN_FLIGHT];
+ void *inpub_arg;
+ /** Incoming data callback */
+ mqtt_incoming_data_cb_t data_cb;
+ mqtt_incoming_publish_cb_t pub_cb;
+ /** Input */
+ u32_t msg_idx;
+ u8_t rx_buffer[MQTT_VAR_HEADER_BUFFER_LEN];
+ /** Output ring-buffer */
+ struct mqtt_ringbuf_t output;
+};
+
+
+/** Connect to server */
+err_t mqtt_client_connect(mqtt_client_t *client, const ip_addr_t *ipaddr, u16_t port, mqtt_connection_cb_t cb, void *arg,
+ const struct mqtt_connect_client_info_t *client_info);
+
+/** Disconnect from server */
+void mqtt_disconnect(mqtt_client_t *client);
+
+/** Create new client */
+mqtt_client_t *mqtt_client_new(void);
+
+/** Check connection status */
+u8_t mqtt_client_is_connected(mqtt_client_t *client);
+
+/** Set callback to call for incoming publish */
+void mqtt_set_inpub_callback(mqtt_client_t *client, mqtt_incoming_publish_cb_t,
+ mqtt_incoming_data_cb_t data_cb, void *arg);
+
+/** Common function for subscribe and unsubscribe */
+err_t mqtt_sub_unsub(mqtt_client_t *client, const char *topic, u8_t qos, mqtt_request_cb_t cb, void *arg, u8_t sub);
+
+/** @ingroup mqtt
+ *Subscribe to topic */
+#define mqtt_subscribe(client, topic, qos, cb, arg) mqtt_sub_unsub(client, topic, qos, cb, arg, 1)
+/** @ingroup mqtt
+ * Unsubscribe to topic */
+#define mqtt_unsubscribe(client, topic, cb, arg) mqtt_sub_unsub(client, topic, 0, cb, arg, 0)
+
+
+/** Publish data to topic */
+err_t mqtt_publish(mqtt_client_t *client, const char *topic, const void *payload, u16_t payload_length, u8_t qos, u8_t retain,
+ mqtt_request_cb_t cb, void *arg);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* LWIP_HDR_APPS_MQTT_CLIENT_H */
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/f52033e9/net/ip/lwip_base/include/lwip/apps/mqtt_opts.h
----------------------------------------------------------------------
diff --git a/net/ip/lwip_base/include/lwip/apps/mqtt_opts.h b/net/ip/lwip_base/include/lwip/apps/mqtt_opts.h
new file mode 100644
index 0000000..ffefacd
--- /dev/null
+++ b/net/ip/lwip_base/include/lwip/apps/mqtt_opts.h
@@ -0,0 +1,103 @@
+/**
+ * @file
+ * MQTT client options
+ */
+
+/*
+ * Copyright (c) 2016 Erik Andersson
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
+ * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
+ * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
+ * OF SUCH DAMAGE.
+ *
+ * This file is part of the lwIP TCP/IP stack.
+ *
+ * Author: Erik Andersson
+ *
+ */
+#ifndef LWIP_HDR_APPS_MQTT_OPTS_H
+#define LWIP_HDR_APPS_MQTT_OPTS_H
+
+#include "lwip/opt.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @defgroup mqtt_opts Options
+ * @ingroup mqtt
+ * @{
+ */
+
+/**
+ * Output ring-buffer size, must be able to fit largest outgoing publish message topic+payloads
+ */
+#ifndef MQTT_OUTPUT_RINGBUF_SIZE
+#define MQTT_OUTPUT_RINGBUF_SIZE 256
+#endif
+
+/**
+ * Number of bytes in receive buffer, must be at least the size of the longest incoming topic + 8
+ * If one wants to avoid fragmented incoming publish, set length to max incoming topic length + max payload length + 8
+ */
+#ifndef MQTT_VAR_HEADER_BUFFER_LEN
+#define MQTT_VAR_HEADER_BUFFER_LEN 128
+#endif
+
+/**
+ * Maximum number of pending subscribe, unsubscribe and publish requests to server .
+ */
+#ifndef MQTT_REQ_MAX_IN_FLIGHT
+#define MQTT_REQ_MAX_IN_FLIGHT 4
+#endif
+
+/**
+ * Seconds between each cyclic timer call.
+ */
+#ifndef MQTT_CYCLIC_TIMER_INTERVAL
+#define MQTT_CYCLIC_TIMER_INTERVAL 5
+#endif
+
+/**
+ * Publish, subscribe and unsubscribe request timeout in seconds.
+ */
+#ifndef MQTT_REQ_TIMEOUT
+#define MQTT_REQ_TIMEOUT 30
+#endif
+
+/**
+ * Seconds for MQTT connect response timeout after sending connect request
+ */
+#ifndef MQTT_CONNECT_TIMOUT
+#define MQTT_CONNECT_TIMOUT 100
+#endif
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* LWIP_HDR_APPS_MQTT_OPTS_H */
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/f52033e9/net/ip/lwip_base/include/lwip/apps/netbiosns.h
----------------------------------------------------------------------
diff --git a/net/ip/lwip_base/include/lwip/apps/netbiosns.h b/net/ip/lwip_base/include/lwip/apps/netbiosns.h
index a326d33..c9f68d8 100644
--- a/net/ip/lwip_base/include/lwip/apps/netbiosns.h
+++ b/net/ip/lwip_base/include/lwip/apps/netbiosns.h
@@ -34,18 +34,10 @@
#include "lwip/apps/netbiosns_opts.h"
-#ifdef __cplusplus
-extern "C" {
-#endif
-
void netbiosns_init(void);
#ifndef NETBIOS_LWIP_NAME
void netbiosns_set_name(const char* hostname);
#endif
void netbiosns_stop(void);
-#ifdef __cplusplus
-}
-#endif
-
#endif /* LWIP_HDR_APPS_NETBIOS_H */
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/f52033e9/net/ip/lwip_base/include/lwip/apps/netbiosns_opts.h
----------------------------------------------------------------------
diff --git a/net/ip/lwip_base/include/lwip/apps/netbiosns_opts.h b/net/ip/lwip_base/include/lwip/apps/netbiosns_opts.h
index df6ea26..0909ef7 100644
--- a/net/ip/lwip_base/include/lwip/apps/netbiosns_opts.h
+++ b/net/ip/lwip_base/include/lwip/apps/netbiosns_opts.h
@@ -34,26 +34,12 @@
#include "lwip/opt.h"
-#ifdef __cplusplus
-extern "C" {
-#endif
-
/**
* @defgroup netbiosns_opts Options
* @ingroup netbiosns
* @{
*/
-/** Since there's no standard function for case-insensitive string comparision,
- * we need another define here:
- * define this to stricmp() for windows or strcasecmp() for linux.
- * If not defined, comparision is case sensitive and the provided hostname must be
- * uppercase.
- */
-#if !defined NETBIOS_STRCMP || defined __DOXYGEN__
-#define NETBIOS_STRCMP(str1, str2) strcmp(str1, str2)
-#endif
-
/** NetBIOS name of lwip device
* This must be uppercase until NETBIOS_STRCMP() is defined to a string
* comparision function that is case insensitive.
@@ -70,8 +56,4 @@ extern "C" {
* @}
*/
-#ifdef __cplusplus
-}
-#endif
-
#endif /* LWIP_HDR_APPS_NETBIOS_OPTS_H */
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/f52033e9/net/ip/lwip_base/include/lwip/apps/snmp_opts.h
----------------------------------------------------------------------
diff --git a/net/ip/lwip_base/include/lwip/apps/snmp_opts.h b/net/ip/lwip_base/include/lwip/apps/snmp_opts.h
index 569a82c..6c9ba7b 100644
--- a/net/ip/lwip_base/include/lwip/apps/snmp_opts.h
+++ b/net/ip/lwip_base/include/lwip/apps/snmp_opts.h
@@ -39,10 +39,6 @@
#include "lwip/opt.h"
-#ifdef __cplusplus
-extern "C" {
-#endif
-
/**
* @defgroup snmp_opts Options
* @ingroup snmp
@@ -294,8 +290,4 @@ extern "C" {
#define LWIP_SNMP_V3_MBEDTLS LWIP_SNMP_V3
#endif
-#ifdef __cplusplus
-}
-#endif
-
#endif /* LWIP_HDR_SNMP_OPTS_H */
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/f52033e9/net/ip/lwip_base/include/lwip/apps/snmpv3.h
----------------------------------------------------------------------
diff --git a/net/ip/lwip_base/include/lwip/apps/snmpv3.h b/net/ip/lwip_base/include/lwip/apps/snmpv3.h
index 1008eea..c99fed4 100644
--- a/net/ip/lwip_base/include/lwip/apps/snmpv3.h
+++ b/net/ip/lwip_base/include/lwip/apps/snmpv3.h
@@ -38,10 +38,6 @@
#include "lwip/apps/snmp_opts.h"
#include "lwip/err.h"
-#ifdef __cplusplus
-extern "C" {
-#endif
-
#if LWIP_SNMP && LWIP_SNMP_V3
#define SNMP_V3_AUTH_ALGO_INVAL 0
@@ -91,8 +87,4 @@ void snmpv3_password_to_key_sha(
#endif
-#ifdef __cplusplus
-}
-#endif
-
#endif /* LWIP_HDR_APPS_SNMP_V3_H */
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/f52033e9/net/ip/lwip_base/include/lwip/apps/sntp_opts.h
----------------------------------------------------------------------
diff --git a/net/ip/lwip_base/include/lwip/apps/sntp_opts.h b/net/ip/lwip_base/include/lwip/apps/sntp_opts.h
index 2dc3033..f3651f9 100644
--- a/net/ip/lwip_base/include/lwip/apps/sntp_opts.h
+++ b/net/ip/lwip_base/include/lwip/apps/sntp_opts.h
@@ -39,10 +39,6 @@
#include "lwip/opt.h"
-#ifdef __cplusplus
-extern "C" {
-#endif
-
/**
* @defgroup sntp_opts Options
* @ingroup sntp
@@ -174,8 +170,4 @@ extern "C" {
* @}
*/
-#ifdef __cplusplus
-}
-#endif
-
#endif /* LWIP_HDR_APPS_SNTP_OPTS_H */
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/f52033e9/net/ip/lwip_base/include/lwip/apps/tftp_opts.h
----------------------------------------------------------------------
diff --git a/net/ip/lwip_base/include/lwip/apps/tftp_opts.h b/net/ip/lwip_base/include/lwip/apps/tftp_opts.h
new file mode 100644
index 0000000..6968a80
--- /dev/null
+++ b/net/ip/lwip_base/include/lwip/apps/tftp_opts.h
@@ -0,0 +1,105 @@
+/****************************************************************//**
+ *
+ * @file tftp_opts.h
+ *
+ * @author Logan Gunthorpe <lo...@deltatee.com>
+ *
+ * @brief Trivial File Transfer Protocol (RFC 1350) implementation options
+ *
+ * Copyright (c) Deltatee Enterprises Ltd. 2013
+ * All rights reserved.
+ *
+ ********************************************************************/
+
+/*
+ * Redistribution and use in source and binary forms, with or without
+ * modification,are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+ * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+ * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Author: Logan Gunthorpe <lo...@deltatee.com>
+ *
+ */
+
+#ifndef LWIP_HDR_APPS_TFTP_OPTS_H
+#define LWIP_HDR_APPS_TFTP_OPTS_H
+
+#include "lwip/opt.h"
+
+/**
+ * @defgroup tftp_opts Options
+ * @ingroup tftp
+ * @{
+ */
+
+/**
+ * Enable TFTP debug messages
+ */
+#if !defined TFTP_DEBUG || defined __DOXYGEN__
+#define TFTP_DEBUG LWIP_DBG_ON
+#endif
+
+/**
+ * TFTP server port
+ */
+#if !defined TFTP_PORT || defined __DOXYGEN__
+#define TFTP_PORT 69
+#endif
+
+/**
+ * TFTP timeout
+ */
+#if !defined TFTP_TIMEOUT_MSECS || defined __DOXYGEN__
+#define TFTP_TIMEOUT_MSECS 10000
+#endif
+
+/**
+ * Max. number of retries when a file is read from server
+ */
+#if !defined TFTP_MAX_RETRIES || defined __DOXYGEN__
+#define TFTP_MAX_RETRIES 5
+#endif
+
+/**
+ * TFTP timer cyclic interval
+ */
+#if !defined TFTP_TIMER_MSECS || defined __DOXYGEN__
+#define TFTP_TIMER_MSECS 50
+#endif
+
+/**
+ * Max. length of TFTP filename
+ */
+#if !defined TFTP_MAX_FILENAME_LEN || defined __DOXYGEN__
+#define TFTP_MAX_FILENAME_LEN 20
+#endif
+
+/**
+ * Max. length of TFTP mode
+ */
+#if !defined TFTP_MAX_MODE_LEN || defined __DOXYGEN__
+#define TFTP_MAX_MODE_LEN 7
+#endif
+
+/**
+ * @}
+ */
+
+#endif /* LWIP_HDR_APPS_TFTP_OPTS_H */
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/f52033e9/net/ip/lwip_base/include/lwip/apps/tftp_server.h
----------------------------------------------------------------------
diff --git a/net/ip/lwip_base/include/lwip/apps/tftp_server.h b/net/ip/lwip_base/include/lwip/apps/tftp_server.h
new file mode 100644
index 0000000..3fbe701
--- /dev/null
+++ b/net/ip/lwip_base/include/lwip/apps/tftp_server.h
@@ -0,0 +1,94 @@
+/****************************************************************//**
+ *
+ * @file tftp_server.h
+ *
+ * @author Logan Gunthorpe <lo...@deltatee.com>
+ *
+ * @brief Trivial File Transfer Protocol (RFC 1350)
+ *
+ * Copyright (c) Deltatee Enterprises Ltd. 2013
+ * All rights reserved.
+ *
+ ********************************************************************/
+
+/*
+ * Redistribution and use in source and binary forms, with or without
+ * modification,are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+ * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+ * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Author: Logan Gunthorpe <lo...@deltatee.com>
+ *
+ */
+
+#ifndef LWIP_HDR_APPS_TFTP_SERVER_H
+#define LWIP_HDR_APPS_TFTP_SERVER_H
+
+#include "lwip/apps/tftp_opts.h"
+#include "lwip/err.h"
+#include "lwip/pbuf.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** @ingroup tftp
+ * TFTP context containing callback functions for TFTP transfers
+ */
+struct tftp_context {
+ /**
+ * Open file for read/write.
+ * @param fname Filename
+ * @param mode Mode string from TFTP RFC 1350 (netascii, octet, mail)
+ * @param write Flag indicating read (0) or write (!= 0) access
+ * @returns File handle supplied to other functions
+ */
+ void* (*open)(const char* fname, const char* mode, u8_t write);
+ /**
+ * Close file handle
+ * @param handle File handle returned by open()
+ */
+ void (*close)(void* handle);
+ /**
+ * Read from file
+ * @param handle File handle returned by open()
+ * @param buf Target buffer to copy read data to
+ * @param bytes Number of bytes to copy to buf
+ * @returns >= 0: Success; < 0: Error
+ */
+ int (*read)(void* handle, void* buf, int bytes);
+ /**
+ * Write to file
+ * @param handle File handle returned by open()
+ * @param pbuf PBUF adjusted such that payload pointer points
+ * to the beginning of write data. In other words,
+ * TFTP headers are stripped off.
+ * @returns >= 0: Success; < 0: Error
+ */
+ int (*write)(void* handle, struct pbuf* p);
+};
+
+err_t tftp_init(const struct tftp_context* ctx);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* LWIP_HDR_APPS_TFTP_SERVER_H */
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/f52033e9/net/ip/lwip_base/include/lwip/arch.h
----------------------------------------------------------------------
diff --git a/net/ip/lwip_base/include/lwip/arch.h b/net/ip/lwip_base/include/lwip/arch.h
index ee4a0b9..55714e1 100644
--- a/net/ip/lwip_base/include/lwip/arch.h
+++ b/net/ip/lwip_base/include/lwip/arch.h
@@ -47,12 +47,67 @@
#include "arch/cc.h"
+/**
+ * @defgroup compiler_abstraction Compiler/platform abstraction
+ * @ingroup sys_layer
+ * All defines related to this section must not be placed in lwipopts.h,
+ * but in arch/cc.h!
+ * These options cannot be \#defined in lwipopts.h since they are not options
+ * of lwIP itself, but options of the lwIP port to your system.
+ * @{
+ */
+
+/** Define the byte order of the system.
+ * Needed for conversion of network data to host byte order.
+ * Allowed values: LITTLE_ENDIAN and BIG_ENDIAN
+ */
+#ifndef BYTE_ORDER
+#define BYTE_ORDER LITTLE_ENDIAN
+#endif
+
+/** Define random number generator function of your system */
+#ifdef __DOXYGEN__
+#define LWIP_RAND() ((u32_t)rand())
+#endif
+
+/** Platform specific diagnostic output.\n
+ * Note the default implementation pulls in printf, which may
+ * in turn pull in a lot of standard libary code. In resource-constrained
+ * systems, this should be defined to something less resource-consuming.
+ */
+#ifndef LWIP_PLATFORM_DIAG
+#define LWIP_PLATFORM_DIAG(x) do {printf x;} while(0)
+#include <stdio.h>
+#include <stdlib.h>
+#endif
+
+/** Platform specific assertion handling.\n
+ * Note the default implementation pulls in printf, fflush and abort, which may
+ * in turn pull in a lot of standard libary code. In resource-constrained
+ * systems, this should be defined to something less resource-consuming.
+ */
+#ifndef LWIP_PLATFORM_ASSERT
+#define LWIP_PLATFORM_ASSERT(x) do {printf("Assertion \"%s\" failed at line %d in %s\n", \
+ x, __LINE__, __FILE__); fflush(NULL); abort();} while(0)
+#include <stdio.h>
+#include <stdlib.h>
+#endif
+
+/** Define this to 1 in arch/cc.h of your port if you do not want to
+ * include stddef.h header to get size_t. You need to typedef size_t
+ * by yourself in this case.
+ */
+#ifndef LWIP_NO_STDDEF_H
+#define LWIP_NO_STDDEF_H 0
+#endif
+
+#if !LWIP_NO_STDDEF_H
+#include <stddef.h> /* for size_t */
+#endif
+
/** Define this to 1 in arch/cc.h of your port if your compiler does not provide
- * the stdint.h header. This cannot be \#defined in lwipopts.h since
- * this is not an option of lwIP itself, but an option of the lwIP port
- * to your system.
- * Additionally, this header is meant to be \#included in lwipopts.h
- * (you may need to declare function prototypes in there).
+ * the stdint.h header. You need to typedef the generic types listed in
+ * lwip/arch.h yourself in this case (u8_t, u16_t...).
*/
#ifndef LWIP_NO_STDINT_H
#define LWIP_NO_STDINT_H 0
@@ -71,11 +126,8 @@ typedef uintptr_t mem_ptr_t;
#endif
/** Define this to 1 in arch/cc.h of your port if your compiler does not provide
- * the inttypes.h header. This cannot be \#defined in lwipopts.h since
- * this is not an option of lwIP itself, but an option of the lwIP port
- * to your system.
- * Additionally, this header is meant to be \#included in lwipopts.h
- * (you may need to declare function prototypes in there).
+ * the inttypes.h header. You need to define the format strings listed in
+ * lwip/arch.h yourself in this case (X8_F, U16_F...).
*/
#ifndef LWIP_NO_INTTYPES_H
#define LWIP_NO_INTTYPES_H 0
@@ -110,14 +162,44 @@ typedef uintptr_t mem_ptr_t;
#endif
#endif
+/** Define this to 1 in arch/cc.h of your port if your compiler does not provide
+ * the limits.h header. You need to define the type limits yourself in this case
+ * (e.g. INT_MAX).
+ */
+#ifndef LWIP_NO_LIMITS_H
+#define LWIP_NO_LIMITS_H 0
+#endif
+
+/* Include limits.h? */
+#if !LWIP_NO_LIMITS_H
+#include <limits.h>
+#endif
+
+/** C++ const_cast<target_type>(val) equivalent to remove constness from a value (GCC -Wcast-qual) */
+#ifndef LWIP_CONST_CAST
+#define LWIP_CONST_CAST(target_type, val) ((target_type)((ptrdiff_t)val))
+#endif
+
+/** Get rid of alignment cast warnings (GCC -Wcast-align) */
+#ifndef LWIP_ALIGNMENT_CAST
+#define LWIP_ALIGNMENT_CAST(target_type, val) LWIP_CONST_CAST(target_type, val)
+#endif
+
+/** Get rid of warnings related to pointer-to-numeric and vice-versa casts,
+ * e.g. "conversion from 'u8_t' to 'void *' of greater size"
+ */
+#ifndef LWIP_PTR_NUMERIC_CAST
+#define LWIP_PTR_NUMERIC_CAST(target_type, val) LWIP_CONST_CAST(target_type, val)
+#endif
+
/** Allocates a memory buffer of specified size that is of sufficient size to align
* its start address using LWIP_MEM_ALIGN.
* You can declare your own version here e.g. to enforce alignment without adding
* trailing padding bytes (see LWIP_MEM_ALIGN_BUFFER) or your own section placement
- * requirements.
- * e.g. if you use gcc and need 32 bit alignment:
- * \#define LWIP_DECLARE_MEMORY_ALIGNED(variable_name, size) u8_t variable_name[size] __attribute__((aligned(4)))
- * or more portable:
+ * requirements.\n
+ * e.g. if you use gcc and need 32 bit alignment:\n
+ * \#define LWIP_DECLARE_MEMORY_ALIGNED(variable_name, size) u8_t variable_name[size] \_\_attribute\_\_((aligned(4)))\n
+ * or more portable:\n
* \#define LWIP_DECLARE_MEMORY_ALIGNED(variable_name, size) u32_t variable_name[(size + sizeof(u32_t) - 1) / sizeof(u32_t)]
*/
#ifndef LWIP_DECLARE_MEMORY_ALIGNED
@@ -151,175 +233,84 @@ typedef uintptr_t mem_ptr_t;
extern "C" {
#endif
+/** Packed structs support.
+ * Placed BEFORE declaration of a packed struct.\n
+ * For examples of packed struct declarations, see include/lwip/prot/ subfolder.\n
+ * A port to GCC/clang is included in lwIP, if you use these compilers there is nothing to do here.
+ */
#ifndef PACK_STRUCT_BEGIN
#define PACK_STRUCT_BEGIN
#endif /* PACK_STRUCT_BEGIN */
+/** Packed structs support.
+ * Placed AFTER declaration of a packed struct.\n
+ * For examples of packed struct declarations, see include/lwip/prot/ subfolder.\n
+ * A port to GCC/clang is included in lwIP, if you use these compilers there is nothing to do here.
+ */
#ifndef PACK_STRUCT_END
#define PACK_STRUCT_END
#endif /* PACK_STRUCT_END */
+/** Packed structs support.
+ * Placed between end of declaration of a packed struct and trailing semicolon.\n
+ * For examples of packed struct declarations, see include/lwip/prot/ subfolder.\n
+ * A port to GCC/clang is included in lwIP, if you use these compilers there is nothing to do here.
+ */
#ifndef PACK_STRUCT_STRUCT
+#if defined(__GNUC__) || defined(__clang__)
+#define PACK_STRUCT_STRUCT __attribute__((packed))
+#else
#define PACK_STRUCT_STRUCT
+#endif
#endif /* PACK_STRUCT_STRUCT */
+/** Packed structs support.
+ * Wraps u32_t and u16_t members.\n
+ * For examples of packed struct declarations, see include/lwip/prot/ subfolder.\n
+ * A port to GCC/clang is included in lwIP, if you use these compilers there is nothing to do here.
+ */
#ifndef PACK_STRUCT_FIELD
#define PACK_STRUCT_FIELD(x) x
#endif /* PACK_STRUCT_FIELD */
-/* Used for struct fields of u8_t,
- * where some compilers warn that packing is not necessary */
+/** Packed structs support.
+ * Wraps u8_t members, where some compilers warn that packing is not necessary.\n
+ * For examples of packed struct declarations, see include/lwip/prot/ subfolder.\n
+ * A port to GCC/clang is included in lwIP, if you use these compilers there is nothing to do here.
+ */
#ifndef PACK_STRUCT_FLD_8
#define PACK_STRUCT_FLD_8(x) PACK_STRUCT_FIELD(x)
#endif /* PACK_STRUCT_FLD_8 */
-/* Used for struct fields of that are packed structs themself,
- * where some compilers warn that packing is not necessary */
+/** Packed structs support.
+ * Wraps members that are packed structs themselves, where some compilers warn that packing is not necessary.\n
+ * For examples of packed struct declarations, see include/lwip/prot/ subfolder.\n
+ * A port to GCC/clang is included in lwIP, if you use these compilers there is nothing to do here.
+ */
#ifndef PACK_STRUCT_FLD_S
#define PACK_STRUCT_FLD_S(x) PACK_STRUCT_FIELD(x)
#endif /* PACK_STRUCT_FLD_S */
+/** Packed structs support using \#include files before and after struct to be packed.\n
+ * The file included BEFORE the struct is "arch/bpstruct.h".\n
+ * The file included AFTER the struct is "arch/epstruct.h".\n
+ * This can be used to implement struct packing on MS Visual C compilers, see
+ * the Win32 port in the lwIP contrib repository for reference.
+ * For examples of packed struct declarations, see include/lwip/prot/ subfolder.\n
+ * A port to GCC/clang is included in lwIP, if you use these compilers there is nothing to do here.
+ */
+#ifdef __DOXYGEN__
+#define PACK_STRUCT_USE_INCLUDES
+#endif
+/** Eliminates compiler warning about unused arguments (GCC -Wextra -Wunused). */
#ifndef LWIP_UNUSED_ARG
#define LWIP_UNUSED_ARG(x) (void)x
#endif /* LWIP_UNUSED_ARG */
-
-#ifdef LWIP_PROVIDE_ERRNO
-
-#define EPERM 1 /* Operation not permitted */
-#define ENOENT 2 /* No such file or directory */
-#define ESRCH 3 /* No such process */
-#define EINTR 4 /* Interrupted system call */
-#define EIO 5 /* I/O error */
-#define ENXIO 6 /* No such device or address */
-#define E2BIG 7 /* Arg list too long */
-#define ENOEXEC 8 /* Exec format error */
-#define EBADF 9 /* Bad file number */
-#define ECHILD 10 /* No child processes */
-#define EAGAIN 11 /* Try again */
-#define ENOMEM 12 /* Out of memory */
-#define EACCES 13 /* Permission denied */
-#define EFAULT 14 /* Bad address */
-#define ENOTBLK 15 /* Block device required */
-#define EBUSY 16 /* Device or resource busy */
-#define EEXIST 17 /* File exists */
-#define EXDEV 18 /* Cross-device link */
-#define ENODEV 19 /* No such device */
-#define ENOTDIR 20 /* Not a directory */
-#define EISDIR 21 /* Is a directory */
-#define EINVAL 22 /* Invalid argument */
-#define ENFILE 23 /* File table overflow */
-#define EMFILE 24 /* Too many open files */
-#define ENOTTY 25 /* Not a typewriter */
-#define ETXTBSY 26 /* Text file busy */
-#define EFBIG 27 /* File too large */
-#define ENOSPC 28 /* No space left on device */
-#define ESPIPE 29 /* Illegal seek */
-#define EROFS 30 /* Read-only file system */
-#define EMLINK 31 /* Too many links */
-#define EPIPE 32 /* Broken pipe */
-#define EDOM 33 /* Math argument out of domain of func */
-#define ERANGE 34 /* Math result not representable */
-#define EDEADLK 35 /* Resource deadlock would occur */
-#define ENAMETOOLONG 36 /* File name too long */
-#define ENOLCK 37 /* No record locks available */
-#define ENOSYS 38 /* Function not implemented */
-#define ENOTEMPTY 39 /* Directory not empty */
-#define ELOOP 40 /* Too many symbolic links encountered */
-#define EWOULDBLOCK EAGAIN /* Operation would block */
-#define ENOMSG 42 /* No message of desired type */
-#define EIDRM 43 /* Identifier removed */
-#define ECHRNG 44 /* Channel number out of range */
-#define EL2NSYNC 45 /* Level 2 not synchronized */
-#define EL3HLT 46 /* Level 3 halted */
-#define EL3RST 47 /* Level 3 reset */
-#define ELNRNG 48 /* Link number out of range */
-#define EUNATCH 49 /* Protocol driver not attached */
-#define ENOCSI 50 /* No CSI structure available */
-#define EL2HLT 51 /* Level 2 halted */
-#define EBADE 52 /* Invalid exchange */
-#define EBADR 53 /* Invalid request descriptor */
-#define EXFULL 54 /* Exchange full */
-#define ENOANO 55 /* No anode */
-#define EBADRQC 56 /* Invalid request code */
-#define EBADSLT 57 /* Invalid slot */
-
-#define EDEADLOCK EDEADLK
-
-#define EBFONT 59 /* Bad font file format */
-#define ENOSTR 60 /* Device not a stream */
-#define ENODATA 61 /* No data available */
-#define ETIME 62 /* Timer expired */
-#define ENOSR 63 /* Out of streams resources */
-#define ENONET 64 /* Machine is not on the network */
-#define ENOPKG 65 /* Package not installed */
-#define EREMOTE 66 /* Object is remote */
-#define ENOLINK 67 /* Link has been severed */
-#define EADV 68 /* Advertise error */
-#define ESRMNT 69 /* Srmount error */
-#define ECOMM 70 /* Communication error on send */
-#define EPROTO 71 /* Protocol error */
-#define EMULTIHOP 72 /* Multihop attempted */
-#define EDOTDOT 73 /* RFS specific error */
-#define EBADMSG 74 /* Not a data message */
-#define EOVERFLOW 75 /* Value too large for defined data type */
-#define ENOTUNIQ 76 /* Name not unique on network */
-#define EBADFD 77 /* File descriptor in bad state */
-#define EREMCHG 78 /* Remote address changed */
-#define ELIBACC 79 /* Can not access a needed shared library */
-#define ELIBBAD 80 /* Accessing a corrupted shared library */
-#define ELIBSCN 81 /* .lib section in a.out corrupted */
-#define ELIBMAX 82 /* Attempting to link in too many shared libraries */
-#define ELIBEXEC 83 /* Cannot exec a shared library directly */
-#define EILSEQ 84 /* Illegal byte sequence */
-#define ERESTART 85 /* Interrupted system call should be restarted */
-#define ESTRPIPE 86 /* Streams pipe error */
-#define EUSERS 87 /* Too many users */
-#define ENOTSOCK 88 /* Socket operation on non-socket */
-#define EDESTADDRREQ 89 /* Destination address required */
-#define EMSGSIZE 90 /* Message too long */
-#define EPROTOTYPE 91 /* Protocol wrong type for socket */
-#define ENOPROTOOPT 92 /* Protocol not available */
-#define EPROTONOSUPPORT 93 /* Protocol not supported */
-#define ESOCKTNOSUPPORT 94 /* Socket type not supported */
-#define EOPNOTSUPP 95 /* Operation not supported on transport endpoint */
-#define EPFNOSUPPORT 96 /* Protocol family not supported */
-#define EAFNOSUPPORT 97 /* Address family not supported by protocol */
-#define EADDRINUSE 98 /* Address already in use */
-#define EADDRNOTAVAIL 99 /* Cannot assign requested address */
-#define ENETDOWN 100 /* Network is down */
-#define ENETUNREACH 101 /* Network is unreachable */
-#define ENETRESET 102 /* Network dropped connection because of reset */
-#define ECONNABORTED 103 /* Software caused connection abort */
-#define ECONNRESET 104 /* Connection reset by peer */
-#define ENOBUFS 105 /* No buffer space available */
-#define EISCONN 106 /* Transport endpoint is already connected */
-#define ENOTCONN 107 /* Transport endpoint is not connected */
-#define ESHUTDOWN 108 /* Cannot send after transport endpoint shutdown */
-#define ETOOMANYREFS 109 /* Too many references: cannot splice */
-#define ETIMEDOUT 110 /* Connection timed out */
-#define ECONNREFUSED 111 /* Connection refused */
-#define EHOSTDOWN 112 /* Host is down */
-#define EHOSTUNREACH 113 /* No route to host */
-#define EALREADY 114 /* Operation already in progress */
-#define EINPROGRESS 115 /* Operation now in progress */
-#define ESTALE 116 /* Stale NFS file handle */
-#define EUCLEAN 117 /* Structure needs cleaning */
-#define ENOTNAM 118 /* Not a XENIX named type file */
-#define ENAVAIL 119 /* No XENIX semaphores available */
-#define EISNAM 120 /* Is a named type file */
-#define EREMOTEIO 121 /* Remote I/O error */
-#define EDQUOT 122 /* Quota exceeded */
-
-#define ENOMEDIUM 123 /* No medium found */
-#define EMEDIUMTYPE 124 /* Wrong medium type */
-
-#ifndef errno
-extern int errno;
-#endif
-
-#endif /* LWIP_PROVIDE_ERRNO */
+/**
+ * @}
+ */
#ifdef __cplusplus
}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/f52033e9/net/ip/lwip_base/include/lwip/autoip.h
----------------------------------------------------------------------
diff --git a/net/ip/lwip_base/include/lwip/autoip.h b/net/ip/lwip_base/include/lwip/autoip.h
index 2f66698..1d85bcc 100644
--- a/net/ip/lwip_base/include/lwip/autoip.h
+++ b/net/ip/lwip_base/include/lwip/autoip.h
@@ -88,6 +88,8 @@ u8_t autoip_supplied_address(const struct netif *netif);
/* for lwIP internal use by ip4.c */
u8_t autoip_accept_packet(struct netif *netif, const ip4_addr_t *addr);
+#define netif_autoip_data(netif) ((struct autoip*)netif_get_client_data(netif, LWIP_NETIF_CLIENT_DATA_INDEX_AUTOIP))
+
#ifdef __cplusplus
}
#endif
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/f52033e9/net/ip/lwip_base/include/lwip/debug.h
----------------------------------------------------------------------
diff --git a/net/ip/lwip_base/include/lwip/debug.h b/net/ip/lwip_base/include/lwip/debug.h
index 11d4775..a142f1c 100644
--- a/net/ip/lwip_base/include/lwip/debug.h
+++ b/net/ip/lwip_base/include/lwip/debug.h
@@ -40,28 +40,45 @@
#include "lwip/arch.h"
#include "lwip/opt.h"
-#ifdef __cplusplus
-extern "C" {
-#endif
+/**
+ * @defgroup debugging_levels LWIP_DBG_MIN_LEVEL and LWIP_DBG_TYPES_ON values
+ * @ingroup lwip_opts_debugmsg
+ * @{
+ */
-/** lower two bits indicate debug level
- * - 0 all
- * - 1 warning
- * - 2 serious
- * - 3 severe
+/** @name Debug level (LWIP_DBG_MIN_LEVEL)
+ * @{
*/
+/** Debug level: ALL messages*/
#define LWIP_DBG_LEVEL_ALL 0x00
-#define LWIP_DBG_LEVEL_OFF LWIP_DBG_LEVEL_ALL /* compatibility define only */
-#define LWIP_DBG_LEVEL_WARNING 0x01 /* bad checksums, dropped packets, ... */
-#define LWIP_DBG_LEVEL_SERIOUS 0x02 /* memory allocation failures, ... */
+/** Debug level: Warnings. bad checksums, dropped packets, ... */
+#define LWIP_DBG_LEVEL_WARNING 0x01
+/** Debug level: Serious. memory allocation failures, ... */
+#define LWIP_DBG_LEVEL_SERIOUS 0x02
+/** Debug level: Severe */
#define LWIP_DBG_LEVEL_SEVERE 0x03
+/**
+ * @}
+ */
+
#define LWIP_DBG_MASK_LEVEL 0x03
+/* compatibility define only */
+#define LWIP_DBG_LEVEL_OFF LWIP_DBG_LEVEL_ALL
+/** @name Enable/disable debug messages completely (LWIP_DBG_TYPES_ON)
+ * @{
+ */
/** flag for LWIP_DEBUGF to enable that debug message */
#define LWIP_DBG_ON 0x80U
/** flag for LWIP_DEBUGF to disable that debug message */
#define LWIP_DBG_OFF 0x00U
+/**
+ * @}
+ */
+/** @name Debug message types (LWIP_DBG_TYPES_ON)
+ * @{
+ */
/** flag for LWIP_DEBUGF indicating a tracing message (to follow program flow) */
#define LWIP_DBG_TRACE 0x40U
/** flag for LWIP_DEBUGF indicating a state debug message (to follow module states) */
@@ -70,11 +87,31 @@ extern "C" {
#define LWIP_DBG_FRESH 0x10U
/** flag for LWIP_DEBUGF to halt after printing this debug message */
#define LWIP_DBG_HALT 0x08U
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
/**
- * LWIP_NOASSERT: Disable LWIP_ASSERT checks.
- * -- To disable assertions define LWIP_NOASSERT in arch/cc.h.
+ * @defgroup lwip_assertions Assertion handling
+ * @ingroup lwip_opts_debug
+ * @{
+ */
+/**
+ * LWIP_NOASSERT: Disable LWIP_ASSERT checks:
+ * To disable assertions define LWIP_NOASSERT in arch/cc.h.
*/
+#ifdef __DOXYGEN__
+#define LWIP_NOASSERT
+#undef LWIP_NOASSERT
+#endif
+/**
+ * @}
+ */
+
#ifndef LWIP_NOASSERT
#define LWIP_ASSERT(message, assertion) do { if (!(assertion)) { \
LWIP_PLATFORM_ASSERT(message); }} while(0)
@@ -85,7 +122,6 @@ extern "C" {
#define LWIP_ASSERT(message, assertion)
#endif /* LWIP_NOASSERT */
-/** if "expression" isn't true, then print "message" and execute "handler" expression */
#ifndef LWIP_ERROR
#ifndef LWIP_NOASSERT
#define LWIP_PLATFORM_ERROR(message) LWIP_PLATFORM_ASSERT(message)
@@ -95,17 +131,23 @@ extern "C" {
#define LWIP_PLATFORM_ERROR(message)
#endif
+/* if "expression" isn't true, then print "message" and execute "handler" expression */
#define LWIP_ERROR(message, expression, handler) do { if (!(expression)) { \
LWIP_PLATFORM_ERROR(message); handler;}} while(0)
#endif /* LWIP_ERROR */
+/** Enable debug message printing, but only if debug message type is enabled
+ * AND is of correct type AND is at least LWIP_DBG_LEVEL.
+ */
+#ifdef __DOXYGEN__
+#define LWIP_DEBUG
+#undef LWIP_DEBUG
+#endif
+
#ifdef LWIP_DEBUG
#ifndef LWIP_PLATFORM_DIAG
#error "If you want to use LWIP_DEBUG, LWIP_PLATFORM_DIAG(message) needs to be defined in your arch/cc.h"
#endif
-/** print debug message only if debug message type is enabled...
- * AND is of correct type AND is at least LWIP_DBG_LEVEL
- */
#define LWIP_DEBUGF(debug, message) do { \
if ( \
((debug) & LWIP_DBG_ON) && \
@@ -122,9 +164,4 @@ extern "C" {
#define LWIP_DEBUGF(debug, message)
#endif /* LWIP_DEBUG */
-#ifdef __cplusplus
-}
-#endif
-
#endif /* LWIP_HDR_DEBUG_H */
-