Commit graph

25 commits

Author SHA1 Message Date
Adam Dunkels 65eba46be2 Moved all generic IP files into the net/ip module 2014-01-26 23:20:21 +01:00
Oliver Schmidt c4bba3e89a Removed unnecessary code from resolver. 2013-09-09 21:35:51 +02:00
Oliver Schmidt e0ddea2a17 Removed unnecessary code from resolver. 2013-09-01 20:23:11 +02:00
Robert Quattlebaum d0b99cc3cc resolv: Fix for bad NSEC record on announce 2013-05-19 16:09:50 -07:00
Robert Quattlebaum 0bed4b17a2 resolv: Fix for word alignment issues in mdns_prep_host_announce_packet(). 2013-05-18 10:43:09 -07:00
Robert Quattlebaum da81360731 core/net/resolv: Misc. updates and cleanups. 2013-03-14 19:14:32 -07:00
Robert Quattlebaum 7e9f472faa core/net/resolv: Fix for resolving CNAME records. 2013-03-14 19:13:51 -07:00
Robert Quattlebaum 639a9ca399 core/net/resolv: Fix for SDCC. 2013-03-14 19:13:04 -07:00
Oliver Schmidt 46cb6013ae Reduced code size.
Combined recent changes from darconeous...
- Refactor to decrease minimum code footprint.
- Added `RESOLV_CONF_SUPPORTS_RECORD_EXPIRATION`.
...with a few additional changes to reduce code size.
2013-03-14 22:53:52 +01:00
Oliver Schmidt d8862bd243 Some more changes improving code style conformance and code size. 2013-03-13 17:52:57 +01:00
Oliver Schmidt 7a1fa4de6c Some coding style nomalization. 2013-03-13 16:14:29 +01:00
Oliver Schmidt 8fa9767d47 Restored Contiki compatibility with non-C99 compilers.
(and compilers without non-standard extensions like void pointer arithmetic)
2013-03-13 14:40:24 +01:00
Robert Quattlebaum f145c17039 core/net/resolv: IPv6 and mDNS ("Bonjour") support. Major refactor.
This patch updates the DNS resolver to support IPv6 and introduces an
improved API for looking up DNS entries. This patch also adds optional
support for mDNS lookups and responses to the DNS resolver.

Here is a quick summary of the changes:

 * Added support for IPv6 lookups.
 * DNS queries now honor record expiration.
 * Added support for mDNS, compatible with "Bonjour".
 * Implemented a new lookup api, `resolv_lookup2()`, which provides
   more information about the state of the record(error, expired,
   looking-up, etc.).

About mDNS/Bonjour Support
--------------------------

This patch adds basic support for mDNS/Bonjour, which allows you to
refer to the name of a device instead of its IP address. This is
incredibly convenient for IPv6 addresses because they tend to be very
long and difficult to remember. It is especially important for
link-local IPv6 addresses, since not all programs support the '%'
notation for indicating a network interface (required on systems with
more than one network interface to disambiguate).

In other words, instead of typing in this:

 * `http://[fe80::58dc:d7ed:a644:628f%en1]/`

You can type this instead:

 * `http://contiki.local/`

Huge improvement, no?

The convenience extends beyond that: this mechanism can be used for
nodes to talk to each other based on their human-readable names instead
of their IPv6 addresses. So instead of a switch on
`aaaa::58dc:d7ed:a644:628f` triggering an actuator on
`aaaa::ed26:19c1:4bd2:f95b`, `light-switch.local` can trigger the
actuator on `living-room-lights.local`.

What you need to do to be able to look up `.local` names on your
workstation depends on a few factors:

 * Your machine needs to be able to send and receive multicast packets
   to and from the LoWPAN. You can do this easily with the Jackdaw
   firmware on an RZUSBStick. If you have a border router, you will need
   it to bridge the mDNS multicast packets across the border.

 * If you are using a Mac, you win. All Apple devices support mDNS
   lookups.

 * If you are using Windows, you can install Apple's Bonjour for Windows
   package. (This may be already installed on your machine if you have
   installed iTunes) After you install this you can easily do `.local`
   lookups.

 * If you are using a Unix machine, you can install Avahi.

The default hostname is set to `contiki.local.`. You can change the
hostname programmatically by calling `resolv_set_hostname()`. You can
change the default hostname by changing `CONTIKI_CONF_DEFAULT_HOSTNAME`.

You may disable mDNS support by setting `RESOLV_CONF_SUPPORTS_MDNS` to
`0`.

---------------------------------

core/net/resolv: `resolv_lookup2()` -> `resolv_lookup()`

Note that this patch should fix several `resolv_lookup()` bugs
that already existed. There were many cases where `resolv_lookup()`
was being called and the IP address ignored, but later code
assumed that the IP address had been fetched... ANYWAY, those
should be fixed now.

---------------------------------

examples/udp-ipv6: Updated client to use MDNS to lookup the server.

Also updated the Cooja regression test simulation.
2013-03-10 11:40:08 -07:00
Adam Dunkels 944537fccf Removed all old RCS tags in the Contiki source tree. Those RCS tags are not used any more, as we are now using git to manage the Contiki source tree 2012-10-26 15:54:49 +02:00
Nicholas J Humfrey 3fe55673d3 Converted deprecated uIP types in the network stack to standard C99 names (in stdint.h) 2012-02-17 22:45:13 +00:00
adamdunkels 5585d72c86 A simple but substantial change: uIP used the htons()/HTONS() macro
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.
2010-10-19 18:29:03 +00:00
nifi b54c6e673b Updated API for uiplib and resolv to use uip_ipaddr_t instead of uint16_t for compability with IPv6 2010-05-31 15:22:08 +00:00
dak664 bb9afb4fb1 Remove compiler warning 2010-02-15 20:49:38 +00:00
adamdunkels 1e1e44a3f8 Fixed compiler warnings to make code compile with gcc's -pedantic switch 2007-11-17 18:01:00 +00:00
matsutsuka a6527b34d9 When UIP_UDP is off, turn off udp functions more accurately. 2007-09-29 03:54:18 +00:00
oliverschmidt cada8d324f Up to now the DNS resolver relied on the uIP 1/2 second polling for its retry management (implementing a linear back-off). But Contiki 2.x uIP doesn't implement the 1/2 second polling for UDP connections anymore! Therefore I added an event timer to the DNS resolver for its retry management. I went for a 1 second interval (still with the same linear back-off) as compromise between officially recommended longer intervals (i.e. BIND with 5 seconds and exponential back-off) and a reasonable user experience for the self induced packet loss in ARP setups. 2007-01-07 13:52:25 +00:00
oliverschmidt 3e92f843ba More uip_ipaddr_t fixes. 2006-09-18 23:27:42 +00:00
oliverschmidt 5bd04b9c0d Avoid compiler warnings. 2006-08-14 23:31:40 +00:00
bg- fb94d50410 Change typedef of uip_ipaddr_t from a vector type to a union.
typedef union uip_ip4addr_t {
  u16_t u16[2];
  u8_t  u8[4];
} uip_ip4addr_t;

typedef uip_ip4addr_t uip_ipaddr_t;

This implies that one must consistently pass pointers to
uip_ipaddr_t:s and not mix and match pointers with
uip_ipaddr_t:s as was done earlier.
2006-08-09 16:13:39 +00:00
adamdunkels c9e808d638 Import of the contiki-2.x development code from the SICS internal CVS server 2006-06-17 22:41:10 +00:00