ldaprot.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346
  1. /** BEGIN COPYRIGHT BLOCK
  2. * This Program is free software; you can redistribute it and/or modify it under
  3. * the terms of the GNU General Public License as published by the Free Software
  4. * Foundation; version 2 of the License.
  5. *
  6. * This Program is distributed in the hope that it will be useful, but WITHOUT
  7. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  8. * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  9. *
  10. * You should have received a copy of the GNU General Public License along with
  11. * this Program; if not, write to the Free Software Foundation, Inc., 59 Temple
  12. * Place, Suite 330, Boston, MA 02111-1307 USA.
  13. *
  14. * In addition, as a special exception, Red Hat, Inc. gives You the additional
  15. * right to link the code of this Program with code not covered under the GNU
  16. * General Public License ("Non-GPL Code") and to distribute linked combinations
  17. * including the two, subject to the limitations in this paragraph. Non-GPL Code
  18. * permitted under this exception must only link to the code of this Program
  19. * through those well defined interfaces identified in the file named EXCEPTION
  20. * found in the source code files (the "Approved Interfaces"). The files of
  21. * Non-GPL Code may instantiate templates or use macros or inline functions from
  22. * the Approved Interfaces without causing the resulting work to be covered by
  23. * the GNU General Public License. Only Red Hat, Inc. may make changes or
  24. * additions to the list of Approved Interfaces. You must obey the GNU General
  25. * Public License in all respects for all of the Program code and other code used
  26. * in conjunction with the Program except the Non-GPL Code covered by this
  27. * exception. If you modify this file, you may extend this exception to your
  28. * version of the file, but you are not obligated to do so. If you do not wish to
  29. * provide this exception without modification, you must delete this exception
  30. * statement from your version and license this file solely under the GPL without
  31. * exception.
  32. *
  33. *
  34. * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission.
  35. * Copyright (C) 2005 Red Hat, Inc.
  36. * All rights reserved.
  37. * END COPYRIGHT BLOCK **/
  38. #ifdef HAVE_CONFIG_H
  39. # include <config.h>
  40. #endif
  41. #ifndef _LDAPROT_H
  42. #define _LDAPROT_H
  43. #ifdef __cplusplus
  44. extern "C" {
  45. #endif
  46. #ifndef LDAP_VERSION1
  47. #define LDAP_VERSION1 1
  48. #endif
  49. #ifndef LDAP_VERSION2
  50. #define LDAP_VERSION2 2
  51. #endif
  52. #ifndef LDAP_VERSION3
  53. #define LDAP_VERSION3 3
  54. #endif
  55. #ifndef LDAP_VERSION
  56. #define LDAP_VERSION LDAP_VERSION2
  57. #endif
  58. #define COMPAT20
  59. #define COMPAT30
  60. #if defined(COMPAT20) || defined(COMPAT30)
  61. #define COMPAT
  62. #endif
  63. #define LDAP_URL_PREFIX "ldap://"
  64. #define LDAP_URL_PREFIX_LEN 7
  65. #define LDAPS_URL_PREFIX "ldaps://"
  66. #define LDAPS_URL_PREFIX_LEN 8
  67. #define LDAP_REF_STR "Referral:\n"
  68. #define LDAP_REF_STR_LEN 10
  69. /*
  70. * specific LDAP instantiations of BER types we know about
  71. */
  72. /* general stuff */
  73. #ifndef LDAP_TAG_MESSAGE
  74. #define LDAP_TAG_MESSAGE 0x30L /* tag is 16 + constructed bit */
  75. #endif
  76. #ifndef OLD_LDAP_TAG_MESSAGE
  77. #define OLD_LDAP_TAG_MESSAGE 0x10L /* forgot the constructed bit */
  78. #endif
  79. #ifndef LDAP_TAG_MSGID
  80. #define LDAP_TAG_MSGID 0x02L /* INTEGER */
  81. #endif
  82. #ifndef LDAP_TAG_LDAPDN
  83. #define LDAP_TAG_LDAPDN 0x04L /* OCTET STRING */
  84. #endif
  85. #ifndef LDAP_TAG_CONTROLS
  86. #define LDAP_TAG_CONTROLS 0xa0L /* context specific + constructed + 0 */
  87. #endif
  88. #ifndef LDAP_TAG_REFERRAL
  89. #define LDAP_TAG_REFERRAL 0xa3L /* context specific + constructed */
  90. #endif
  91. #ifndef LDAP_TAG_NEWSUPERIOR
  92. #define LDAP_TAG_NEWSUPERIOR 0x80L /* context specific + primitive */
  93. #endif
  94. #ifndef LDAP_TAG_MRA_OID
  95. #define LDAP_TAG_MRA_OID 0x81L /* context specific + primitive */
  96. #endif
  97. #ifndef LDAP_TAG_MRA_TYPE
  98. #define LDAP_TAG_MRA_TYPE 0x82L /* context specific + primitive */
  99. #endif
  100. #ifndef LDAP_TAG_MRA_VALUE
  101. #define LDAP_TAG_MRA_VALUE 0x83L /* context specific + primitive */
  102. #endif
  103. #ifndef LDAP_TAG_MRA_DNATTRS
  104. #define LDAP_TAG_MRA_DNATTRS 0x84L /* context specific + primitive */
  105. #endif
  106. #ifndef LDAP_TAG_EXOP_REQ_OID
  107. #define LDAP_TAG_EXOP_REQ_OID 0x80L /* context specific + primitive */
  108. #endif
  109. #ifndef LDAP_TAG_EXOP_REQ_VALUE
  110. #define LDAP_TAG_EXOP_REQ_VALUE 0x81L /* context specific + primitive */
  111. #endif
  112. #ifndef LDAP_TAG_EXOP_RES_OID
  113. #define LDAP_TAG_EXOP_RES_OID 0x8aL /* context specific + primitive + 10 */
  114. #endif
  115. #ifndef LDAP_TAG_EXOP_RES_VALUE
  116. #define LDAP_TAG_EXOP_RES_VALUE 0x8bL /* context specific + primitive + 11 */
  117. #endif
  118. #ifndef LDAP_TAG_SK_MATCHRULE
  119. #define LDAP_TAG_SK_MATCHRULE 0x80L /* context specific + primitive */
  120. #endif
  121. #ifndef LDAP_TAG_SK_REVERSE
  122. #define LDAP_TAG_SK_REVERSE 0x81L /* context specific + primitive */
  123. #endif
  124. #ifndef LDAP_TAG_SR_ATTRTYPE
  125. #define LDAP_TAG_SR_ATTRTYPE 0x80L /* context specific + primitive */
  126. #endif
  127. #ifndef LDAP_TAG_SASL_RES_CREDS
  128. #define LDAP_TAG_SASL_RES_CREDS 0x87L /* context specific + primitive */
  129. #endif
  130. #ifndef LDAP_TAG_VLV_BY_INDEX
  131. #define LDAP_TAG_VLV_BY_INDEX 0xa0L /* context specific + constructed + 0 */
  132. #endif
  133. #ifndef LDAP_TAG_VLV_BY_VALUE
  134. #define LDAP_TAG_VLV_BY_VALUE 0x81L /* context specific + primitive + 1 */
  135. #endif
  136. #ifndef LDAP_TAG_PWP_WARNING
  137. #define LDAP_TAG_PWP_WARNING 0xA0 /* context specific + constructed + 0 */
  138. #endif
  139. #ifndef LDAP_TAG_PWP_SECSLEFT
  140. #define LDAP_TAG_PWP_SECSLEFT 0x80L /* context specific + primitive */
  141. #endif
  142. #ifndef LDAP_TAG_PWP_GRCLOGINS
  143. #define LDAP_TAG_PWP_GRCLOGINS 0x81L /* context specific + primitive + 1 */
  144. #endif
  145. #ifndef LDAP_TAG_PWP_ERROR
  146. #define LDAP_TAG_PWP_ERROR 0x81L /* context specific + primitive + 1 */
  147. #endif
  148. /* possible operations a client can invoke */
  149. #ifndef LDAP_REQ_BIND
  150. #define LDAP_REQ_BIND 0x60L /* application + constructed */
  151. #endif
  152. #ifndef LDAP_REQ_UNBIND
  153. #define LDAP_REQ_UNBIND 0x42L /* application + primitive */
  154. #endif
  155. #ifndef LDAP_REQ_SEARCH
  156. #define LDAP_REQ_SEARCH 0x63L /* application + constructed */
  157. #endif
  158. #ifndef LDAP_REQ_MODIFY
  159. #define LDAP_REQ_MODIFY 0x66L /* application + constructed */
  160. #endif
  161. #ifndef LDAP_REQ_ADD
  162. #define LDAP_REQ_ADD 0x68L /* application + constructed */
  163. #endif
  164. #ifndef LDAP_REQ_DELETE
  165. #define LDAP_REQ_DELETE 0x4aL /* application + primitive */
  166. #endif
  167. #ifndef LDAP_REQ_MODRDN
  168. #define LDAP_REQ_MODRDN 0x6cL /* application + constructed */
  169. #endif
  170. #ifndef LDAP_REQ_MODDN
  171. #define LDAP_REQ_MODDN 0x6cL /* application + constructed */
  172. #endif
  173. #ifndef LDAP_REQ_RENAME
  174. #define LDAP_REQ_RENAME 0x6cL /* application + constructed */
  175. #endif
  176. #ifndef LDAP_REQ_COMPARE
  177. #define LDAP_REQ_COMPARE 0x6eL /* application + constructed */
  178. #endif
  179. #ifndef LDAP_REQ_ABANDON
  180. #define LDAP_REQ_ABANDON 0x50L /* application + primitive */
  181. #endif
  182. #ifndef LDAP_REQ_EXTENDED
  183. #define LDAP_REQ_EXTENDED 0x77L /* application + constructed */
  184. #endif
  185. /* version 3.0 compatibility stuff */
  186. #ifndef LDAP_REQ_UNBIND_30
  187. #define LDAP_REQ_UNBIND_30 0x62L
  188. #endif
  189. #ifndef LDAP_REQ_DELETE_30
  190. #define LDAP_REQ_DELETE_30 0x6aL
  191. #endif
  192. #ifndef LDAP_REQ_ABANDON_30
  193. #define LDAP_REQ_ABANDON_30 0x70L
  194. #endif
  195. /*
  196. * old broken stuff for backwards compatibility - forgot application tag
  197. * and constructed/primitive bit
  198. */
  199. #define OLD_LDAP_REQ_BIND 0x00L
  200. #define OLD_LDAP_REQ_UNBIND 0x02L
  201. #define OLD_LDAP_REQ_SEARCH 0x03L
  202. #define OLD_LDAP_REQ_MODIFY 0x06L
  203. #define OLD_LDAP_REQ_ADD 0x08L
  204. #define OLD_LDAP_REQ_DELETE 0x0aL
  205. #define OLD_LDAP_REQ_MODRDN 0x0cL
  206. #define OLD_LDAP_REQ_MODDN 0x0cL
  207. #define OLD_LDAP_REQ_COMPARE 0x0eL
  208. #define OLD_LDAP_REQ_ABANDON 0x10L
  209. /* old broken stuff for backwards compatibility */
  210. #define OLD_LDAP_RES_BIND 0x01L
  211. #define OLD_LDAP_RES_SEARCH_ENTRY 0x04L
  212. #define OLD_LDAP_RES_SEARCH_RESULT 0x05L
  213. #define OLD_LDAP_RES_MODIFY 0x07L
  214. #define OLD_LDAP_RES_ADD 0x09L
  215. #define OLD_LDAP_RES_DELETE 0x0bL
  216. #define OLD_LDAP_RES_MODRDN 0x0dL
  217. #define OLD_LDAP_RES_MODDN 0x0dL
  218. #define OLD_LDAP_RES_COMPARE 0x0fL
  219. /* 3.0 compatibility auth methods */
  220. #define LDAP_AUTH_SIMPLE_30 0xa0L /* context specific + constructed */
  221. #define LDAP_AUTH_KRBV41_30 0xa1L /* context specific + constructed */
  222. #define LDAP_AUTH_KRBV42_30 0xa2L /* context specific + constructed */
  223. /* old broken stuff */
  224. #define OLD_LDAP_AUTH_SIMPLE 0x00L
  225. #define OLD_LDAP_AUTH_KRBV4 0x01L
  226. #define OLD_LDAP_AUTH_KRBV42 0x02L
  227. /* 3.0 compatibility filter types */
  228. #define LDAP_FILTER_PRESENT_30 0xa7L /* context specific + constructed */
  229. /* filter types */
  230. #ifndef LDAP_FILTER_AND
  231. #define LDAP_FILTER_AND 0xa0L /* context specific + constructed */
  232. #endif
  233. #ifndef LDAP_FILTER_OR
  234. #define LDAP_FILTER_OR 0xa1L /* context specific + constructed */
  235. #endif
  236. #ifndef LDAP_FILTER_NOT
  237. #define LDAP_FILTER_NOT 0xa2L /* context specific + constructed */
  238. #endif
  239. #ifndef LDAP_FILTER_EQUALITY
  240. #define LDAP_FILTER_EQUALITY 0xa3L /* context specific + constructed */
  241. #endif
  242. #ifndef LDAP_FILTER_SUBSTRINGS
  243. #define LDAP_FILTER_SUBSTRINGS 0xa4L /* context specific + constructed */
  244. #endif
  245. #ifndef LDAP_FILTER_GE
  246. #define LDAP_FILTER_GE 0xa5L /* context specific + constructed */
  247. #endif
  248. #ifndef LDAP_FILTER_LE
  249. #define LDAP_FILTER_LE 0xa6L /* context specific + constructed */
  250. #endif
  251. #ifndef LDAP_FILTER_PRESENT
  252. #define LDAP_FILTER_PRESENT 0x87L /* context specific + primitive */
  253. #endif
  254. #ifndef LDAP_FILTER_APPROX
  255. #define LDAP_FILTER_APPROX 0xa8L /* context specific + constructed */
  256. #endif
  257. #ifndef LDAP_FILTER_EXTENDED
  258. #ifdef LDAP_FILTER_EXT
  259. #define LDAP_FILTER_EXTENDED LDAP_FILTER_EXT
  260. #else
  261. #define LDAP_FILTER_EXTENDED 0xa9L
  262. #endif
  263. #endif
  264. /* old broken stuff */
  265. #define OLD_LDAP_FILTER_AND 0x00L
  266. #define OLD_LDAP_FILTER_OR 0x01L
  267. #define OLD_LDAP_FILTER_NOT 0x02L
  268. #define OLD_LDAP_FILTER_EQUALITY 0x03L
  269. #define OLD_LDAP_FILTER_SUBSTRINGS 0x04L
  270. #define OLD_LDAP_FILTER_GE 0x05L
  271. #define OLD_LDAP_FILTER_LE 0x06L
  272. #define OLD_LDAP_FILTER_PRESENT 0x07L
  273. #define OLD_LDAP_FILTER_APPROX 0x08L
  274. /* substring filter component types */
  275. #ifndef LDAP_SUBSTRING_INITIAL
  276. #define LDAP_SUBSTRING_INITIAL 0x80L /* context specific */
  277. #endif
  278. #ifndef LDAP_SUBSTRING_ANY
  279. #define LDAP_SUBSTRING_ANY 0x81L /* context specific */
  280. #endif
  281. #ifndef LDAP_SUBSTRING_FINAL
  282. #define LDAP_SUBSTRING_FINAL 0x82L /* context specific */
  283. #endif
  284. /* extended filter component types */
  285. #ifndef LDAP_FILTER_EXTENDED_OID
  286. #ifdef LDAP_FILTER_EXT_OID
  287. #define LDAP_FILTER_EXTENDED_OID LDAP_FILTER_EXT_OID
  288. #else
  289. #define LDAP_FILTER_EXTENDED_OID 0x81L /* context specific */
  290. #endif
  291. #endif
  292. #ifndef LDAP_FILTER_EXTENDED_TYPE
  293. #ifdef LDAP_FILTER_EXT_TYPE
  294. #define LDAP_FILTER_EXTENDED_TYPE LDAP_FILTER_EXT_TYPE
  295. #else
  296. #define LDAP_FILTER_EXTENDED_TYPE 0x82L /* context specific */
  297. #endif
  298. #endif
  299. #ifndef LDAP_FILTER_EXTENDED_VALUE
  300. #ifdef LDAP_FILTER_EXT_VALUE
  301. #define LDAP_FILTER_EXTENDED_VALUE LDAP_FILTER_EXT_VALUE
  302. #else
  303. #define LDAP_FILTER_EXTENDED_VALUE 0x83L /* context specific */
  304. #endif
  305. #endif
  306. #ifndef LDAP_FILTER_EXTENDED_DNATTRS
  307. #ifdef LDAP_FILTER_EXT_DNATTRS
  308. #define LDAP_FILTER_EXTENDED_DNATTRS LDAP_FILTER_EXT_DNATTRS
  309. #else
  310. #define LDAP_FILTER_EXTENDED_DNATTRS 0x84L /* context specific */
  311. #endif
  312. #endif
  313. /* 3.0 compatibility substring filter component types */
  314. #define LDAP_SUBSTRING_INITIAL_30 0xa0L /* context specific */
  315. #define LDAP_SUBSTRING_ANY_30 0xa1L /* context specific */
  316. #define LDAP_SUBSTRING_FINAL_30 0xa2L /* context specific */
  317. /* old broken stuff */
  318. #define OLD_LDAP_SUBSTRING_INITIAL 0x00L
  319. #define OLD_LDAP_SUBSTRING_ANY 0x01L
  320. #define OLD_LDAP_SUBSTRING_FINAL 0x02L
  321. #ifdef __cplusplus
  322. }
  323. #endif
  324. #endif /* _LDAPROT_H */