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 feedback.h 00019 * @brief ROHC feedback routines. 00020 * @author Didier Barvaux <didier.barvaux@toulouse.viveris.com> 00021 * @author Didier Barvaux <didier@barvaux.org> 00022 * @author The hackers from ROHC for Linux 00023 */ 00024 00025 #ifndef FEEDBACK_H 00026 #define FEEDBACK_H 00027 00028 #include "rohc.h" 00029 00030 #include <stdint.h> 00031 #include <stdlib.h> 00032 00033 00034 /// CRC option for the FEEDBACK-2 packet 00035 #define OPT_TYPE_CRC 1 00036 /// Reject option for the FEEDBACK-2 packet 00037 #define OPT_TYPE_REJECT 2 00038 /// SN-not-valid option for the FEEDBACK-2 packet 00039 #define OPT_TYPE_SN_NOT_VALID 3 00040 /// SN option for the FEEDBACK-2 packet 00041 #define OPT_TYPE_SN 4 00042 /// Clock option for the FEEDBACK-2 packet (not used) 00043 #define OPT_TYPE_CLOCK 5 00044 /// Jitter option for the FEEDBACK-2 packet (not used) 00045 #define OPT_TYPE_JITTER 6 00046 /// Loss option for the FEEDBACK-2 packet 00047 #define OPT_TYPE_LOSS 7 00048 00049 00050 /// Feedback ACK 00051 #define ACKTYPE_ACK 0 00052 /// Feedback Negative ACK 00053 #define ACKTYPE_NACK 1 00054 /// Feedback Satic Negative ACK 00055 #define ACKTYPE_STATIC_NACK 2 00056 00057 00058 /// Do not add a CRC option in Feedback packet 00059 #define NO_CRC 0 00060 /// Do add a CRC option in Feedback packet 00061 #define WITH_CRC 1 00062 00063 00064 /// The maximum length (in bytes) of the feedback data 00065 #define FEEDBACK_DATA_MAX_LEN 30 00066 00067 00068 /** 00069 * @brief Defines a ROHC feedback. 00070 */ 00071 struct d_feedback 00072 { 00073 /// The type of feedback (1 for FEEDBACK-1 and 2 for FEEDBACK-2) 00074 int type; 00075 /// The feedback data 00076 char data[FEEDBACK_DATA_MAX_LEN]; 00077 /// The size of feedback data 00078 int size; 00079 }; 00080 00081 00082 /* 00083 * Prototypes of public functions. 00084 */ 00085 00086 int f_feedback1(int sn, struct d_feedback *feedback); 00087 00088 int f_feedback2(int acktype, int mode, uint32_t sn, struct d_feedback *feedback); 00089 00090 int f_add_option(struct d_feedback *feedback, 00091 const uint8_t opt_type, 00092 const unsigned char *data, 00093 const size_t data_len); 00094 00095 unsigned char * f_wrap_feedback(struct d_feedback *feedback, 00096 const uint16_t cid, 00097 const rohc_cid_type_t cid_type, 00098 int with_crc, 00099 unsigned char *crc_table, 00100 int *final_size); 00101 00102 00103 #endif 00104