summaryrefslogtreecommitdiffstats
path: root/asn1/asn1c/OCTET_STRING.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/OCTET_STRING.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/OCTET_STRING.h')
-rw-r--r--asn1/asn1c/OCTET_STRING.h80
1 files changed, 80 insertions, 0 deletions
diff --git a/asn1/asn1c/OCTET_STRING.h b/asn1/asn1c/OCTET_STRING.h
new file mode 100644
index 000000000..5150161a7
--- /dev/null
+++ b/asn1/asn1c/OCTET_STRING.h
@@ -0,0 +1,80 @@
+/*-
+ * Copyright (c) 2003 Lev Walkin <vlm@lionet.info>. All rights reserved.
+ * Redistribution and modifications are permitted subject to BSD license.
+ */
+#ifndef _OCTET_STRING_H_
+#define _OCTET_STRING_H_
+
+#include <asn_application.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct OCTET_STRING {
+ uint8_t *buf; /* Buffer with consecutive OCTET_STRING bits */
+ int size; /* Size of the buffer */
+
+ asn_struct_ctx_t _asn_ctx; /* Parsing across buffer boundaries */
+} OCTET_STRING_t;
+
+extern asn_TYPE_descriptor_t asn_DEF_OCTET_STRING;
+
+asn_struct_free_f OCTET_STRING_free;
+asn_struct_print_f OCTET_STRING_print;
+asn_struct_print_f OCTET_STRING_print_utf8;
+ber_type_decoder_f OCTET_STRING_decode_ber;
+der_type_encoder_f OCTET_STRING_encode_der;
+xer_type_decoder_f OCTET_STRING_decode_xer_hex; /* Hexadecimal */
+xer_type_decoder_f OCTET_STRING_decode_xer_binary; /* 01010111010 */
+xer_type_decoder_f OCTET_STRING_decode_xer_utf8; /* ASCII/UTF-8 */
+xer_type_encoder_f OCTET_STRING_encode_xer;
+xer_type_encoder_f OCTET_STRING_encode_xer_utf8;
+per_type_decoder_f OCTET_STRING_decode_uper;
+per_type_encoder_f OCTET_STRING_encode_uper;
+
+/******************************
+ * Handy conversion routines. *
+ ******************************/
+
+/*
+ * This function clears the previous value of the OCTET STRING (if any)
+ * and then allocates a new memory with the specified content (str/size).
+ * If size = -1, the size of the original string will be determined
+ * using strlen(str).
+ * If str equals to NULL, the function will silently clear the
+ * current contents of the OCTET STRING.
+ * Returns 0 if it was possible to perform operation, -1 otherwise.
+ */
+int OCTET_STRING_fromBuf(OCTET_STRING_t *s, const char *str, int size);
+
+/* Handy conversion from the C string into the OCTET STRING. */
+#define OCTET_STRING_fromString(s, str) OCTET_STRING_fromBuf(s, str, -1)
+
+/*
+ * Allocate and fill the new OCTET STRING and return a pointer to the newly
+ * allocated object. NULL is permitted in str: the function will just allocate
+ * empty OCTET STRING.
+ */
+OCTET_STRING_t *OCTET_STRING_new_fromBuf(asn_TYPE_descriptor_t *td,
+ const char *str, int size);
+
+/****************************
+ * Internally useful stuff. *
+ ****************************/
+
+typedef struct asn_OCTET_STRING_specifics_s {
+ /*
+ * Target structure description.
+ */
+ int struct_size; /* Size of the structure */
+ int ctx_offset; /* Offset of the asn_struct_ctx_t member */
+
+ int subvariant; /* {0,1,2} for O-S, BIT STRING or ANY */
+} asn_OCTET_STRING_specifics_t;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _OCTET_STRING_H_ */