Skip to content

Commit 06e4c85

Browse files
committed
BNER: Make OCTET_STRING_print a weak function
This will allow a bacnet library to override this function and be able to pretty print the BNER primitives: Double CharacterString Date Time BACnetObjectIdentifier
1 parent 7c6c02f commit 06e4c85

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

skeletons/OCTET_STRING.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1653,8 +1653,8 @@ OCTET_STRING_encode_uper(const asn_TYPE_descriptor_t *td,
16531653
#endif /* ASN_DISABLE_PER_SUPPORT */
16541654

16551655
int
1656-
OCTET_STRING_print(const asn_TYPE_descriptor_t *td, const void *sptr,
1657-
int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
1656+
OCTET_STRING_print_impl(const asn_TYPE_descriptor_t *td, const void *sptr,
1657+
int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
16581658
const char * const h2c = "0123456789ABCDEF";
16591659
const OCTET_STRING_t *st = (const OCTET_STRING_t *)sptr;
16601660
char scratch[16 * 3 + 4];
@@ -1694,6 +1694,12 @@ OCTET_STRING_print(const asn_TYPE_descriptor_t *td, const void *sptr,
16941694
return 0;
16951695
}
16961696

1697+
__attribute__((weak)) int
1698+
OCTET_STRING_print(const asn_TYPE_descriptor_t *td, const void *sptr,
1699+
int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
1700+
return OCTET_STRING_print_impl(td, sptr, ilevel, cb, app_key);
1701+
}
1702+
16971703
int
16981704
OCTET_STRING_print_utf8(const asn_TYPE_descriptor_t *td, const void *sptr,
16991705
int ilevel, asn_app_consume_bytes_f *cb,

skeletons/OCTET_STRING.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ extern asn_TYPE_operation_t asn_OP_OCTET_STRING;
2323

2424
asn_struct_free_f OCTET_STRING_free;
2525
asn_struct_print_f OCTET_STRING_print;
26+
asn_struct_print_f OCTET_STRING_print_impl;
2627
asn_struct_print_f OCTET_STRING_print_utf8;
2728
asn_struct_compare_f OCTET_STRING_compare;
2829
ber_type_decoder_f OCTET_STRING_decode_ber;

0 commit comments

Comments
 (0)