diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 11:11:40 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 11:11:40 +0000 |
commit | 7731832751ab9f3c6ddeb66f186d3d7fa1934a6d (patch) | |
tree | e91015872543a59be2aad26c2fea02e41b57005d /contrib/ldapc++/src/LDAPControl.h | |
parent | Initial commit. (diff) | |
download | openldap-7731832751ab9f3c6ddeb66f186d3d7fa1934a6d.tar.xz openldap-7731832751ab9f3c6ddeb66f186d3d7fa1934a6d.zip |
Adding upstream version 2.4.57+dfsg.upstream/2.4.57+dfsgupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'contrib/ldapc++/src/LDAPControl.h')
-rw-r--r-- | contrib/ldapc++/src/LDAPControl.h | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/contrib/ldapc++/src/LDAPControl.h b/contrib/ldapc++/src/LDAPControl.h new file mode 100644 index 0000000..9086685 --- /dev/null +++ b/contrib/ldapc++/src/LDAPControl.h @@ -0,0 +1,87 @@ +// $OpenLDAP$ +/* + * Copyright 2000-2021 The OpenLDAP Foundation, All Rights Reserved. + * COPYING RESTRICTIONS APPLY, see COPYRIGHT file + */ + + +#ifndef LDAP_CONTROL_H +#define LDAP_CONTROL_H +#include <string> +#include <ldap.h> + +/** + * This class is used to store Controls. Controls are a mechanism to extend + * and modify LDAP-Operations. + */ +class LDAPCtrl{ + public : + /** + * Constructor. + * @param oid: The Object Identifier of the Control + * @param critical: "true" if the Control should be handled + * critical by the server. + * @param data: If there is data for the control, put it here. + * @param length: The length of the data field + */ + LDAPCtrl(const char *oid, bool critical=false, const char *data=0, + int length=0); + + /** + * Constructor. + * @param oid: The Object Identifier of the Control + * @param critical: "true" if the Control should be handled + * critical by the server. + * @param data: If there is data for the control, put it here. + */ + LDAPCtrl(const std::string& oid, bool critical, + const std::string& data); + + /** + * Creates a copy of the Control that "ctrl is pointing to + */ + LDAPCtrl(const LDAPControl* ctrl); + + /** + * Destructor + */ + ~LDAPCtrl(); + + /** + * @return The OID of the control + */ + std::string getOID() const; + + /** + * @return true if there is no "Control Value" (there is a + * difference between no and an empty control value) + */ + bool hasData() const; + + /** + * @return The Data of the control as a std::string-Object + */ + std::string getData() const; + + /** + * @return "true" if the control is critical + */ + bool isCritical() const; + + /** + * For internal use only. + * + * Translates the control to a LDAPControl-structure as needed by + * the C-API + */ + LDAPControl* getControlStruct() const; + static void freeLDAPControlStruct(LDAPControl *ctrl); + + private : + std::string m_oid; + std::string m_data; + bool m_isCritical; + bool m_noData; +}; + +#endif //LDAP_CONTROL_H |