summaryrefslogtreecommitdiffstats
path: root/include/asn1c
diff options
context:
space:
mode:
Diffstat (limited to 'include/asn1c')
-rw-r--r--include/asn1c/Makefile.am2
-rw-r--r--include/asn1c/asn1helpers.h26
2 files changed, 27 insertions, 1 deletions
diff --git a/include/asn1c/Makefile.am b/include/asn1c/Makefile.am
index 899ad78..0e56b05 100644
--- a/include/asn1c/Makefile.am
+++ b/include/asn1c/Makefile.am
@@ -1,3 +1,3 @@
asn1cdir = $(includedir)/asn1c
-asn1c_HEADERS = ANY.h asn_application.h asn_codecs.h asn_codecs_prim.h asn_internal.h asn_SEQUENCE_OF.h asn_SET_OF.h asn_system.h ber_decoder.h ber_tlv_length.h ber_tlv_tag.h BIT_STRING.h BMPString.h BOOLEAN.h constraints.h constr_CHOICE.h constr_SEQUENCE.h constr_SEQUENCE_OF.h constr_SET.h constr_SET_OF.h constr_TYPE.h der_encoder.h ENUMERATED.h GeneralizedTime.h GeneralString.h GraphicString.h IA5String.h INTEGER.h ISO646String.h NativeEnumerated.h NativeInteger.h NativeReal.h NULL.h NumericString.h ObjectDescriptor.h OBJECT_IDENTIFIER.h OCTET_STRING.h per_decoder.h per_encoder.h per_support.h PrintableString.h REAL.h RELATIVE-OID.h T61String.h TeletexString.h UniversalString.h UTCTime.h UTF8String.h VideotexString.h VisibleString.h xer_decoder.h xer_encoder.h xer_support.h per_opentype.h
+asn1c_HEADERS = ANY.h asn_application.h asn_codecs.h asn_codecs_prim.h asn_internal.h asn_SEQUENCE_OF.h asn_SET_OF.h asn_system.h ber_decoder.h ber_tlv_length.h ber_tlv_tag.h BIT_STRING.h BMPString.h BOOLEAN.h constraints.h constr_CHOICE.h constr_SEQUENCE.h constr_SEQUENCE_OF.h constr_SET.h constr_SET_OF.h constr_TYPE.h der_encoder.h ENUMERATED.h GeneralizedTime.h GeneralString.h GraphicString.h IA5String.h INTEGER.h ISO646String.h NativeEnumerated.h NativeInteger.h NativeReal.h NULL.h NumericString.h ObjectDescriptor.h OBJECT_IDENTIFIER.h OCTET_STRING.h per_decoder.h per_encoder.h per_support.h PrintableString.h REAL.h RELATIVE-OID.h T61String.h TeletexString.h UniversalString.h UTCTime.h UTF8String.h VideotexString.h VisibleString.h xer_decoder.h xer_encoder.h xer_support.h per_opentype.h asn1helpers.h
diff --git a/include/asn1c/asn1helpers.h b/include/asn1c/asn1helpers.h
new file mode 100644
index 0000000..007f207
--- /dev/null
+++ b/include/asn1c/asn1helpers.h
@@ -0,0 +1,26 @@
+#pragma once
+
+#include <unistd.h>
+
+#include "asn_system.h"
+#include "BIT_STRING.h"
+#include "OCTET_STRING.h"
+
+void asn1_u32_to_bitstring(BIT_STRING_t *bitstr, uint32_t *buf, uint32_t in);
+void asn1_u28_to_bitstring(BIT_STRING_t *bitstr, uint32_t *buf, uint32_t in);
+void asn1_u24_to_bitstring(BIT_STRING_t *bitstr, uint32_t *buf, uint32_t in);
+int BIT_STRING_fromBuf(BIT_STRING_t *st, const uint8_t *str, unsigned int bit_len);
+void asn1_u16_to_str(OCTET_STRING_t *str, uint16_t *buf, uint16_t in);
+void asn1_u8_to_str(OCTET_STRING_t *str, uint8_t *buf, uint8_t in);
+int asn1_strncpy(char *out, const OCTET_STRING_t *in, size_t n);
+uint16_t asn1str_to_u16(const OCTET_STRING_t *in);
+uint8_t asn1str_to_u8(const OCTET_STRING_t *in);
+uint32_t asn1bitstr_to_u32(const BIT_STRING_t *in);
+uint32_t asn1bitstr_to_u28(const BIT_STRING_t *in);
+uint32_t asn1bitstr_to_u24(const BIT_STRING_t *in);
+
+static inline void OCTET_STRING_noalloc(OCTET_STRING_t *s, const uint8_t *str, int size)
+{
+ s->buf = str;
+ s->size = size;
+}