ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/gvpe/src/rohc/rohc.h
(Generate patch)

Comparing gvpe/src/rohc/rohc.h (file contents):
Revision 1.1 by pcg, Sun Feb 8 06:02:44 2004 UTC vs.
Revision 1.2 by pcg, Sun Feb 8 07:24:25 2004 UTC

28 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 28 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
29*/ 29*/
30#ifndef _ROHC_H 30#ifndef _ROHC_H
31#define _ROHC_H 31#define _ROHC_H
32 32
33#include <netinet/ip.h>
34#include <netinet/udp.h>
35
36#include <inttypes.h>
37
38uint16_t typedef u16;
39uint32_t typedef u32;
40
33// ROHC_DEBUG_LEVEL determines the level of output produced by ROHC module 41// ROHC_DEBUG_LEVEL determines the level of output produced by ROHC module
34// 0 == error messages only (useable in kernel module) 42// 0 == error messages only (useable in kernel module)
35// 1 == a few informative messages also 43// 1 == a few informative messages also
36// 2 == more informative messages (useable for user mode debugging) 44// 2 == more informative messages (useable for user mode debugging)
37// 3 == even more informative messages 45// 3 == even more informative messages
139#define PACKAGE_IR 4 147#define PACKAGE_IR 4
140#define PACKAGE_UNKNOWN 5 148#define PACKAGE_UNKNOWN 5
141#define PACKAGE_CE 6 149#define PACKAGE_CE 6
142#define PACKAGE_CE_OFF 7 150#define PACKAGE_CE_OFF 7
143 151
144// DO NOT CHANGE THIS NUMBERS! 152// DO NOT CHANGE THESE NUMBERS!
145#define PACKAGE_EXT_0 0 153#define PACKAGE_EXT_0 0
146#define PACKAGE_EXT_1 1 154#define PACKAGE_EXT_1 1
147#define PACKAGE_EXT_2 2 155#define PACKAGE_EXT_2 2
148#define PACKAGE_EXT_3 3 156#define PACKAGE_EXT_3 3
149 157
155#define CRC_ACTION 1 163#define CRC_ACTION 1
156 164
157#define WEIGHT_OLD 1 165#define WEIGHT_OLD 1
158#define WEIGHT_NEW 1 166#define WEIGHT_NEW 1
159 167
160#ifdef USER_SPACE
161 #include <stdio.h> 168#include <stdio.h>
162 #include <stdlib.h> 169#include <stdlib.h>
163 #include <time.h> 170#include <time.h>
164 #include <sys/time.h> 171#include <sys/time.h>
165 172
166 #define KERN_DEBUG stderr 173#define KERN_DEBUG stderr
167 #define GFP_KERNEL 0 174#define GFP_KERNEL 0
168 #define GFP_ATOMIC 1 175#define GFP_ATOMIC 1
169 #define printk printf 176#define printk printf
170 #define kfree free 177#define kfree free
171 178
172 static inline void * kmalloc(int size, int type) { 179static inline void * kmalloc(int size, int type) {
173 if (type != GFP_ATOMIC) { 180 if (type != GFP_ATOMIC) {
174 printf("wrong kmalloc type..\n"); 181 printf("wrong kmalloc type..\n");
175 exit(0); 182 exit(0);
176 } 183 }
177 return malloc(size); 184 return malloc(size);
178 } 185}
179 186
180 #include <stdarg.h> 187#include <stdarg.h>
181 #define rohc_debugf(level, format...) if (level<=ROHC_DEBUG_LEVEL) { printf(format); } else 188#define rohc_debugf(level, format...) if (level<=ROHC_DEBUG_LEVEL) { printf(format); } else
182 189
183 190#if defined(__i386__) && defined(__GNUC__)
184/* 191/*
185 * This is a version of ip_compute_csum() optimized for IP headers, 192 * This is a version of ip_compute_csum() optimized for IP headers,
186 * which always checksum on 4 octet boundaries. 193 * which always checksum on 4 octet boundaries.
187 * 194 *
188 * By Jorge Cwik <jorge@laser.satlink.net>, adapted for linux by 195 * By Jorge Cwik <jorge@laser.satlink.net>, adapted for linux by
216 will assume they contain their original values. */ 223 will assume they contain their original values. */
217 : "=r" (sum), "=r" (iph), "=r" (ihl) 224 : "=r" (sum), "=r" (iph), "=r" (ihl)
218 : "1" (iph), "2" (ihl)); 225 : "1" (iph), "2" (ihl));
219 return(sum); 226 return(sum);
220} 227}
221
222 static inline int get_microseconds(void) {
223 struct timeval tv;
224 gettimeofday(&tv, NULL);
225 return tv.tv_sec * 1000000 + tv.tv_usec;
226 }
227
228
229 static inline int get_milliseconds(void) {
230 struct timeval tv;
231 gettimeofday(&tv, NULL);
232 return tv.tv_sec * 1000 + tv.tv_usec/1000;
233 }
234
235
236
237 #define simple_strtol strtol
238
239// End of userspace defines..
240#else 228#else
241// Start of kernel mode defines.. 229# error "non-asm version of ip_fast_csum is required but not yet coded"
242
243 #define rohc_debugf(level, format...) if (level<=ROHC_DEBUG_LEVEL) { printk(KERN_INFO format); } else
244
245 static inline int get_microseconds(void) {
246 struct timeval tv;
247 do_gettimeofday(&tv);
248 return tv.tv_sec * 1000000 + tv.tv_usec;
249 }
250
251 static inline int get_milliseconds(void) {
252 struct timeval tv;
253 do_gettimeofday(&tv);
254 return tv.tv_sec * 1000 + tv.tv_usec/1000;
255 }
256
257#endif // End of kernelsapce defines
258
259
260#endif 230#endif
231
232static inline int get_microseconds(void) {
233 struct timeval tv;
234 gettimeofday(&tv, NULL);
235 return tv.tv_sec * 1000000 + tv.tv_usec;
236}
237
238
239static inline int get_milliseconds(void) {
240 struct timeval tv;
241 gettimeofday(&tv, NULL);
242 return tv.tv_sec * 1000 + tv.tv_usec/1000;
243}
244
245#define simple_strtol strtol
246
247#endif

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines