This patch enables automatic route setup and cleanup when
starting and stopping the minimal-net target on OS X.
Both IPv4 and IPv6 are supported.
Using the minimal-net target on OS X was absolute hell
before I came up with this patch. Now it is painless.
The minimal-net target, as currently written, wakes up the
CPU every millisecond to check for packets, and will only
react in real-time to input from stdin. If you are running
this on a laptop battery, your battery will quickly drain.
This change allows the CPU to idle when there is literally
nothing to do while still being responsive to input from
stein and/or incoming packets. This fix should significantly
improve performance while significantly improving power
usage. Win-win.
Also added `_xassert()` implementation so that the contiki-
provided `assert()` macro will work properly when used
on this platform.
functions for converting between host and network byte order. These
names are the de facto standard names for this functionality because
of the original BSD TCP/IP implementation. But they cause problems for
uIP/Contiki: some platforms define these names themselves (Mac OS,
most notably), causing compilation problems for Contiki on those
platforms.
This commit changes all htons to uip_htons instead. Same goes for
htonl, ntohs, and ntohl. All-caps versions as well.
Now tcpip_output() is a function pointer that is supposed to be set via the macro tcpip_set_outputfunc(). Packet drivers do so on process startup.
Thus if there are several packet drivers in a Contiki system the one started last is the one actually used. This behaviour is especially useful for the 'IP forwarding' "meta" packet driver.
This change means that one needs to select _ONE_ cfs implementation at Contiki library link time. But this doesn't appear to be an issue as all platforms have their "favorite" implementation anyway.