ROHC compression/decompression library
feedback_create.h
Go to the documentation of this file.
1 /*
2  * Copyright 2011,2013,2014 Didier Barvaux
3  * Copyright 2007,2009,2010,2012 Viveris Technologies
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18  */
19 
20 /**
21  * @file feedback_create.h
22  * @brief Functions to create ROHC feedback
23  * @author Didier Barvaux <didier.barvaux@toulouse.viveris.com>
24  * @author Didier Barvaux <didier@barvaux.org>
25  */
26 
27 #ifndef ROHC_DECOMP_FEEDBACK_CREATE_H
28 #define ROHC_DECOMP_FEEDBACK_CREATE_H
29 
30 #include <rohc/rohc.h>
31 #include <rohc/rohc_buf.h>
32 #include <feedback.h>
33 
34 #include <stdint.h>
35 #include <stdlib.h>
36 #include <stdbool.h>
37 
38 
39 /// The maximum length (in bytes) of the feedback data
40 #define FEEDBACK_DATA_MAX_LEN 30
41 
42 
43 /**
44  * @brief Defines a ROHC feedback.
45  */
46 struct d_feedback
47 {
48  /// The type of feedback (1 for FEEDBACK-1 and 2 for FEEDBACK-2)
50  /// The feedback data
52  /// The size of feedback data
53  int size;
54 };
55 
56 
57 /*
58  * Prototypes of public functions.
59  */
60 
61 bool rohc_decomp_feedback_size(const struct rohc_buf rohc_data,
62  size_t *const feedback_hdr_len,
63  size_t *const feedback_data_len)
64  __attribute__((warn_unused_result, nonnull(2, 3)));
65 
66 void f_feedback1(const uint32_t sn_bits, struct d_feedback *const feedback)
67  __attribute__((nonnull(2)));
68 
69 bool f_feedback2(const rohc_profile_t profile_id,
70  const enum rohc_feedback_ack_type ack_type,
71  const rohc_mode_t mode,
72  const uint32_t sn_bits,
73  const size_t sn_bits_nr,
74  struct d_feedback *const feedback)
75  __attribute__((warn_unused_result, nonnull(6)));
76 
77 bool f_add_option(struct d_feedback *const feedback,
78  const enum rohc_feedback_opt opt_type,
79  const uint8_t *const data,
80  const size_t data_len)
81  __attribute__((warn_unused_result, nonnull(1)));
82 
83 uint8_t * f_wrap_feedback(struct d_feedback *feedback,
84  const uint16_t cid,
85  const rohc_cid_type_t cid_type,
86  const rohc_feedback_crc_t protect_with_crc,
87  const uint8_t *const crc_table,
88  size_t *const final_size)
89  __attribute__((warn_unused_result, nonnull(1, 5, 6)));
90 
91 
92 #endif
93 
rohc_feedback_ack_type
Definition: feedback.h:50
rohc_mode_t
ROHC operation modes.
Definition: rohc.h:111
bool rohc_decomp_feedback_size(const struct rohc_buf rohc_data, size_t *const feedback_hdr_len, size_t *const feedback_data_len)
rohc_feedback_opt
Definition: feedback.h:72
uint8_t data[FEEDBACK_DATA_MAX_LEN]
The feedback data.
Definition: feedback_create.h:51
rohc_cid_type_t
The different types of Context IDs (CID)
Definition: rohc.h:176
int size
The size of feedback data.
Definition: feedback_create.h:53
Defines a ROHC feedback.
Definition: feedback_create.h:46
enum rohc_feedback_ack_type type
The type of feedback (1 for FEEDBACK-1 and 2 for FEEDBACK-2)
Definition: feedback_create.h:49
bool f_add_option(struct d_feedback *const feedback, const enum rohc_feedback_opt opt_type, const uint8_t *const data, const size_t data_len)
Add an option data to the FEEDBACK-2 packet.
Definition: feedback_create.c:249
A network buffer for the ROHC library.
Definition: rohc_buf.h:102
uint8_t * f_wrap_feedback(struct d_feedback *feedback, const uint16_t cid, const rohc_cid_type_t cid_type, const rohc_feedback_crc_t protect_with_crc, const uint8_t *const crc_table, size_t *const final_size)
Wrap the feedback packet and add a CRC option if specified.
Definition: feedback_create.c:408
#define FEEDBACK_DATA_MAX_LEN
The maximum length (in bytes) of the feedback data.
Definition: feedback_create.h:40
void f_feedback1(const uint32_t sn_bits, struct d_feedback *const feedback)
Build a FEEDBACK-1 packet.
Definition: feedback_create.c:58
rohc_profile_t
The different ROHC compression/decompression profiles.
Definition: rohc_profiles.h:70
bool f_feedback2(const rohc_profile_t profile_id, const enum rohc_feedback_ack_type ack_type, const rohc_mode_t mode, const uint32_t sn_bits, const size_t sn_bits_nr, struct d_feedback *const feedback)
Build a FEEDBACK-2 packet.
Definition: feedback_create.c:85
ROHC feedback definitions and formats.
rohc_feedback_crc_t
Whether the feedback is protected by a CRC or not.
Definition: feedback.h:62