]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - contrib/apr-util/include/apr_ldap_url.h
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / contrib / apr-util / include / apr_ldap_url.h
1 /* Licensed to the Apache Software Foundation (ASF) under one or more
2  * contributor license agreements.  See the NOTICE file distributed with
3  * this work for additional information regarding copyright ownership.
4  * The ASF licenses this file to You under the Apache License, Version 2.0
5  * (the "License"); you may not use this file except in compliance with
6  * the License.  You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 /**
18  * @file apr_ldap_url.h
19  * @brief  APR-UTIL LDAP ldap_init() functions
20  */
21 #ifndef APR_LDAP_URL_H
22 #define APR_LDAP_URL_H
23
24 /**
25  * @addtogroup APR_Util_LDAP
26  * @{
27  */
28
29 #if defined(DOXYGEN)
30 #include "apr_ldap.h"
31 #endif
32
33 #if APR_HAS_LDAP
34
35 #include "apu.h"
36 #include "apr_pools.h"
37
38 #ifdef __cplusplus
39 extern "C" {
40 #endif /* __cplusplus */
41
42 /** Structure to access an exploded LDAP URL */
43 typedef struct apr_ldap_url_desc_t {
44     struct  apr_ldap_url_desc_t  *lud_next;
45     char    *lud_scheme;
46     char    *lud_host;
47     int     lud_port;
48     char    *lud_dn;
49     char    **lud_attrs;
50     int     lud_scope;
51     char    *lud_filter;
52     char    **lud_exts;
53     int     lud_crit_exts;
54 } apr_ldap_url_desc_t;
55
56 #ifndef APR_LDAP_URL_SUCCESS
57 #define APR_LDAP_URL_SUCCESS          0x00    /* Success */
58 #define APR_LDAP_URL_ERR_MEM          0x01    /* can't allocate memory space */
59 #define APR_LDAP_URL_ERR_PARAM        0x02    /* parameter is bad */
60 #define APR_LDAP_URL_ERR_BADSCHEME    0x03    /* URL doesn't begin with "ldap[si]://" */
61 #define APR_LDAP_URL_ERR_BADENCLOSURE 0x04    /* URL is missing trailing ">" */
62 #define APR_LDAP_URL_ERR_BADURL       0x05    /* URL is bad */
63 #define APR_LDAP_URL_ERR_BADHOST      0x06    /* host port is bad */
64 #define APR_LDAP_URL_ERR_BADATTRS     0x07    /* bad (or missing) attributes */
65 #define APR_LDAP_URL_ERR_BADSCOPE     0x08    /* scope string is invalid (or missing) */
66 #define APR_LDAP_URL_ERR_BADFILTER    0x09    /* bad or missing filter */
67 #define APR_LDAP_URL_ERR_BADEXTS      0x0a    /* bad or missing extensions */
68 #endif
69
70 /**
71  * Is this URL an ldap url? ldap://
72  * @param url The url to test
73  */
74 APU_DECLARE(int) apr_ldap_is_ldap_url(const char *url);
75
76 /**
77  * Is this URL an SSL ldap url? ldaps://
78  * @param url The url to test
79  */
80 APU_DECLARE(int) apr_ldap_is_ldaps_url(const char *url);
81
82 /**
83  * Is this URL an ldap socket url? ldapi://
84  * @param url The url to test
85  */
86 APU_DECLARE(int) apr_ldap_is_ldapi_url(const char *url);
87
88 /**
89  * Parse an LDAP URL.
90  * @param pool The pool to use
91  * @param url_in The URL to parse
92  * @param ludpp The structure to return the exploded URL
93  * @param result_err The result structure of the operation
94  */
95 APU_DECLARE(int) apr_ldap_url_parse_ext(apr_pool_t *pool,
96                                         const char *url_in,
97                                         apr_ldap_url_desc_t **ludpp,
98                                         apr_ldap_err_t **result_err);
99
100 /**
101  * Parse an LDAP URL.
102  * @param pool The pool to use
103  * @param url_in The URL to parse
104  * @param ludpp The structure to return the exploded URL
105  * @param result_err The result structure of the operation
106  */
107 APU_DECLARE(int) apr_ldap_url_parse(apr_pool_t *pool,
108                                     const char *url_in,
109                                     apr_ldap_url_desc_t **ludpp,
110                                     apr_ldap_err_t **result_err);
111
112 #ifdef __cplusplus
113 }
114 #endif
115
116 #endif /* APR_HAS_LDAP */
117
118 /** @} */
119
120 #endif /* APR_LDAP_URL_H */