Contiki 3.x
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  * 3. Neither the name of the copyright holder nor the names of its
14  * contributors may be used to endorse or promote products derived
15  * from this software without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
20  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
21  * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
22  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
28  * OF THE POSSIBILITY OF SUCH DAMAGE.
29  *
30  */
31 #ifndef IP64_H
32 #define IP64_H
33 
34 #include "net/ip/uip.h"
35 
36 void ip64_init(void);
37 int ip64_6to4(const uint8_t *ipv6packet, const uint16_t ipv6len,
38  uint8_t *resultpacket);
39 int ip64_4to6(const uint8_t *ipv4packet, const uint16_t ipv4len,
40  uint8_t *resultpacket);
41 
42 void ip64_set_ipv4_address(const uip_ip4addr_t *ipv4addr,
43  const uip_ip4addr_t *netmask);
44 void ip64_set_ipv6_address(const uip_ip6addr_t *ipv6addr);
45 
46 const uip_ip4addr_t *ip64_get_hostaddr(void);
47 const uip_ip4addr_t *ip64_get_netmask(void);
48 const uip_ip4addr_t *ip64_get_draddr(void);
49 
50 void ip64_set_hostaddr(const uip_ip4addr_t *hostaddr);
51 void ip64_set_netmask(const uip_ip4addr_t *netmask);
52 void ip64_set_draddr(const uip_ip4addr_t *draddr);
53 
54 int ip64_hostaddr_is_configured(void);
55 
56 extern uint8_t *ip64_packet_buffer;
57 extern uint16_t ip64_packet_buffer_maxlen;
58 
59 #include "ip64-conf.h"
60 
61 #ifndef IP64_CONF_ETH_DRIVER
62 #error IP64_CONF_ETH_DRIVER must be #defined in ip64-conf.h
63 #else /* IP64_CONF_ETH_DRIVER */
64 #define IP64_ETH_DRIVER IP64_CONF_ETH_DRIVER
65 #endif /* IP64_CONF_ETH_DRIVER */
66 
67 #ifndef IP64_CONF_INPUT
68 #error IP64_CONF_INPUT must be #defined in ip64-conf.h
69 #else /* IP64_CONF_INPUT */
70 #define IP64_INPUT IP64_CONF_INPUT
71 #endif /* IP64_CONF_INPUT */
72 
73 
74 
75 #endif /* IP64_H */
76 
Header file for the uIP TCP/IP stack.
Representation of an IP address.
Definition: uip.h:101