summaryrefslogtreecommitdiffstats
path: root/asn1/asn1c/ber_decoder.h
diff options
context:
space:
mode:
authorSimo Sorce <simo@redhat.com>2014-11-13 11:31:09 -0500
committerSimo Sorce <simo@redhat.com>2014-11-20 10:52:13 -0500
commitc6afc489a1c9d86fd593bd47c4a8dae6d9a008d2 (patch)
tree27ad9cc99e3c8e38b8df1adacb3cca5e3f8f1e43 /asn1/asn1c/ber_decoder.h
parentb170851058d6712442d553ef3d11ecd21b282443 (diff)
downloadfreeipa-c6afc489a1c9d86fd593bd47c4a8dae6d9a008d2.tar.gz
freeipa-c6afc489a1c9d86fd593bd47c4a8dae6d9a008d2.tar.xz
freeipa-c6afc489a1c9d86fd593bd47c4a8dae6d9a008d2.zip
Add asn1c generated code for keytab controls
Instead of manually encoding controls, use an actual asn1 compiler. The file asn1/asn1c/ipa.asn1 will contain ipa modules. The generated code is committed to the tree and built into a static library that is linked to the code that uses it. The first module implements the GetKeytabControl control. Related: https://fedorahosted.org/freeipa/ticket/4718 https://fedorahosted.org/freeipa/ticket/4728 Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com> Reviewed-By: Nathaniel McCallum <npmccallum@redhat.com>
Diffstat (limited to 'asn1/asn1c/ber_decoder.h')
-rw-r--r--asn1/asn1c/ber_decoder.h63
1 files changed, 63 insertions, 0 deletions
diff --git a/asn1/asn1c/ber_decoder.h b/asn1/asn1c/ber_decoder.h
new file mode 100644
index 000000000..768133b67
--- /dev/null
+++ b/asn1/asn1c/ber_decoder.h
@@ -0,0 +1,63 @@
+/*-
+ * Copyright (c) 2003, 2004 Lev Walkin <vlm@lionet.info>. All rights reserved.
+ * Redistribution and modifications are permitted subject to BSD license.
+ */
+#ifndef _BER_DECODER_H_
+#define _BER_DECODER_H_
+
+#include <asn_application.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct asn_TYPE_descriptor_s; /* Forward declaration */
+struct asn_codec_ctx_s; /* Forward declaration */
+
+/*
+ * The BER decoder of any type.
+ * This function may be invoked directly from the application.
+ */
+asn_dec_rval_t ber_decode(struct asn_codec_ctx_s *opt_codec_ctx,
+ struct asn_TYPE_descriptor_s *type_descriptor,
+ void **struct_ptr, /* Pointer to a target structure's pointer */
+ const void *buffer, /* Data to be decoded */
+ size_t size /* Size of that buffer */
+ );
+
+/*
+ * Type of generic function which decodes the byte stream into the structure.
+ */
+typedef asn_dec_rval_t (ber_type_decoder_f)(
+ struct asn_codec_ctx_s *opt_codec_ctx,
+ struct asn_TYPE_descriptor_s *type_descriptor,
+ void **struct_ptr, const void *buf_ptr, size_t size,
+ int tag_mode);
+
+/*******************************
+ * INTERNALLY USEFUL FUNCTIONS *
+ *******************************/
+
+/*
+ * Check that all tags correspond to the type definition (as given in head).
+ * On return, last_length would contain either a non-negative length of the
+ * value part of the last TLV, or the negative number of expected
+ * "end of content" sequences. The number may only be negative if the
+ * head->last_tag_form is non-zero.
+ */
+asn_dec_rval_t ber_check_tags(
+ struct asn_codec_ctx_s *opt_codec_ctx, /* codec options */
+ struct asn_TYPE_descriptor_s *type_descriptor,
+ asn_struct_ctx_t *opt_ctx, /* saved decoding context */
+ const void *ptr, size_t size,
+ int tag_mode, /* {-1,0,1}: IMPLICIT, no, EXPLICIT */
+ int last_tag_form, /* {-1,0:1}: any, primitive, constr */
+ ber_tlv_len_t *last_length,
+ int *opt_tlv_form /* optional tag form */
+ );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _BER_DECODER_H_ */