Files
openairinterface5g/openair2/RRC/LTE/MESSAGES/asn1_patch
T

523 lines
17 KiB
Plaintext

diff -cB /homes/kaltenbe/Devel/openair/openair_branches/openair_lte/openair2/RRC/LITE/MESSAGES/asn1c/asn1c/skeletons/asn_codecs_prim.c patch_dir/asn_codecs_prim.c
*** /homes/kaltenbe/Devel/openair/openair_branches/openair_lte/openair2/RRC/LITE/MESSAGES/asn1c/asn1c/skeletons/asn_codecs_prim.c 2011-03-31 10:22:56.000000000 +0200
--- patch_dir/asn_codecs_prim.c 2011-05-31 10:28:26.000000000 +0200
***************
*** 4,10 ****
*/
#include <asn_internal.h>
#include <asn_codecs_prim.h>
- #include <errno.h>
/*
* Decode an always-primitive type.
--- 4,9 ----
diff -cB /homes/kaltenbe/Devel/openair/openair_branches/openair_lte/openair2/RRC/LITE/MESSAGES/asn1c/asn1c/skeletons/asn_internal.h patch_dir/asn_internal.h
*** /homes/kaltenbe/Devel/openair/openair_branches/openair_lte/openair2/RRC/LITE/MESSAGES/asn1c/asn1c/skeletons/asn_internal.h 2011-03-31 10:22:57.000000000 +0200
--- patch_dir/asn_internal.h 2011-05-31 10:28:26.000000000 +0200
***************
*** 10,20 ****
--- 10,31 ----
#define _ASN_INTERNAL_H_
#include "asn_application.h" /* Application-visible API */
+ #ifndef USER_MODE
+ #include <rtai.h>
+ #include <rtai_malloc.h>
+ #include "rtai_mem.h"
+ #endif
#ifndef __NO_ASSERT_H__ /* Include assert.h only for internal use. */
#include <assert.h> /* for assert() macro */
#endif
+ #ifndef USER_MODE
+ #ifndef assert
+ #define assert(expr) ((expr) ? (void) 0 : printk("Assertion failed in %s:%d\n", __FILE__, __LINE__))
+ #endif
+ #endif
+
#ifdef __cplusplus
extern "C" {
#endif
***************
*** 23,32 ****
--- 34,51 ----
#define ASN1C_ENVIRONMENT_VERSION 922 /* Compile-time version */
int get_asn1c_environment_version(void); /* Run-time version */
+ #ifdef USER_MODE
#define CALLOC(nmemb, size) calloc(nmemb, size)
#define MALLOC(size) malloc(size)
#define REALLOC(oldptr, size) realloc(oldptr, size)
#define FREEMEM(ptr) free(ptr)
+ #else
+ #define CALLOC(nmemb, size) rt_calloc(nmemb,size)
+ #define MALLOC(size) rt_malloc(size)
+ #define REALLOC(oldptr, size) rt_realloc(oldptr, size)
+ #define FREEMEM(ptr) rt_free(ptr);
+ #endif
+
/*
* A macro for debugging the ASN.1 internals.
***************
*** 38,45 ****
#ifdef ASN_THREAD_SAFE
#define asn_debug_indent 0
#else /* !ASN_THREAD_SAFE */
! int asn_debug_indent;
#endif /* ASN_THREAD_SAFE */
#define ASN_DEBUG(fmt, args...) do { \
int adi = asn_debug_indent; \
while(adi--) fprintf(stderr, " "); \
--- 57,65 ----
#ifdef ASN_THREAD_SAFE
#define asn_debug_indent 0
#else /* !ASN_THREAD_SAFE */
! extern int asn_debug_indent;
#endif /* ASN_THREAD_SAFE */
+ #ifdef USER_MODE
#define ASN_DEBUG(fmt, args...) do { \
int adi = asn_debug_indent; \
while(adi--) fprintf(stderr, " "); \
***************
*** 47,52 ****
--- 67,81 ----
fprintf(stderr, " (%s:%d)\n", \
__FILE__, __LINE__); \
} while(0)
+ #else
+ #define ASN_DEBUG(fmt, args...) do { \
+ int adi = asn_debug_indent; \
+ while(adi--) printk(" "); \
+ printk(fmt, ##args); \
+ printk(" (%s:%d)\n", \
+ __FILE__, __LINE__); \
+ } while(0)
+ #endif
#else /* !__GNUC__ */
void ASN_DEBUG_f(const char *fmt, ...);
#define ASN_DEBUG ASN_DEBUG_f
diff -cB /homes/kaltenbe/Devel/openair/openair_branches/openair_lte/openair2/RRC/LITE/MESSAGES/asn1c/asn1c/skeletons/asn_SET_OF.c patch_dir/asn_SET_OF.c
*** /homes/kaltenbe/Devel/openair/openair_branches/openair_lte/openair2/RRC/LITE/MESSAGES/asn1c/asn1c/skeletons/asn_SET_OF.c 2011-03-31 10:22:56.000000000 +0200
--- patch_dir/asn_SET_OF.c 2011-05-31 10:28:26.000000000 +0200
***************
*** 4,10 ****
*/
#include <asn_internal.h>
#include <asn_SET_OF.h>
- #include <errno.h>
/*
* Add another element into the set.
--- 4,9 ----
***************
*** 21,26 ****
--- 20,27 ----
/*
* Make sure there's enough space to insert an element.
*/
+ ASN_DEBUG("SET ADD: count %d, size %d",as->count,as->size);
+
if(as->count == as->size) {
int _newsize = as->size ? (as->size << 1) : 4;
void *_new_arr;
diff -cB /homes/kaltenbe/Devel/openair/openair_branches/openair_lte/openair2/RRC/LITE/MESSAGES/asn1c/asn1c/skeletons/asn_system.h patch_dir/asn_system.h
*** /homes/kaltenbe/Devel/openair/openair_branches/openair_lte/openair2/RRC/LITE/MESSAGES/asn1c/asn1c/skeletons/asn_system.h 2011-03-31 10:22:57.000000000 +0200
--- patch_dir/asn_system.h 2011-05-31 10:28:26.000000000 +0200
***************
*** 13,25 ****
#include "config.h"
#endif
! #include <stdio.h> /* For snprintf(3) */
! #include <stdlib.h> /* For *alloc(3) */
! #include <string.h> /* For memcpy(3) */
! #include <sys/types.h> /* For size_t */
! #include <limits.h> /* For LONG_MAX */
! #include <stdarg.h> /* For va_start */
! #include <stddef.h> /* for offsetof and ptrdiff_t */
#ifdef WIN32
--- 13,39 ----
#include "config.h"
#endif
! #ifdef USER_MODE
! #include <stdio.h> // For snprintf(3)
! #include <stdlib.h> // For *alloc(3)
! #include <string.h> // For memcpy(3)
! #include <sys/types.h> // For size_t
! #include <limits.h> // For LONG_MAX
! #include <stdarg.h> // For va_start
! #include <stddef.h> // for offsetof and ptrdiff_t
! #include <errno.h> // For errno
! #else
! typedef char FILE;
! #include <linux/types.h>
! #include <linux/slab.h> // For snprintf
! #include <linux/sort.h> // For sort
! #define qsort(base,num,size,cmp_func) sort(base,num,size,cmp_func,NULL)
! #include <linux/errno.h>// For errno
! #ifndef errno
! extern int errno;
! #endif
! #include "bsearch.h"
! #endif
#ifdef WIN32
***************
*** 63,69 ****
#include <types/vxTypes.h>
#else /* !defined(__vxworks) */
! #include <inttypes.h> /* C99 specifies this file */
/*
* 1. Earlier FreeBSD version didn't have <stdint.h>,
* but <inttypes.h> was present.
--- 77,85 ----
#include <types/vxTypes.h>
#else /* !defined(__vxworks) */
! #ifdef USER_MODE
! #include <inttypes.h> /*C99 specifies this file */
! #endif
/*
* 1. Earlier FreeBSD version didn't have <stdint.h>,
* but <inttypes.h> was present.
***************
*** 81,91 ****
#define inline
#endif /* __GNUC__ */
#else
! #include <stdint.h> /* SUSv2+ and C99 specify this file, for uintXX_t */
#endif /* defined(sun) */
#endif
! #include <netinet/in.h> /* for ntohl() */
#define sys_ntohl(foo) ntohl(foo)
#endif /* defined(__vxworks) */
--- 97,109 ----
#define inline
#endif /* __GNUC__ */
#else
! #ifdef USER_MODE
! #include <stdint.h> /*SUSv2+ and C99 specify this file, for uintXX_t */
! #endif
#endif /* defined(sun) */
#endif
! /*#include <netinet/in.h> for ntohl() */
#define sys_ntohl(foo) ntohl(foo)
#endif /* defined(__vxworks) */
diff -cB /homes/kaltenbe/Devel/openair/openair_branches/openair_lte/openair2/RRC/LITE/MESSAGES/asn1c/asn1c/skeletons/ber_tlv_tag.c patch_dir/ber_tlv_tag.c
*** /homes/kaltenbe/Devel/openair/openair_branches/openair_lte/openair2/RRC/LITE/MESSAGES/asn1c/asn1c/skeletons/ber_tlv_tag.c 2011-03-31 10:22:56.000000000 +0200
--- patch_dir/ber_tlv_tag.c 2011-05-31 10:28:26.000000000 +0200
***************
*** 4,10 ****
*/
#include <asn_internal.h>
#include <ber_tlv_tag.h>
- #include <errno.h>
ssize_t
ber_fetch_tag(const void *ptr, size_t size, ber_tlv_tag_t *tag_r) {
--- 4,9 ----
***************
*** 57,63 ****
return 0; /* Want more */
}
!
ssize_t
ber_tlv_tag_fwrite(ber_tlv_tag_t tag, FILE *f) {
char buf[sizeof("[APPLICATION ]") + 32];
--- 56,62 ----
return 0; /* Want more */
}
! #ifdef USER_MODE
ssize_t
ber_tlv_tag_fwrite(ber_tlv_tag_t tag, FILE *f) {
char buf[sizeof("[APPLICATION ]") + 32];
***************
*** 71,76 ****
--- 70,76 ----
return fwrite(buf, 1, ret, f);
}
+ #endif
ssize_t
ber_tlv_tag_snprint(ber_tlv_tag_t tag, char *buf, size_t size) {
diff -cB /homes/kaltenbe/Devel/openair/openair_branches/openair_lte/openair2/RRC/LITE/MESSAGES/asn1c/asn1c/skeletons/constraints.c patch_dir/constraints.c
*** /homes/kaltenbe/Devel/openair/openair_branches/openair_lte/openair2/RRC/LITE/MESSAGES/asn1c/asn1c/skeletons/constraints.c 2011-03-31 10:22:57.000000000 +0200
--- patch_dir/constraints.c 2011-05-31 10:28:26.000000000 +0200
***************
*** 1,4 ****
! #include "asn_internal.h"
#include "constraints.h"
int
--- 1,4 ----
! #include <asn_internal.h>
#include "constraints.h"
int
diff -cB /homes/kaltenbe/Devel/openair/openair_branches/openair_lte/openair2/RRC/LITE/MESSAGES/asn1c/asn1c/skeletons/constr_TYPE.c patch_dir/constr_TYPE.c
*** /homes/kaltenbe/Devel/openair/openair_branches/openair_lte/openair2/RRC/LITE/MESSAGES/asn1c/asn1c/skeletons/constr_TYPE.c 2011-03-31 10:22:56.000000000 +0200
--- patch_dir/constr_TYPE.c 2011-05-31 10:28:26.000000000 +0200
***************
*** 4,10 ****
*/
#include <asn_internal.h>
#include <constr_TYPE.h>
- #include <errno.h>
/*
* Version of the ASN.1 infrastructure shipped with compiler.
--- 4,9 ----
***************
*** 29,34 ****
--- 28,34 ----
return type_descriptor->outmost_tag(type_descriptor, struct_ptr, 0, 0);
}
+ #ifdef USER_MODE
/*
* Print the target language's structure in human readable form.
*/
***************
*** 75,77 ****
--- 75,78 ----
fprintf(stderr, "\n");
va_end(ap);
}
+ #endif
diff -cB /homes/kaltenbe/Devel/openair/openair_branches/openair_lte/openair2/RRC/LITE/MESSAGES/asn1c/asn1c/skeletons/der_encoder.c patch_dir/der_encoder.c
*** /homes/kaltenbe/Devel/openair/openair_branches/openair_lte/openair2/RRC/LITE/MESSAGES/asn1c/asn1c/skeletons/der_encoder.c 2011-03-31 10:22:56.000000000 +0200
--- patch_dir/der_encoder.c 2011-05-31 10:28:26.000000000 +0200
***************
*** 3,9 ****
* Redistribution and modifications are permitted subject to BSD license.
*/
#include <asn_internal.h>
- #include <errno.h>
static ssize_t der_write_TL(ber_tlv_tag_t tag, ber_tlv_len_t len,
asn_app_consume_bytes_f *cb, void *app_key, int constructed);
--- 3,8 ----
***************
*** 81,89 ****
--- 80,90 ----
asn_app_consume_bytes_f *cb,
void *app_key) {
ber_tlv_tag_t *tags; /* Copy of tags stream */
+ ber_tlv_tag_t tags_array[8];
int tags_count; /* Number of tags */
size_t overall_length;
ssize_t *lens;
+ ssize_t lens_array[8];
int i;
ASN_DEBUG("Writing tags (%s, tm=%d, tc=%d, tag=%s, mtc=%d)",
***************
*** 102,111 ****
* and initialize it appropriately.
*/
int stag_offset;
! tags = (ber_tlv_tag_t *)alloca((sd->tags_count + 1) * sizeof(ber_tlv_tag_t));
if(!tags) { /* Can fail on !x86 */
! errno = ENOMEM;
! return -1;
}
tags_count = sd->tags_count
+ 1 /* EXPLICIT or IMPLICIT tag is given */
--- 103,121 ----
* and initialize it appropriately.
*/
int stag_offset;
! //tags = (ber_tlv_tag_t *)alloca((sd->tags_count + 1) * sizeof(ber_tlv_tag_t));
! tags = &(tags_array[0]);
! if ((sd->tags_count + 1)>=8) {
! #ifdef USER_MODE
! printf("der_encoder.c: ERROR tags array too small. Increase size!\n");
! exit(-1);
! #endif
! errno = ENOMEM;
! return -1;
! }
if(!tags) { /* Can fail on !x86 */
! errno = ENOMEM;
! return -1;
}
tags_count = sd->tags_count
+ 1 /* EXPLICIT or IMPLICIT tag is given */
***************
*** 124,135 ****
if(tags_count == 0)
return 0;
! lens = (ssize_t *)alloca(tags_count * sizeof(lens[0]));
if(!lens) {
! errno = ENOMEM;
! return -1;
}
!
/*
* Array of tags is initialized.
* Now, compute the size of the TLV pairs, from right to left.
--- 134,154 ----
if(tags_count == 0)
return 0;
! //lens = (ssize_t *)alloca(tags_count * sizeof(lens[0]));
! lens = &(lens_array[0]);
! if (tags_count>=8) {
! #ifdef USER_MODE
! printf("der_encoder.c: ERROR lens array too small. Increase size!\n");
! exit(-1);
! #endif
! errno = ENOMEM;
! return -1;
! }
if(!lens) {
! errno = ENOMEM;
! return -1;
}
!
/*
* Array of tags is initialized.
* Now, compute the size of the TLV pairs, from right to left.
diff -cB /homes/kaltenbe/Devel/openair/openair_branches/openair_lte/openair2/RRC/LITE/MESSAGES/asn1c/asn1c/skeletons/INTEGER.c patch_dir/INTEGER.c
*** /homes/kaltenbe/Devel/openair/openair_branches/openair_lte/openair2/RRC/LITE/MESSAGES/asn1c/asn1c/skeletons/INTEGER.c 2011-03-31 10:22:56.000000000 +0200
--- patch_dir/INTEGER.c 2011-05-31 10:28:26.000000000 +0200
***************
*** 6,12 ****
#include <asn_internal.h>
#include <INTEGER.h>
#include <asn_codecs_prim.h> /* Encoder and decoder of a primitive type */
- #include <errno.h>
/*
* INTEGER basic type description.
--- 6,11 ----
***************
*** 103,109 ****
static ssize_t
INTEGER__dump(asn_TYPE_descriptor_t *td, const INTEGER_t *st, asn_app_consume_bytes_f *cb, void *app_key, int plainOrXER) {
asn_INTEGER_specifics_t *specs=(asn_INTEGER_specifics_t *)td->specifics;
! char scratch[32]; /* Enough for 64-bit integer */
uint8_t *buf = st->buf;
uint8_t *buf_end = st->buf + st->size;
signed long accum;
--- 102,108 ----
static ssize_t
INTEGER__dump(asn_TYPE_descriptor_t *td, const INTEGER_t *st, asn_app_consume_bytes_f *cb, void *app_key, int plainOrXER) {
asn_INTEGER_specifics_t *specs=(asn_INTEGER_specifics_t *)td->specifics;
! char scratch[128];
uint8_t *buf = st->buf;
uint8_t *buf_end = st->buf + st->size;
signed long accum;
***************
*** 142,149 ****
--- 141,152 ----
el = INTEGER_map_value2enum(specs, accum);
if(el) {
+ scrsize = sizeof(scratch);
+ scr = scratch;
+ /* cannot use alloca in kernel
scrsize = el->enum_len + 32;
scr = (char *)alloca(scrsize);
+ */
if(plainOrXER == 0)
ret = snprintf(scr, scrsize,
"%ld (%s)", accum, el->enum_name);
diff -cB /homes/kaltenbe/Devel/openair/openair_branches/openair_lte/openair2/RRC/LITE/MESSAGES/asn1c/asn1c/skeletons/NativeEnumerated.c patch_dir/NativeEnumerated.c
*** /homes/kaltenbe/Devel/openair/openair_branches/openair_lte/openair2/RRC/LITE/MESSAGES/asn1c/asn1c/skeletons/NativeEnumerated.c 2011-03-31 10:22:57.000000000 +0200
--- patch_dir/NativeEnumerated.c 2011-05-31 10:28:26.000000000 +0200
***************
*** 46,51 ****
--- 46,52 ----
asn_app_consume_bytes_f *cb, void *app_key) {
asn_INTEGER_specifics_t *specs=(asn_INTEGER_specifics_t *)td->specifics;
asn_enc_rval_t er;
+ char scratch[128];
const long *native = (const long *)sptr;
const asn_INTEGER_enum_map_t *el;
***************
*** 57,63 ****
el = INTEGER_map_value2enum(specs, *native);
if(el) {
size_t srcsize = el->enum_len + 5;
! char *src = (char *)alloca(srcsize);
er.encoded = snprintf(src, srcsize, "<%s/>", el->enum_name);
assert(er.encoded > 0 && (size_t)er.encoded < srcsize);
--- 58,64 ----
el = INTEGER_map_value2enum(specs, *native);
if(el) {
size_t srcsize = el->enum_len + 5;
! char *src = (char *)scratch; //alloca(srcsize);
er.encoded = snprintf(src, srcsize, "<%s/>", el->enum_name);
assert(er.encoded > 0 && (size_t)er.encoded < srcsize);
diff -cB /homes/kaltenbe/Devel/openair/openair_branches/openair_lte/openair2/RRC/LITE/MESSAGES/asn1c/asn1c/skeletons/OCTET_STRING.c patch_dir/OCTET_STRING.c
*** /homes/kaltenbe/Devel/openair/openair_branches/openair_lte/openair2/RRC/LITE/MESSAGES/asn1c/asn1c/skeletons/OCTET_STRING.c 2011-03-31 10:22:55.000000000 +0200
--- patch_dir/OCTET_STRING.c 2011-05-31 10:28:26.000000000 +0200
***************
*** 6,12 ****
#include <asn_internal.h>
#include <OCTET_STRING.h>
#include <BIT_STRING.h> /* for .bits_unused member */
- #include <errno.h>
/*
* OCTET STRING basic type description.
--- 6,11 ----
diff -cB /homes/kaltenbe/Devel/openair/openair_branches/openair_lte/openair2/RRC/LITE/MESSAGES/asn1c/asn1c/skeletons/xer_encoder.c patch_dir/xer_encoder.c
*** /homes/kaltenbe/Devel/openair/openair_branches/openair_lte/openair2/RRC/LITE/MESSAGES/asn1c/asn1c/skeletons/xer_encoder.c 2011-04-11 18:03:26.000000000 +0200
--- patch_dir/xer_encoder.c 2011-05-31 10:28:26.000000000 +0200
***************
*** 3,10 ****
* Redistribution and modifications are permitted subject to BSD license.
*/
#include <asn_internal.h>
! #include <stdio.h>
! #include <errno.h>
/*
* The XER encoder of any type. May be invoked by the application.
--- 3,10 ----
* Redistribution and modifications are permitted subject to BSD license.
*/
#include <asn_internal.h>
! //#include <stdio.h>
! //#include <errno.h>
/*
* The XER encoder of any type. May be invoked by the application.
***************
*** 41,46 ****
--- 41,47 ----
* This is a helper function for xer_fprint, which directs all incoming data
* into the provided file descriptor.
*/
+ #ifdef USER_MODE
static int
xer__print2fp(const void *buffer, size_t size, void *app_key) {
FILE *stream = (FILE *)app_key;
***************
*** 65,67 ****
--- 66,69 ----
return fflush(stream);
}
+ #endif