1251876Speter/* Licensed to the Apache Software Foundation (ASF) under one or more
2251876Speter * contributor license agreements.  See the NOTICE file distributed with
3251876Speter * this work for additional information regarding copyright ownership.
4251876Speter * The ASF licenses this file to You under the Apache License, Version 2.0
5251876Speter * (the "License"); you may not use this file except in compliance with
6251876Speter * the License.  You may obtain a copy of the License at
7251876Speter *
8251876Speter *     http://www.apache.org/licenses/LICENSE-2.0
9251876Speter *
10251876Speter * Unless required by applicable law or agreed to in writing, software
11251876Speter * distributed under the License is distributed on an "AS IS" BASIS,
12251876Speter * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13251876Speter * See the License for the specific language governing permissions and
14251876Speter * limitations under the License.
15251876Speter */
16251876Speter
17251876Speter/**
18251876Speter * @file apr_ldap_url.h
19251876Speter * @brief  APR-UTIL LDAP ldap_init() functions
20251876Speter */
21251876Speter#ifndef APR_LDAP_URL_H
22251876Speter#define APR_LDAP_URL_H
23251876Speter
24251876Speter/**
25251876Speter * @addtogroup APR_Util_LDAP
26251876Speter * @{
27251876Speter */
28251876Speter
29251876Speter#if defined(DOXYGEN)
30251876Speter#include "apr_ldap.h"
31251876Speter#endif
32251876Speter
33251876Speter#if APR_HAS_LDAP
34251876Speter
35251876Speter#include "apu.h"
36251876Speter#include "apr_pools.h"
37251876Speter
38251876Speter#ifdef __cplusplus
39251876Speterextern "C" {
40251876Speter#endif /* __cplusplus */
41251876Speter
42251876Speter/** Structure to access an exploded LDAP URL */
43251876Spetertypedef struct apr_ldap_url_desc_t {
44251876Speter    struct  apr_ldap_url_desc_t  *lud_next;
45251876Speter    char    *lud_scheme;
46251876Speter    char    *lud_host;
47251876Speter    int     lud_port;
48251876Speter    char    *lud_dn;
49251876Speter    char    **lud_attrs;
50251876Speter    int     lud_scope;
51251876Speter    char    *lud_filter;
52251876Speter    char    **lud_exts;
53251876Speter    int     lud_crit_exts;
54251876Speter} apr_ldap_url_desc_t;
55251876Speter
56251876Speter#ifndef APR_LDAP_URL_SUCCESS
57251876Speter#define APR_LDAP_URL_SUCCESS          0x00    /* Success */
58251876Speter#define APR_LDAP_URL_ERR_MEM          0x01    /* can't allocate memory space */
59251876Speter#define APR_LDAP_URL_ERR_PARAM        0x02    /* parameter is bad */
60251876Speter#define APR_LDAP_URL_ERR_BADSCHEME    0x03    /* URL doesn't begin with "ldap[si]://" */
61251876Speter#define APR_LDAP_URL_ERR_BADENCLOSURE 0x04    /* URL is missing trailing ">" */
62251876Speter#define APR_LDAP_URL_ERR_BADURL       0x05    /* URL is bad */
63251876Speter#define APR_LDAP_URL_ERR_BADHOST      0x06    /* host port is bad */
64251876Speter#define APR_LDAP_URL_ERR_BADATTRS     0x07    /* bad (or missing) attributes */
65251876Speter#define APR_LDAP_URL_ERR_BADSCOPE     0x08    /* scope string is invalid (or missing) */
66251876Speter#define APR_LDAP_URL_ERR_BADFILTER    0x09    /* bad or missing filter */
67251876Speter#define APR_LDAP_URL_ERR_BADEXTS      0x0a    /* bad or missing extensions */
68251876Speter#endif
69251876Speter
70251876Speter/**
71251876Speter * Is this URL an ldap url? ldap://
72251876Speter * @param url The url to test
73251876Speter */
74251876SpeterAPU_DECLARE(int) apr_ldap_is_ldap_url(const char *url);
75251876Speter
76251876Speter/**
77251876Speter * Is this URL an SSL ldap url? ldaps://
78251876Speter * @param url The url to test
79251876Speter */
80251876SpeterAPU_DECLARE(int) apr_ldap_is_ldaps_url(const char *url);
81251876Speter
82251876Speter/**
83251876Speter * Is this URL an ldap socket url? ldapi://
84251876Speter * @param url The url to test
85251876Speter */
86251876SpeterAPU_DECLARE(int) apr_ldap_is_ldapi_url(const char *url);
87251876Speter
88251876Speter/**
89251876Speter * Parse an LDAP URL.
90251876Speter * @param pool The pool to use
91251876Speter * @param url_in The URL to parse
92251876Speter * @param ludpp The structure to return the exploded URL
93251876Speter * @param result_err The result structure of the operation
94251876Speter */
95251876SpeterAPU_DECLARE(int) apr_ldap_url_parse_ext(apr_pool_t *pool,
96251876Speter                                        const char *url_in,
97251876Speter                                        apr_ldap_url_desc_t **ludpp,
98251876Speter                                        apr_ldap_err_t **result_err);
99251876Speter
100251876Speter/**
101251876Speter * Parse an LDAP URL.
102251876Speter * @param pool The pool to use
103251876Speter * @param url_in The URL to parse
104251876Speter * @param ludpp The structure to return the exploded URL
105251876Speter * @param result_err The result structure of the operation
106251876Speter */
107251876SpeterAPU_DECLARE(int) apr_ldap_url_parse(apr_pool_t *pool,
108251876Speter                                    const char *url_in,
109251876Speter                                    apr_ldap_url_desc_t **ludpp,
110251876Speter                                    apr_ldap_err_t **result_err);
111251876Speter
112251876Speter#ifdef __cplusplus
113251876Speter}
114251876Speter#endif
115251876Speter
116251876Speter#endif /* APR_HAS_LDAP */
117251876Speter
118251876Speter/** @} */
119251876Speter
120251876Speter#endif /* APR_LDAP_URL_H */
121