apr_ldap_url.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  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. * @file apr_ldap_url.h
  18. * @brief APR-UTIL LDAP ldap_init() functions
  19. */
  20. #ifndef APR_LDAP_URL_H
  21. #define APR_LDAP_URL_H
  22. /**
  23. * @addtogroup APR_Util_LDAP
  24. * @{
  25. */
  26. #if defined(DOXYGEN)
  27. #include "apr_ldap.h"
  28. #endif
  29. #if APR_HAS_LDAP
  30. #include "apu.h"
  31. #include "apr_pools.h"
  32. #ifdef __cplusplus
  33. extern "C" {
  34. #endif /* __cplusplus */
  35. /** Structure to access an exploded LDAP URL */
  36. typedef struct apr_ldap_url_desc_t {
  37. struct apr_ldap_url_desc_t *lud_next;
  38. char *lud_scheme;
  39. char *lud_host;
  40. int lud_port;
  41. char *lud_dn;
  42. char **lud_attrs;
  43. int lud_scope;
  44. char *lud_filter;
  45. char **lud_exts;
  46. int lud_crit_exts;
  47. } apr_ldap_url_desc_t;
  48. #ifndef APR_LDAP_URL_SUCCESS
  49. #define APR_LDAP_URL_SUCCESS 0x00 /* Success */
  50. #define APR_LDAP_URL_ERR_MEM 0x01 /* can't allocate memory space */
  51. #define APR_LDAP_URL_ERR_PARAM 0x02 /* parameter is bad */
  52. #define APR_LDAP_URL_ERR_BADSCHEME 0x03 /* URL doesn't begin with "ldap[si]://" */
  53. #define APR_LDAP_URL_ERR_BADENCLOSURE 0x04 /* URL is missing trailing ">" */
  54. #define APR_LDAP_URL_ERR_BADURL 0x05 /* URL is bad */
  55. #define APR_LDAP_URL_ERR_BADHOST 0x06 /* host port is bad */
  56. #define APR_LDAP_URL_ERR_BADATTRS 0x07 /* bad (or missing) attributes */
  57. #define APR_LDAP_URL_ERR_BADSCOPE 0x08 /* scope string is invalid (or missing) */
  58. #define APR_LDAP_URL_ERR_BADFILTER 0x09 /* bad or missing filter */
  59. #define APR_LDAP_URL_ERR_BADEXTS 0x0a /* bad or missing extensions */
  60. #endif
  61. /**
  62. * Is this URL an ldap url? ldap://
  63. * @param url The url to test
  64. */
  65. APU_DECLARE(int) apr_ldap_is_ldap_url(const char *url);
  66. /**
  67. * Is this URL an SSL ldap url? ldaps://
  68. * @param url The url to test
  69. */
  70. APU_DECLARE(int) apr_ldap_is_ldaps_url(const char *url);
  71. /**
  72. * Is this URL an ldap socket url? ldapi://
  73. * @param url The url to test
  74. */
  75. APU_DECLARE(int) apr_ldap_is_ldapi_url(const char *url);
  76. /**
  77. * Parse an LDAP URL.
  78. * @param pool The pool to use
  79. * @param url_in The URL to parse
  80. * @param ludpp The structure to return the exploded URL
  81. * @param result_err The result structure of the operation
  82. */
  83. APU_DECLARE(int) apr_ldap_url_parse_ext(apr_pool_t *pool,
  84. const char *url_in,
  85. apr_ldap_url_desc_t **ludpp,
  86. apr_ldap_err_t **result_err);
  87. /**
  88. * Parse an LDAP URL.
  89. * @param pool The pool to use
  90. * @param url_in The URL to parse
  91. * @param ludpp The structure to return the exploded URL
  92. * @param result_err The result structure of the operation
  93. */
  94. APU_DECLARE(int) apr_ldap_url_parse(apr_pool_t *pool,
  95. const char *url_in,
  96. apr_ldap_url_desc_t **ludpp,
  97. apr_ldap_err_t **result_err);
  98. #ifdef __cplusplus
  99. }
  100. #endif
  101. #endif /* APR_HAS_LDAP */
  102. /** @} */
  103. #endif /* APR_LDAP_URL_H */