source: branches/samba-3.5.x/source4/heimdal/lib/asn1/asn1-common.h

Last change on this file was 414, checked in by Herwig Bauernfeind, 16 years ago

Samba 3.5.0: Initial import

File size: 1.8 KB
Line 
1/* $Id$ */
2
3#include <stddef.h>
4#include <time.h>
5
6#ifndef __asn1_common_definitions__
7#define __asn1_common_definitions__
8
9typedef struct heim_integer {
10 size_t length;
11 void *data;
12 int negative;
13} heim_integer;
14
15typedef struct heim_octet_string {
16 size_t length;
17 void *data;
18} heim_octet_string;
19
20typedef char *heim_general_string;
21typedef char *heim_utf8_string;
22typedef char *heim_printable_string;
23typedef char *heim_ia5_string;
24
25typedef struct heim_bmp_string {
26 size_t length;
27 uint16_t *data;
28} heim_bmp_string;
29
30typedef struct heim_universal_string {
31 size_t length;
32 uint32_t *data;
33} heim_universal_string;
34
35typedef char *heim_visible_string;
36
37typedef struct heim_oid {
38 size_t length;
39 unsigned *components;
40} heim_oid;
41
42typedef struct heim_bit_string {
43 size_t length;
44 void *data;
45} heim_bit_string;
46
47typedef struct heim_octet_string heim_any;
48typedef struct heim_octet_string heim_any_set;
49
50#define ASN1_MALLOC_ENCODE(T, B, BL, S, L, R) \
51 do { \
52 (BL) = length_##T((S)); \
53 (B) = malloc((BL)); \
54 if((B) == NULL) { \
55 (R) = ENOMEM; \
56 } else { \
57 (R) = encode_##T(((unsigned char*)(B)) + (BL) - 1, (BL), \
58 (S), (L)); \
59 if((R) != 0) { \
60 free((B)); \
61 (B) = NULL; \
62 } \
63 } \
64 } while (0)
65
66#endif
Note: See TracBrowser for help on using the repository browser.