ROHC compression/decompression library
|
00001 /* 00002 * Copyright 2014 Didier Barvaux 00003 * Copyright 2014 Viveris Technologies 00004 * 00005 * This library is free software; you can redistribute it and/or 00006 * modify it under the terms of the GNU Lesser General Public 00007 * License as published by the Free Software Foundation; either 00008 * version 2.1 of the License, or (at your option) any later version. 00009 * 00010 * This library is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 * Lesser General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU Lesser General Public 00016 * License along with this library; if not, write to the Free Software 00017 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00018 */ 00019 00020 /** 00021 * @file common/net_pkt.h 00022 * @brief Network packet (may contains several IP headers) 00023 * @author Didier Barvaux <didier.barvaux@toulouse.viveris.com> 00024 */ 00025 00026 #ifndef ROHC_COMMON_NET_PKT_H 00027 #define ROHC_COMMON_NET_PKT_H 00028 00029 #include "rohc_buf.h" 00030 #include "ip.h" 00031 #include "rohc_traces.h" 00032 00033 #include "dllexport.h" 00034 00035 #include "config.h" /* for ROHC_ENABLE_DEPRECATED_API */ 00036 00037 00038 /** The key to help identify (not quaranted unique) a compression context */ 00039 typedef uint32_t rohc_ctxt_key_t; 00040 00041 00042 /** One network packet */ 00043 struct net_pkt 00044 { 00045 const uint8_t *data; /**< The packet data */ 00046 size_t len; /**< The length (in bytes) of the packet data */ 00047 00048 size_t ip_hdr_nr; /**< The number of IP headers */ 00049 struct ip_packet outer_ip; /**< The outer IP header */ 00050 struct ip_packet inner_ip; /**< The inner IP header if any */ 00051 00052 struct net_hdr *transport; /**< The transport layer of the packet if any */ 00053 00054 rohc_ctxt_key_t key; /**< The hash key of the packet */ 00055 00056 #if !defined(ROHC_ENABLE_DEPRECATED_API) || ROHC_ENABLE_DEPRECATED_API == 1 00057 /** The old callback function used to manage traces */ 00058 rohc_trace_callback_t trace_callback; 00059 #endif 00060 /** The new callback function used to manage traces */ 00061 rohc_trace_callback2_t trace_callback2; 00062 /** The private context of the callback function used to manage traces */ 00063 void *trace_callback_priv; 00064 }; 00065 00066 00067 bool ROHC_EXPORT net_pkt_parse(struct net_pkt *const packet, 00068 const struct rohc_buf data, 00069 #if !defined(ROHC_ENABLE_DEPRECATED_API) || ROHC_ENABLE_DEPRECATED_API == 1 00070 rohc_trace_callback_t trace_cb, 00071 #endif 00072 rohc_trace_callback2_t trace_cb2, 00073 void *const trace_cb_priv, 00074 rohc_trace_entity_t trace_entity) 00075 __attribute__((warn_unused_result, nonnull(1))); 00076 00077 size_t ROHC_EXPORT net_pkt_get_payload_offset(const struct net_pkt *const packet) 00078 __attribute__((warn_unused_result, nonnull(1))); 00079 00080 #endif 00081