00001 /* 00002 * Copyright 2000, OpenLDAP Foundation, All Rights Reserved. 00003 * COPYING RESTRICTIONS APPLY, see COPYRIGHT file 00004 */ 00005 00006 00007 #ifndef LDAP_RESULT_H 00008 #define LDAP_RESULT_H 00009 00010 #include<iostream> 00011 #include<ldap.h> 00012 #include <LDAPMessage.h> 00013 #include <LDAPControlSet.h> 00014 #include <LDAPUrlList.h> 00015 00016 class LDAPRequest; 00017 class LDAPAsynConnection; 00018 00029 class LDAPResult : public LDAPMsg{ 00030 public : 00031 //Error codes from RFC 2251 00032 static const int SUCCESS = 0; 00033 static const int OPERATIONS_ERROR = 1; 00034 static const int PROTOCOL_ERROR = 2; 00035 static const int TIME_LIMIT_EXCEEDED = 3; 00036 static const int SIZE_LIMIT_EXCEEDED = 4; 00037 static const int COMPARE_FALSE = 5; 00038 static const int COMPARE_TRUE = 6; 00039 static const int AUTH_METHOD_NOT_SUPPORTED = 7; 00040 static const int STRONG_AUTH_REQUIRED = 8; 00041 00042 static const int REFERRAL = 10; 00043 static const int ADMIN_LIMIT_EXCEEDED = 11; 00044 static const int UNAVAILABLE_CRITICAL_EXTENSION = 12; 00045 static const int CONFIDENTIALITY_REQUIRED = 13; 00046 static const int SASL_BIND_IN_PROGRESS = 14; 00047 00048 static const int NO_SUCH_ATTRIBUTE = 16; 00049 static const int UNDEFINED_ATTRIBUTE_TYP = 17; 00050 static const int INAPPROPRIATE_MATCHING = 18; 00051 static const int CONSTRAINT_VIOLATION = 19; 00052 static const int ATTRIBUTE_OR_VALUE_EXISTS = 20; 00053 static const int INVALID_ATTRIBUTE_SYNTAX = 21; 00054 00055 static const int NO_SUCH_OBJECT = 32; 00056 static const int ALIAS_PROBLEM = 33; 00057 static const int INVALID_DN_SYNTAX = 34; 00058 00059 static const int ALIAS_DEREFERENCING_PROBLEM = 36; 00060 00061 static const int INAPPROPRIATE_AUTENTICATION = 48; 00062 static const int INVALID_CREDENTIALS = 49; 00063 static const int INSUFFICIENT_ACCESS = 50; 00064 static const int BUSY = 51; 00065 static const int UNAVAILABLE = 52; 00066 static const int UNWILLING_TO_PERFORM = 53; 00067 static const int LOOP_DETECT = 54; 00068 00069 static const int NAMING_VIOLATION = 64; 00070 static const int OBJECT_CLASS_VIOLATION = 65; 00071 static const int NOT_ALLOWED_ON_NONLEAF = 66; 00072 static const int NOT_ALLOWED_ON_RDN = 67; 00073 static const int ENTRY_ALREADY_EXISTS = 68; 00074 static const int OBJECT_CLASS_MODS_PROHIBITED = 69; 00075 00076 static const int AFFECTS_MULTIPLE_DSAS = 71; 00077 00078 // some Errorcodes defined in the LDAP C API DRAFT 00079 static const int OTHER = 80; 00080 static const int SERVER_DOWN = 81; 00081 static const int LOCAL_ERROR = 82; 00082 static const int ENCODING_ERROR = 83; 00083 static const int DECODING_ERROR = 84; 00084 static const int TIMEOUT = 85; 00085 static const int AUTH_UNKNOWN = 86; 00086 static const int FILTER_ERROR = 87; 00087 static const int USER_CANCELLED = 88; 00088 static const int PARAM_ERROR = 89; 00089 static const int NO_MEMORY = 90; 00090 static const int CONNECT_ERROR = 91; 00091 static const int NOT_SUPPORTED = 92; 00092 static const int CONTROL_NOT_FOUND = 93; 00093 static const int NO_RESULTS_RETURNED = 94; 00094 static const int MORE_RESULTS_TO_RETURN = 95; 00095 static const int CLIENT_LOOP = 96; 00096 static const int REFERRAL_LIMIT_EXCEEDED = 97; 00097 00105 LDAPResult(const LDAPRequest *req, LDAPMessage *msg); 00106 00110 virtual ~LDAPResult(); 00111 00116 int getResultCode() const; 00117 00123 std::string resToString() const; 00124 00130 const std::string& getErrMsg() const; 00131 00139 const std::string& getMatchedDN() const; 00140 00145 const LDAPUrlList& getReferralUrls() const; 00146 00147 private : 00148 int m_resCode; 00149 std::string m_matchedDN; 00150 std::string m_errMsg; 00151 LDAPUrlList m_referrals; 00152 00157 friend std::ostream& operator<<(std::ostream &s,LDAPResult &l); 00158 }; 00159 #endif //LDAP_RESULT_H 00160