xldaplite.h00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036 #ifndef _XLDAPLITE_H
00037 #define _XLDAPLITE_H
00038
00039
00040
00041 #include <ldap.h>
00042 #include <qstring.h>
00043 #include <qstringlist.h>
00044 #include <qptrlist.h>
00045
00046
00047
00048 class xLDAPquery;
00049 class xLDAPiterator;
00050 class xLDAPattribute;
00051
00052
00053
00054 class xLDAPconnection
00055 {
00056
00057
00058 friend class xLDAPquery;
00059 friend class xLDAPiterator;
00060 friend class xLDAPattribute;
00061
00062
00063 public:
00064
00065
00066
00067 xLDAPconnection();
00068
00069
00070
00071 ~xLDAPconnection();
00072
00073
00074
00075 bool connect();
00076
00077
00078
00079 void disconnect();
00080
00081
00082
00083 const LDAP* connection() { return m_Connection; }
00084 const QString& base() { return m_Base; }
00085 const QString& password() { return m_RootPassword; }
00086
00087
00088 protected:
00089
00090
00091 LDAP* m_Connection;
00092 QString m_RootPassword;
00093 ber_int_t m_Scope;
00094 QString m_Base;
00095
00096
00097 };
00098
00099
00100
00101 class xLDAPquery
00102 {
00103
00104
00105
00106 friend class xLDAPiterator;
00107 friend class xLDAPattribute;
00108
00109
00110 public:
00111
00112
00113
00114 xLDAPquery( xLDAPconnection&,
00115 const QString& filter,
00116 const QString& base = 0,
00117 char** attrs = 0 );
00118
00119
00120
00121 ~xLDAPquery();
00122
00123
00124 protected:
00125
00126
00127 xLDAPconnection* m_Connection;
00128 LDAPMessage* m_Query;
00129 int m_Result;
00130
00131
00132 };
00133
00134
00135
00136 class xLDAPiterator
00137 {
00138
00139
00140 friend class xLDAPattribute;
00141
00142
00143 public:
00144
00145
00146 xLDAPiterator(xLDAPquery&);
00147
00148
00149 ~xLDAPiterator();
00150
00151
00152 operator bool(void);
00153
00154
00155 void operator ++ (void);
00156
00157
00158 protected:
00159
00160
00161 void clearElement();
00162
00163
00164 xLDAPquery* m_Query;
00165 LDAPMessage* m_Entry;
00166 BerElement* m_Element;
00167
00168
00169 };
00170
00171
00172
00173 class xLDAPattribute
00174 {
00175
00176
00177 public:
00178
00179
00180 xLDAPattribute(xLDAPiterator&);
00181
00182
00183 ~xLDAPattribute();
00184
00185
00186 operator bool(void);
00187
00188
00189 void operator ++ (void);
00190
00191
00192 const char* attribute() { return m_Attribute; }
00193
00194
00195 const char* firstValue();
00196 const char* nextValue();
00197
00198
00199 protected:
00200
00201
00202 void clearAttribute();
00203 void clearValues();
00204
00205
00206 xLDAPiterator* m_Iterator;
00207 char* m_Attribute;
00208 char** m_Values;
00209 char** m_CurrentValue;
00210
00211
00212 };
00213
00214
00215
00216 #endif
00217
|