ROHC compression/decompression library
|
00001 /* 00002 * This program is free software; you can redistribute it and/or modify 00003 * it under the terms of the GNU General Public License as published by 00004 * the Free Software Foundation; either version 2 of the License, or 00005 * (at your option) any later version. 00006 * 00007 * This program is distributed in the hope that it will be useful, 00008 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00009 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00010 * GNU General Public License for more details. 00011 * 00012 * You should have received a copy of the GNU General Public License 00013 * along with this program; if not, write to the Free Software 00014 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00015 */ 00016 00017 /** 00018 * @file c_udp.h 00019 * @brief ROHC compression context for the UDP profile. 00020 * @author Didier Barvaux <didier.barvaux@toulouse.viveris.com> 00021 * @author The hackers from ROHC for Linux 00022 */ 00023 00024 #ifndef C_UDP_H 00025 #define C_UDP_H 00026 00027 #include "c_generic.h" 00028 #include "protocols/udp.h" 00029 00030 00031 /** 00032 * @brief Define the UDP-specific temporary variables in the profile compression 00033 * context. 00034 * 00035 * This object must be used by the UDP-specific decompression context sc_udp_context. 00036 * 00037 * @see sc_udp_context 00038 */ 00039 struct udp_tmp_vars 00040 { 00041 /// The number of UDP fields that changed in the UDP header 00042 int send_udp_dynamic; 00043 }; 00044 00045 00046 /** 00047 * @brief Define the UDP part of the profile decompression context. 00048 * 00049 * This object must be used with the generic part of the decompression 00050 * context c_generic_context. 00051 * 00052 * @see c_generic_context 00053 */ 00054 struct sc_udp_context 00055 { 00056 /// The number of times the checksum field was added to the compressed header 00057 int udp_checksum_change_count; 00058 00059 /// The previous UDP header 00060 struct udphdr old_udp; 00061 00062 /// @brief UDP-specific temporary variables that are used during one single 00063 /// compression of packet 00064 struct udp_tmp_vars tmp; 00065 }; 00066 00067 00068 /* 00069 * Function prototypes. 00070 */ 00071 00072 int c_udp_create(struct c_context *const context, const struct ip_packet *ip); 00073 00074 int c_udp_check_context(const struct c_context *context, 00075 const struct ip_packet *ip); 00076 00077 int c_udp_encode(struct c_context *const context, 00078 const struct ip_packet *ip, 00079 const int packet_size, 00080 unsigned char *const dest, 00081 const int dest_size, 00082 rohc_packet_t *const packet_type, 00083 int *const payload_offset); 00084 00085 void udp_decide_state(struct c_context *const context); 00086 00087 int udp_code_uo_remainder(const struct c_context *context, 00088 const unsigned char *next_header, 00089 unsigned char *const dest, 00090 int counter); 00091 00092 int udp_code_static_udp_part(const struct c_context *context, 00093 const unsigned char *next_header, 00094 unsigned char *const dest, 00095 int counter); 00096 00097 00098 #endif 00099