Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
asn1c
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
asn1c
Commits
71b96b59
Commit
71b96b59
authored
Feb 02, 2024
by
v0-e
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
copy: Implementation for all types
parent
648f0bc3
Changes
71
Hide whitespace changes
Inline
Side-by-side
Showing
71 changed files
with
534 additions
and
0 deletions
+534
-0
asn1-tools/unber/libasn1_unber_tool.c
asn1-tools/unber/libasn1_unber_tool.c
+9
-0
skeletons/ANY.c
skeletons/ANY.c
+1
-0
skeletons/ANY.h
skeletons/ANY.h
+1
-0
skeletons/BIT_STRING.c
skeletons/BIT_STRING.c
+35
-0
skeletons/BIT_STRING.h
skeletons/BIT_STRING.h
+1
-0
skeletons/BMPString.c
skeletons/BMPString.c
+1
-0
skeletons/BMPString.h
skeletons/BMPString.h
+1
-0
skeletons/BOOLEAN.c
skeletons/BOOLEAN.c
+27
-0
skeletons/BOOLEAN.h
skeletons/BOOLEAN.h
+1
-0
skeletons/ENUMERATED.c
skeletons/ENUMERATED.c
+1
-0
skeletons/ENUMERATED.h
skeletons/ENUMERATED.h
+1
-0
skeletons/GeneralString.c
skeletons/GeneralString.c
+1
-0
skeletons/GeneralString.h
skeletons/GeneralString.h
+1
-0
skeletons/GeneralizedTime.c
skeletons/GeneralizedTime.c
+1
-0
skeletons/GeneralizedTime.h
skeletons/GeneralizedTime.h
+1
-0
skeletons/GraphicString.c
skeletons/GraphicString.c
+1
-0
skeletons/GraphicString.h
skeletons/GraphicString.h
+1
-0
skeletons/IA5String.c
skeletons/IA5String.c
+1
-0
skeletons/IA5String.h
skeletons/IA5String.h
+1
-0
skeletons/INTEGER.c
skeletons/INTEGER.c
+38
-0
skeletons/INTEGER.h
skeletons/INTEGER.h
+1
-0
skeletons/ISO646String.c
skeletons/ISO646String.c
+1
-0
skeletons/ISO646String.h
skeletons/ISO646String.h
+1
-0
skeletons/NULL.c
skeletons/NULL.c
+13
-0
skeletons/NULL.h
skeletons/NULL.h
+1
-0
skeletons/NativeEnumerated.c
skeletons/NativeEnumerated.c
+1
-0
skeletons/NativeEnumerated.h
skeletons/NativeEnumerated.h
+1
-0
skeletons/NativeInteger.c
skeletons/NativeInteger.c
+28
-0
skeletons/NativeInteger.h
skeletons/NativeInteger.h
+1
-0
skeletons/NativeReal.c
skeletons/NativeReal.c
+30
-0
skeletons/NativeReal.h
skeletons/NativeReal.h
+1
-0
skeletons/NumericString.c
skeletons/NumericString.c
+1
-0
skeletons/NumericString.h
skeletons/NumericString.h
+1
-0
skeletons/OBJECT_IDENTIFIER.c
skeletons/OBJECT_IDENTIFIER.c
+1
-0
skeletons/OBJECT_IDENTIFIER.h
skeletons/OBJECT_IDENTIFIER.h
+1
-0
skeletons/OCTET_STRING.c
skeletons/OCTET_STRING.c
+38
-0
skeletons/OCTET_STRING.h
skeletons/OCTET_STRING.h
+1
-0
skeletons/OPEN_TYPE.c
skeletons/OPEN_TYPE.c
+1
-0
skeletons/OPEN_TYPE.h
skeletons/OPEN_TYPE.h
+1
-0
skeletons/ObjectDescriptor.c
skeletons/ObjectDescriptor.c
+1
-0
skeletons/PrintableString.c
skeletons/PrintableString.c
+1
-0
skeletons/PrintableString.h
skeletons/PrintableString.h
+1
-0
skeletons/REAL.c
skeletons/REAL.c
+36
-0
skeletons/REAL.h
skeletons/REAL.h
+1
-0
skeletons/RELATIVE-OID.c
skeletons/RELATIVE-OID.c
+1
-0
skeletons/RELATIVE-OID.h
skeletons/RELATIVE-OID.h
+1
-0
skeletons/T61String.c
skeletons/T61String.c
+1
-0
skeletons/T61String.h
skeletons/T61String.h
+1
-0
skeletons/TeletexString.c
skeletons/TeletexString.c
+1
-0
skeletons/TeletexString.h
skeletons/TeletexString.h
+1
-0
skeletons/UTCTime.c
skeletons/UTCTime.c
+1
-0
skeletons/UTCTime.h
skeletons/UTCTime.h
+1
-0
skeletons/UTF8String.c
skeletons/UTF8String.c
+1
-0
skeletons/UTF8String.h
skeletons/UTF8String.h
+1
-0
skeletons/UniversalString.c
skeletons/UniversalString.c
+1
-0
skeletons/UniversalString.h
skeletons/UniversalString.h
+1
-0
skeletons/VideotexString.c
skeletons/VideotexString.c
+1
-0
skeletons/VideotexString.h
skeletons/VideotexString.h
+1
-0
skeletons/VisibleString.c
skeletons/VisibleString.c
+1
-0
skeletons/VisibleString.h
skeletons/VisibleString.h
+1
-0
skeletons/constr_CHOICE.c
skeletons/constr_CHOICE.c
+54
-0
skeletons/constr_CHOICE.h
skeletons/constr_CHOICE.h
+1
-0
skeletons/constr_SEQUENCE.c
skeletons/constr_SEQUENCE.c
+51
-0
skeletons/constr_SEQUENCE.h
skeletons/constr_SEQUENCE.h
+1
-0
skeletons/constr_SEQUENCE_OF.c
skeletons/constr_SEQUENCE_OF.c
+1
-0
skeletons/constr_SEQUENCE_OF.h
skeletons/constr_SEQUENCE_OF.h
+1
-0
skeletons/constr_SET.c
skeletons/constr_SET.c
+51
-0
skeletons/constr_SET.h
skeletons/constr_SET.h
+1
-0
skeletons/constr_SET_OF.c
skeletons/constr_SET_OF.c
+56
-0
skeletons/constr_SET_OF.h
skeletons/constr_SET_OF.h
+1
-0
skeletons/constr_TYPE.h
skeletons/constr_TYPE.h
+11
-0
No files found.
asn1-tools/unber/libasn1_unber_tool.c
View file @
71b96b59
...
...
@@ -866,6 +866,15 @@ OCTET_STRING_compare(const asn_TYPE_descriptor_t *td, const void *a,
return
0
;
}
int
OCTET_STRING_copy
(
const
asn_TYPE_descriptor_t
*
td
,
void
**
a
,
const
void
*
b
)
{
(
void
)
td
;
(
void
)
a
;
(
void
)
b
;
return
0
;
}
intmax_t
asn_random_between
(
intmax_t
a
,
intmax_t
b
)
{
(
void
)
b
;
...
...
skeletons/ANY.c
View file @
71b96b59
...
...
@@ -18,6 +18,7 @@ asn_TYPE_operation_t asn_OP_ANY = {
0
,
#endif
/* !defined(ASN_DISABLE_PRINT_SUPPORT) */
OCTET_STRING_compare
,
OCTET_STRING_copy
,
#if !defined(ASN_DISABLE_BER_SUPPORT)
OCTET_STRING_decode_ber
,
OCTET_STRING_encode_der
,
...
...
skeletons/ANY.h
View file @
71b96b59
...
...
@@ -29,6 +29,7 @@ extern asn_OCTET_STRING_specifics_t asn_SPC_ANY_specs;
#endif
/* !defined(ASN_DISABLE_PRINT_SUPPORT) */
#define ANY_compare OCTET_STRING_compare
#define ANY_copy OCTET_STRING_copy
#define ANY_constraint asn_generic_no_constraint
...
...
skeletons/BIT_STRING.c
View file @
71b96b59
...
...
@@ -24,6 +24,7 @@ asn_TYPE_operation_t asn_OP_BIT_STRING = {
0
,
#endif
/* !defined(ASN_DISABLE_PRINT_SUPPORT) */
BIT_STRING_compare
,
BIT_STRING_copy
,
#if !defined(ASN_DISABLE_BER_SUPPORT)
OCTET_STRING_decode_ber
,
/* Implemented in terms of OCTET STRING */
OCTET_STRING_encode_der
,
/* Implemented in terms of OCTET STRING */
...
...
@@ -213,3 +214,37 @@ BIT_STRING_compare(const asn_TYPE_descriptor_t *td, const void *aptr,
return
1
;
}
}
int
BIT_STRING_copy
(
const
asn_TYPE_descriptor_t
*
td
,
void
**
aptr
,
const
void
*
bptr
)
{
const
asn_OCTET_STRING_specifics_t
*
specs
=
td
->
specifics
;
BIT_STRING_t
*
a
=
(
BIT_STRING_t
*
)
*
aptr
;
const
BIT_STRING_t
*
b
=
(
const
BIT_STRING_t
*
)
bptr
;
if
(
!
b
)
{
if
(
a
)
{
FREEMEM
(
a
->
buf
);
FREEMEM
(
a
);
*
aptr
=
0
;
}
return
0
;
}
if
(
!
a
)
{
a
=
*
aptr
=
CALLOC
(
1
,
specs
->
struct_size
);
if
(
!
a
)
return
-
1
;
}
uint8_t
*
buf
=
MALLOC
(
b
->
size
+
1
);
if
(
!
buf
)
return
-
1
;
memcpy
(
buf
,
b
->
buf
,
b
->
size
);
buf
[
b
->
size
]
=
0
;
FREEMEM
(
a
->
buf
);
a
->
buf
=
buf
;
a
->
size
=
b
->
size
;
a
->
bits_unused
=
b
->
bits_unused
;
return
0
;
}
skeletons/BIT_STRING.h
View file @
71b96b59
...
...
@@ -31,6 +31,7 @@ asn_struct_print_f BIT_STRING_print; /* Human-readable output */
#endif
/* !defined(ASN_DISABLE_PRINT_SUPPORT) */
asn_struct_compare_f
BIT_STRING_compare
;
asn_struct_copy_f
BIT_STRING_copy
;
asn_constr_check_f
BIT_STRING_constraint
;
...
...
skeletons/BMPString.c
View file @
71b96b59
...
...
@@ -32,6 +32,7 @@ asn_TYPE_operation_t asn_OP_BMPString = {
0
,
#endif
/* !defined(ASN_DISABLE_PRINT_SUPPORT) */
OCTET_STRING_compare
,
OCTET_STRING_copy
,
#if !defined(ASN_DISABLE_BER_SUPPORT)
OCTET_STRING_decode_ber
,
OCTET_STRING_encode_der
,
...
...
skeletons/BMPString.h
View file @
71b96b59
...
...
@@ -28,6 +28,7 @@ asn_struct_print_f BMPString_print; /* Human-readable output */
#endif
/* !defined(ASN_DISABLE_PRINT_SUPPORT) */
#define BMPString_compare OCTET_STRING_compare
#define BMPString_copy OCTET_STRING_copy
asn_constr_check_f
BMPString_constraint
;
...
...
skeletons/BOOLEAN.c
View file @
71b96b59
...
...
@@ -19,6 +19,7 @@ asn_TYPE_operation_t asn_OP_BOOLEAN = {
0
,
#endif
/* !defined(ASN_DISABLE_PRINT_SUPPORT) */
BOOLEAN_compare
,
BOOLEAN_copy
,
#if !defined(ASN_DISABLE_BER_SUPPORT)
BOOLEAN_decode_ber
,
BOOLEAN_encode_der
,
...
...
@@ -128,3 +129,29 @@ BOOLEAN_compare(const asn_TYPE_descriptor_t *td, const void *aptr,
return
1
;
}
}
int
BOOLEAN_copy
(
const
asn_TYPE_descriptor_t
*
td
,
void
**
aptr
,
const
void
*
bptr
)
{
BOOLEAN_t
*
a
=
*
aptr
;
const
BOOLEAN_t
*
b
=
bptr
;
(
void
)
td
;
if
(
!
b
)
{
if
(
a
)
{
FREEMEM
(
a
);
*
aptr
=
0
;
}
return
0
;
}
if
(
!
a
)
{
a
=
*
aptr
=
MALLOC
(
sizeof
(
BOOLEAN_t
));
if
(
!
a
)
return
-
1
;
}
*
a
=
*
b
;
return
0
;
}
skeletons/BOOLEAN.h
View file @
71b96b59
...
...
@@ -28,6 +28,7 @@ asn_struct_print_f BOOLEAN_print;
#endif
/* !defined(ASN_DISABLE_PRINT_SUPPORT) */
asn_struct_compare_f
BOOLEAN_compare
;
asn_struct_copy_f
BOOLEAN_copy
;
#define BOOLEAN_constraint asn_generic_no_constraint
...
...
skeletons/ENUMERATED.c
View file @
71b96b59
...
...
@@ -20,6 +20,7 @@ asn_TYPE_operation_t asn_OP_ENUMERATED = {
0
,
#endif
/* !defined(ASN_DISABLE_PRINT_SUPPORT) */
INTEGER_compare
,
/* Implemented in terms of INTEGER */
INTEGER_copy
,
/* Implemented in terms of INTEGER */
#if !defined(ASN_DISABLE_BER_SUPPORT)
ber_decode_primitive
,
INTEGER_encode_der
,
/* Implemented in terms of INTEGER */
...
...
skeletons/ENUMERATED.h
View file @
71b96b59
...
...
@@ -23,6 +23,7 @@ extern asn_TYPE_operation_t asn_OP_ENUMERATED;
#endif
/* !defined(ASN_DISABLE_PRINT_SUPPORT) */
#define ENUMERATED_compare INTEGER_compare
#define ENUMERATED_copy INTEGER_copy
#define ENUMERATED_constraint asn_generic_no_constraint
...
...
skeletons/GeneralString.c
View file @
71b96b59
...
...
@@ -20,6 +20,7 @@ asn_TYPE_operation_t asn_OP_GeneralString = {
0
,
#endif
/* !defined(ASN_DISABLE_PRINT_SUPPORT) */
OCTET_STRING_compare
,
OCTET_STRING_copy
,
#if !defined(ASN_DISABLE_BER_SUPPORT)
OCTET_STRING_decode_ber
,
/* Implemented in terms of OCTET STRING */
OCTET_STRING_encode_der
,
...
...
skeletons/GeneralString.h
View file @
71b96b59
...
...
@@ -23,6 +23,7 @@ extern asn_TYPE_operation_t asn_OP_GeneralString;
#endif
/* !defined(ASN_DISABLE_PRINT_SUPPORT) */
#define GeneralString_compare OCTET_STRING_compare
#define GeneralString_copy OCTET_STRING_copy
#define GeneralString_constraint asn_generic_unknown_constraint
...
...
skeletons/GeneralizedTime.c
View file @
71b96b59
...
...
@@ -182,6 +182,7 @@ asn_TYPE_operation_t asn_OP_GeneralizedTime = {
0
,
#endif
/* !defined(ASN_DISABLE_PRINT_SUPPORT) */
GeneralizedTime_compare
,
GeneralizedTime_copy
,
#if !defined(ASN_DISABLE_BER_SUPPORT)
OCTET_STRING_decode_ber
,
/* Implemented in terms of OCTET STRING */
GeneralizedTime_encode_der
,
...
...
skeletons/GeneralizedTime.h
View file @
71b96b59
...
...
@@ -23,6 +23,7 @@ asn_struct_print_f GeneralizedTime_print;
#endif
/* !defined(ASN_DISABLE_PRINT_SUPPORT) */
asn_struct_compare_f
GeneralizedTime_compare
;
#define GeneralizedTime_copy OCTET_STRING_copy
asn_constr_check_f
GeneralizedTime_constraint
;
...
...
skeletons/GraphicString.c
View file @
71b96b59
...
...
@@ -20,6 +20,7 @@ asn_TYPE_operation_t asn_OP_GraphicString = {
0
,
#endif
/* !defined(ASN_DISABLE_PRINT_SUPPORT) */
OCTET_STRING_compare
,
OCTET_STRING_copy
,
#if !defined(ASN_DISABLE_BER_SUPPORT)
OCTET_STRING_decode_ber
,
/* Implemented in terms of OCTET STRING */
OCTET_STRING_encode_der
,
...
...
skeletons/GraphicString.h
View file @
71b96b59
...
...
@@ -23,6 +23,7 @@ extern asn_TYPE_operation_t asn_OP_GraphicString;
#endif
/* !defined(ASN_DISABLE_PRINT_SUPPORT) */
#define GraphicString_compare OCTET_STRING_compare
#define GraphicString_copy OCTET_STRING_copy
#define GraphicString_constraint asn_generic_unknown_constraint
...
...
skeletons/IA5String.c
View file @
71b96b59
...
...
@@ -27,6 +27,7 @@ asn_TYPE_operation_t asn_OP_IA5String = {
0
,
#endif
/* !defined(ASN_DISABLE_PRINT_SUPPORT) */
OCTET_STRING_compare
,
OCTET_STRING_copy
,
#if !defined(ASN_DISABLE_BER_SUPPORT)
OCTET_STRING_decode_ber
,
/* Implemented in terms of OCTET STRING */
OCTET_STRING_encode_der
,
...
...
skeletons/IA5String.h
View file @
71b96b59
...
...
@@ -26,6 +26,7 @@ extern asn_TYPE_operation_t asn_OP_IA5String;
#endif
/* !defined(ASN_DISABLE_PRINT_SUPPORT) */
#define IA5String_compare OCTET_STRING_compare
#define IA5String_copy OCTET_STRING_copy
asn_constr_check_f
IA5String_constraint
;
...
...
skeletons/INTEGER.c
View file @
71b96b59
...
...
@@ -22,6 +22,7 @@ asn_TYPE_operation_t asn_OP_INTEGER = {
0
,
#endif
/* !defined(ASN_DISABLE_PRINT_SUPPORT) */
INTEGER_compare
,
INTEGER_copy
,
#if !defined(ASN_DISABLE_BER_SUPPORT)
ber_decode_primitive
,
INTEGER_encode_der
,
...
...
@@ -738,3 +739,40 @@ INTEGER_compare(const asn_TYPE_descriptor_t *td, const void *aptr,
}
}
int
INTEGER_copy
(
const
asn_TYPE_descriptor_t
*
td
,
void
**
aptr
,
const
void
*
bptr
)
{
(
void
)
td
;
INTEGER_t
*
a
=
*
aptr
;
const
INTEGER_t
*
b
=
bptr
;
if
(
!
b
)
{
if
(
a
)
{
FREEMEM
(
a
->
buf
);
FREEMEM
(
a
);
*
aptr
=
0
;
}
return
0
;
}
if
(
!
a
)
{
a
=
*
aptr
=
CALLOC
(
1
,
sizeof
(
*
a
));
if
(
!
a
)
return
-
1
;
}
if
(
b
->
size
)
{
uint8_t
*
buf
=
MALLOC
(
b
->
size
);
if
(
!
buf
)
return
-
1
;
memcpy
(
buf
,
b
->
buf
,
b
->
size
);
FREEMEM
(
a
->
buf
);
a
->
buf
=
buf
;
a
->
size
=
b
->
size
;
}
else
{
FREEMEM
(
a
->
buf
);
a
->
buf
=
0
;
a
->
size
=
0
;
}
return
0
;
}
skeletons/INTEGER.h
View file @
71b96b59
...
...
@@ -47,6 +47,7 @@ asn_struct_print_f INTEGER_print;
#endif
/* !defined(ASN_DISABLE_PRINT_SUPPORT) */
asn_struct_compare_f
INTEGER_compare
;
asn_struct_copy_f
INTEGER_copy
;
#define INTEGER_constraint asn_generic_no_constraint
...
...
skeletons/ISO646String.c
View file @
71b96b59
...
...
@@ -27,6 +27,7 @@ asn_TYPE_operation_t asn_OP_ISO646String = {
0
,
#endif
/* !defined(ASN_DISABLE_PRINT_SUPPORT) */
OCTET_STRING_compare
,
OCTET_STRING_copy
,
#if !defined(ASN_DISABLE_BER_SUPPORT)
OCTET_STRING_decode_ber
,
/* Implemented in terms of OCTET STRING */
OCTET_STRING_encode_der
,
...
...
skeletons/ISO646String.h
View file @
71b96b59
...
...
@@ -24,6 +24,7 @@ extern asn_TYPE_operation_t asn_OP_ISO646String;
#endif
/* !defined(ASN_DISABLE_PRINT_SUPPORT) */
#define ISO646String_compare OCTET_STRING_compare
#define ISO646String_copy OCTET_STRING_copy
#define ISO646String_constraint VisibleString_constraint
...
...
skeletons/NULL.c
View file @
71b96b59
...
...
@@ -19,6 +19,7 @@ asn_TYPE_operation_t asn_OP_NULL = {
0
,
#endif
/* !defined(ASN_DISABLE_PRINT_SUPPORT) */
NULL_compare
,
NULL_copy
,
#if !defined(ASN_DISABLE_BER_SUPPORT)
NULL_decode_ber
,
NULL_encode_der
,
/* Special handling of DER encoding */
...
...
@@ -113,3 +114,15 @@ NULL_compare(const asn_TYPE_descriptor_t *td, const void *a, const void *b) {
(
void
)
b
;
return
0
;
}
int
NULL_copy
(
const
asn_TYPE_descriptor_t
*
td
,
void
**
a
,
const
void
*
b
)
{
(
void
)
td
;
if
(
b
&&
!*
a
)
{
*
a
=
CALLOC
(
1
,
sizeof
(
NULL_t
));
if
(
!*
a
)
return
-
1
;
}
return
0
;
}
skeletons/NULL.h
View file @
71b96b59
...
...
@@ -27,6 +27,7 @@ asn_struct_print_f NULL_print;
#endif
/* !defined(ASN_DISABLE_PRINT_SUPPORT) */
asn_struct_compare_f
NULL_compare
;
asn_struct_copy_f
NULL_copy
;
#define NULL_constraint asn_generic_no_constraint
...
...
skeletons/NativeEnumerated.c
View file @
71b96b59
...
...
@@ -26,6 +26,7 @@ asn_TYPE_operation_t asn_OP_NativeEnumerated = {
0
,
#endif
/* !defined(ASN_DISABLE_PRINT_SUPPORT) */
NativeInteger_compare
,
NativeInteger_copy
,
#if !defined(ASN_DISABLE_BER_SUPPORT)
NativeInteger_decode_ber
,
NativeInteger_encode_der
,
...
...
skeletons/NativeEnumerated.h
View file @
71b96b59
...
...
@@ -29,6 +29,7 @@ extern asn_TYPE_operation_t asn_OP_NativeEnumerated;
#endif
/* !defined(ASN_DISABLE_PRINT_SUPPORT) */
#define NativeEnumerated_compare NativeInteger_compare
#define NativeEnumerated_copy NativeInteger_copy
#define NativeEnumerated_constraint asn_generic_no_constraint
...
...
skeletons/NativeInteger.c
View file @
71b96b59
...
...
@@ -27,6 +27,7 @@ asn_TYPE_operation_t asn_OP_NativeInteger = {
0
,
#endif
/* !defined(ASN_DISABLE_PRINT_SUPPORT) */
NativeInteger_compare
,
NativeInteger_copy
,
#if !defined(ASN_DISABLE_BER_SUPPORT)
NativeInteger_decode_ber
,
NativeInteger_encode_der
,
...
...
@@ -152,3 +153,30 @@ NativeInteger_compare(const asn_TYPE_descriptor_t *td, const void *aptr, const v
return
1
;
}
}
int
NativeInteger_copy
(
const
asn_TYPE_descriptor_t
*
td
,
void
**
aptr
,
const
void
*
bptr
)
{
unsigned
long
*
a
=
*
aptr
;
const
unsigned
long
*
b
=
bptr
;
(
void
)
td
;
/* Check if source has data */
if
(
!
b
)
{
/* Clear destination */
if
(
a
)
{
FREEMEM
(
a
);
*
aptr
=
0
;
}
return
0
;
}
if
(
!
a
)
{
a
=
*
aptr
=
MALLOC
(
sizeof
(
*
a
));
if
(
!
a
)
return
-
1
;
}
*
a
=
*
b
;
return
0
;
}
skeletons/NativeInteger.h
View file @
71b96b59
...
...
@@ -29,6 +29,7 @@ asn_struct_print_f NativeInteger_print;
#endif
/* !defined(ASN_DISABLE_PRINT_SUPPORT) */
asn_struct_compare_f
NativeInteger_compare
;
asn_struct_copy_f
NativeInteger_copy
;
#define NativeInteger_constraint asn_generic_no_constraint
...
...
skeletons/NativeReal.c
View file @
71b96b59
...
...
@@ -46,6 +46,7 @@ asn_TYPE_operation_t asn_OP_NativeReal = {
0
,
#endif
/* !defined(ASN_DISABLE_PRINT_SUPPORT) */
NativeReal_compare
,
NativeReal_copy
,
#if !defined(ASN_DISABLE_BER_SUPPORT)
NativeReal_decode_ber
,
NativeReal_encode_der
,
...
...
@@ -149,6 +150,35 @@ NativeReal_compare(const asn_TYPE_descriptor_t *td, const void *aptr,
}
}
int
NativeReal_copy
(
const
asn_TYPE_descriptor_t
*
td
,
void
**
aptr
,
const
void
*
bptr
)
{
size_t
float_size
=
NativeReal__float_size
(
td
);
void
*
a
=
*
aptr
;
const
void
*
b
=
bptr
;
if
(
!
b
)
{
if
(
a
)
{
FREEMEM
(
a
);
*
aptr
=
0
;
}
return
0
;
}
if
(
!
a
)
{
a
=
*
aptr
=
MALLOC
(
float_size
);
if
(
!
a
)
return
-
1
;
}
if
(
float_size
==
sizeof
(
float
))
{
*
(
float
*
)
a
=
*
(
const
float
*
)
b
;
}
else
{
*
(
double
*
)
a
=
*
(
const
double
*
)
b
;
}
return
0
;
}
void
NativeReal_free
(
const
asn_TYPE_descriptor_t
*
td
,
void
*
ptr
,
enum
asn_struct_free_method
method
)
{
...
...
skeletons/NativeReal.h
View file @
71b96b59
...
...
@@ -37,6 +37,7 @@ asn_struct_print_f NativeReal_print;
#endif
/* !defined(ASN_DISABLE_PRINT_SUPPORT) */
asn_struct_compare_f
NativeReal_compare
;
asn_struct_copy_f
NativeReal_copy
;
#define NativeReal_constraint asn_generic_no_constraint
...
...
skeletons/NumericString.c
View file @
71b96b59
...
...
@@ -47,6 +47,7 @@ asn_TYPE_operation_t asn_OP_NumericString = {
0
,
#endif
/* !defined(ASN_DISABLE_PRINT_SUPPORT) */
OCTET_STRING_compare
,
OCTET_STRING_copy
,
#if !defined(ASN_DISABLE_BER_SUPPORT)
OCTET_STRING_decode_ber
,
/* Implemented in terms of OCTET STRING */
OCTET_STRING_encode_der
,
...
...
skeletons/NumericString.h
View file @
71b96b59
...
...
@@ -23,6 +23,7 @@ extern asn_TYPE_operation_t asn_OP_NumericString;
#endif
/* !defined(ASN_DISABLE_PRINT_SUPPORT) */
#define NumericString_compare OCTET_STRING_compare
#define NumericString_copy OCTET_STRING_copy
asn_constr_check_f
NumericString_constraint
;
...
...
skeletons/OBJECT_IDENTIFIER.c
View file @
71b96b59
...
...
@@ -24,6 +24,7 @@ asn_TYPE_operation_t asn_OP_OBJECT_IDENTIFIER = {
0
,
#endif
/* !defined(ASN_DISABLE_PRINT_SUPPORT) */
OCTET_STRING_compare
,
/* Implemented in terms of a string comparison */
OCTET_STRING_copy
,
/* Implemented in terms of a string copy */
#if !defined(ASN_DISABLE_BER_SUPPORT)
ber_decode_primitive
,
der_encode_primitive
,
...
...
skeletons/OBJECT_IDENTIFIER.h
View file @
71b96b59
...
...
@@ -32,6 +32,7 @@ asn_struct_print_f OBJECT_IDENTIFIER_print;
#endif
/* !defined(ASN_DISABLE_PRINT_SUPPORT) */
#define OBJECT_IDENTIFIER_compare OCTET_STRING_compare
#define OBJECT_IDENTIFIER_copy OCTET_STRING_copy
asn_constr_check_f
OBJECT_IDENTIFIER_constraint
;
...
...
skeletons/OCTET_STRING.c
View file @
71b96b59
...
...
@@ -26,6 +26,7 @@ asn_TYPE_operation_t asn_OP_OCTET_STRING = {
0
,
#endif
/* !defined(ASN_DISABLE_PRINT_SUPPORT) */
OCTET_STRING_compare
,
OCTET_STRING_copy
,
#if !defined(ASN_DISABLE_BER_SUPPORT)
OCTET_STRING_decode_ber
,
OCTET_STRING_encode_der
,
...
...
@@ -249,6 +250,43 @@ OCTET_STRING_compare(const asn_TYPE_descriptor_t *td, const void *aptr,
}
int
OCTET_STRING_copy
(
const
asn_TYPE_descriptor_t
*
td
,
void
**
aptr
,
const
void
*
bptr
)
{
const
asn_OCTET_STRING_specifics_t
*
specs
=
td
->
specifics
?
(
const
asn_OCTET_STRING_specifics_t
*
)
td
->
specifics
:
&
asn_SPC_OCTET_STRING_specs
;
OCTET_STRING_t
*
a
=
*
aptr
;
const
OCTET_STRING_t
*
b
=
bptr
;
if
(
!
b
)
{
if
(
a
)
{
FREEMEM
(
a
->
buf
);
a
->
buf
=
0
;
a
->
size
=
0
;
FREEMEM
(
a
);
}
*
aptr
=
0
;
return
0
;
}
if
(
!
a
)
{
a
=
*
aptr
=
(
OCTET_STRING_t
*
)
CALLOC
(
1
,
specs
->
struct_size
);
if
(
!
a
)
return
-
1
;
}
void
*
buf
=
MALLOC
(
b
->
size
+
1
);
if
(
!
buf
)
return
-
1
;
memcpy
(
buf
,
b
->
buf
,
b
->
size
);
((
uint8_t
*
)
buf
)[
b
->
size
]
=
'\0'
;
FREEMEM
(
a
->
buf
);
a
->
buf
=
(
uint8_t
*
)
buf
;
a
->
size
=
b
->
size
;
return
0
;
}
#if !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT)
int
OCTET_STRING_per_get_characters
(
asn_per_data_t
*
po
,
uint8_t
*
buf
,
...
...
skeletons/OCTET_STRING.h
View file @
71b96b59
...
...
@@ -29,6 +29,7 @@ asn_struct_print_f OCTET_STRING_print_utf8;
#endif
/* !defined(ASN_DISABLE_PRINT_SUPPORT) */
asn_struct_compare_f
OCTET_STRING_compare
;
asn_struct_copy_f
OCTET_STRING_copy
;
#define OCTET_STRING_constraint asn_generic_no_constraint
...
...
skeletons/OPEN_TYPE.c
View file @
71b96b59
...
...
@@ -14,6 +14,7 @@ asn_TYPE_operation_t asn_OP_OPEN_TYPE = {
0
,
#endif
/* !defined(ASN_DISABLE_PRINT_SUPPORT) */
OPEN_TYPE_compare
,
OPEN_TYPE_copy
,
#if !defined(ASN_DISABLE_BER_SUPPORT)
OPEN_TYPE_decode_ber
,
OPEN_TYPE_encode_der
,
...
...
skeletons/OPEN_TYPE.h
View file @
71b96b59
...
...
@@ -33,6 +33,7 @@ extern "C" {
#endif
/* !defined(ASN_DISABLE_PRINT_SUPPORT) */
#define OPEN_TYPE_compare CHOICE_compare
#define OPEN_TYPE_copy CHOICE_copy
#define OPEN_TYPE_constraint CHOICE_constraint
...
...
skeletons/ObjectDescriptor.c
View file @
71b96b59
...
...
@@ -20,6 +20,7 @@ asn_TYPE_operation_t asn_OP_ObjectDescriptor = {
0
,
#endif
/* !defined(ASN_DISABLE_PRINT_SUPPORT) */
OCTET_STRING_compare
,
OCTET_STRING_copy
,
#if !defined(ASN_DISABLE_BER_SUPPORT)
OCTET_STRING_decode_ber
,
/* Implemented in terms of OCTET STRING */
OCTET_STRING_encode_der
,
...
...
skeletons/PrintableString.c
View file @
71b96b59
...
...
@@ -57,6 +57,7 @@ asn_TYPE_operation_t asn_OP_PrintableString = {
0
,
#endif
/* !defined(ASN_DISABLE_PRINT_SUPPORT) */
OCTET_STRING_compare
,
OCTET_STRING_copy
,
#if !defined(ASN_DISABLE_BER_SUPPORT)
OCTET_STRING_decode_ber
,
/* Implemented in terms of OCTET STRING */
OCTET_STRING_encode_der
,
...
...
skeletons/PrintableString.h
View file @
71b96b59
...
...
@@ -23,6 +23,7 @@ extern asn_TYPE_operation_t asn_OP_PrintableString;
#endif
/* !defined(ASN_DISABLE_PRINT_SUPPORT) */
#define PrintableString_compare OCTET_STRING_compare
#define PrintableString_copy OCTET_STRING_copy
asn_constr_check_f
PrintableString_constraint
;
...
...
skeletons/REAL.c
View file @
71b96b59
...
...
@@ -62,6 +62,7 @@ asn_TYPE_operation_t asn_OP_REAL = {
0
,
#endif
/* !defined(ASN_DISABLE_PRINT_SUPPORT) */
REAL_compare
,
REAL_copy
,
#if !defined(ASN_DISABLE_BER_SUPPORT)
ber_decode_primitive
,
der_encode_primitive
,
...
...
@@ -361,6 +362,41 @@ REAL_compare(const asn_TYPE_descriptor_t *td, const void *aptr,
}
}
int
REAL_copy
(
const
asn_TYPE_descriptor_t
*
td
,
void
**
aptr
,
const
void
*
bptr
)
{
REAL_t
*
a
=
*
aptr
;
const
REAL_t
*
b
=
bptr
;
(
void
)
td
;
if
(
!
b
)
{
if
(
a
)
{
FREEMEM
(
a
->
buf
);
FREEMEM
(
a
);
*
aptr
=
0
;
}
return
0
;
}
if
(
!
a
)
{
a
=
*
aptr
=
CALLOC
(
1
,
sizeof
(
*
a
));
if
(
!
a
)
return
-
1
;
}
if
(
b
->
size
)
{
uint8_t
*
buf
=
(
uint8_t
*
)
MALLOC
(
b
->
size
);
if
(
!
buf
)
return
-
1
;
memcpy
(
buf
,
b
->
buf
,
b
->
size
);
FREEMEM
(
a
->
buf
);
a
->
buf
=
buf
;
a
->
size
=
b
->
size
;
}
return
0
;
}
int
asn_REAL2double
(
const
REAL_t
*
st
,
double
*
dbl_value
)
{
unsigned
int
octv
;
...
...
skeletons/REAL.h
View file @
71b96b59
...
...
@@ -54,6 +54,7 @@ asn_struct_print_f REAL_print;
#endif
/* !defined(ASN_DISABLE_PRINT_SUPPORT) */
asn_struct_compare_f
REAL_compare
;
asn_struct_copy_f
REAL_copy
;
#define REAL_constraint asn_generic_no_constraint
...
...
skeletons/RELATIVE-OID.c
View file @
71b96b59
...
...
@@ -22,6 +22,7 @@ asn_TYPE_operation_t asn_OP_RELATIVE_OID = {
0
,
#endif
/* !defined(ASN_DISABLE_PRINT_SUPPORT) */
OCTET_STRING_compare
,
/* Implemented in terms of opaque comparison */
OCTET_STRING_copy
,
/* Implemented in terms of opaque copy */
#if !defined(ASN_DISABLE_BER_SUPPORT)
ber_decode_primitive
,
der_encode_primitive
,
...
...
skeletons/RELATIVE-OID.h
View file @
71b96b59
...
...
@@ -28,6 +28,7 @@ asn_struct_print_f RELATIVE_OID_print;
#endif
/* !defined(ASN_DISABLE_PRINT_SUPPORT) */
#define RELATIVE_OID_compare OCTET_STRING_compare
#define RELATIVE_OID_copy OCTET_STRING_copy
#define RELATIVE_OID_constraint asn_generic_no_constraint
...
...
skeletons/T61String.c
View file @
71b96b59
...
...
@@ -20,6 +20,7 @@ asn_TYPE_operation_t asn_OP_T61String = {
0
,
#endif
/* !defined(ASN_DISABLE_PRINT_SUPPORT) */
OCTET_STRING_compare
,
OCTET_STRING_copy
,
#if !defined(ASN_DISABLE_BER_SUPPORT)
OCTET_STRING_decode_ber
,
/* Implemented in terms of OCTET STRING */
OCTET_STRING_encode_der
,
...
...
skeletons/T61String.h
View file @
71b96b59
...
...
@@ -23,6 +23,7 @@ extern asn_TYPE_operation_t asn_OP_T61String;
#endif
/* !defined(ASN_DISABLE_PRINT_SUPPORT) */
#define T61String_compare OCTET_STRING_compare
#define T61String_copy OCTET_STRING_copy
#define T61String_constraint asn_generic_unknown_constraint
...
...
skeletons/TeletexString.c
View file @
71b96b59
...
...
@@ -20,6 +20,7 @@ asn_TYPE_operation_t asn_OP_TeletexString = {
0
,
#endif
/* !defined(ASN_DISABLE_PRINT_SUPPORT) */
OCTET_STRING_compare
,
OCTET_STRING_copy
,
#if !defined(ASN_DISABLE_BER_SUPPORT)
OCTET_STRING_decode_ber
,
/* Implemented in terms of OCTET STRING */
OCTET_STRING_encode_der
,
...
...
skeletons/TeletexString.h
View file @
71b96b59
...
...
@@ -23,6 +23,7 @@ extern asn_TYPE_operation_t asn_OP_TeletexString;
#endif
/* !defined(ASN_DISABLE_PRINT_SUPPORT) */
#define TeletexString_compare OCTET_STRING_compare
#define TeletexString_copy OCTET_STRING_copy
#define TeletexString_constraint asn_generic_unknown_constraint
...
...
skeletons/UTCTime.c
View file @
71b96b59
...
...
@@ -38,6 +38,7 @@ asn_TYPE_operation_t asn_OP_UTCTime = {
0
,
#endif
/* !defined(ASN_DISABLE_PRINT_SUPPORT) */
UTCTime_compare
,
UTCTime_copy
,
#if !defined(ASN_DISABLE_BER_SUPPORT)
OCTET_STRING_decode_ber
,
/* Implemented in terms of OCTET STRING */
OCTET_STRING_encode_der
,
/* Implemented in terms of OCTET STRING */
...
...
skeletons/UTCTime.h
View file @
71b96b59
...
...
@@ -23,6 +23,7 @@ asn_struct_print_f UTCTime_print;
#endif
/* !defined(ASN_DISABLE_PRINT_SUPPORT) */
asn_struct_compare_f
UTCTime_compare
;
#define UTCTime_copy OCTET_STRING_copy
asn_constr_check_f
UTCTime_constraint
;
...
...
skeletons/UTF8String.c
View file @
71b96b59
...
...
@@ -21,6 +21,7 @@ asn_TYPE_operation_t asn_OP_UTF8String = {
0
,
#endif
/* !defined(ASN_DISABLE_PRINT_SUPPORT) */
OCTET_STRING_compare
,
OCTET_STRING_copy
,
#if !defined(ASN_DISABLE_BER_SUPPORT)
OCTET_STRING_decode_ber
,
/* Implemented in terms of OCTET STRING */
OCTET_STRING_encode_der
,
...
...
skeletons/UTF8String.h
View file @
71b96b59
...
...
@@ -23,6 +23,7 @@ asn_struct_print_f UTF8String_print;
#endif
/* !defined(ASN_DISABLE_PRINT_SUPPORT) */
#define UTF8String_compare OCTET_STRING_compare
#define UTF8String_copy OCTET_STRING_copy
asn_constr_check_f
UTF8String_constraint
;
...
...
skeletons/UniversalString.c
View file @
71b96b59
...
...
@@ -32,6 +32,7 @@ asn_TYPE_operation_t asn_OP_UniversalString = {
0
,
#endif
/* !defined(ASN_DISABLE_PRINT_SUPPORT) */
OCTET_STRING_compare
,
OCTET_STRING_copy
,
#if !defined(ASN_DISABLE_BER_SUPPORT)
OCTET_STRING_decode_ber
,
OCTET_STRING_encode_der
,
...
...
skeletons/UniversalString.h
View file @
71b96b59
...
...
@@ -24,6 +24,7 @@ asn_struct_print_f UniversalString_print; /* Human-readable output */
#endif
/* !defined(ASN_DISABLE_PRINT_SUPPORT) */
#define UniversalString_compare OCTET_STRING_compare
#define UniversalString_copy OCTET_STRING_copy
asn_constr_check_f
UniversalString_constraint
;
...
...
skeletons/VideotexString.c
View file @
71b96b59
...
...
@@ -20,6 +20,7 @@ asn_TYPE_operation_t asn_OP_VideotexString = {
0
,
#endif
/* !defined(ASN_DISABLE_PRINT_SUPPORT) */
OCTET_STRING_compare
,
OCTET_STRING_copy
,
#if !defined(ASN_DISABLE_BER_SUPPORT)
OCTET_STRING_decode_ber
,
/* Implemented in terms of OCTET STRING */
OCTET_STRING_encode_der
,
...
...
skeletons/VideotexString.h
View file @
71b96b59
...
...
@@ -23,6 +23,7 @@ extern asn_TYPE_operation_t asn_OP_VideotexString;
#endif
/* !defined(ASN_DISABLE_PRINT_SUPPORT) */
#define VideotexString_compare OCTET_STRING_compare
#define VideotexString_copy OCTET_STRING_copy
#define VideotexString_constraint asn_generic_unknown_constraint
...
...
skeletons/VisibleString.c
View file @
71b96b59
...
...
@@ -27,6 +27,7 @@ asn_TYPE_operation_t asn_OP_VisibleString = {
0
,
#endif
/* !defined(ASN_DISABLE_PRINT_SUPPORT) */
OCTET_STRING_compare
,
OCTET_STRING_copy
,
#if !defined(ASN_DISABLE_BER_SUPPORT)
OCTET_STRING_decode_ber
,
/* Implemented in terms of OCTET STRING */
OCTET_STRING_encode_der
,
...
...
skeletons/VisibleString.h
View file @
71b96b59
...
...
@@ -23,6 +23,7 @@ extern asn_TYPE_operation_t asn_OP_VisibleString;
#endif
/* !defined(ASN_DISABLE_PRINT_SUPPORT) */
#define VisibleString_compare OCTET_STRING_compare
#define VisibleString_copy OCTET_STRING_copy
asn_constr_check_f
VisibleString_constraint
;
...
...
skeletons/constr_CHOICE.c
View file @
71b96b59
...
...
@@ -13,6 +13,7 @@ asn_TYPE_operation_t asn_OP_CHOICE = {
0
,
#endif
/* !defined(ASN_DISABLE_PRINT_SUPPORT) */
CHOICE_compare
,
CHOICE_copy
,
#if !defined(ASN_DISABLE_BER_SUPPORT)
CHOICE_decode_ber
,
CHOICE_encode_der
,
...
...
@@ -314,6 +315,59 @@ CHOICE_compare(const asn_TYPE_descriptor_t *td, const void *aptr, const void *bp
}
}
int
CHOICE_copy
(
const
asn_TYPE_descriptor_t
*
td
,
void
**
aptr
,
const
void
*
bptr
)
{
if
(
!
td
)
return
-
1
;
void
*
st
=
*
aptr
;
const
asn_CHOICE_specifics_t
*
specs
=
(
const
asn_CHOICE_specifics_t
*
)
td
->
specifics
;
const
asn_TYPE_member_t
*
elm
;
/* CHOICE's element */
int
present
;
int
ret
;
void
*
amemb
;
void
**
amembp
;
const
void
*
bmemb
;
if
(
!
bptr
)
{
if
(
st
)
{
ASN_STRUCT_FREE
(
*
td
,
st
);
*
aptr
=
NULL
;
}
return
0
;
}
if
(
!
st
)
{
st
=
*
aptr
=
CALLOC
(
1
,
specs
->
struct_size
);
if
(
!
st
)
return
-
1
;
}
present
=
_fetch_present_idx
(
bptr
,
specs
->
pres_offset
,
specs
->
pres_size
);
if
(
present
<=
0
&&
(
unsigned
)
present
>
td
->
elements_count
)
return
-
1
;
--
present
;
elm
=
&
td
->
elements
[
present
];
if
(
elm
->
flags
&
ATF_POINTER
)
{
/* Member is a pointer to another structure */
amembp
=
(
void
**
)((
char
*
)
st
+
elm
->
memb_offset
);
bmemb
=
*
(
const
void
*
const
*
)((
const
char
*
)
bptr
+
elm
->
memb_offset
);
}
else
{
amemb
=
(
char
*
)
st
+
elm
->
memb_offset
;
amembp
=
&
amemb
;
bmemb
=
(
const
void
*
)((
const
char
*
)
bptr
+
elm
->
memb_offset
);
}
ret
=
elm
->
type
->
op
->
copy_struct
(
elm
->
type
,
amembp
,
bmemb
);
if
(
ret
!=
0
)
return
ret
;
_set_present_idx
(
st
,
specs
->
pres_offset
,
specs
->
pres_size
,
present
+
1
);
return
0
;
}
/*
* Return the 1-based choice variant presence index.
* Returns 0 in case of error.
...
...
skeletons/constr_CHOICE.h
View file @
71b96b59
...
...
@@ -46,6 +46,7 @@ asn_struct_print_f CHOICE_print;
#endif
/* !defined(ASN_DISABLE_PRINT_SUPPORT) */
asn_struct_compare_f
CHOICE_compare
;
asn_struct_copy_f
CHOICE_copy
;
asn_constr_check_f
CHOICE_constraint
;
...
...
skeletons/constr_SEQUENCE.c
View file @
71b96b59
...
...
@@ -14,6 +14,7 @@ asn_TYPE_operation_t asn_OP_SEQUENCE = {
0
,
#endif
/* !defined(ASN_DISABLE_PRINT_SUPPORT) */
SEQUENCE_compare
,
SEQUENCE_copy
,
#if !defined(ASN_DISABLE_BER_SUPPORT)
SEQUENCE_decode_ber
,
SEQUENCE_encode_der
,
...
...
@@ -198,3 +199,53 @@ SEQUENCE_compare(const asn_TYPE_descriptor_t *td, const void *aptr,
return
0
;
}
int
SEQUENCE_copy
(
const
asn_TYPE_descriptor_t
*
td
,
void
**
aptr
,
const
void
*
bptr
)
{
if
(
!
td
)
return
-
1
;
const
asn_SEQUENCE_specifics_t
*
specs
=
(
const
asn_SEQUENCE_specifics_t
*
)
td
->
specifics
;
size_t
edx
;
void
*
st
=
*
aptr
;
/* Target structure */
if
(
!
bptr
)
{
if
(
st
)
{
SEQUENCE_free
(
td
,
st
,
0
);
*
aptr
=
0
;
}
return
0
;
}
/*
* Create the target structure if it is not present already.
*/
if
(
st
==
0
)
{
st
=
*
aptr
=
CALLOC
(
1
,
specs
->
struct_size
);
if
(
st
==
0
)
return
-
1
;
}
for
(
edx
=
0
;
edx
<
td
->
elements_count
;
edx
++
)
{
asn_TYPE_member_t
*
elm
=
&
td
->
elements
[
edx
];
void
*
amemb
;
void
**
amembp
;
const
void
*
bmemb
;
int
ret
;
if
(
elm
->
flags
&
ATF_POINTER
)
{
/* Member is a pointer to another structure */
amembp
=
(
void
**
)((
char
*
)
st
+
elm
->
memb_offset
);
bmemb
=
*
(
const
void
*
const
*
)((
const
char
*
)
bptr
+
elm
->
memb_offset
);
}
else
{
amemb
=
(
char
*
)
st
+
elm
->
memb_offset
;
amembp
=
&
amemb
;
bmemb
=
(
const
void
*
)((
const
char
*
)
bptr
+
elm
->
memb_offset
);
}
ret
=
elm
->
type
->
op
->
copy_struct
(
elm
->
type
,
amembp
,
bmemb
);
if
(
ret
!=
0
)
return
ret
;
}
return
0
;
}
skeletons/constr_SEQUENCE.h
View file @
71b96b59
...
...
@@ -51,6 +51,7 @@ asn_struct_print_f SEQUENCE_print;
#endif
/* !defined(ASN_DISABLE_PRINT_SUPPORT) */
asn_struct_compare_f
SEQUENCE_compare
;
asn_struct_copy_f
SEQUENCE_copy
;
asn_constr_check_f
SEQUENCE_constraint
;
...
...
skeletons/constr_SEQUENCE_OF.c
View file @
71b96b59
...
...
@@ -15,6 +15,7 @@ asn_TYPE_operation_t asn_OP_SEQUENCE_OF = {
0
,
#endif
/* !defined(ASN_DISABLE_PRINT_SUPPORT) */
SEQUENCE_OF_compare
,
SEQUENCE_OF_copy
,
#if !defined(ASN_DISABLE_BER_SUPPORT)
SEQUENCE_OF_decode_ber
,
SEQUENCE_OF_encode_der
,
...
...
skeletons/constr_SEQUENCE_OF.h
View file @
71b96b59
...
...
@@ -23,6 +23,7 @@ extern "C" {
#endif
/* !defined(ASN_DISABLE_PRINT_SUPPORT) */
asn_struct_compare_f
SEQUENCE_OF_compare
;
#define SEQUENCE_OF_copy SET_OF_copy
#define SEQUENCE_OF_constraint SET_OF_constraint
...
...
skeletons/constr_SET.c
View file @
71b96b59
...
...
@@ -14,6 +14,7 @@ asn_TYPE_operation_t asn_OP_SET = {
0
,
#endif
/* !defined(ASN_DISABLE_PRINT_SUPPORT) */
SET_compare
,
SET_copy
,
#if !defined(ASN_DISABLE_BER_SUPPORT)
SET_decode_ber
,
SET_encode_der
,
...
...
@@ -216,3 +217,53 @@ SET_compare(const asn_TYPE_descriptor_t *td, const void *aptr,
return
0
;
}
int
SET_copy
(
const
asn_TYPE_descriptor_t
*
td
,
void
**
aptr
,
const
void
*
bptr
)
{
if
(
!
td
)
return
-
1
;
const
asn_SET_specifics_t
*
specs
=
(
const
asn_SET_specifics_t
*
)
td
->
specifics
;
size_t
edx
;
void
*
st
=
*
aptr
;
/* Target structure */
if
(
!
bptr
)
{
if
(
st
)
{
SET_free
(
td
,
st
,
ASFM_FREE_EVERYTHING
);
*
aptr
=
0
;
}
return
0
;
}
/*
* Create the target structure if it is not present already.
*/
if
(
st
==
0
)
{
st
=
*
aptr
=
CALLOC
(
1
,
specs
->
struct_size
);
if
(
st
==
0
)
return
-
1
;
}
for
(
edx
=
0
;
edx
<
td
->
elements_count
;
edx
++
)
{
asn_TYPE_member_t
*
elm
=
&
td
->
elements
[
edx
];
void
*
amemb
;
void
**
amembp
;
const
void
*
bmemb
;
int
ret
;
if
(
elm
->
flags
&
ATF_POINTER
)
{
/* Member is a pointer to another structure */
amembp
=
(
void
**
)((
char
*
)
st
+
elm
->
memb_offset
);
bmemb
=
*
(
const
void
*
const
*
)((
const
char
*
)
bptr
+
elm
->
memb_offset
);
}
else
{
amemb
=
(
char
*
)
st
+
elm
->
memb_offset
;
amembp
=
&
amemb
;
bmemb
=
(
const
void
*
)((
const
char
*
)
bptr
+
elm
->
memb_offset
);
}
ret
=
elm
->
type
->
op
->
copy_struct
(
elm
->
type
,
amembp
,
bmemb
);
if
(
ret
!=
0
)
return
ret
;
}
return
0
;
}
skeletons/constr_SET.h
View file @
71b96b59
...
...
@@ -52,6 +52,7 @@ asn_struct_print_f SET_print;
#endif
/* !defined(ASN_DISABLE_PRINT_SUPPORT) */
asn_struct_compare_f
SET_compare
;
asn_struct_copy_f
SET_copy
;
asn_constr_check_f
SET_constraint
;
...
...
skeletons/constr_SET_OF.c
View file @
71b96b59
...
...
@@ -14,6 +14,7 @@ asn_TYPE_operation_t asn_OP_SET_OF = {
0
,
#endif
/* !defined(ASN_DISABLE_PRINT_SUPPORT) */
SET_OF_compare
,
SET_OF_copy
,
#if !defined(ASN_DISABLE_BER_SUPPORT)
SET_OF_decode_ber
,
SET_OF_encode_der
,
...
...
@@ -371,3 +372,58 @@ SET_OF_compare(const asn_TYPE_descriptor_t *td, const void *aptr,
return
0
;
}
int
SET_OF_copy
(
const
asn_TYPE_descriptor_t
*
td
,
void
**
aptr
,
const
void
*
bptr
)
{
if
(
!
td
)
return
-
1
;
const
asn_SET_OF_specifics_t
*
specs
=
(
const
asn_SET_OF_specifics_t
*
)
td
->
specifics
;
void
*
st
=
*
aptr
;
if
(
!
bptr
)
{
if
(
*
aptr
)
{
asn_set_empty
(
_A_SET_FROM_VOID
(
*
aptr
));
*
aptr
=
0
;
}
return
0
;
}
if
(
st
==
0
)
{
st
=
*
aptr
=
CALLOC
(
1
,
specs
->
struct_size
);
if
(
st
==
0
)
return
-
1
;
}
asn_anonymous_set_
*
a
=
_A_SET_FROM_VOID
(
*
aptr
);
const
asn_anonymous_set_
*
b
=
_A_CSET_FROM_VOID
(
bptr
);
if
(
b
->
size
)
{
void
*
_new_arr
;
_new_arr
=
REALLOC
(
a
->
array
,
b
->
size
*
sizeof
(
b
->
array
[
0
]));
if
(
_new_arr
)
{
a
->
array
=
(
void
**
)
_new_arr
;
a
->
size
=
b
->
size
;
}
else
{
return
-
1
;
}
a
->
count
=
b
->
count
;
for
(
int
i
=
0
;
i
<
b
->
count
;
i
++
)
{
void
*
bmemb
=
b
->
array
[
i
];
if
(
bmemb
)
{
void
*
amemb
=
0
;
int
ret
;
ret
=
td
->
elements
->
type
->
op
->
copy_struct
(
td
->
elements
->
type
,
&
amemb
,
bmemb
);
if
(
ret
!=
0
)
return
ret
;
a
->
array
[
i
]
=
amemb
;
}
else
{
a
->
array
[
i
]
=
0
;
}
}
}
return
0
;
}
skeletons/constr_SET_OF.h
View file @
71b96b59
...
...
@@ -33,6 +33,7 @@ asn_struct_print_f SET_OF_print;
#endif
/* !defined(ASN_DISABLE_PRINT_SUPPORT) */
asn_struct_compare_f
SET_OF_compare
;
asn_struct_copy_f
SET_OF_copy
;
asn_constr_check_f
SET_OF_constraint
;
...
...
skeletons/constr_TYPE.h
View file @
71b96b59
...
...
@@ -143,6 +143,16 @@ typedef int (asn_struct_compare_f)(
const
void
*
struct_A
,
const
void
*
struct_B
);
/*
* Copies struct B into struct A.
* Allocates memory for struct A, if necessary.
*/
typedef
int
(
asn_struct_copy_f
)(
const
struct
asn_TYPE_descriptor_s
*
type_descriptor
,
void
**
struct_A
,
const
void
*
struct_B
);
/*
* Return the outmost tag of the type.
* If the type is untagged CHOICE, the dynamic operation is performed.
...
...
@@ -175,6 +185,7 @@ typedef struct asn_TYPE_operation_s {
asn_struct_free_f
*
free_struct
;
/* Free the structure */
asn_struct_print_f
*
print_struct
;
/* Human readable output */
asn_struct_compare_f
*
compare_struct
;
/* Compare two structures */
asn_struct_copy_f
*
copy_struct
;
/* Copy method */
ber_type_decoder_f
*
ber_decoder
;
/* Generic BER decoder */
der_type_encoder_f
*
der_encoder
;
/* Canonical DER encoder */
xer_type_decoder_f
*
xer_decoder
;
/* Generic XER decoder */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment