D:/Storage/CVS_Head/h323plus/include/h350/h350.h

00001 
00002 /*
00003  * h350.h
00004  *
00005  * H.350 LDAP interface class.
00006  *
00007  * h323plus library
00008  *
00009  * Copyright (c) 2007 ISVO (Asia) Pte. Ltd.
00010  *
00011  * The contents of this file are subject to the Mozilla Public License
00012  * Version 1.1 (the "License"); you may not use this file except in
00013  * compliance with the License. You may obtain a copy of the License at
00014  * http://www.mozilla.org/MPL/
00015  *
00016  * Alternatively, the contents of this file may be used under the terms
00017  * of the General Public License (the  "GNU License"), in which case the
00018  * provisions of GNU License are applicable instead of those
00019  * above. If you wish to allow use of your version of this file only
00020  * under the terms of the GNU License and not to allow others to use
00021  * your version of this file under the MPL, indicate your decision by
00022  * deleting the provisions above and replace them with the notice and
00023  * other provisions required by the GNU License. If you do not delete
00024  * the provisions above, a recipient may use your version of this file
00025  * under either the MPL or the GNU License."
00026  *
00027  * Software distributed under the License is distributed on an "AS IS"
00028  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
00029  * the License for the specific language governing rights and limitations
00030  * under the License.
00031  *
00032  *
00033  * The Initial Developer of the Original Code is ISVO (Asia) Pte. Ltd.
00034  *
00035  * Contributor(s): ______________________________________.
00036  *
00037  * $Log: h350.h,v $
00038  * Revision 1.1  2007/08/06 20:50:50  shorne
00039  * First commit of h323plus
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 

Generated on Thu Oct 25 13:42:28 2007 for h323plus by  doxygen 1.5.2