1 /***********************************************************************\
2 *                                winber.d                               *
3 *                                                                       *
4 *                       Windows API header module                       *
5 *                                                                       *
6 *                 Translated from MinGW Windows headers                 *
7 *                           by Stewart Gordon                           *
8 *                                                                       *
9 *                       Placed into public domain                       *
10 \***********************************************************************/
11 module win32.winber;
12 
13 /* Comment from MinGW
14   winber.h - Header file for the Windows LDAP Basic Encoding Rules API
15 
16   Written by Filip Navara <xnavara@volny.cz>
17 
18   References:
19     The C LDAP Application Program Interface
20     http://www.watersprings.org/pub/id/draft-ietf-ldapext-ldap-c-api-05.txt
21 
22     Lightweight Directory Access Protocol Reference
23     http://msdn.microsoft.com/library/en-us/netdir/ldap/ldap_reference.asp
24 
25   This library is distributed in the hope that it will be useful,
26   but WITHOUT ANY WARRANTY; without even the implied warranty of
27   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
28  */
29 
30  import win32.basetsd;
31  
32 /* Opaque structure
33  *	http://msdn.microsoft.com/library/en-us/ldap/ldap/berelement.asp
34  */
35 struct BerElement;
36 
37 alias int ber_int_t, ber_slen_t;
38 alias uint ber_uint_t, ber_len_t, ber_tag_t;
39 
40 align(4):
41 struct BerValue {
42 	ber_len_t bv_len;
43 	char*     bv_val;
44 }
45 alias BerValue LDAP_BERVAL, BERVAL;
46 alias BerValue* PLDAP_BERVAL, PBERVAL;
47 
48 const ber_tag_t
49 	LBER_ERROR   = -1,
50 	LBER_DEFAULT = -1,
51 	LBER_USE_DER =  1;
52 
53 /*	FIXME: In MinGW, these are WINBERAPI == DECLSPEC_IMPORT.  Linkage
54  *	attribute?
55  */
56 extern (C) {
57 	BerElement* ber_init(CPtr!(BerValue));
58 	int ber_printf(BerElement*, CPtr!(char), ...);
59 	int ber_flatten(BerElement*, BerValue**);
60 	ber_tag_t ber_scanf(BerElement*, CPtr!(char), ...);
61 	ber_tag_t ber_peek_tag(BerElement*, ber_len_t*);
62 	ber_tag_t ber_skip_tag(BerElement*, ber_len_t*);
63 	ber_tag_t ber_first_element(BerElement*, ber_len_t*, char**);
64 	ber_tag_t ber_next_element(BerElement*, ber_len_t*, char*);
65 	void ber_bvfree(BerValue*);
66 	void ber_bvecfree(BerValue**);
67 	void ber_free(BerElement*, int);
68 	BerValue* ber_bvdup(BerValue*);
69 	BerElement* ber_alloc_t(int);
70 }