summaryrefslogtreecommitdiffstats
path: root/asn1/asn1c/asn_system.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/asn_system.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/asn_system.h')
-rw-r--r--asn1/asn1c/asn_system.h104
1 files changed, 104 insertions, 0 deletions
diff --git a/asn1/asn1c/asn_system.h b/asn1/asn1c/asn_system.h
new file mode 100644
index 000000000..d7ebdaa4e
--- /dev/null
+++ b/asn1/asn1c/asn_system.h
@@ -0,0 +1,104 @@
+/*-
+ * Copyright (c) 2003, 2004 Lev Walkin <vlm@lionet.info>. All rights reserved.
+ * Redistribution and modifications are permitted subject to BSD license.
+ */
+/*
+ * Miscellaneous system-dependent types.
+ */
+#ifndef _ASN_SYSTEM_H_
+#define _ASN_SYSTEM_H_
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdio.h> /* For snprintf(3) */
+#include <stdlib.h> /* For *alloc(3) */
+#include <string.h> /* For memcpy(3) */
+#include <sys/types.h> /* For size_t */
+#include <stdarg.h> /* For va_start */
+#include <stddef.h> /* for offsetof and ptrdiff_t */
+
+#ifdef WIN32
+
+#include <malloc.h>
+#include <stdint.h>
+#define snprintf _snprintf
+#define vsnprintf _vsnprintf
+
+#ifdef _MSC_VER /* MSVS.Net */
+#ifndef __cplusplus
+#define inline __inline
+#endif
+#define ssize_t SSIZE_T
+typedef char int8_t;
+typedef short int16_t;
+typedef int int32_t;
+typedef unsigned char uint8_t;
+typedef unsigned short uint16_t;
+typedef unsigned int uint32_t;
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+#include <float.h>
+#define isnan _isnan
+#define finite _finite
+#define copysign _copysign
+#define ilogb _logb
+#endif /* _MSC_VER */
+
+#else /* !WIN32 */
+
+#if defined(__vxworks)
+#include <types/vxTypes.h>
+#else /* !defined(__vxworks) */
+
+#include <inttypes.h> /* C99 specifies this file */
+/*
+ * 1. Earlier FreeBSD version didn't have <stdint.h>,
+ * but <inttypes.h> was present.
+ * 2. Sun Solaris requires <alloca.h> for alloca(3),
+ * but does not have <stdint.h>.
+ */
+#if (!defined(__FreeBSD__) || !defined(_SYS_INTTYPES_H_))
+#if defined(sun)
+#include <alloca.h> /* For alloca(3) */
+#include <ieeefp.h> /* for finite(3) */
+#elif defined(__hpux)
+#ifdef __GNUC__
+#include <alloca.h> /* For alloca(3) */
+#else /* !__GNUC__ */
+#define inline
+#endif /* __GNUC__ */
+#else
+#include <stdint.h> /* SUSv2+ and C99 specify this file, for uintXX_t */
+#endif /* defined(sun) */
+#endif
+
+#endif /* defined(__vxworks) */
+
+#endif /* WIN32 */
+
+#if __GNUC__ >= 3
+#ifndef GCC_PRINTFLIKE
+#define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var)))
+#endif
+#else
+#ifndef GCC_PRINTFLIKE
+#define GCC_PRINTFLIKE(fmt,var) /* nothing */
+#endif
+#endif
+
+#ifndef offsetof /* If not defined by <stddef.h> */
+#define offsetof(s, m) ((ptrdiff_t)&(((s *)0)->m) - (ptrdiff_t)((s *)0))
+#endif /* offsetof */
+
+#ifndef MIN /* Suitable for comparing primitive types (integers) */
+#if defined(__GNUC__)
+#define MIN(a,b) ({ __typeof a _a = a; __typeof b _b = b; \
+ ((_a)<(_b)?(_a):(_b)); })
+#else /* !__GNUC__ */
+#define MIN(a,b) ((a)<(b)?(a):(b)) /* Unsafe variant */
+#endif /* __GNUC__ */
+#endif /* MIN */
+
+#endif /* _ASN_SYSTEM_H_ */