apr_ldap_url.h revision 251876
1124208Sdes/* Licensed to the Apache Software Foundation (ASF) under one or more
2124208Sdes * contributor license agreements.  See the NOTICE file distributed with
3124208Sdes * this work for additional information regarding copyright ownership.
4124208Sdes * The ASF licenses this file to You under the Apache License, Version 2.0
5124208Sdes * (the "License"); you may not use this file except in compliance with
6124208Sdes * the License.  You may obtain a copy of the License at
7124208Sdes *
8124208Sdes *     http://www.apache.org/licenses/LICENSE-2.0
9124208Sdes *
10124208Sdes * Unless required by applicable law or agreed to in writing, software
11124208Sdes * distributed under the License is distributed on an "AS IS" BASIS,
12124208Sdes * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13124208Sdes * See the License for the specific language governing permissions and
14124208Sdes * limitations under the License.
15124208Sdes */
16124208Sdes
17124208Sdes/**
18124208Sdes * @file apr_ldap_url.h
19124208Sdes * @brief  APR-UTIL LDAP ldap_init() functions
20124208Sdes */
21124208Sdes#ifndef APR_LDAP_URL_H
22124208Sdes#define APR_LDAP_URL_H
23124208Sdes
24124208Sdes/**
2598937Sdes * @addtogroup APR_Util_LDAP
2698937Sdes * @{
2798937Sdes */
28262566Sdes
2998937Sdes#if defined(DOXYGEN)
3098937Sdes#include "apr_ldap.h"
3198937Sdes#endif
3298937Sdes
33162852Sdes#if APR_HAS_LDAP
3498937Sdes
3598937Sdes#include "apu.h"
3698937Sdes#include "apr_pools.h"
3798937Sdes
3898937Sdes#ifdef __cplusplus
3998937Sdesextern "C" {
4098937Sdes#endif /* __cplusplus */
4198937Sdes
4298937Sdes/** Structure to access an exploded LDAP URL */
4398937Sdestypedef struct apr_ldap_url_desc_t {
4498937Sdes    struct  apr_ldap_url_desc_t  *lud_next;
45221420Sdes    char    *lud_scheme;
46221420Sdes    char    *lud_host;
47221420Sdes    int     lud_port;
48221487Sdes    char    *lud_dn;
49221420Sdes    char    **lud_attrs;
5098937Sdes    int     lud_scope;
5198937Sdes    char    *lud_filter;
5298937Sdes    char    **lud_exts;
5398937Sdes    int     lud_crit_exts;
5498937Sdes} apr_ldap_url_desc_t;
5598937Sdes
5698937Sdes#ifndef APR_LDAP_URL_SUCCESS
5798937Sdes#define APR_LDAP_URL_SUCCESS          0x00    /* Success */
58221420Sdes#define APR_LDAP_URL_ERR_MEM          0x01    /* can't allocate memory space */
59221420Sdes#define APR_LDAP_URL_ERR_PARAM        0x02    /* parameter is bad */
60221420Sdes#define APR_LDAP_URL_ERR_BADSCHEME    0x03    /* URL doesn't begin with "ldap[si]://" */
61221420Sdes#define APR_LDAP_URL_ERR_BADENCLOSURE 0x04    /* URL is missing trailing ">" */
62221420Sdes#define APR_LDAP_URL_ERR_BADURL       0x05    /* URL is bad */
63221420Sdes#define APR_LDAP_URL_ERR_BADHOST      0x06    /* host port is bad */
64221420Sdes#define APR_LDAP_URL_ERR_BADATTRS     0x07    /* bad (or missing) attributes */
65221420Sdes#define APR_LDAP_URL_ERR_BADSCOPE     0x08    /* scope string is invalid (or missing) */
66221420Sdes#define APR_LDAP_URL_ERR_BADFILTER    0x09    /* bad or missing filter */
67221420Sdes#define APR_LDAP_URL_ERR_BADEXTS      0x0a    /* bad or missing extensions */
68221420Sdes#endif
69221420Sdes
70221420Sdes/**
71221420Sdes * Is this URL an ldap url? ldap://
72221420Sdes * @param url The url to test
73221420Sdes */
74221420SdesAPU_DECLARE(int) apr_ldap_is_ldap_url(const char *url);
75221420Sdes
76221420Sdes/**
77221420Sdes * Is this URL an SSL ldap url? ldaps://
78221420Sdes * @param url The url to test
79221420Sdes */
80221420SdesAPU_DECLARE(int) apr_ldap_is_ldaps_url(const char *url);
81221420Sdes
82221420Sdes/**
83221420Sdes * Is this URL an ldap socket url? ldapi://
84221420Sdes * @param url The url to test
85221420Sdes */
86221420SdesAPU_DECLARE(int) apr_ldap_is_ldapi_url(const char *url);
87221420Sdes
88221420Sdes/**
89221420Sdes * Parse an LDAP URL.
90240075Sdes * @param pool The pool to use
91240075Sdes * @param url_in The URL to parse
92240075Sdes * @param ludpp The structure to return the exploded URL
93240075Sdes * @param result_err The result structure of the operation
94240075Sdes */
95240075SdesAPU_DECLARE(int) apr_ldap_url_parse_ext(apr_pool_t *pool,
9698937Sdes                                        const char *url_in,
9798937Sdes                                        apr_ldap_url_desc_t **ludpp,
9898937Sdes                                        apr_ldap_err_t **result_err);
9998937Sdes
100149749Sdes/**
101149749Sdes * Parse an LDAP URL.
102149749Sdes * @param pool The pool to use
103149749Sdes * @param url_in The URL to parse
104149749Sdes * @param ludpp The structure to return the exploded URL
10598937Sdes * @param result_err The result structure of the operation
10698937Sdes */
10798937SdesAPU_DECLARE(int) apr_ldap_url_parse(apr_pool_t *pool,
108181111Sdes                                    const char *url_in,
109149749Sdes                                    apr_ldap_url_desc_t **ludpp,
110149749Sdes                                    apr_ldap_err_t **result_err);
111149749Sdes
11298937Sdes#ifdef __cplusplus
11398937Sdes}
11498937Sdes#endif
11598937Sdes
11698937Sdes#endif /* APR_HAS_LDAP */
11798937Sdes
11898937Sdes/** @} */
11998937Sdes
12098937Sdes#endif /* APR_LDAP_URL_H */
12198937Sdes