17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * Copyright (c) 2001 by Sun Microsystems, Inc.
37c478bd9Sstevel@tonic-gate  * All rights reserved.
47c478bd9Sstevel@tonic-gate  */
57c478bd9Sstevel@tonic-gate 
67c478bd9Sstevel@tonic-gate /*
77c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the Netscape Public
87c478bd9Sstevel@tonic-gate  * License Version 1.1 (the "License"); you may not use this file
97c478bd9Sstevel@tonic-gate  * except in compliance with the License. You may obtain a copy of
107c478bd9Sstevel@tonic-gate  * the License at http://www.mozilla.org/NPL/
117c478bd9Sstevel@tonic-gate  *
127c478bd9Sstevel@tonic-gate  * Software distributed under the License is distributed on an "AS
137c478bd9Sstevel@tonic-gate  * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
147c478bd9Sstevel@tonic-gate  * implied. See the License for the specific language governing
157c478bd9Sstevel@tonic-gate  * rights and limitations under the License.
167c478bd9Sstevel@tonic-gate  *
177c478bd9Sstevel@tonic-gate  * The Original Code is Mozilla Communicator client code, released
187c478bd9Sstevel@tonic-gate  * March 31, 1998.
197c478bd9Sstevel@tonic-gate  *
207c478bd9Sstevel@tonic-gate  * The Initial Developer of the Original Code is Netscape
217c478bd9Sstevel@tonic-gate  * Communications Corporation. Portions created by Netscape are
227c478bd9Sstevel@tonic-gate  * Copyright (C) 1998-1999 Netscape Communications Corporation. All
237c478bd9Sstevel@tonic-gate  * Rights Reserved.
247c478bd9Sstevel@tonic-gate  *
257c478bd9Sstevel@tonic-gate  * Contributor(s):
267c478bd9Sstevel@tonic-gate  */
277c478bd9Sstevel@tonic-gate 
287c478bd9Sstevel@tonic-gate #ifndef _LDAPROT_H
297c478bd9Sstevel@tonic-gate #define _LDAPROT_H
307c478bd9Sstevel@tonic-gate 
317c478bd9Sstevel@tonic-gate #ifdef __cplusplus
327c478bd9Sstevel@tonic-gate extern "C" {
337c478bd9Sstevel@tonic-gate #endif
347c478bd9Sstevel@tonic-gate 
357c478bd9Sstevel@tonic-gate #define LDAP_VERSION1	1
367c478bd9Sstevel@tonic-gate #define LDAP_VERSION2	2
377c478bd9Sstevel@tonic-gate #define LDAP_VERSION3	3
387c478bd9Sstevel@tonic-gate #define LDAP_VERSION	LDAP_VERSION2
397c478bd9Sstevel@tonic-gate 
407c478bd9Sstevel@tonic-gate #define COMPAT20
417c478bd9Sstevel@tonic-gate #define COMPAT30
427c478bd9Sstevel@tonic-gate #if defined(COMPAT20) || defined(COMPAT30)
437c478bd9Sstevel@tonic-gate #define COMPAT
447c478bd9Sstevel@tonic-gate #endif
457c478bd9Sstevel@tonic-gate 
467c478bd9Sstevel@tonic-gate #define LDAP_URL_PREFIX		"ldap://"
477c478bd9Sstevel@tonic-gate #define LDAP_URL_PREFIX_LEN	7
487c478bd9Sstevel@tonic-gate #define LDAPS_URL_PREFIX	"ldaps://"
497c478bd9Sstevel@tonic-gate #define LDAPS_URL_PREFIX_LEN	8
507c478bd9Sstevel@tonic-gate #define LDAP_REF_STR		"Referral:\n"
517c478bd9Sstevel@tonic-gate #define LDAP_REF_STR_LEN	10
527c478bd9Sstevel@tonic-gate 
53*1da57d55SToomas Soome /*
547c478bd9Sstevel@tonic-gate  * specific LDAP instantiations of BER types we know about
557c478bd9Sstevel@tonic-gate  */
567c478bd9Sstevel@tonic-gate 
577c478bd9Sstevel@tonic-gate #ifdef _SOLARIS_SDK
587c478bd9Sstevel@tonic-gate #define LDAP_TAG_LDAPDN         0x04   /* OCTET STRING */
597c478bd9Sstevel@tonic-gate #define OLD_LDAP_TAG_MESSAGE    0x10   /* forgot the constructed bit  */
607c478bd9Sstevel@tonic-gate #define LDAP_TAG_MRA_OID        0x81   /* context specific + primitive + 1 */
617c478bd9Sstevel@tonic-gate #define LDAP_TAG_MRA_TYPE       0x82   /* context specific + primitive + 2 */
627c478bd9Sstevel@tonic-gate #define LDAP_TAG_MRA_VALUE      0x83   /* context specific + primitive + 3 */
637c478bd9Sstevel@tonic-gate #define LDAP_TAG_MRA_DNATTRS    0x84   /* context specific + primitive + 4 */
647c478bd9Sstevel@tonic-gate #define LDAP_TAG_EXOP_REQ_OID   0x80   /* context specific + primitive + 0 */
657c478bd9Sstevel@tonic-gate #define LDAP_TAG_EXOP_REQ_VALUE 0x81   /* context specific + primitive + 1 */
667c478bd9Sstevel@tonic-gate #define LDAP_TAG_EXOP_RES_OID   0x8a   /* context specific + primitive + 10 */
677c478bd9Sstevel@tonic-gate #define LDAP_TAG_EXOP_RES_VALUE 0x8b   /* context specific + primitive + 11 */
687c478bd9Sstevel@tonic-gate #endif /* ifdef _SOLARIS_SDK */
697c478bd9Sstevel@tonic-gate 
707c478bd9Sstevel@tonic-gate #ifndef _SOLARIS_SDK
717c478bd9Sstevel@tonic-gate 
727c478bd9Sstevel@tonic-gate /* general stuff */
737c478bd9Sstevel@tonic-gate #define LDAP_TAG_MESSAGE	0x30L	/* tag is 16 + constructed bit */
747c478bd9Sstevel@tonic-gate #define LDAP_TAG_MSGID		0x02L   /* INTEGER */
757c478bd9Sstevel@tonic-gate #define LDAP_TAG_CONTROLS	0xa0L	/* context specific + constructed + 0 */
767c478bd9Sstevel@tonic-gate #define LDAP_TAG_REFERRAL	0xa3L	/* context specific + constructed + 3 */
777c478bd9Sstevel@tonic-gate #define LDAP_TAG_NEWSUPERIOR	0x80L	/* context specific + primitive + 0 */
787c478bd9Sstevel@tonic-gate #define LDAP_TAG_SASL_RES_CREDS	0x87L	/* context specific + primitive + 7 */
797c478bd9Sstevel@tonic-gate #define LDAP_TAG_VLV_BY_INDEX	0xa0L	/* context specific + constructed + 0 */
807c478bd9Sstevel@tonic-gate #define LDAP_TAG_VLV_BY_VALUE	0x81L	/* context specific + primitive + 1 */
817c478bd9Sstevel@tonic-gate 
827c478bd9Sstevel@tonic-gate 
837c478bd9Sstevel@tonic-gate #define LDAP_TAG_LDAPDN		0x04L	/* OCTET STRING */
847c478bd9Sstevel@tonic-gate #define OLD_LDAP_TAG_MESSAGE	0x10L	/* forgot the constructed bit  */
857c478bd9Sstevel@tonic-gate #define LDAP_TAG_MRA_OID	0x81L	/* context specific + primitive + 1 */
867c478bd9Sstevel@tonic-gate #define LDAP_TAG_MRA_TYPE	0x82L	/* context specific + primitive + 2 */
877c478bd9Sstevel@tonic-gate #define LDAP_TAG_MRA_VALUE	0x83L	/* context specific + primitive + 3 */
887c478bd9Sstevel@tonic-gate #define LDAP_TAG_MRA_DNATTRS	0x84L	/* context specific + primitive + 4 */
897c478bd9Sstevel@tonic-gate #define LDAP_TAG_EXOP_REQ_OID	0x80L	/* context specific + primitive + 0 */
907c478bd9Sstevel@tonic-gate #define LDAP_TAG_EXOP_REQ_VALUE	0x81L	/* context specific + primitive + 1 */
917c478bd9Sstevel@tonic-gate #define LDAP_TAG_EXOP_RES_OID	0x8aL	/* context specific + primitive + 10 */
927c478bd9Sstevel@tonic-gate #define LDAP_TAG_EXOP_RES_VALUE	0x8bL	/* context specific + primitive + 11 */
937c478bd9Sstevel@tonic-gate #define LDAP_TAG_SK_MATCHRULE   0x80L   /* context specific + primitive + 0 */
947c478bd9Sstevel@tonic-gate #define LDAP_TAG_SK_REVERSE 	0x81L	/* context specific + primitive + 1 */
957c478bd9Sstevel@tonic-gate #define LDAP_TAG_SR_ATTRTYPE    0x80L   /* context specific + primitive + 0 */
967c478bd9Sstevel@tonic-gate 
977c478bd9Sstevel@tonic-gate /* possible operations a client can invoke */
987c478bd9Sstevel@tonic-gate #define LDAP_REQ_BIND		0x60L	/* application + constructed + 0 */
997c478bd9Sstevel@tonic-gate #define LDAP_REQ_UNBIND		0x42L	/* application + primitive   + 2 */
1007c478bd9Sstevel@tonic-gate #define LDAP_REQ_SEARCH		0x63L	/* application + constructed + 3 */
1017c478bd9Sstevel@tonic-gate #define LDAP_REQ_MODIFY		0x66L	/* application + constructed + 6 */
1027c478bd9Sstevel@tonic-gate #define LDAP_REQ_ADD		0x68L	/* application + constructed + 8 */
1037c478bd9Sstevel@tonic-gate #define LDAP_REQ_DELETE		0x4aL	/* application + primitive   + 10 */
1047c478bd9Sstevel@tonic-gate #define LDAP_REQ_MODRDN		0x6cL	/* application + constructed + 12 */
1057c478bd9Sstevel@tonic-gate #define LDAP_REQ_MODDN		0x6cL	/* application + constructed + 12 */
1067c478bd9Sstevel@tonic-gate #define LDAP_REQ_RENAME		0x6cL	/* application + constructed + 12 */
1077c478bd9Sstevel@tonic-gate #define LDAP_REQ_COMPARE	0x6eL	/* application + constructed + 14 */
1087c478bd9Sstevel@tonic-gate #define LDAP_REQ_ABANDON	0x50L	/* application + primitive   + 16 */
1097c478bd9Sstevel@tonic-gate #define LDAP_REQ_EXTENDED	0x77L	/* application + constructed + 23 */
1107c478bd9Sstevel@tonic-gate 
1117c478bd9Sstevel@tonic-gate /* U-M LDAP release 3.0 compatibility stuff */
1127c478bd9Sstevel@tonic-gate #define LDAP_REQ_UNBIND_30	0x62L
1137c478bd9Sstevel@tonic-gate #define LDAP_REQ_DELETE_30	0x6aL
1147c478bd9Sstevel@tonic-gate #define LDAP_REQ_ABANDON_30	0x70L
1157c478bd9Sstevel@tonic-gate 
1167c478bd9Sstevel@tonic-gate /* U-M LDAP 3.0 compatibility auth methods */
1177c478bd9Sstevel@tonic-gate #define LDAP_AUTH_SIMPLE_30	0xa0L	/* context specific + constructed */
1187c478bd9Sstevel@tonic-gate #define LDAP_AUTH_KRBV41_30	0xa1L	/* context specific + constructed */
1197c478bd9Sstevel@tonic-gate #define LDAP_AUTH_KRBV42_30	0xa2L	/* context specific + constructed */
1207c478bd9Sstevel@tonic-gate 
1217c478bd9Sstevel@tonic-gate /*
1227c478bd9Sstevel@tonic-gate  * old broken stuff for backwards compatibility - forgot application tag
1237c478bd9Sstevel@tonic-gate  * and constructed/primitive bit
1247c478bd9Sstevel@tonic-gate  */
1257c478bd9Sstevel@tonic-gate #define OLD_LDAP_REQ_BIND	0x00L
1267c478bd9Sstevel@tonic-gate #define OLD_LDAP_REQ_UNBIND	0x02L
1277c478bd9Sstevel@tonic-gate #define OLD_LDAP_REQ_SEARCH	0x03L
1287c478bd9Sstevel@tonic-gate #define OLD_LDAP_REQ_MODIFY	0x06L
1297c478bd9Sstevel@tonic-gate #define OLD_LDAP_REQ_ADD	0x08L
1307c478bd9Sstevel@tonic-gate #define OLD_LDAP_REQ_DELETE	0x0aL
1317c478bd9Sstevel@tonic-gate #define OLD_LDAP_REQ_MODRDN	0x0cL
1327c478bd9Sstevel@tonic-gate #define OLD_LDAP_REQ_MODDN	0x0cL
1337c478bd9Sstevel@tonic-gate #define OLD_LDAP_REQ_COMPARE	0x0eL
1347c478bd9Sstevel@tonic-gate #define OLD_LDAP_REQ_ABANDON	0x10L
1357c478bd9Sstevel@tonic-gate 
1367c478bd9Sstevel@tonic-gate /* old broken stuff for backwards compatibility */
1377c478bd9Sstevel@tonic-gate #define OLD_LDAP_RES_BIND		0x01L
1387c478bd9Sstevel@tonic-gate #define OLD_LDAP_RES_SEARCH_ENTRY	0x04L
1397c478bd9Sstevel@tonic-gate #define OLD_LDAP_RES_SEARCH_RESULT	0x05L
1407c478bd9Sstevel@tonic-gate #define OLD_LDAP_RES_MODIFY		0x07L
1417c478bd9Sstevel@tonic-gate #define OLD_LDAP_RES_ADD		0x09L
1427c478bd9Sstevel@tonic-gate #define OLD_LDAP_RES_DELETE		0x0bL
1437c478bd9Sstevel@tonic-gate #define OLD_LDAP_RES_MODRDN		0x0dL
1447c478bd9Sstevel@tonic-gate #define OLD_LDAP_RES_MODDN		0x0dL
1457c478bd9Sstevel@tonic-gate #define OLD_LDAP_RES_COMPARE		0x0fL
1467c478bd9Sstevel@tonic-gate 
1477c478bd9Sstevel@tonic-gate /* U-M LDAP 3.0 compatibility auth methods */
1487c478bd9Sstevel@tonic-gate #define LDAP_AUTH_SIMPLE_30	0xa0L	/* context specific + constructed */
1497c478bd9Sstevel@tonic-gate #define LDAP_AUTH_KRBV41_30	0xa1L	/* context specific + constructed */
1507c478bd9Sstevel@tonic-gate #define LDAP_AUTH_KRBV42_30	0xa2L	/* context specific + constructed */
1517c478bd9Sstevel@tonic-gate 
1527c478bd9Sstevel@tonic-gate /* old broken stuff */
1537c478bd9Sstevel@tonic-gate #define OLD_LDAP_AUTH_SIMPLE	0x00L
1547c478bd9Sstevel@tonic-gate #define OLD_LDAP_AUTH_KRBV4	0x01L
1557c478bd9Sstevel@tonic-gate #define OLD_LDAP_AUTH_KRBV42	0x02L
1567c478bd9Sstevel@tonic-gate 
1577c478bd9Sstevel@tonic-gate /* U-M LDAP 3.0 compatibility filter types */
1587c478bd9Sstevel@tonic-gate #define LDAP_FILTER_PRESENT_30	0xa7L	/* context specific + constructed */
1597c478bd9Sstevel@tonic-gate 
1607c478bd9Sstevel@tonic-gate /* filter types */
1617c478bd9Sstevel@tonic-gate #define LDAP_FILTER_AND		0xa0L	/* context specific + constructed + 0 */
1627c478bd9Sstevel@tonic-gate #define LDAP_FILTER_OR		0xa1L	/* context specific + constructed + 1 */
1637c478bd9Sstevel@tonic-gate #define LDAP_FILTER_NOT		0xa2L	/* context specific + constructed + 2 */
1647c478bd9Sstevel@tonic-gate #define LDAP_FILTER_EQUALITY	0xa3L	/* context specific + constructed + 3 */
1657c478bd9Sstevel@tonic-gate #define LDAP_FILTER_SUBSTRINGS	0xa4L	/* context specific + constructed + 4 */
1667c478bd9Sstevel@tonic-gate #define LDAP_FILTER_GE		0xa5L	/* context specific + constructed + 5 */
1677c478bd9Sstevel@tonic-gate #define LDAP_FILTER_LE		0xa6L	/* context specific + constructed + 6 */
1687c478bd9Sstevel@tonic-gate #define LDAP_FILTER_PRESENT	0x87L	/* context specific + primitive   + 7 */
1697c478bd9Sstevel@tonic-gate #define LDAP_FILTER_APPROX	0xa8L	/* context specific + constructed + 8 */
1707c478bd9Sstevel@tonic-gate #define LDAP_FILTER_EXTENDED	0xa9L	/* context specific + constructed + 0 */
1717c478bd9Sstevel@tonic-gate 
1727c478bd9Sstevel@tonic-gate /* old broken stuff */
1737c478bd9Sstevel@tonic-gate #define OLD_LDAP_FILTER_AND		0x00L
1747c478bd9Sstevel@tonic-gate #define OLD_LDAP_FILTER_OR		0x01L
1757c478bd9Sstevel@tonic-gate #define OLD_LDAP_FILTER_NOT		0x02L
1767c478bd9Sstevel@tonic-gate #define OLD_LDAP_FILTER_EQUALITY	0x03L
1777c478bd9Sstevel@tonic-gate #define OLD_LDAP_FILTER_SUBSTRINGS	0x04L
1787c478bd9Sstevel@tonic-gate #define OLD_LDAP_FILTER_GE		0x05L
1797c478bd9Sstevel@tonic-gate #define OLD_LDAP_FILTER_LE		0x06L
1807c478bd9Sstevel@tonic-gate #define OLD_LDAP_FILTER_PRESENT		0x07L
1817c478bd9Sstevel@tonic-gate #define OLD_LDAP_FILTER_APPROX		0x08L
1827c478bd9Sstevel@tonic-gate 
1837c478bd9Sstevel@tonic-gate /* substring filter component types */
1847c478bd9Sstevel@tonic-gate #define LDAP_SUBSTRING_INITIAL	0x80L	/* context specific + primitive + 0 */
1857c478bd9Sstevel@tonic-gate #define LDAP_SUBSTRING_ANY	0x81L	/* context specific + primitive + 1 */
1867c478bd9Sstevel@tonic-gate #define LDAP_SUBSTRING_FINAL	0x82L	/* context specific + primitive + 2 */
1877c478bd9Sstevel@tonic-gate 
1887c478bd9Sstevel@tonic-gate /* extended filter component types */
1897c478bd9Sstevel@tonic-gate #define LDAP_FILTER_EXTENDED_OID	0x81L	/* context spec. + prim. + 1 */
1907c478bd9Sstevel@tonic-gate #define LDAP_FILTER_EXTENDED_TYPE	0x82L	/* context spec. + prim. + 2 */
1917c478bd9Sstevel@tonic-gate #define LDAP_FILTER_EXTENDED_VALUE	0x83L	/* context spec. + prim. + 3 */
1927c478bd9Sstevel@tonic-gate #define LDAP_FILTER_EXTENDED_DNATTRS	0x84L	/* context spec. + prim. + 4 */
1937c478bd9Sstevel@tonic-gate 
1947c478bd9Sstevel@tonic-gate /* U-M LDAP 3.0 compatibility substring filter component types */
1957c478bd9Sstevel@tonic-gate #define LDAP_SUBSTRING_INITIAL_30	0xa0L	/* context specific */
1967c478bd9Sstevel@tonic-gate #define LDAP_SUBSTRING_ANY_30		0xa1L	/* context specific */
1977c478bd9Sstevel@tonic-gate #define LDAP_SUBSTRING_FINAL_30		0xa2L	/* context specific */
1987c478bd9Sstevel@tonic-gate 
1997c478bd9Sstevel@tonic-gate /* old broken stuff */
2007c478bd9Sstevel@tonic-gate #define OLD_LDAP_SUBSTRING_INITIAL	0x00L
2017c478bd9Sstevel@tonic-gate #define OLD_LDAP_SUBSTRING_ANY		0x01L
2027c478bd9Sstevel@tonic-gate #define OLD_LDAP_SUBSTRING_FINAL	0x02L
2037c478bd9Sstevel@tonic-gate 
2047c478bd9Sstevel@tonic-gate #endif /* _SOLARIS_SDK */
2057c478bd9Sstevel@tonic-gate 
2067c478bd9Sstevel@tonic-gate #ifdef __cplusplus
2077c478bd9Sstevel@tonic-gate }
2087c478bd9Sstevel@tonic-gate #endif
2097c478bd9Sstevel@tonic-gate #endif /* _LDAPROT_H */
210