KLdap

w32-ldap-help.h
1// krazy:excludeall=style
2/* w32-ldap-help.h - Map utf8 based API into a wchar_t API.
3
4 SPDX-FileCopyrightText: 2010 Andre Heinecke <aheinecke@intevation.de>
5
6 SPDX-License-Identifier: LGPL-2.0-or-later
7 */
8
9#pragma once
10
11#include <windows.h>
12#ifdef UNICODE
13#undef UNICODE
14#include <winber.h>
15#include <winldap.h>
16#define UNICODE
17#else
18#include <winber.h>
19#include <winldap.h>
20#endif // UNICODE
21
22/*
23 * From the openldap manpage:
24 * ber_len_t is an unsigned integer of at least 32 bits used to represent
25 * a length. It is commonly equivalent to a size_t. ber_slen_t is the
26 * signed variant to ber_len_t.
27 */
28typedef ULONG ber_len_t;
29
30#ifndef timeval
31#define timeval l_timeval
32#endif
33
34/* Redirect used ldap functions to functions with win_ prefix
35 * to further redirect those depending on the Windows Flavour */
36// #define ldap_err2string(a) win_ldap_err2string(a)
37#define ldap_init(a, b) win_ldap_init(a, b)
38#define ldap_sasl_bind(a, b, c, d, e, f, g) win_ldap_sasl_bind(a, b, c, d, e, f, g)
39#define ldap_sasl_bind_s(a, b, c, d, e, f, g) win_ldap_sasl_bind_s(a, b, c, d, e, f, g)
40#define ldap_parse_sasl_bind_result (a, b, c, d, e) win_ldap_parse_sasl_bind_result((a), (b), (c), (d), (e))
41#define ldap_get_dn(a, b) win_ldap_get_dn(a, b)
42#define ldap_memfree(a) win_ldap_memfree(a)
43#define ldap_mods_free(a, b) win_ldap_mods_free(a, b)
44#define ldap_first_attribute(a, b, c) win_ldap_first_attribute(a, b, c)
45#define ldap_get_values_len(a, b, c) win_ldap_get_values_len(a, b, c)
46#define ldap_next_attribute(a, b, c) win_ldap_next_attribute(a, b, c)
47#define ldap_parse_result(a, b, c, d, e, f, g, h) win_ldap_parse_result(a, b, c, d, e, f, g, h)
48#define ldap_parse_extended_result(a, b, c, d, e) win_ldap_parse_extended_result(a, b, c, d, e)
49#define ldap_add_ext(a, b, c, d, e, f) win_ldap_add_ext((a), (b), (c), (d), (e), (f))
50#define ldap_add_ext_s(a, b, c, d, e) win_ldap_add_ext_s((a), (b), (c), (d), (e))
51#define ldap_compare_ext_s(a, b, c, d, e, f) win_ldap_compare_ext_s((a), (b), (c), (d), (e), (f))
52#define ldap_compare_ext(a, b, c, d, e, f, g) win_ldap_compare_ext((a), (b), (c), (d), (e), (f), (g))
53#define ldap_modify_ext_s(a, b, c, d, e) win_ldap_modify_ext_s((a), (b), (c), (d), (e))
54#define ldap_search_ext(a, b, c, d, e, f, g, h, i, j, k) win_ldap_search_ext((a), (b), (c), (d), (e), (f), (g), (h), (i), (j), (k))
55#define ldap_rename_ext(a, b, c, d, e, f, g, h) win_ldap_rename_ext((a), (b), (c), (d), (e), (f), (g), (h))
56#define ldap_rename(a, b, c, d, e, f, g, h) ldap_rename_ext((a), (b), (c), (d), (e), (f), (g), (h))
57#define ldap_delete_ext(a, b, c, d, e) win_ldap_delete_ext((a), (b), (c), (d), (e))
58#define ldap_modify_ext(a, b, c, d, e, f) win_ldap_modify_ext((a), (b), (c), (d), (e), (f))
59#define ldap_abandon_ext(a, b, c, d) win_ldap_abandon_ext((a), (b), (c), (d))
60#define ldap_controls_free(a) win_ldap_controls_free(a)
61
62// Use the functions that are available on the platform
63// or redirect to wrapper functions
64
65/* Windows offers ASCII variants of most LDAP functions
66 * we only have to ensure that those are used */
67#define LDAPControl LDAPControlA
68#define LDAPMod LDAPModA
69#define win_ldap_init(a, b) ldap_initA((a), (b))
70#define win_ldap_simple_bind_s(a, b, c) ldap_simple_bind_sA((a), (b), (c))
71#define win_ldap_sasl_bind(a, b, c, d, e, f, g) ldap_sasl_bindA(a, b, c, d, e, f, g)
72#define win_ldap_sasl_bind_s(a, b, c, d, e, f, g) ldap_sasl_bind_sA(a, b, c, d, e, f, g)
73#define win_ldap_search_st(a, b, c, d, e, f, g, h) ldap_search_stA((a), (b), (c), (d), (e), (f), (g), (h))
74#define win_ldap_search_ext(a, b, c, d, e, f, g, h, i, j, k) my_win_ldap_search_ext((a), (b), (c), (d), (e), (f), (g), (h), (i), (j), (k))
75#define win_ldap_get_dn(a, b) ldap_get_dnA((a), (b))
76#define win_ldap_first_attribute(a, b, c) ldap_first_attributeA((a), (b), (c))
77#define win_ldap_next_attribute(a, b, c) ldap_next_attributeA((a), (b), (c))
78#define win_ldap_get_values_len(a, b, c) ldap_get_values_lenA((a), (b), (c))
79#define win_ldap_memfree(a) ldap_memfreeA((a))
80#define win_ldap_err2string(a) ldap_err2stringA((a))
81#define win_ldap_controls_free(a) ldap_controls_freeA((a))
82#define win_ldap_mods_free(a, b) ldap_mods_freeA((a), (b))
83#define win_ldap_add_ext(a, b, c, d, e, f) ldap_add_extA((a), (b), (c), (d), (e), ((ulong *)f))
84#define win_ldap_add_ext_s(a, b, c, d, e) ldap_add_ext_sA((a), (b), (c), (d), (e))
85#define win_ldap_parse_extended_result(a, b, c, d, e) ldap_parse_extended_resultA((*a), (b), (c), (d), (e))
86#define win_ldap_parse_result(a, b, c, d, e, f, g, h) ldap_parse_resultA((a), (b), ((ulong *)c), (d), (e), (f), (g), (h))
87#define win_ldap_modify_ext_s(a, b, c, d, e) ldap_modify_ext_sW((a), (b), (c), (d), (e))
88#define win_ldap_compare_ext_s(a, b, c, d, e, f) ldap_compare_ext_sA((a), (b), (c), (d), (e), (f))
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 22 2024 12:05:57 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.