ldapsdk  0.0.1
LDAPResult.h
Go to the documentation of this file.
1 // $OpenLDAP$
2 /*
3  * Copyright 2000-2011 The OpenLDAP Foundation, All Rights Reserved.
4  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
5  */
6 
7 
8 #ifndef LDAP_RESULT_H
9 #define LDAP_RESULT_H
10 
11 #include<iostream>
12 #include<ldap.h>
13 #include <LDAPMessage.h>
14 #include <LDAPControlSet.h>
15 #include <LDAPUrlList.h>
16 
17 class LDAPRequest;
18 class LDAPAsynConnection;
19 
30 class LDAPResult : public LDAPMsg{
31  public :
32  //Error codes from RFC 2251
33  static const int SUCCESS = 0;
34  static const int OPERATIONS_ERROR = 1;
35  static const int PROTOCOL_ERROR = 2;
36  static const int TIME_LIMIT_EXCEEDED = 3;
37  static const int SIZE_LIMIT_EXCEEDED = 4;
38  static const int COMPARE_FALSE = 5;
39  static const int COMPARE_TRUE = 6;
40  static const int AUTH_METHOD_NOT_SUPPORTED = 7;
41  static const int STRONG_AUTH_REQUIRED = 8;
42 
43  static const int REFERRAL = 10;
44  static const int ADMIN_LIMIT_EXCEEDED = 11;
45  static const int UNAVAILABLE_CRITICAL_EXTENSION = 12;
46  static const int CONFIDENTIALITY_REQUIRED = 13;
47  static const int SASL_BIND_IN_PROGRESS = 14;
48 
49  static const int NO_SUCH_ATTRIBUTE = 16;
50  static const int UNDEFINED_ATTRIBUTE_TYP = 17;
51  static const int INAPPROPRIATE_MATCHING = 18;
52  static const int CONSTRAINT_VIOLATION = 19;
53  static const int ATTRIBUTE_OR_VALUE_EXISTS = 20;
54  static const int INVALID_ATTRIBUTE_SYNTAX = 21;
55 
56  static const int NO_SUCH_OBJECT = 32;
57  static const int ALIAS_PROBLEM = 33;
58  static const int INVALID_DN_SYNTAX = 34;
59 
60  static const int ALIAS_DEREFERENCING_PROBLEM = 36;
61 
62  static const int INAPPROPRIATE_AUTENTICATION = 48;
63  static const int INVALID_CREDENTIALS = 49;
64  static const int INSUFFICIENT_ACCESS = 50;
65  static const int BUSY = 51;
66  static const int UNAVAILABLE = 52;
67  static const int UNWILLING_TO_PERFORM = 53;
68  static const int LOOP_DETECT = 54;
69 
70  static const int NAMING_VIOLATION = 64;
71  static const int OBJECT_CLASS_VIOLATION = 65;
72  static const int NOT_ALLOWED_ON_NONLEAF = 66;
73  static const int NOT_ALLOWED_ON_RDN = 67;
74  static const int ENTRY_ALREADY_EXISTS = 68;
75  static const int OBJECT_CLASS_MODS_PROHIBITED = 69;
76 
77  static const int AFFECTS_MULTIPLE_DSAS = 71;
78 
79  // some Errorcodes defined in the LDAP C API DRAFT
80  static const int OTHER = 80;
81  static const int SERVER_DOWN = 81;
82  static const int LOCAL_ERROR = 82;
83  static const int ENCODING_ERROR = 83;
84  static const int DECODING_ERROR = 84;
85  static const int TIMEOUT = 85;
86  static const int AUTH_UNKNOWN = 86;
87  static const int FILTER_ERROR = 87;
88  static const int USER_CANCELLED = 88;
89  static const int PARAM_ERROR = 89;
90  static const int NO_MEMORY = 90;
91  static const int CONNECT_ERROR = 91;
92  static const int NOT_SUPPORTED = 92;
93  static const int CONTROL_NOT_FOUND = 93;
94  static const int NO_RESULTS_RETURNED = 94;
95  static const int MORE_RESULTS_TO_RETURN = 95;
96  static const int CLIENT_LOOP = 96;
97  static const int REFERRAL_LIMIT_EXCEEDED = 97;
98 
106  LDAPResult(const LDAPRequest *req, LDAPMessage *msg);
107  LDAPResult(int type, int resultCode, const std::string &msg);
108 
112  virtual ~LDAPResult();
113 
118  int getResultCode() const;
119 
125  std::string resToString() const;
126 
132  const std::string& getErrMsg() const;
133 
141  const std::string& getMatchedDN() const;
142 
147  const LDAPUrlList& getReferralUrls() const;
148 
149  private :
150  int m_resCode;
151  std::string m_matchedDN;
152  std::string m_errMsg;
153  LDAPUrlList m_referrals;
154 
159  friend std::ostream& operator<<(std::ostream &s,LDAPResult &l);
160 };
161 #endif //LDAP_RESULT_H
162