ROHC compression/decompression library
ipv6.h
Go to the documentation of this file.
00001 /* Copyright (C) 1991-1997, 2001, 2003, 2006 Free Software Foundation, Inc.
00002    This file is part of the GNU C Library.
00003 
00004    The GNU C Library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Lesser General Public
00006    License as published by the Free Software Foundation; either
00007    version 2.1 of the License, or (at your option) any later version.
00008 
00009    The GNU C Library is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012    Lesser General Public License for more details.
00013 
00014    You should have received a copy of the GNU Lesser General Public
00015    License along with the GNU C Library; if not, write to the Free
00016    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00017    02111-1307 USA.  */
00018 
00019 /**
00020  * @file   ipv6.h
00021  * @brief  Defines the IPv6 header
00022  * @author Free Software Foundation, Inc
00023  *
00024  * This file contains a part of netinet/ip6.h from the GNU C library. It is
00025  * copied here to be portable on all platforms, even the platforms that miss
00026  * the declarations or got different declarations, such as Microsoft Windows
00027  * or FreeBSD.
00028  */
00029 
00030 #ifndef ROHC_PROTOCOLS_IPV6_H
00031 #define ROHC_PROTOCOLS_IPV6_H
00032 
00033 #include <stdint.h>
00034 
00035 
00036 /**
00037  * @brief The IPv6 address
00038  */
00039 struct ipv6_addr
00040 {
00041         union
00042         {
00043                 uint8_t __u6_addr8[16];
00044                 uint16_t __u6_addr16[8];
00045                 uint32_t __u6_addr32[4];
00046         } __in6_u;
00047 #define s6_addr         __in6_u.__u6_addr8
00048 #define s6_addr16               __in6_u.__u6_addr16
00049 #define s6_addr32               __in6_u.__u6_addr32
00050 };
00051 
00052 
00053 /**
00054  * @brief The IPv6 header
00055  */
00056 struct ipv6_hdr
00057 {
00058         union
00059         {
00060                 struct ip6_hdrctl
00061                 {
00062                         uint32_t ip6_un1_flow;   /* 4 bits version, 8 bits TC,
00063                                                     20 bits flow-ID */
00064                         uint16_t ip6_un1_plen;   /* payload length */
00065                         uint8_t  ip6_un1_nxt;    /* next header */
00066                         uint8_t  ip6_un1_hlim;   /* hop limit */
00067                 } ip6_un1;
00068                 uint8_t ip6_un2_vfc;       /* 4 bits version, top 4 bits tclass */
00069         } ip6_ctlun;
00070         struct ipv6_addr ip6_src;     /* source address */
00071         struct ipv6_addr ip6_dst;     /* destination address */
00072 };
00073 
00074 #define ip6_vfc   ip6_ctlun.ip6_un2_vfc
00075 #define ip6_flow  ip6_ctlun.ip6_un1.ip6_un1_flow
00076 #define ip6_plen  ip6_ctlun.ip6_un1.ip6_un1_plen
00077 #define ip6_nxt   ip6_ctlun.ip6_un1.ip6_un1_nxt
00078 #define ip6_hlim  ip6_ctlun.ip6_un1.ip6_un1_hlim
00079 #define ip6_hops  ip6_ctlun.ip6_un1.ip6_un1_hlim
00080 
00081 #endif