Skip to content

Commit

Permalink
BNER: Make OCTET_STRING_print a weak function
Browse files Browse the repository at this point in the history
This will allow a bacnet library to override this function and be able to
pretty print the BNER primitives:
  Double
  CharacterString
  Date
  Time
  BACnetObjectIdentifier
  • Loading branch information
ringlej committed Dec 1, 2017
1 parent 7c6c02f commit 06e4c85
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
10 changes: 8 additions & 2 deletions skeletons/OCTET_STRING.c
Original file line number Diff line number Diff line change
Expand Up @@ -1653,8 +1653,8 @@ OCTET_STRING_encode_uper(const asn_TYPE_descriptor_t *td,
#endif /* ASN_DISABLE_PER_SUPPORT */

int
OCTET_STRING_print(const asn_TYPE_descriptor_t *td, const void *sptr,
int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
OCTET_STRING_print_impl(const asn_TYPE_descriptor_t *td, const void *sptr,
int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
const char * const h2c = "0123456789ABCDEF";
const OCTET_STRING_t *st = (const OCTET_STRING_t *)sptr;
char scratch[16 * 3 + 4];
Expand Down Expand Up @@ -1694,6 +1694,12 @@ OCTET_STRING_print(const asn_TYPE_descriptor_t *td, const void *sptr,
return 0;
}

__attribute__((weak)) int
OCTET_STRING_print(const asn_TYPE_descriptor_t *td, const void *sptr,
int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
return OCTET_STRING_print_impl(td, sptr, ilevel, cb, app_key);
}

int
OCTET_STRING_print_utf8(const asn_TYPE_descriptor_t *td, const void *sptr,
int ilevel, asn_app_consume_bytes_f *cb,
Expand Down
1 change: 1 addition & 0 deletions skeletons/OCTET_STRING.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ extern asn_TYPE_operation_t asn_OP_OCTET_STRING;

asn_struct_free_f OCTET_STRING_free;
asn_struct_print_f OCTET_STRING_print;
asn_struct_print_f OCTET_STRING_print_impl;
asn_struct_print_f OCTET_STRING_print_utf8;
asn_struct_compare_f OCTET_STRING_compare;
ber_type_decoder_f OCTET_STRING_decode_ber;
Expand Down

0 comments on commit 06e4c85

Please sign in to comment.