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/rohc_buf.h> 00030 #include "ip.h" 00031 #include "rohc_traces.h" 00032 00033 00034 /** The key to help identify (not quaranted unique) a compression context */ 00035 typedef uint32_t rohc_ctxt_key_t; 00036 00037 00038 /** One network packet */ 00039 struct net_pkt 00040 { 00041 const uint8_t *data; /**< The packet data */ 00042 size_t len; /**< The length (in bytes) of the packet data */ 00043 00044 size_t ip_hdr_nr; /**< The number of IP headers */ 00045 struct ip_packet outer_ip; /**< The outer IP header */ 00046 struct ip_packet inner_ip; /**< The inner IP header if any */ 00047 00048 struct net_hdr *transport; /**< The transport layer of the packet if any */ 00049 00050 rohc_ctxt_key_t key; /**< The hash key of the packet */ 00051 00052 /** The callback function used to manage traces */ 00053 rohc_trace_callback2_t trace_callback; 00054 /** The private context of the callback function used to manage traces */ 00055 void *trace_callback_priv; 00056 }; 00057 00058 00059 bool net_pkt_parse(struct net_pkt *const packet, 00060 const struct rohc_buf data, 00061 rohc_trace_callback2_t trace_cb, 00062 void *const trace_cb_priv, 00063 rohc_trace_entity_t trace_entity) 00064 __attribute__((warn_unused_result, nonnull(1))); 00065 00066 size_t net_pkt_get_payload_offset(const struct net_pkt *const packet) 00067 __attribute__((warn_unused_result, nonnull(1))); 00068 00069 #endif 00070
1.6.1