2 * Copyright 2000, OpenLDAP Foundation, All Rights Reserved.
3 * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
12 #include <LDAPMessage.h>
13 #include <LDAPControlSet.h>
14 #include <LDAPUrlList.h>
17 class LDAPAsynConnection;
20 * This class is for representing LDAP-Result-Messages.
22 * It represents all Messages that were returned
23 * from LDAP-Operations except for Messages of the Type
24 * LDAPMsg::SEARCH_ENTRY, LDAPMsg::SEARCH_REFERENCE and
25 * LDAPMsg::EXTENDED_RESPONSE. <BR>
26 * It defines a integer constant for every possible result type that can be
27 * returned by the server.
29 class LDAPResult : public LDAPMsg{
31 //Error codes from RFC 2251
32 static const int SUCCESS = 0;
33 static const int OPERATIONS_ERROR = 1;
34 static const int PROTOCOL_ERROR = 2;
35 static const int TIME_LIMIT_EXCEEDED = 3;
36 static const int SIZE_LIMIT_EXCEEDED = 4;
37 static const int COMPARE_FALSE = 5;
38 static const int COMPARE_TRUE = 6;
39 static const int AUTH_METHOD_NOT_SUPPORTED = 7;
40 static const int STRONG_AUTH_REQUIRED = 8;
42 static const int REFERRAL = 10;
43 static const int ADMIN_LIMIT_EXCEEDED = 11;
44 static const int UNAVAILABLE_CRITICAL_EXTENSION = 12;
45 static const int CONFIDENTIALITY_REQUIRED = 13;
46 static const int SASL_BIND_IN_PROGRESS = 14;
48 static const int NO_SUCH_ATTRIBUTE = 16;
49 static const int UNDEFINED_ATTRIBUTE_TYP = 17;
50 static const int INAPPROPRIATE_MATCHING = 18;
51 static const int CONSTRAINT_VIOLATION = 19;
52 static const int ATTRIBUTE_OR_VALUE_EXISTS = 20;
53 static const int INVALID_ATTRIBUTE_SYNTAX = 21;
55 static const int NO_SUCH_OBJECT = 32;
56 static const int ALIAS_PROBLEM = 33;
57 static const int INVALID_DN_SYNTAX = 34;
59 static const int ALIAS_DEREFERENCING_PROBLEM = 36;
61 static const int INAPPROPRIATE_AUTENTICATION = 48;
62 static const int INVALID_CREDENTIALS = 49;
63 static const int INSUFFICIENT_ACCESS = 50;
64 static const int BUSY = 51;
65 static const int UNAVAILABLE = 52;
66 static const int UNWILLING_TO_PERFORM = 53;
67 static const int LOOP_DETECT = 54;
69 static const int NAMING_VIOLATION = 64;
70 static const int OBJECT_CLASS_VIOLATION = 65;
71 static const int NOT_ALLOWED_ON_NONLEAF = 66;
72 static const int NOT_ALLOWED_ON_RDN = 67;
73 static const int ENTRY_ALREADY_EXISTS = 68;
74 static const int OBJECT_CLASS_MODS_PROHIBITED = 69;
76 static const int AFFECTS_MULTIPLE_DSAS = 71;
78 // some Errorcodes defined in the LDAP C API DRAFT
79 static const int OTHER = 80;
80 static const int SERVER_DOWN = 81;
81 static const int LOCAL_ERROR = 82;
82 static const int ENCODING_ERROR = 83;
83 static const int DECODING_ERROR = 84;
84 static const int TIMEOUT = 85;
85 static const int AUTH_UNKNOWN = 86;
86 static const int FILTER_ERROR = 87;
87 static const int USER_CANCELLED = 88;
88 static const int PARAM_ERROR = 89;
89 static const int NO_MEMORY = 90;
90 static const int CONNECT_ERROR = 91;
91 static const int NOT_SUPPORTED = 92;
92 static const int CONTROL_NOT_FOUND = 93;
93 static const int NO_RESULTS_RETURNED = 94;
94 static const int MORE_RESULTS_TO_RETURN = 95;
95 static const int CLIENT_LOOP = 96;
96 static const int REFERRAL_LIMIT_EXCEEDED = 97;
99 * This constructor is called by the LDAPMsg::create method in
100 * order to parse a LDAPResult-Message
101 * @param req The request the result is associated with.
102 * @param msg The LDAPMessage-structure that contains the
105 LDAPResult(const LDAPRequest *req, LDAPMessage *msg);
106 LDAPResult(int type, int resultCode, const std::string &msg);
111 virtual ~LDAPResult();
114 * @returns The result code of the Message. Possible values are the
115 * integer constants defined in this class.
117 int getResultCode() const;
120 * This method transforms the result code to a human-readable
122 * @returns A std::string containing the result message.
124 std::string resToString() const;
127 * In some case of error the server may return addional error
129 * @returns The additional error message returned by the server.
131 const std::string& getErrMsg() const;
134 * For messages with a result code of: NO_SUCH_OBJECT,
135 * ALIAS_PROBLEM, ALIAS_DEREFERENCING_PROBLEM or INVALID_DN_SYNTAX
136 * the server returns the DN of deepest entry in the DIT that could
137 * be found for this operation.
138 * @returns The Matched-DN value that was returned by the server.
140 const std::string& getMatchedDN() const;
143 * @returns If the result code is REFERRAL this methode returns the
144 * URLs of the referral that was sent by the server.
146 const LDAPUrlList& getReferralUrls() const;
150 std::string m_matchedDN;
151 std::string m_errMsg;
152 LDAPUrlList m_referrals;
155 * This method can be used to dump the data of a LDAPResult-Object.
156 * It is only useful for debugging purposes at the moment
158 friend std::ostream& operator<<(std::ostream &s,LDAPResult &l);
160 #endif //LDAP_RESULT_H