Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
oai
openairinterface5G
Commits
9108ecbd
Commit
9108ecbd
authored
Feb 22, 2016
by
Cedric Roux
Browse files
Use diff files and 'patch' instead of copying full files.
parent
a9256ded
Changes
13
Expand all
Hide whitespace changes
Inline
Side-by-side
cmake_targets/tools/fix_asn1
View file @
9108ecbd
#!/bin/bash
# in those arrays, each line is:
# <file> <sha1sum of file> <
replacement
file>
# <file> <sha1sum of file> <
patch to apply to
file>
RRC_Rel10
=(
"SystemInformation-r8-IEs.h"
819eda3db27516f7c6780d832fb3c462e2264ea7
"fix_asn1.data/RRC.rel10/SystemInformation-r8-IEs.h"
"SystemInformation-r8-IEs.h"
819eda3db27516f7c6780d832fb3c462e2264ea7
"fix_asn1.data/RRC.rel10/SystemInformation-r8-IEs.h
.diff
"
)
X2AP_Rel11_2
=(
"X2ap-CriticalityDiagnostics-IE-List.h"
f0e2414992bfacfbc4b9fd15c977241d6d7fabeb
"fix_asn1.data/X2AP.rel11.2/X2ap-CriticalityDiagnostics-IE-List.h"
"NativeInteger.c"
e23034083a0fb9d4a2e523e2a64286161e621f27
"fix_asn1.data/X2AP.rel11.2/NativeInteger.c"
"constr_SET_OF.c"
5fb65da648a57ea61f008fa226b707cf343c1c0c
"fix_asn1.data/X2AP.rel11.2/constr_SET_OF.c"
"X2ap-CriticalityDiagnostics-IE-List.h"
f0e2414992bfacfbc4b9fd15c977241d6d7fabeb
"fix_asn1.data/X2AP.rel11.2/X2ap-CriticalityDiagnostics-IE-List.h
.diff
"
"NativeInteger.c"
e23034083a0fb9d4a2e523e2a64286161e621f27
"fix_asn1.data/X2AP.rel11.2/NativeInteger.c
.diff
"
"constr_SET_OF.c"
5fb65da648a57ea61f008fa226b707cf343c1c0c
"fix_asn1.data/X2AP.rel11.2/constr_SET_OF.c
.diff
"
)
S1AP_Rel10_5
=(
"NativeInteger.c"
e23034083a0fb9d4a2e523e2a64286161e621f27
"fix_asn1.data/S1AP.rel10.5/NativeInteger.c"
"constr_SET_OF.c"
5fb65da648a57ea61f008fa226b707cf343c1c0c
"fix_asn1.data/S1AP.rel10.5/constr_SET_OF.c"
"NativeInteger.c"
e23034083a0fb9d4a2e523e2a64286161e621f27
"fix_asn1.data/S1AP.rel10.5/NativeInteger.c
.diff
"
"constr_SET_OF.c"
5fb65da648a57ea61f008fa226b707cf343c1c0c
"fix_asn1.data/S1AP.rel10.5/constr_SET_OF.c
.diff
"
)
red_color
=
"
\x
1b[31m
"
green_color
=
"
\x
1b[32m
"
reset_color
=
"
\x
1b[0m
"
red_color
=
"
$(
tput setaf 1
)
"
green_color
=
"
$(
tput setaf 2
)
"
reset_color
=
"
$(
tput sgr0
)
"
function
error
()
{
...
...
@@ -46,21 +46,21 @@ function check_sha1()
fi
}
function
copy
_file
()
function
patch
_file
()
{
local
file
=
"
$1
"
local
destination
=
"
$2
"
local
patch
=
"
$1
"
local
file
=
"
$2
"
echo
-e
"
$green_color
""
copy file
$OPENAIR_DIR
/cmake_targets/tools/
$
file
to
$destination
""
$reset_color
"
echo
-e
"
$green_color
""
patch file
$file
with
$OPENAIR_DIR
/cmake_targets/tools/
$
patch
""
$reset_color
"
cp
-f
"
$OPENAIR_DIR
/cmake_targets/tools/
$
file
"
"
$destination
"
patch
"
$file
"
"
$OPENAIR_DIR
/cmake_targets/tools/
$
patch
"
if
[
$?
-ne
0
]
then
error
"
copy
of
$file
to
$destination
failed"
error
"
patching
of
$file
with
$OPENAIR_DIR
/cmake_targets/tools/
$patch
failed"
fi
}
function
patch
()
function
apply_
patch
es
()
{
local
directory
=
"
$1
"
local
array
=
$2
...
...
@@ -69,7 +69,7 @@ function patch()
local
i
local
file
local
sha1
local
replace
local
patch
local
item
for
((
i
=
0
;
i <
$len
;
i +
=
3
))
...
...
@@ -77,9 +77,9 @@ function patch()
# special bash syntax to access the array
item
=
$array
[
$i
]
;
file
=
${
!item
}
item
=
$array
[
$((
i+1
))
]
;
sha1
=
${
!item
}
item
=
$array
[
$((
i+2
))
]
;
replace
=
${
!item
}
item
=
$array
[
$((
i+2
))
]
;
patch
=
${
!item
}
check_sha1
"
$directory
/
$file
"
"
$sha1
"
copy
_file
"
$
replace
"
"
$directory
"
patch
_file
"
$
patch
"
"
$directory
/
$file
"
done
}
...
...
@@ -91,7 +91,7 @@ function patch_rrc()
case
"
$version
"
in
Rel10
)
echo
"patching RRC files release 10"
patch
"
$directory
"
RRC_Rel10
${#
RRC_Rel10
[*]
}
apply_
patch
es
"
$directory
"
RRC_Rel10
${#
RRC_Rel10
[*]
}
;;
*
)
error unknwon/unhandled RRC version
\'
"
$version
"
\'
...
...
@@ -107,7 +107,7 @@ function patch_x2ap()
case
"
$version
"
in
R11
)
echo
"patching X2AP files release 11.2"
patch
"
$directory
"
X2AP_Rel11_2
${#
X2AP_Rel11_2
[*]
}
apply_
patch
es
"
$directory
"
X2AP_Rel11_2
${#
X2AP_Rel11_2
[*]
}
;;
*
)
error unknwon/unhandled X2AP version
\'
"
$version
"
\'
...
...
@@ -123,7 +123,7 @@ function patch_s1ap()
case
"
$version
"
in
R10
)
echo
"patching S1AP files release 10.5"
patch
"
$directory
"
S1AP_Rel10_5
${#
S1AP_Rel10_5
[*]
}
apply_
patch
es
"
$directory
"
S1AP_Rel10_5
${#
S1AP_Rel10_5
[*]
}
;;
*
)
error unknwon/unhandled S1AP version
\'
"
$version
"
\'
...
...
cmake_targets/tools/fix_asn1.data/RRC.rel10/SystemInformation-r8-IEs.h
deleted
100644 → 0
View file @
a9256ded
/*
* Generated by asn1c-0.9.24 (http://lionet.info/asn1c)
* From ASN.1 module "EUTRA-RRC-Definitions"
* found in "fixed_grammar.asn"
* `asn1c -gen-PER`
*/
#ifndef _SystemInformation_r8_IEs_H_
#define _SystemInformation_r8_IEs_H_
#include <asn_application.h>
/* Including external dependencies */
#include <asn_SEQUENCE_OF.h>
#include "SystemInformationBlockType2.h"
#include "SystemInformationBlockType3.h"
#include "SystemInformationBlockType4.h"
#include "SystemInformationBlockType5.h"
#include "SystemInformationBlockType6.h"
#include "SystemInformationBlockType7.h"
#include "SystemInformationBlockType8.h"
#include "SystemInformationBlockType9.h"
#include "SystemInformationBlockType10.h"
#include "SystemInformationBlockType11.h"
#include "SystemInformationBlockType12-r9.h"
#include "SystemInformationBlockType13-r9.h"
#include <constr_CHOICE.h>
#include <constr_SEQUENCE_OF.h>
#include <constr_SEQUENCE.h>
#ifdef __cplusplus
extern
"C"
{
#endif
/* Dependencies */
typedef
enum
SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR
{
SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_NOTHING
,
/* No components present */
SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib2
,
SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib3
,
SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib4
,
SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib5
,
SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib6
,
SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib7
,
SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib8
,
SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib9
,
SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib10
,
SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib11
,
/* Extensions may appear below */
SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib12_v920
,
SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib13_v920
}
SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR
;
/* Forward declarations */
struct
SystemInformation_v8a0_IEs
;
union
SystemInformation_r8_IEs__sib_TypeAndInfo__Member_u
{
SystemInformationBlockType2_t
sib2
;
SystemInformationBlockType3_t
sib3
;
SystemInformationBlockType4_t
sib4
;
SystemInformationBlockType5_t
sib5
;
SystemInformationBlockType6_t
sib6
;
SystemInformationBlockType7_t
sib7
;
SystemInformationBlockType8_t
sib8
;
SystemInformationBlockType9_t
sib9
;
SystemInformationBlockType10_t
sib10
;
SystemInformationBlockType11_t
sib11
;
/*
* This type is extensible,
* possible extensions are below.
*/
SystemInformationBlockType12_r9_t
sib12_v920
;
SystemInformationBlockType13_r9_t
sib13_v920
;
};
struct
SystemInformation_r8_IEs__sib_TypeAndInfo__Member
{
SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR
present
;
union
SystemInformation_r8_IEs__sib_TypeAndInfo__Member_u
choice
;
/* Context for parsing across buffer boundaries */
asn_struct_ctx_t
_asn_ctx
;
};
/* SystemInformation-r8-IEs */
typedef
struct
SystemInformation_r8_IEs
{
struct
SystemInformation_r8_IEs__sib_TypeAndInfo
{
A_SEQUENCE_OF
(
struct
SystemInformation_r8_IEs__sib_TypeAndInfo__Member
)
list
;
/* Context for parsing across buffer boundaries */
asn_struct_ctx_t
_asn_ctx
;
}
sib_TypeAndInfo
;
struct
SystemInformation_v8a0_IEs
*
nonCriticalExtension
/* OPTIONAL */
;
/* Context for parsing across buffer boundaries */
asn_struct_ctx_t
_asn_ctx
;
}
SystemInformation_r8_IEs_t
;
/* Implementation */
extern
asn_TYPE_descriptor_t
asn_DEF_SystemInformation_r8_IEs
;
#ifdef __cplusplus
}
#endif
/* Referred external types */
#include "SystemInformation-v8a0-IEs.h"
#endif
/* _SystemInformation_r8_IEs_H_ */
#include <asn_internal.h>
cmake_targets/tools/fix_asn1.data/RRC.rel10/SystemInformation-r8-IEs.h.diff
0 → 100644
View file @
9108ecbd
57,61d56
< /* SystemInformation-r8-IEs */
< typedef struct SystemInformation_r8_IEs {
< struct SystemInformation_r8_IEs__sib_TypeAndInfo {
< A_SEQUENCE_OF(struct SystemInformation_r8_IEs__sib_TypeAndInfo__Member {
< SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR present;
79c74,78
< } choice;
---
> };
>
> struct SystemInformation_r8_IEs__sib_TypeAndInfo__Member {
> SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR present;
> union SystemInformation_r8_IEs__sib_TypeAndInfo__Member_u choice;
83c82,87
< } ) list;
---
> };
>
> /* SystemInformation-r8-IEs */
> typedef struct SystemInformation_r8_IEs {
> struct SystemInformation_r8_IEs__sib_TypeAndInfo {
> A_SEQUENCE_OF(struct SystemInformation_r8_IEs__sib_TypeAndInfo__Member) list;
cmake_targets/tools/fix_asn1.data/S1AP.rel10.5/NativeInteger.c
deleted
100644 → 0
View file @
a9256ded
/*-
* Copyright (c) 2004, 2005, 2006 Lev Walkin <vlm@lionet.info>.
* All rights reserved.
* Redistribution and modifications are permitted subject to BSD license.
*/
/*
* Read the NativeInteger.h for the explanation wrt. differences between
* INTEGER and NativeInteger.
* Basically, both are decoders and encoders of ASN.1 INTEGER type, but this
* implementation deals with the standard (machine-specific) representation
* of them instead of using the platform-independent buffer.
*/
#include <asn_internal.h>
#include <NativeInteger.h>
/*
* NativeInteger basic type description.
*/
static
ber_tlv_tag_t
asn_DEF_NativeInteger_tags
[]
=
{
(
ASN_TAG_CLASS_UNIVERSAL
|
(
2
<<
2
))
};
asn_TYPE_descriptor_t
asn_DEF_NativeInteger
=
{
"INTEGER"
,
/* The ASN.1 type is still INTEGER */
"INTEGER"
,
NativeInteger_free
,
NativeInteger_print
,
asn_generic_no_constraint
,
NativeInteger_decode_ber
,
NativeInteger_encode_der
,
NativeInteger_decode_xer
,
NativeInteger_encode_xer
,
NativeInteger_decode_uper
,
/* Unaligned PER decoder */
NativeInteger_encode_uper
,
/* Unaligned PER encoder */
NativeInteger_decode_aper
,
/* Aligned PER decoder */
NativeInteger_encode_aper
,
/* Aligned PER encoder */
0
,
/* Use generic outmost tag fetcher */
asn_DEF_NativeInteger_tags
,
sizeof
(
asn_DEF_NativeInteger_tags
)
/
sizeof
(
asn_DEF_NativeInteger_tags
[
0
]),
asn_DEF_NativeInteger_tags
,
/* Same as above */
sizeof
(
asn_DEF_NativeInteger_tags
)
/
sizeof
(
asn_DEF_NativeInteger_tags
[
0
]),
0
,
/* No PER visible constraints */
0
,
0
,
/* No members */
0
/* No specifics */
};
/*
* Decode INTEGER type.
*/
asn_dec_rval_t
NativeInteger_decode_ber
(
asn_codec_ctx_t
*
opt_codec_ctx
,
asn_TYPE_descriptor_t
*
td
,
void
**
nint_ptr
,
const
void
*
buf_ptr
,
size_t
size
,
int
tag_mode
)
{
asn_INTEGER_specifics_t
*
specs
=
(
asn_INTEGER_specifics_t
*
)
td
->
specifics
;
long
*
native
=
(
long
*
)
*
nint_ptr
;
asn_dec_rval_t
rval
;
ber_tlv_len_t
length
;
/*
* If the structure is not there, allocate it.
*/
if
(
native
==
NULL
)
{
native
=
(
long
*
)(
*
nint_ptr
=
CALLOC
(
1
,
sizeof
(
*
native
)));
if
(
native
==
NULL
)
{
rval
.
code
=
RC_FAIL
;
rval
.
consumed
=
0
;
return
rval
;
}
}
ASN_DEBUG
(
"Decoding %s as INTEGER (tm=%d)"
,
td
->
name
,
tag_mode
);
/*
* Check tags.
*/
rval
=
ber_check_tags
(
opt_codec_ctx
,
td
,
0
,
buf_ptr
,
size
,
tag_mode
,
0
,
&
length
,
0
);
if
(
rval
.
code
!=
RC_OK
)
return
rval
;
ASN_DEBUG
(
"%s length is %d bytes"
,
td
->
name
,
(
int
)
length
);
/*
* Make sure we have this length.
*/
buf_ptr
=
((
const
char
*
)
buf_ptr
)
+
rval
.
consumed
;
size
-=
rval
.
consumed
;
if
(
length
>
(
ber_tlv_len_t
)
size
)
{
rval
.
code
=
RC_WMORE
;
rval
.
consumed
=
0
;
return
rval
;
}
/*
* ASN.1 encoded INTEGER: buf_ptr, length
* Fill the native, at the same time checking for overflow.
* If overflow occured, return with RC_FAIL.
*/
{
INTEGER_t
tmp
;
union
{
const
void
*
constbuf
;
void
*
nonconstbuf
;
}
unconst_buf
;
long
l
;
unconst_buf
.
constbuf
=
buf_ptr
;
tmp
.
buf
=
(
uint8_t
*
)
unconst_buf
.
nonconstbuf
;
tmp
.
size
=
length
;
if
((
specs
&&
specs
->
field_unsigned
)
?
asn_INTEGER2ulong
(
&
tmp
,
(
unsigned
long
*
)
&
l
)
/* sic */
:
asn_INTEGER2long
(
&
tmp
,
&
l
))
{
rval
.
code
=
RC_FAIL
;
rval
.
consumed
=
0
;
return
rval
;
}
*
native
=
l
;
}
rval
.
code
=
RC_OK
;
rval
.
consumed
+=
length
;
ASN_DEBUG
(
"Took %ld/%ld bytes to encode %s (%ld)"
,
(
long
)
rval
.
consumed
,
(
long
)
length
,
td
->
name
,
(
long
)
*
native
);
return
rval
;
}
/*
* Encode the NativeInteger using the standard INTEGER type DER encoder.
*/
asn_enc_rval_t
NativeInteger_encode_der
(
asn_TYPE_descriptor_t
*
sd
,
void
*
ptr
,
int
tag_mode
,
ber_tlv_tag_t
tag
,
asn_app_consume_bytes_f
*
cb
,
void
*
app_key
)
{
unsigned
long
native
=
*
(
unsigned
long
*
)
ptr
;
/* Disable sign ext. */
asn_enc_rval_t
erval
;
INTEGER_t
tmp
;
#ifdef WORDS_BIGENDIAN
/* Opportunistic optimization */
tmp
.
buf
=
(
uint8_t
*
)
&
native
;
tmp
.
size
=
sizeof
(
native
);
#else
/* Works even if WORDS_BIGENDIAN is not set where should've been */
uint8_t
buf
[
sizeof
(
native
)];
uint8_t
*
p
;
/* Prepare a fake INTEGER */
for
(
p
=
buf
+
sizeof
(
buf
)
-
1
;
p
>=
buf
;
p
--
,
native
>>=
8
)
*
p
=
(
uint8_t
)
native
;
tmp
.
buf
=
buf
;
tmp
.
size
=
sizeof
(
buf
);
#endif
/* WORDS_BIGENDIAN */
/* Encode fake INTEGER */
erval
=
INTEGER_encode_der
(
sd
,
&
tmp
,
tag_mode
,
tag
,
cb
,
app_key
);
if
(
erval
.
encoded
==
-
1
)
{
assert
(
erval
.
structure_ptr
==
&
tmp
);
erval
.
structure_ptr
=
ptr
;
}
return
erval
;
}
/*
* Decode the chunk of XML text encoding INTEGER.
*/
asn_dec_rval_t
NativeInteger_decode_xer
(
asn_codec_ctx_t
*
opt_codec_ctx
,
asn_TYPE_descriptor_t
*
td
,
void
**
sptr
,
const
char
*
opt_mname
,
const
void
*
buf_ptr
,
size_t
size
)
{
asn_INTEGER_specifics_t
*
specs
=
(
asn_INTEGER_specifics_t
*
)
td
->
specifics
;
asn_dec_rval_t
rval
;
INTEGER_t
st
;
void
*
st_ptr
=
(
void
*
)
&
st
;
long
*
native
=
(
long
*
)
*
sptr
;
if
(
!
native
)
{
native
=
(
long
*
)(
*
sptr
=
CALLOC
(
1
,
sizeof
(
*
native
)));
if
(
!
native
)
_ASN_DECODE_FAILED
;
}
memset
(
&
st
,
0
,
sizeof
(
st
));
rval
=
INTEGER_decode_xer
(
opt_codec_ctx
,
td
,
&
st_ptr
,
opt_mname
,
buf_ptr
,
size
);
if
(
rval
.
code
==
RC_OK
)
{
long
l
;
if
((
specs
&&
specs
->
field_unsigned
)
?
asn_INTEGER2ulong
(
&
st
,
(
unsigned
long
*
)
&
l
)
/* sic */
:
asn_INTEGER2long
(
&
st
,
&
l
))
{
rval
.
code
=
RC_FAIL
;
rval
.
consumed
=
0
;
}
else
{
*
native
=
l
;
}
}
else
{
/*
* Cannot restart from the middle;
* there is no place to save state in the native type.
* Request a continuation from the very beginning.
*/
rval
.
consumed
=
0
;
}
ASN_STRUCT_FREE_CONTENTS_ONLY
(
asn_DEF_INTEGER
,
&
st
);
return
rval
;
}
asn_enc_rval_t
NativeInteger_encode_xer
(
asn_TYPE_descriptor_t
*
td
,
void
*
sptr
,
int
ilevel
,
enum
xer_encoder_flags_e
flags
,
asn_app_consume_bytes_f
*
cb
,
void
*
app_key
)
{
asn_INTEGER_specifics_t
*
specs
=
(
asn_INTEGER_specifics_t
*
)
td
->
specifics
;
char
scratch
[
32
];
/* Enough for 64-bit int */
asn_enc_rval_t
er
;
const
long
*
native
=
(
const
long
*
)
sptr
;
(
void
)
ilevel
;
(
void
)
flags
;
if
(
!
native
)
_ASN_ENCODE_FAILED
;
er
.
encoded
=
snprintf
(
scratch
,
sizeof
(
scratch
),
(
specs
&&
specs
->
field_unsigned
)
?
"%lu"
:
"%ld"
,
*
native
);
if
(
er
.
encoded
<=
0
||
(
size_t
)
er
.
encoded
>=
sizeof
(
scratch
)
||
cb
(
scratch
,
er
.
encoded
,
app_key
)
<
0
)
_ASN_ENCODE_FAILED
;
_ASN_ENCODED_OK
(
er
);
}
asn_dec_rval_t
NativeInteger_decode_uper
(
asn_codec_ctx_t
*
opt_codec_ctx
,
asn_TYPE_descriptor_t
*
td
,
asn_per_constraints_t
*
constraints
,
void
**
sptr
,
asn_per_data_t
*
pd
)
{
asn_INTEGER_specifics_t
*
specs
=
(
asn_INTEGER_specifics_t
*
)
td
->
specifics
;
asn_dec_rval_t
rval
;
long
*
native
=
(
long
*
)
*
sptr
;
INTEGER_t
tmpint
;
void
*
tmpintptr
=
&
tmpint
;
(
void
)
opt_codec_ctx
;
ASN_DEBUG
(
"Decoding NativeInteger %s (UPER)"
,
td
->
name
);
if
(
!
native
)
{
native
=
(
long
*
)(
*
sptr
=
CALLOC
(
1
,
sizeof
(
*
native
)));
if
(
!
native
)
_ASN_DECODE_FAILED
;
}
memset
(
&
tmpint
,
0
,
sizeof
tmpint
);
rval
=
INTEGER_decode_uper
(
opt_codec_ctx
,
td
,
constraints
,
&
tmpintptr
,
pd
);
if
(
rval
.
code
==
RC_OK
)
{
if
((
specs
&&
specs
->
field_unsigned
)
?
asn_INTEGER2ulong
(
&
tmpint
,
(
unsigned
long
*
)
native
)
:
asn_INTEGER2long
(
&
tmpint
,
native
))
rval
.
code
=
RC_FAIL
;
else
ASN_DEBUG
(
"NativeInteger %s got value %ld"
,
td
->
name
,
*
native
);
}
ASN_STRUCT_FREE_CONTENTS_ONLY
(
asn_DEF_INTEGER
,
&
tmpint
);
return
rval
;
}
asn_dec_rval_t
NativeInteger_decode_aper
(
asn_codec_ctx_t
*
opt_codec_ctx
,
asn_TYPE_descriptor_t
*
td
,
asn_per_constraints_t
*
constraints
,
void
**
sptr
,
asn_per_data_t
*
pd
)
{
asn_INTEGER_specifics_t
*
specs
=
(
asn_INTEGER_specifics_t
*
)
td
->
specifics
;
asn_dec_rval_t
rval
;
long
*
native
=
(
long
*
)
*
sptr
;
INTEGER_t
tmpint
;
void
*
tmpintptr
=
&
tmpint
;
//int dynamic = 0;
(
void
)
opt_codec_ctx
;
ASN_DEBUG
(
"Decoding NativeInteger %s (APER)"
,
td
->
name
);
if
(
!
native
)
{
native
=
(
long
*
)(
*
sptr
=
CALLOC
(
1
,
sizeof
(
*
native
)));
//dynamic = 1;
if
(
!
native
)
_ASN_DECODE_FAILED
;
}
memset
(
&
tmpint
,
0
,
sizeof
tmpint
);
rval
=
INTEGER_decode_aper
(
opt_codec_ctx
,
td
,
constraints
,
&
tmpintptr
,
pd
);
if
(
rval
.
code
==
RC_OK
)
{
if
((
specs
&&
specs
->
field_unsigned
)
?
asn_INTEGER2ulong
(
&
tmpint
,
(
unsigned
long
*
)
native
)
:
asn_INTEGER2long
(
&
tmpint
,
native
))
rval
.
code
=
RC_FAIL
;
else
ASN_DEBUG
(
"NativeInteger %s got value %ld"
,
td
->
name
,
*
native
);
}
ASN_STRUCT_FREE_CONTENTS_ONLY
(
asn_DEF_INTEGER
,
&
tmpint
);
//if (dynamic)
// free(native);
return
rval
;
}
asn_enc_rval_t
NativeInteger_encode_uper
(
asn_TYPE_descriptor_t
*
td
,
asn_per_constraints_t
*
constraints
,
void
*
sptr
,
asn_per_outp_t
*
po
)
{
asn_INTEGER_specifics_t
*
specs
=
(
asn_INTEGER_specifics_t
*
)
td
->
specifics
;
asn_enc_rval_t
er
;
long
native
;
INTEGER_t
tmpint
;
if
(
!
sptr
)
_ASN_ENCODE_FAILED
;
native
=
*
(
long
*
)
sptr
;
ASN_DEBUG
(
"Encoding NativeInteger %s %ld (UPER)"
,
td
->
name
,
native
);
memset
(
&
tmpint
,
0
,
sizeof
(
tmpint
));
if
((
specs
&&
specs
->
field_unsigned
)
?
asn_ulong2INTEGER
(
&
tmpint
,
native
)
:
asn_long2INTEGER
(
&
tmpint
,
native
))
_ASN_ENCODE_FAILED
;
er
=
INTEGER_encode_uper
(
td
,
constraints
,
&
tmpint
,
po
);
ASN_STRUCT_FREE_CONTENTS_ONLY
(
asn_DEF_INTEGER
,
&
tmpint
);
return
er
;
}
asn_enc_rval_t
NativeInteger_encode_aper
(
asn_TYPE_descriptor_t
*
td
,
asn_per_constraints_t
*
constraints
,
void
*
sptr
,
asn_per_outp_t
*
po
)
{
asn_INTEGER_specifics_t
*
specs
=
(
asn_INTEGER_specifics_t
*
)
td
->
specifics
;
asn_enc_rval_t
er
;
INTEGER_t
tmpint
;
if
(
!
sptr
)
_ASN_ENCODE_FAILED
;
memset
(
&
tmpint
,
0
,
sizeof
(
tmpint
));
if
(
specs
&&
specs
->
field_unsigned
)
{
unsigned
long
native
;
native
=
*
(
unsigned
long
*
)
sptr
;