Contiki-NG
ip64.h
1/*
2 * Copyright (c) 2012, Thingsquare, http://www.thingsquare.com/.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 *
14 * 3. Neither the name of the copyright holder nor the names of its
15 * contributors may be used to endorse or promote products derived
16 * from this software without specific prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
21 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
22 * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
23 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
27 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
29 * OF THE POSSIBILITY OF SUCH DAMAGE.
30 *
31 */
32#ifndef IP64_H
33#define IP64_H
34
35#include "net/ipv6/uip.h"
36
37void ip64_init(void);
38int ip64_6to4(const uint8_t *ipv6packet, const uint16_t ipv6len,
39 uint8_t *resultpacket);
40int ip64_4to6(const uint8_t *ipv4packet, const uint16_t ipv4len,
41 uint8_t *resultpacket);
42
43void ip64_set_ipv4_address(const uip_ip4addr_t *ipv4addr,
44 const uip_ip4addr_t *netmask);
45void ip64_set_ipv6_address(const uip_ip6addr_t *ipv6addr);
46
47const uip_ip4addr_t *ip64_get_hostaddr(void);
48const uip_ip4addr_t *ip64_get_netmask(void);
49const uip_ip4addr_t *ip64_get_draddr(void);
50
51void ip64_set_hostaddr(const uip_ip4addr_t *hostaddr);
52void ip64_set_netmask(const uip_ip4addr_t *netmask);
53void ip64_set_draddr(const uip_ip4addr_t *draddr);
54
55int ip64_hostaddr_is_configured(void);
56
57extern uint8_t *ip64_packet_buffer;
58extern uint16_t ip64_packet_buffer_maxlen;
59
60#include "ip64-conf.h"
61
62#ifndef IP64_CONF_ETH_DRIVER
63#error IP64_CONF_ETH_DRIVER must be #defined in ip64-conf.h
64#else /* IP64_CONF_ETH_DRIVER */
65#define IP64_ETH_DRIVER IP64_CONF_ETH_DRIVER
66#endif /* IP64_CONF_ETH_DRIVER */
67
68#ifndef IP64_CONF_INPUT
69#error IP64_CONF_INPUT must be #defined in ip64-conf.h
70#else /* IP64_CONF_INPUT */
71#define IP64_INPUT IP64_CONF_INPUT
72#endif /* IP64_CONF_INPUT */
73
74#ifndef IP64_CONF_UIP_FALLBACK_INTERFACE
75#error IP64_CONF_UIP_FALLBACK_INTERFACE must be #defined in ip64-conf.h
76#else /* IP64_CONF_UIP_FALLBACK_INTERFACE */
77#define IP64_UIP_FALLBACK_INTERFACE IP64_CONF_UIP_FALLBACK_INTERFACE
78#endif /* IP64_CONF_UIP_FALLBACK_INTERFACE */
79
80#ifdef IP64_CONF_DHCP
81#define IP64_DHCP IP64_CONF_DHCP
82#else /* IP64_CONF_DHCP */
83/* Enable DHCP per default */
84#define IP64_DHCP 1
85#endif /* IP64_CONF_DHCP */
86
87#endif /* IP64_H */
88
Header file for the uIP TCP/IP stack.
Representation of an IP address.
Definition: uip.h:95