Contiki-NG
Loading...
Searching...
No Matches
ip64-addr.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_ADDR_H
33#define IP64_ADDR_H
34
35#include "net/ipv6/uip.h"
36
37
38/**
39 * \brief Is IPv4-mapped Address
40 *
41 * See https://tools.ietf.org/html/rfc6890#page-14
42 */
43#define ip64_addr_is_ipv4_mapped_addr(a) \
44 ((((a)->u16[0]) == 0) && \
45 (((a)->u16[1]) == 0) && \
46 (((a)->u16[2]) == 0) && \
47 (((a)->u16[3]) == 0) && \
48 (((a)->u16[4]) == 0) && \
49 (((a)->u16[5]) == 0xFFFF))
50
51void ip64_addr_copy4(uip_ip4addr_t *dest, const uip_ip4addr_t *src);
52
53void ip64_addr_copy6(uip_ip6addr_t *dest, const uip_ip6addr_t *src);
54
55int ip64_addr_6to4(const uip_ip6addr_t *ipv6addr,
56 uip_ip4addr_t *ipv4addr);
57
58int ip64_addr_4to6(const uip_ip4addr_t *ipv4addr,
59 uip_ip6addr_t *ipv6addr);
60
61int ip64_addr_is_ip64(const uip_ip6addr_t *ipv6addr);
62
63void ip64_addr_set_prefix(const uip_ip6addr_t *prefix, uint8_t prefix_len);
64
65#endif /* IP64_ADDR_H */
66
Header file for the uIP TCP/IP stack.
Representation of an IP address.
Definition uip.h:95