X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?p=sim%2Fe2-interface.git;a=blobdiff_plain;f=e2sim%2Fe2apv1sim%2FASN1c%2Foer_support.h;fp=e2sim%2Fe2apv1sim%2FASN1c%2Foer_support.h;h=dbc9b5fcff51a184b7fb7937cd4353592d0f6156;hp=0000000000000000000000000000000000000000;hb=0eba05c4ff0c99974d3f3a63b65cbe2adb209e51;hpb=c380e183231711cf9f8bc72d0eb52e532dd07085 diff --git a/e2sim/e2apv1sim/ASN1c/oer_support.h b/e2sim/e2apv1sim/ASN1c/oer_support.h new file mode 100644 index 0000000..dbc9b5f --- /dev/null +++ b/e2sim/e2apv1sim/ASN1c/oer_support.h @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2017 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#ifndef OER_SUPPORT_H +#define OER_SUPPORT_H + +#include /* Platform-specific types */ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Pre-computed OER constraints. + */ +typedef struct asn_oer_constraint_number_s { + unsigned width; /* ±8,4,2,1 fixed bytes */ + unsigned positive; /* 1 for unsigned number, 0 for signed */ +} asn_oer_constraint_number_t; +typedef struct asn_oer_constraints_s { + asn_oer_constraint_number_t value; + ssize_t size; /* -1 (no constraint) or >= 0 */ +} asn_oer_constraints_t; + + +/* + * Fetch the length determinant (X.696 (08/2015), #8.6) into *len_r. + * RETURN VALUES: + * 0: More data expected than bufptr contains. + * -1: Fatal error deciphering length. + * >0: Number of bytes used from bufptr. + */ +ssize_t oer_fetch_length(const void *bufptr, size_t size, size_t *len_r); + +/* + * Serialize OER length. Returns the number of bytes serialized + * or -1 if a given callback returned with negative result. + */ +ssize_t oer_serialize_length(size_t length, asn_app_consume_bytes_f *cb, void *app_key); + + +#ifdef __cplusplus +} +#endif + +#endif /* OER_SUPPORT_H */