ldapsdk  0.0.1
LDAPResult.h
Go to the documentation of this file.
1 // $OpenLDAP$
2 /*
3  * Copyright 2000-2013 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 
LDAPResult::AFFECTS_MULTIPLE_DSAS
static const int AFFECTS_MULTIPLE_DSAS
Definition: LDAPResult.h:77
LDAPControlSet.h
LDAPException
This class is only thrown as an Exception and used to signalize error conditions during LDAP-operatio...
Definition: LDAPException.h:23
LDAPResult::NO_SUCH_ATTRIBUTE
static const int NO_SUCH_ATTRIBUTE
Definition: LDAPResult.h:49
LDAPResult::getMatchedDN
const std::string & getMatchedDN() const
For messages with a result code of: NO_SUCH_OBJECT, ALIAS_PROBLEM, ALIAS_DEREFERENCING_PROBLEM or INV...
Definition: LDAPResult.cpp:81
LDAPResult::ENTRY_ALREADY_EXISTS
static const int ENTRY_ALREADY_EXISTS
Definition: LDAPResult.h:74
LDAPResult::OTHER
static const int OTHER
Definition: LDAPResult.h:80
LDAPResult::ALIAS_DEREFERENCING_PROBLEM
static const int ALIAS_DEREFERENCING_PROBLEM
Definition: LDAPResult.h:60
LDAPResult::DECODING_ERROR
static const int DECODING_ERROR
Definition: LDAPResult.h:84
LDAPAsynConnection
This class represents an asynchronous connection to an LDAP-Server.
Definition: LDAPAsynConnection.h:45
LDAPResult::INVALID_DN_SYNTAX
static const int INVALID_DN_SYNTAX
Definition: LDAPResult.h:58
LDAP_DEBUG_TRACE
#define LDAP_DEBUG_TRACE
Definition: debug.h:12
LDAPResult::NOT_ALLOWED_ON_RDN
static const int NOT_ALLOWED_ON_RDN
Definition: LDAPResult.h:73
LDAPMsg
This class represents any type of LDAP- Message returned from the server.
Definition: LDAPMessage.h:23
LDAPResult::ADMIN_LIMIT_EXCEEDED
static const int ADMIN_LIMIT_EXCEEDED
Definition: LDAPResult.h:44
LDAPResult::LOOP_DETECT
static const int LOOP_DETECT
Definition: LDAPResult.h:68
LDAPResult::MORE_RESULTS_TO_RETURN
static const int MORE_RESULTS_TO_RETURN
Definition: LDAPResult.h:95
LDAPResult::LDAPResult
LDAPResult(const LDAPRequest *req, LDAPMessage *msg)
This constructor is called by the LDAPMsg::create method in order to parse a LDAPResult-Message.
Definition: LDAPResult.cpp:18
LDAPResult::INVALID_ATTRIBUTE_SYNTAX
static const int INVALID_ATTRIBUTE_SYNTAX
Definition: LDAPResult.h:54
LDAPResult::INVALID_CREDENTIALS
static const int INVALID_CREDENTIALS
Definition: LDAPResult.h:63
LDAPResult::AUTH_UNKNOWN
static const int AUTH_UNKNOWN
Definition: LDAPResult.h:86
LDAPResult::COMPARE_FALSE
static const int COMPARE_FALSE
Definition: LDAPResult.h:38
LDAPResult::getErrMsg
const std::string & getErrMsg() const
In some case of error the server may return addional error messages.
Definition: LDAPResult.cpp:76
LDAPResult::resToString
std::string resToString() const
This method transforms the result code to a human-readable result message.
Definition: LDAPResult.cpp:71
LDAPResult::NO_RESULTS_RETURNED
static const int NO_RESULTS_RETURNED
Definition: LDAPResult.h:94
LDAPMsg::m_srvControls
LDAPControlSet m_srvControls
This attribute stores Server-Control that were returned with the message.
Definition: LDAPMessage.h:119
LDAPResult::UNWILLING_TO_PERFORM
static const int UNWILLING_TO_PERFORM
Definition: LDAPResult.h:67
LDAPResult::TIME_LIMIT_EXCEEDED
static const int TIME_LIMIT_EXCEEDED
Definition: LDAPResult.h:36
LDAPResult::NO_SUCH_OBJECT
static const int NO_SUCH_OBJECT
Definition: LDAPResult.h:56
LDAPResult::CLIENT_LOOP
static const int CLIENT_LOOP
Definition: LDAPResult.h:96
LDAPResult::SASL_BIND_IN_PROGRESS
static const int SASL_BIND_IN_PROGRESS
Definition: LDAPResult.h:47
DEBUG
#define DEBUG(level, arg)
Definition: debug.h:30
LDAPAsynConnection.h
LDAPMessage.h
LDAPResult::NOT_ALLOWED_ON_NONLEAF
static const int NOT_ALLOWED_ON_NONLEAF
Definition: LDAPResult.h:72
LDAPResult::INAPPROPRIATE_MATCHING
static const int INAPPROPRIATE_MATCHING
Definition: LDAPResult.h:51
LDAP_DEBUG_DESTROY
#define LDAP_DEBUG_DESTROY
Definition: debug.h:14
LDAPResult::PARAM_ERROR
static const int PARAM_ERROR
Definition: LDAPResult.h:89
LDAPAsynConnection::getSessionHandle
LDAP * getSessionHandle() const
Definition: LDAPAsynConnection.cpp:292
LDAPResult::UNAVAILABLE
static const int UNAVAILABLE
Definition: LDAPResult.h:66
LDAPResult::SERVER_DOWN
static const int SERVER_DOWN
Definition: LDAPResult.h:81
LDAPResult::UNAVAILABLE_CRITICAL_EXTENSION
static const int UNAVAILABLE_CRITICAL_EXTENSION
Definition: LDAPResult.h:45
LDAPResult::LOCAL_ERROR
static const int LOCAL_ERROR
Definition: LDAPResult.h:82
LDAPResult::CONFIDENTIALITY_REQUIRED
static const int CONFIDENTIALITY_REQUIRED
Definition: LDAPResult.h:46
LDAPResult::CONTROL_NOT_FOUND
static const int CONTROL_NOT_FOUND
Definition: LDAPResult.h:93
LDAPResult::PROTOCOL_ERROR
static const int PROTOCOL_ERROR
Definition: LDAPResult.h:35
LDAPResult::INAPPROPRIATE_AUTENTICATION
static const int INAPPROPRIATE_AUTENTICATION
Definition: LDAPResult.h:62
LDAPResult
This class is for representing LDAP-Result-Messages.
Definition: LDAPResult.h:30
LDAPResult::OBJECT_CLASS_VIOLATION
static const int OBJECT_CLASS_VIOLATION
Definition: LDAPResult.h:71
LDAPResult::ALIAS_PROBLEM
static const int ALIAS_PROBLEM
Definition: LDAPResult.h:57
LDAPResult::REFERRAL
static const int REFERRAL
Definition: LDAPResult.h:43
LDAPResult::CONNECT_ERROR
static const int CONNECT_ERROR
Definition: LDAPResult.h:91
LDAPControlSet
This container class is used to store multiple LDAPCtrl-objects.
Definition: LDAPControlSet.h:19
LDAPResult::SUCCESS
static const int SUCCESS
Definition: LDAPResult.h:33
LDAP_DEBUG_CONSTRUCT
#define LDAP_DEBUG_CONSTRUCT
Definition: debug.h:13
LDAPResult::~LDAPResult
virtual ~LDAPResult()
The destructor.
Definition: LDAPResult.cpp:62
LDAPUrlList
This container class is used to store multiple LDAPUrl-objects.
Definition: LDAPUrlList.h:16
LDAPMsg::m_hasControls
bool m_hasControls
Definition: LDAPMessage.h:121
LDAPResult::OBJECT_CLASS_MODS_PROHIBITED
static const int OBJECT_CLASS_MODS_PROHIBITED
Definition: LDAPResult.h:75
LDAPResult::BUSY
static const int BUSY
Definition: LDAPResult.h:65
LDAPResult::operator<<
friend std::ostream & operator<<(std::ostream &s, LDAPResult &l)
This method can be used to dump the data of a LDAPResult-Object.
LDAPResult::REFERRAL_LIMIT_EXCEEDED
static const int REFERRAL_LIMIT_EXCEEDED
Definition: LDAPResult.h:97
LDAPResult::NO_MEMORY
static const int NO_MEMORY
Definition: LDAPResult.h:90
LDAPException.h
LDAPResult::ATTRIBUTE_OR_VALUE_EXISTS
static const int ATTRIBUTE_OR_VALUE_EXISTS
Definition: LDAPResult.h:53
LDAPResult::getReferralUrls
const LDAPUrlList & getReferralUrls() const
Definition: LDAPResult.cpp:86
LDAPResult::TIMEOUT
static const int TIMEOUT
Definition: LDAPResult.h:85
LDAPResult::NAMING_VIOLATION
static const int NAMING_VIOLATION
Definition: LDAPResult.h:70
LDAPResult::COMPARE_TRUE
static const int COMPARE_TRUE
Definition: LDAPResult.h:39
LDAPUrlList.h
LDAPResult::FILTER_ERROR
static const int FILTER_ERROR
Definition: LDAPResult.h:87
LDAPResult::UNDEFINED_ATTRIBUTE_TYP
static const int UNDEFINED_ATTRIBUTE_TYP
Definition: LDAPResult.h:50
LDAPResult::INSUFFICIENT_ACCESS
static const int INSUFFICIENT_ACCESS
Definition: LDAPResult.h:64
operator<<
ostream & operator<<(ostream &s, LDAPResult &l)
Definition: LDAPResult.cpp:91
LDAPResult::getResultCode
int getResultCode() const
Definition: LDAPResult.cpp:66
LDAPRequest::getConnection
const LDAPAsynConnection * getConnection() const
Definition: LDAPRequest.cpp:86
LDAPResult::AUTH_METHOD_NOT_SUPPORTED
static const int AUTH_METHOD_NOT_SUPPORTED
Definition: LDAPResult.h:40
LDAPResult.h
LDAPRequest.h
LDAPResult::CONSTRAINT_VIOLATION
static const int CONSTRAINT_VIOLATION
Definition: LDAPResult.h:52
LDAPRequest
For internal use only.
Definition: LDAPRequest.h:25
LDAPResult::ENCODING_ERROR
static const int ENCODING_ERROR
Definition: LDAPResult.h:83
LDAPResult::SIZE_LIMIT_EXCEEDED
static const int SIZE_LIMIT_EXCEEDED
Definition: LDAPResult.h:37
LDAPResult::OPERATIONS_ERROR
static const int OPERATIONS_ERROR
Definition: LDAPResult.h:34
LDAPResult::USER_CANCELLED
static const int USER_CANCELLED
Definition: LDAPResult.h:88
debug.h
LDAPResult::NOT_SUPPORTED
static const int NOT_SUPPORTED
Definition: LDAPResult.h:92
LDAPResult::STRONG_AUTH_REQUIRED
static const int STRONG_AUTH_REQUIRED
Definition: LDAPResult.h:41