1 /**
2 	Exposes the C library stuff.
3 
4 	Only meant to be used internally.
5  */
6 module dldap.c.liblber.lber_int;
7 
8 import dldap.c.lber_types;
9 import dldap.c.lber_types;
10 
11 nothrow:
12 extern(C):
13 
14 struct lber_options
15 {
16 	short lbo_valid;
17 	ushort lbo_options;
18 	int lbo_debug;
19 };
20 
21 struct berelement 
22 {
23 	lber_options ber_opts;
24 
25 	alias ber_valid = ber_opts.lbo_valid;
26 	alias ber_options = ber_opts.lbo_options;
27 	alias ber_debug = ber_opts.lbo_debug;
28 
29 	/*
30 	 * The members below, when not NULL/LBER_DEFAULT/etc, are:
31 	 *   ber_buf       Data buffer.  Other pointers normally point into it.
32 	 *   ber_rwptr     Read/write cursor for Sockbuf I/O.
33 	 *   ber_memctx    Context passed to ber_memalloc() & co.
34 	 * When decoding data (reading it from the BerElement):
35 	 *   ber_end       End of BER data.
36 	 *   ber_ptr       Read cursor, except for 1st octet of tags.
37 	 *   ber_tag       1st octet of next tag, saved from *ber_ptr when
38 	 *                 ber_ptr may be pointing at a tag and is >ber_buf.
39 	 *                 The octet *ber_ptr itself may get overwritten with
40 	 *                 a \0, to terminate the preceding element.
41 	 * When encoding data (writing it to the BerElement):
42 	 *   ber_end       End of allocated buffer - 1 (allowing a final \0).
43 	 *   ber_ptr       Last complete BER element (normally write cursor).
44 	 *   ber_sos_ptr   NULL or write cursor for incomplete sequence or set.
45 	 *   ber_sos_inner offset(seq/set length octets) if ber_sos_ptr!=NULL.
46 	 *   ber_tag       Default tag for next ber_printf() element.
47 	 *   ber_usertag   Boolean set by ber_printf "!" if it sets ber_tag.
48 	 *   ber_len       Reused for ber_sos_inner.
49 	 * When output to a Sockbuf:
50 	 *   ber_ptr       End of encoded data to write.
51 	 * When input from a Sockbuf:
52 	 *   See ber_get_next().
53 	 */
54 
55 	/* Do not change the order of these 3 fields! see ber_get_next */
56 	ber_tag_t	ber_tag;
57 	ber_len_t	ber_len;
58 	ber_tag_t	ber_usertag;
59 
60 	char* ber_buf;
61 	char* ber_ptr;
62 	char* ber_end;
63 
64 	char* ber_sos_ptr;
65 	alias er_sos_inner = ber_len; /* reused for binary compat */
66 
67 	char* ber_rwptr;
68 	void* ber_memctx;
69 };
70