00001 #ifndef __ILDAP_SERVER_H
00002 #define __ILDAP_SERVER_H
00003
00004 #include "../../src/common/INet/Ber/Ber.h"
00005 #include "GVariant.h"
00006 #include "INet.h"
00007
00008 #define LDAP_PORT 389
00009
00010 #define WM_ILDAP_SERVER_DONE (M_USER+0x240)
00011 #define WM_ILDAP_ERROR_MSG (M_USER+0x241)
00012
00013 enum ILdapField
00014 {
00015 LdapFirstName = 1,
00016 LdapLastName,
00017 LdapEmail
00018 };
00019
00020 class ILdapServerDb
00021 {
00022 public:
00023 virtual char *MapField(ILdapField Id) = 0;
00024 virtual int GetData(List<GDom> &Lst) = 0;
00025 };
00026
00027 class ILdapServer : public GThread
00028 {
00029 GView *Parent;
00030 ILdapServerDb *Db;
00031 GFile Log;
00032 GSocket Socket;
00033 GSocket Listen;
00034 List<GDom> Contacts;
00035
00036
00037 char *GetContactUid(GDom *c);
00038 void WriteField(EncBer *Parent, char *Name, char *Value, List<char> &Return);
00039 void ProcessFilter(DecBer *Filter, int FilterType, List<GDom> *Input, List<GDom> &Results);
00040
00041
00042 int TokenDump(uchar *Data, int Len, int Indent);
00043 void BerDump(char *Title, GBytePipe &Data);
00044 void HexDump(char *Title, GBytePipe &Data);
00045
00046 public:
00047 ILdapServer(GView *p, ILdapServerDb *db);
00048 ~ILdapServer();
00049
00050 int Main();
00051 void Send(EncBer &b);
00052 void OnMessage(DecBer &Msg);
00053
00054 void Server();
00055 };
00056
00057 #endif