apr_ldap_url.h 3.5 KB

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