ldaprot.h 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317
  1. /** BEGIN COPYRIGHT BLOCK
  2. * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission.
  3. * Copyright (C) 2005 Red Hat, Inc.
  4. * All rights reserved.
  5. *
  6. * License: GPL (version 3 or any later version).
  7. * See LICENSE for details.
  8. * END COPYRIGHT BLOCK **/
  9. #ifdef HAVE_CONFIG_H
  10. # include <config.h>
  11. #endif
  12. #ifndef _LDAPROT_H
  13. #define _LDAPROT_H
  14. #ifdef __cplusplus
  15. extern "C" {
  16. #endif
  17. #ifndef LDAP_VERSION1
  18. #define LDAP_VERSION1 1
  19. #endif
  20. #ifndef LDAP_VERSION2
  21. #define LDAP_VERSION2 2
  22. #endif
  23. #ifndef LDAP_VERSION3
  24. #define LDAP_VERSION3 3
  25. #endif
  26. #ifndef LDAP_VERSION
  27. #define LDAP_VERSION LDAP_VERSION2
  28. #endif
  29. #define COMPAT20
  30. #define COMPAT30
  31. #if defined(COMPAT20) || defined(COMPAT30)
  32. #define COMPAT
  33. #endif
  34. #define LDAP_URL_PREFIX "ldap://"
  35. #define LDAP_URL_PREFIX_LEN 7
  36. #define LDAPS_URL_PREFIX "ldaps://"
  37. #define LDAPS_URL_PREFIX_LEN 8
  38. #define LDAP_REF_STR "Referral:\n"
  39. #define LDAP_REF_STR_LEN 10
  40. /*
  41. * specific LDAP instantiations of BER types we know about
  42. */
  43. /* general stuff */
  44. #ifndef LDAP_TAG_MESSAGE
  45. #define LDAP_TAG_MESSAGE 0x30L /* tag is 16 + constructed bit */
  46. #endif
  47. #ifndef OLD_LDAP_TAG_MESSAGE
  48. #define OLD_LDAP_TAG_MESSAGE 0x10L /* forgot the constructed bit */
  49. #endif
  50. #ifndef LDAP_TAG_MSGID
  51. #define LDAP_TAG_MSGID 0x02L /* INTEGER */
  52. #endif
  53. #ifndef LDAP_TAG_LDAPDN
  54. #define LDAP_TAG_LDAPDN 0x04L /* OCTET STRING */
  55. #endif
  56. #ifndef LDAP_TAG_CONTROLS
  57. #define LDAP_TAG_CONTROLS 0xa0L /* context specific + constructed + 0 */
  58. #endif
  59. #ifndef LDAP_TAG_REFERRAL
  60. #define LDAP_TAG_REFERRAL 0xa3L /* context specific + constructed */
  61. #endif
  62. #ifndef LDAP_TAG_NEWSUPERIOR
  63. #define LDAP_TAG_NEWSUPERIOR 0x80L /* context specific + primitive */
  64. #endif
  65. #ifndef LDAP_TAG_MRA_OID
  66. #define LDAP_TAG_MRA_OID 0x81L /* context specific + primitive */
  67. #endif
  68. #ifndef LDAP_TAG_MRA_TYPE
  69. #define LDAP_TAG_MRA_TYPE 0x82L /* context specific + primitive */
  70. #endif
  71. #ifndef LDAP_TAG_MRA_VALUE
  72. #define LDAP_TAG_MRA_VALUE 0x83L /* context specific + primitive */
  73. #endif
  74. #ifndef LDAP_TAG_MRA_DNATTRS
  75. #define LDAP_TAG_MRA_DNATTRS 0x84L /* context specific + primitive */
  76. #endif
  77. #ifndef LDAP_TAG_EXOP_REQ_OID
  78. #define LDAP_TAG_EXOP_REQ_OID 0x80L /* context specific + primitive */
  79. #endif
  80. #ifndef LDAP_TAG_EXOP_REQ_VALUE
  81. #define LDAP_TAG_EXOP_REQ_VALUE 0x81L /* context specific + primitive */
  82. #endif
  83. #ifndef LDAP_TAG_EXOP_RES_OID
  84. #define LDAP_TAG_EXOP_RES_OID 0x8aL /* context specific + primitive + 10 */
  85. #endif
  86. #ifndef LDAP_TAG_EXOP_RES_VALUE
  87. #define LDAP_TAG_EXOP_RES_VALUE 0x8bL /* context specific + primitive + 11 */
  88. #endif
  89. #ifndef LDAP_TAG_SK_MATCHRULE
  90. #define LDAP_TAG_SK_MATCHRULE 0x80L /* context specific + primitive */
  91. #endif
  92. #ifndef LDAP_TAG_SK_REVERSE
  93. #define LDAP_TAG_SK_REVERSE 0x81L /* context specific + primitive */
  94. #endif
  95. #ifndef LDAP_TAG_SR_ATTRTYPE
  96. #define LDAP_TAG_SR_ATTRTYPE 0x80L /* context specific + primitive */
  97. #endif
  98. #ifndef LDAP_TAG_SASL_RES_CREDS
  99. #define LDAP_TAG_SASL_RES_CREDS 0x87L /* context specific + primitive */
  100. #endif
  101. #ifndef LDAP_TAG_VLV_BY_INDEX
  102. #define LDAP_TAG_VLV_BY_INDEX 0xa0L /* context specific + constructed + 0 */
  103. #endif
  104. #ifndef LDAP_TAG_VLV_BY_VALUE
  105. #define LDAP_TAG_VLV_BY_VALUE 0x81L /* context specific + primitive + 1 */
  106. #endif
  107. #ifndef LDAP_TAG_PWP_WARNING
  108. #define LDAP_TAG_PWP_WARNING 0xA0 /* context specific + constructed + 0 */
  109. #endif
  110. #ifndef LDAP_TAG_PWP_SECSLEFT
  111. #define LDAP_TAG_PWP_SECSLEFT 0x80L /* context specific + primitive */
  112. #endif
  113. #ifndef LDAP_TAG_PWP_GRCLOGINS
  114. #define LDAP_TAG_PWP_GRCLOGINS 0x81L /* context specific + primitive + 1 */
  115. #endif
  116. #ifndef LDAP_TAG_PWP_ERROR
  117. #define LDAP_TAG_PWP_ERROR 0x81L /* context specific + primitive + 1 */
  118. #endif
  119. /* possible operations a client can invoke */
  120. #ifndef LDAP_REQ_BIND
  121. #define LDAP_REQ_BIND 0x60L /* application + constructed */
  122. #endif
  123. #ifndef LDAP_REQ_UNBIND
  124. #define LDAP_REQ_UNBIND 0x42L /* application + primitive */
  125. #endif
  126. #ifndef LDAP_REQ_SEARCH
  127. #define LDAP_REQ_SEARCH 0x63L /* application + constructed */
  128. #endif
  129. #ifndef LDAP_REQ_MODIFY
  130. #define LDAP_REQ_MODIFY 0x66L /* application + constructed */
  131. #endif
  132. #ifndef LDAP_REQ_ADD
  133. #define LDAP_REQ_ADD 0x68L /* application + constructed */
  134. #endif
  135. #ifndef LDAP_REQ_DELETE
  136. #define LDAP_REQ_DELETE 0x4aL /* application + primitive */
  137. #endif
  138. #ifndef LDAP_REQ_MODRDN
  139. #define LDAP_REQ_MODRDN 0x6cL /* application + constructed */
  140. #endif
  141. #ifndef LDAP_REQ_MODDN
  142. #define LDAP_REQ_MODDN 0x6cL /* application + constructed */
  143. #endif
  144. #ifndef LDAP_REQ_RENAME
  145. #define LDAP_REQ_RENAME 0x6cL /* application + constructed */
  146. #endif
  147. #ifndef LDAP_REQ_COMPARE
  148. #define LDAP_REQ_COMPARE 0x6eL /* application + constructed */
  149. #endif
  150. #ifndef LDAP_REQ_ABANDON
  151. #define LDAP_REQ_ABANDON 0x50L /* application + primitive */
  152. #endif
  153. #ifndef LDAP_REQ_EXTENDED
  154. #define LDAP_REQ_EXTENDED 0x77L /* application + constructed */
  155. #endif
  156. /* version 3.0 compatibility stuff */
  157. #ifndef LDAP_REQ_UNBIND_30
  158. #define LDAP_REQ_UNBIND_30 0x62L
  159. #endif
  160. #ifndef LDAP_REQ_DELETE_30
  161. #define LDAP_REQ_DELETE_30 0x6aL
  162. #endif
  163. #ifndef LDAP_REQ_ABANDON_30
  164. #define LDAP_REQ_ABANDON_30 0x70L
  165. #endif
  166. /*
  167. * old broken stuff for backwards compatibility - forgot application tag
  168. * and constructed/primitive bit
  169. */
  170. #define OLD_LDAP_REQ_BIND 0x00L
  171. #define OLD_LDAP_REQ_UNBIND 0x02L
  172. #define OLD_LDAP_REQ_SEARCH 0x03L
  173. #define OLD_LDAP_REQ_MODIFY 0x06L
  174. #define OLD_LDAP_REQ_ADD 0x08L
  175. #define OLD_LDAP_REQ_DELETE 0x0aL
  176. #define OLD_LDAP_REQ_MODRDN 0x0cL
  177. #define OLD_LDAP_REQ_MODDN 0x0cL
  178. #define OLD_LDAP_REQ_COMPARE 0x0eL
  179. #define OLD_LDAP_REQ_ABANDON 0x10L
  180. /* old broken stuff for backwards compatibility */
  181. #define OLD_LDAP_RES_BIND 0x01L
  182. #define OLD_LDAP_RES_SEARCH_ENTRY 0x04L
  183. #define OLD_LDAP_RES_SEARCH_RESULT 0x05L
  184. #define OLD_LDAP_RES_MODIFY 0x07L
  185. #define OLD_LDAP_RES_ADD 0x09L
  186. #define OLD_LDAP_RES_DELETE 0x0bL
  187. #define OLD_LDAP_RES_MODRDN 0x0dL
  188. #define OLD_LDAP_RES_MODDN 0x0dL
  189. #define OLD_LDAP_RES_COMPARE 0x0fL
  190. /* 3.0 compatibility auth methods */
  191. #define LDAP_AUTH_SIMPLE_30 0xa0L /* context specific + constructed */
  192. #define LDAP_AUTH_KRBV41_30 0xa1L /* context specific + constructed */
  193. #define LDAP_AUTH_KRBV42_30 0xa2L /* context specific + constructed */
  194. /* old broken stuff */
  195. #define OLD_LDAP_AUTH_SIMPLE 0x00L
  196. #define OLD_LDAP_AUTH_KRBV4 0x01L
  197. #define OLD_LDAP_AUTH_KRBV42 0x02L
  198. /* 3.0 compatibility filter types */
  199. #define LDAP_FILTER_PRESENT_30 0xa7L /* context specific + constructed */
  200. /* filter types */
  201. #ifndef LDAP_FILTER_AND
  202. #define LDAP_FILTER_AND 0xa0L /* context specific + constructed */
  203. #endif
  204. #ifndef LDAP_FILTER_OR
  205. #define LDAP_FILTER_OR 0xa1L /* context specific + constructed */
  206. #endif
  207. #ifndef LDAP_FILTER_NOT
  208. #define LDAP_FILTER_NOT 0xa2L /* context specific + constructed */
  209. #endif
  210. #ifndef LDAP_FILTER_EQUALITY
  211. #define LDAP_FILTER_EQUALITY 0xa3L /* context specific + constructed */
  212. #endif
  213. #ifndef LDAP_FILTER_SUBSTRINGS
  214. #define LDAP_FILTER_SUBSTRINGS 0xa4L /* context specific + constructed */
  215. #endif
  216. #ifndef LDAP_FILTER_GE
  217. #define LDAP_FILTER_GE 0xa5L /* context specific + constructed */
  218. #endif
  219. #ifndef LDAP_FILTER_LE
  220. #define LDAP_FILTER_LE 0xa6L /* context specific + constructed */
  221. #endif
  222. #ifndef LDAP_FILTER_PRESENT
  223. #define LDAP_FILTER_PRESENT 0x87L /* context specific + primitive */
  224. #endif
  225. #ifndef LDAP_FILTER_APPROX
  226. #define LDAP_FILTER_APPROX 0xa8L /* context specific + constructed */
  227. #endif
  228. #ifndef LDAP_FILTER_EXTENDED
  229. #ifdef LDAP_FILTER_EXT
  230. #define LDAP_FILTER_EXTENDED LDAP_FILTER_EXT
  231. #else
  232. #define LDAP_FILTER_EXTENDED 0xa9L
  233. #endif
  234. #endif
  235. /* old broken stuff */
  236. #define OLD_LDAP_FILTER_AND 0x00L
  237. #define OLD_LDAP_FILTER_OR 0x01L
  238. #define OLD_LDAP_FILTER_NOT 0x02L
  239. #define OLD_LDAP_FILTER_EQUALITY 0x03L
  240. #define OLD_LDAP_FILTER_SUBSTRINGS 0x04L
  241. #define OLD_LDAP_FILTER_GE 0x05L
  242. #define OLD_LDAP_FILTER_LE 0x06L
  243. #define OLD_LDAP_FILTER_PRESENT 0x07L
  244. #define OLD_LDAP_FILTER_APPROX 0x08L
  245. /* substring filter component types */
  246. #ifndef LDAP_SUBSTRING_INITIAL
  247. #define LDAP_SUBSTRING_INITIAL 0x80L /* context specific */
  248. #endif
  249. #ifndef LDAP_SUBSTRING_ANY
  250. #define LDAP_SUBSTRING_ANY 0x81L /* context specific */
  251. #endif
  252. #ifndef LDAP_SUBSTRING_FINAL
  253. #define LDAP_SUBSTRING_FINAL 0x82L /* context specific */
  254. #endif
  255. /* extended filter component types */
  256. #ifndef LDAP_FILTER_EXTENDED_OID
  257. #ifdef LDAP_FILTER_EXT_OID
  258. #define LDAP_FILTER_EXTENDED_OID LDAP_FILTER_EXT_OID
  259. #else
  260. #define LDAP_FILTER_EXTENDED_OID 0x81L /* context specific */
  261. #endif
  262. #endif
  263. #ifndef LDAP_FILTER_EXTENDED_TYPE
  264. #ifdef LDAP_FILTER_EXT_TYPE
  265. #define LDAP_FILTER_EXTENDED_TYPE LDAP_FILTER_EXT_TYPE
  266. #else
  267. #define LDAP_FILTER_EXTENDED_TYPE 0x82L /* context specific */
  268. #endif
  269. #endif
  270. #ifndef LDAP_FILTER_EXTENDED_VALUE
  271. #ifdef LDAP_FILTER_EXT_VALUE
  272. #define LDAP_FILTER_EXTENDED_VALUE LDAP_FILTER_EXT_VALUE
  273. #else
  274. #define LDAP_FILTER_EXTENDED_VALUE 0x83L /* context specific */
  275. #endif
  276. #endif
  277. #ifndef LDAP_FILTER_EXTENDED_DNATTRS
  278. #ifdef LDAP_FILTER_EXT_DNATTRS
  279. #define LDAP_FILTER_EXTENDED_DNATTRS LDAP_FILTER_EXT_DNATTRS
  280. #else
  281. #define LDAP_FILTER_EXTENDED_DNATTRS 0x84L /* context specific */
  282. #endif
  283. #endif
  284. /* 3.0 compatibility substring filter component types */
  285. #define LDAP_SUBSTRING_INITIAL_30 0xa0L /* context specific */
  286. #define LDAP_SUBSTRING_ANY_30 0xa1L /* context specific */
  287. #define LDAP_SUBSTRING_FINAL_30 0xa2L /* context specific */
  288. /* old broken stuff */
  289. #define OLD_LDAP_SUBSTRING_INITIAL 0x00L
  290. #define OLD_LDAP_SUBSTRING_ANY 0x01L
  291. #define OLD_LDAP_SUBSTRING_FINAL 0x02L
  292. #ifdef __cplusplus
  293. }
  294. #endif
  295. #endif /* _LDAPROT_H */