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