00001
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
00037
00038
00039
00040
00041
00042
00043
00044
00045 #pragma once
00046
00047 #if !P_LDAP
00048 #undef H323_H350
00049 #pragma message("H350 disabled due to missing OpenLDAP Support")
00050 #else
00051 #define H323_H350 1
00052 #endif
00053
00054 #ifdef H323_H350
00055
00056 #include <ptlib/pluginmgr.h>
00057 #include <ptclib/pldap.h>
00058 #include <map>
00059 #include <list>
00060
00061 #define P_FORCE_STATIC_PLUGIN
00062
00063 class H350_Session : public PLDAPSession
00064 {
00065 public:
00066 typedef std::list<PLDAPSchema> LDAP_Record;
00067 typedef std::map<PString,LDAP_Record> LDAP_RecordList;
00068
00069 BOOL Open(const PString & hostname, WORD port = 389);
00070
00071 BOOL Login(const PString & who, const PString & passwd, AuthenticationMethod authMethod=AuthSimple);
00072
00073 void NewRecord(LDAP_Record & rec);
00074
00075 BOOL SetAttribute(LDAP_Record & record,const PString & attrib, const PString & value);
00076 BOOL SetAttribute(LDAP_Record & record,const PString & attrib, const PBYTEArray & value);
00077
00078 BOOL GetAttribute(LDAP_Record & record,const PString & attrib, PString & value);
00079 BOOL GetAttribute(LDAP_Record & record,const PString & attrib, PBYTEArray & value);
00080
00081 BOOL PostNew(const PString & dn, const LDAP_Record & record);
00082 BOOL PostUpdate(const PString & dn, const LDAP_Record & record);
00083
00084 BOOL Delete() { return FALSE; }
00085
00086 int Search(const PString & base,
00087 const PString & filter,
00088 LDAP_RecordList & results,
00089 const PStringArray & attributes = PStringList()
00090 );
00091 };
00092
00093 #define H350_Schema(cname) \
00094 class cname##_schema : public PLDAPSchema \
00095 { \
00096 public: static PStringList SchemaName() { return PStringList(cname##_SchemaName); } \
00097 void AttributeList(attributeList & attrib) { \
00098 for (PINDEX i = 0; i< PARRAYSIZE(##cname##_attributes); i++) \
00099 attrib.push_back(Attribute(##cname##_attributes[i].name,(AttributeType)##cname##_attributes[i].type)); }; \
00100 }; \
00101 LDAP_Schema(##cname##);
00102
00103
00104 #endif
00105