quel 64bit warnings, fixup implicit encoding for template, fix spelling
[heimdal.git] / lib / asn1 / asn1-common.h
blob8a935d3740c235ed1a03969e0ccaf60deb26454e
1 /* $Id$ */
3 #include <stddef.h>
4 #include <time.h>
5 #include <krb5-types.h>
7 #ifndef __asn1_common_definitions__
8 #define __asn1_common_definitions__
10 #ifndef __HEIM_BASE_DATA__
11 #define __HEIM_BASE_DATA__ 1
12 struct heim_base_data {
13 size_t length;
14 void *data;
16 #endif
18 typedef struct heim_integer {
19 size_t length;
20 void *data;
21 int negative;
22 } heim_integer;
24 typedef struct heim_base_data heim_octet_string;
26 typedef char *heim_general_string;
27 typedef char *heim_utf8_string;
28 typedef struct heim_base_data heim_printable_string;
29 typedef struct heim_base_data heim_ia5_string;
31 typedef struct heim_bmp_string {
32 size_t length;
33 uint16_t *data;
34 } heim_bmp_string;
36 typedef struct heim_universal_string {
37 size_t length;
38 uint32_t *data;
39 } heim_universal_string;
41 typedef char *heim_visible_string;
43 typedef struct heim_oid {
44 size_t length;
45 unsigned *components;
46 } heim_oid;
48 typedef struct heim_bit_string {
49 size_t length;
50 void *data;
51 } heim_bit_string;
53 typedef struct heim_base_data heim_any;
54 typedef struct heim_base_data heim_any_set;
56 #define ASN1_MALLOC_ENCODE(T, B, BL, S, L, R) \
57 do { \
58 (BL) = length_##T((S)); \
59 (B) = malloc((BL)); \
60 if((B) == NULL) { \
61 (R) = ENOMEM; \
62 } else { \
63 (R) = encode_##T(((unsigned char*)(B)) + (BL) - 1, (BL), \
64 (S), (L)); \
65 if((R) != 0) { \
66 free((B)); \
67 (B) = NULL; \
68 } \
69 } \
70 } while (0)
72 #ifdef _WIN32
73 #ifndef ASN1_LIB
74 #define ASN1EXP __declspec(dllimport)
75 #else
76 #define ASN1EXP
77 #endif
78 #define ASN1CALL __stdcall
79 #else
80 #define ASN1EXP
81 #define ASN1CALL
82 #endif
84 #endif