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 #ifndef _eyedb_sesslog_
00026 #define _eyedb_sesslog_
00027
00028 #include <eyedbconfig.h>
00029
00030 #include <eyedb/eyedb.h>
00031 #include <eyedbsm/eyedbsm.h>
00032 #include "eyedbsm/transaction.h"
00033 #include "eyedbsm/mutex.h"
00034 #include <eyedblib/m_mem.h>
00035
00036 namespace eyedb {
00037
00038 class SessionHead;
00039 class ClientInfo;
00040
00041 class ClientSessionLog {
00042
00043 public:
00044 ClientSessionLog(ClientInfo *);
00045
00046 ClientInfo *getClientInfo() {return clinfo;}
00047
00048 void addDatabase(const char *name, const char *userauth, int flags);
00049 void suppressDatabase(const char *name, const char *userauth, int flags);
00050
00051 ~ClientSessionLog();
00052
00053 private:
00054 ClientInfo *clinfo;
00055 };
00056
00057 class SessionLog {
00058
00059 public:
00060
00061 SessionLog(const char *host, const char *port, const char *logdir,
00062 Bool writing);
00063
00064
00065 SessionLog(const char *logdir, const char *version,
00066 int nports, const char *hosts[], const char *ports[],
00067 const char *voldir,
00068 const char *logdev, int loglevel);
00069
00070 SessionLog(const SessionLog &);
00071
00072 Status add(const char *hostname, const char *portname,
00073 const char *username, const char *progname, int pid,
00074 ClientSessionLog *&);
00075
00076 Bool isUp() const;
00077
00078 void suppress(ClientSessionLog *);
00079
00080 Status stopServers(Bool force);
00081
00082 void display(FILE *fd, Bool nolock = False);
00083
00084 void remove();
00085
00086 Status getStatus() const {return status;}
00087
00088 static void release();
00089
00090 ~SessionLog();
00091
00092 private:
00093 void init(const char *host, const char *port, const char *logdir,
00094 Bool writing);
00095 char *host;
00096 char *port;
00097 char *logdir;
00098 eyedbsm::XMHandle *xm_connlog;
00099 m_Map *m_connlog;
00100 char *addr_connlog;
00101 SessionHead *connhead;
00102 Status status;
00103 Bool islocked;
00104 static SessionLog *sesslog;
00105 int file_cnt;
00106 char **files;
00107 void *vd;
00108 #ifdef HAVE_SEMAPHORE_POLICY_SYSV_IPC
00109 Status init_sems();
00110 #endif
00111
00112 Status openRealize(const char *host, const char *port, const char *logdir,
00113 Bool create, Bool writing);
00114 char *makeFile(const char *host, const char *port, const char *_logdir);
00115 int get_nb_clients();
00116 };
00117
00118 }
00119
00120 #endif