00001 /* 00002 * Copyright 2015 Didier Barvaux 00003 * 00004 * This 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 * This 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 this library; if not, write to the Free Software 00016 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00017 */ 00018 00019 /** 00020 * @file protocols/ip.h 00021 * @brief Defines the common IPv4/v6 header 00022 * @author Didier Barvaux <didier@barvaux.org> 00023 */ 00024 00025 #ifndef ROHC_PROTOCOLS_IP_H 00026 #define ROHC_PROTOCOLS_IP_H 00027 00028 #include <stdint.h> 00029 00030 #ifdef __KERNEL__ 00031 # include <endian.h> 00032 #else 00033 # include "config.h" /* for WORDS_BIGENDIAN */ 00034 #endif 00035 00036 00037 /** The common IPv4/v6 header */ 00038 struct ip_hdr 00039 { 00040 #if WORDS_BIGENDIAN == 1 00041 uint8_t version:4; /**< The IP version */ 00042 uint8_t reserved:4; /**< That field depends on IP version */ 00043 #else 00044 uint8_t reserved:4; 00045 uint8_t version:4; 00046 #endif 00047 } __attribute__((packed)); 00048 00049 00050 #endif 00051
1.6.1