LDAPControl.h revision 1.1.1.1
1// $OpenLDAP: pkg/ldap/contrib/ldapc++/src/LDAPControl.h,v 1.5.10.1 2008/04/14 23:09:26 quanah Exp $ 2/* 3 * Copyright 2000, OpenLDAP Foundation, All Rights Reserved. 4 * COPYING RESTRICTIONS APPLY, see COPYRIGHT file 5 */ 6 7 8#ifndef LDAP_CONTROL_H 9#define LDAP_CONTROL_H 10#include <string> 11#include <ldap.h> 12 13/** 14 * This class is used to store Controls. Controls are a mechanism to extend 15 * and modify LDAP-Operations. 16 */ 17class LDAPCtrl{ 18 public : 19 /** 20 * Copy-constructor 21 */ 22 LDAPCtrl(const LDAPCtrl& c); 23 24 /** 25 * Constructor. 26 * @param oid: The Object Identifier of the Control 27 * @param critical: "true" if the Control should be handled 28 * critical by the server. 29 * @param data: If there is data for the control, put it here. 30 * @param length: The length of the data field 31 */ 32 LDAPCtrl(const char *oid, bool critical, const char *data=0, 33 int length=0); 34 35 /** 36 * Constructor. 37 * @param oid: The Object Identifier of the Control 38 * @param critical: "true" if the Control should be handled 39 * critical by the server. 40 * @param data: If there is data for the control, put it here. 41 */ 42 LDAPCtrl(const std::string& oid, bool critical=false, 43 const std::string& data=std::string()); 44 45 /** 46 * Creates a copy of the Control that "ctrl is pointing to 47 */ 48 LDAPCtrl(const LDAPControl* ctrl); 49 50 /** 51 * Destructor 52 */ 53 ~LDAPCtrl(); 54 55 /** 56 * @return The OID of the control 57 */ 58 std::string getOID() const; 59 60 /** 61 * @return The Data of the control as a std::string-Objekt 62 */ 63 std::string getData() const; 64 65 /** 66 * @return "true" if the control is critical 67 */ 68 bool isCritical() const; 69 70 /** 71 * For internal use only. 72 * 73 * Translates the control to a LDAPControl-structure as needed by 74 * the C-API 75 */ 76 LDAPControl* getControlStruct() const; 77 static void freeLDAPControlStruct(LDAPControl *ctrl); 78 79 private : 80 std::string m_oid; 81 std::string m_data; 82 bool m_isCritical; 83}; 84 85#endif //LDAP_CONTROL_H 86