ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/gvpe/src/rohc/decomp.h
Revision: 1.2
Committed: Tue Apr 26 00:55:56 2005 UTC (19 years, 2 months ago) by pcg
Content type: text/plain
Branch: MAIN
CVS Tags: rel-2_01, rel-3_0, rel-2_2, rel-2_0, rel-2_21, rel-2_22, rel-2_25, HEAD
Changes since 1.1: +1 -1 lines
Log Message:
*** empty log message ***

File Contents

# User Rev Content
1 pcg 1.1 /*
2     ROHC Project 2003 at Lulea University of Technology, Sweden.
3     Authors: Andreas Vernersson <andver-8@student.luth.se>
4     Daniel Pettersson <danpet-7@student.luth.se>
5     Erik Soderstrom <soderstrom@yahoo.com>
6     Fredrik Lindstrom <frelin-9@student.luth.se>
7     Johan Stenmark <johste-8@student.luth.se>
8     Martin Juhlin <juhlin@users.sourceforge.net>
9     Mikael Larsson <larmik-9@student.luth.se>
10     Robert Maxe <robmax-1@student.luth.se>
11    
12     Copyright (C) 2003 Andreas Vernersson, Daniel Pettersson,
13     Erik Soderström, Fredrik Lindström, Johan Stenmark,
14     Martin Juhlin, Mikael Larsson, Robert Maxe.
15    
16     This program is free software; you can redistribute it and/or modify
17     it under the terms of the GNU General Public License as published by
18     the Free Software Foundation; either version 2 of the License, or
19     (at your option) any later version.
20    
21     This program is distributed in the hope that it will be useful,
22     but WITHOUT ANY WARRANTY; without even the implied warranty of
23     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24     GNU General Public License for more details.
25    
26     You should have received a copy of the GNU General Public License
27     along with this program; if not, write to the Free Software
28 pcg 1.2 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
29 pcg 1.1 */
30     //----------------------------------------------------------------------------------------------------------------------------------
31     #ifndef _DECOMP_H
32     #define _DECOMP_H
33     //----------------------------------------------------------------------------------------------------------------------------------
34     #include "rohc.h"
35     #include "d_util.h"
36     #include "comp.h"
37    
38     #define D_NUM_PROFILES 4
39     //----------------------------------------------------------------------------------------------------------------------------------
40     struct sd_decode_data
41     {
42     int cid;
43     int addcidUsed;
44     int largecidUsed;
45     struct sd_context * active;
46     };
47     //----------------------------------------------------------------------------------------------------------------------------------
48     struct sd_statistics
49     {
50     unsigned int packets_received;
51     unsigned int packets_failed_crc;
52     unsigned int packets_failed_no_context;
53     unsigned int packets_failed_package;
54     unsigned int packets_feedback;
55     };
56     //----------------------------------------------------------------------------------------------------------------------------------
57     struct sd_rohc
58     {
59     struct sd_context ** context;
60     int context_array_size;
61    
62     struct s_medium * medium;
63     struct sc_rohc * compressor;
64    
65     unsigned int maxval; // updated from GUI
66     unsigned int errval;
67     unsigned int okval;
68     int curval;
69    
70     struct sd_statistics statistics;
71     };
72     //----------------------------------------------------------------------------------------------------------------------------------
73     // Medium specific data
74     //----------------------------------------------------------------------------------------------------------------------------------
75     struct s_medium
76     {
77     int cid_type; // large or small cid
78     int max_cid; // maximum cid value
79     };
80     //----------------------------------------------------------------------------------------------------------------------------------
81     // The context structure
82     //----------------------------------------------------------------------------------------------------------------------------------
83     struct sd_context
84     {
85     //int last_failed;
86    
87     struct s_profile * profile; // used profile
88    
89     void * data; // profile data
90    
91     int mode; // U_MODE, O_MODE, R_MODE
92     int state; // NO_CONTEXT, STATIC_CONTEXT, FULL_CONTEXT
93    
94    
95     int latest_used, first_used; // timestamps..
96    
97     // statistics variables..
98     int total_uncompressed_size, total_compressed_size;
99     int header_uncompressed_size, header_compressed_size;
100     int num_recv_packets, num_recv_ir, num_recv_ir_dyn, num_sent_feedbacks;
101     int num_decomp_failures, num_decomp_repairs;
102     struct sc_wlsb *total_16_uncompressed, *total_16_compressed;
103     struct sc_wlsb *header_16_uncompressed, *header_16_compressed;
104    
105     int curval;
106     };
107     //----------------------------------------------------------------------------------------------------------------------------------
108     // The profile structure
109     //----------------------------------------------------------------------------------------------------------------------------------
110     struct s_profile
111     {
112     int id; // 0x0000 fr uncompress, etc
113     char *version;
114     char *description;
115    
116     int (*decode) (
117     struct sd_rohc * state,
118     struct sd_context * context,
119     unsigned char * src,
120     int size,
121     int second_byte,
122     unsigned char * dest
123     );
124    
125     int (*decode_ir) (
126     struct sd_rohc * state,
127     struct sd_context * context,
128     unsigned char * src,
129     int size,
130     int last_bit,
131     unsigned char * dest
132     );
133    
134     void *(*allocate_decode_data)(void);
135     void (*free_decode_data)(void *);
136    
137     int (*detect_ir_size)(unsigned char * first_byte, int second_byte_add);
138     int (*detect_ir_dyn_size)(unsigned char * first_byte, struct sd_context * context);
139     int (*get_sn)(struct sd_context * context);
140     };
141     //----------------------------------------------------------------------------------------------------------------------------------
142     void context_array_increase(struct sd_rohc * state, int highestcid);
143     void context_array_decrease(struct sd_rohc * state);
144    
145     struct sd_context * find_context(struct sd_rohc * state, int cid);
146     struct sd_context * context_create(struct sd_rohc * state, int with_cid, struct s_profile * profile);
147     void context_free(struct sd_context * context);
148    
149     struct sd_rohc * rohc_alloc_decompressor(struct sc_rohc *compressor);
150     void rohc_free_decompressor(struct sd_rohc * state);
151     int rohc_decompress(struct sd_rohc * state, unsigned char * ibuf, int isize, unsigned char * obuf, int osize );
152    
153     int rohc_d_statistics(struct sd_rohc *, char *buffer); // store statistics about decompressor
154     int rohc_d_context(struct sd_rohc *, int index, char *buffer); // store statistics about a context
155    
156     int rohc_decompress_both(struct sd_rohc * state, unsigned char * ibuf, int isize, unsigned char * obuf, int osize, int large);
157    
158     int d_decode_header(struct sd_rohc * state, unsigned char * ibuf, int isize, unsigned char * obuf, int osize, struct sd_decode_data * ddata);
159     int d_decode_feedback(struct sd_rohc * state, unsigned char * ibuf);
160     int d_decode_feedback_first(struct sd_rohc * state, unsigned char ** walk, const int isize);
161    
162     void d_operation_mode_feedback(struct sd_rohc * state, int rohc_status, int cid, int addcidUsed, int largecidUsed, int mode, struct sd_context * ctxt);
163     void d_change_mode_feedback(struct sd_rohc * state, struct sd_context * ctxt);
164    
165     int rohc_ir_packet_crc_ok(unsigned char * walk, const int largecid, const int addcidUsed, const struct s_profile * profile);
166     int rohc_ir_dyn_packet_crc_ok(unsigned char * walk, const int largecid, const int addcidUsed, const struct s_profile * profile, struct sd_context * context);
167    
168     void clear_statistics(struct sd_rohc * state);
169     void usergui_interactions(struct sd_rohc * state, int feedback_maxval);
170     //----------------------------------------------------------------------------------------------------------------------------------
171     #endif
172     //----------------------------------------------------------------------------------------------------------------------------------