| Line | |
|---|
| 1 | #ifndef EVIDENCE_H_SEEN
|
|---|
| 2 | #define EVIDENCE_H_SEEN
|
|---|
| 3 |
|
|---|
| 4 | #include <stdio.h>
|
|---|
| 5 | #include <stdarg.h>
|
|---|
| 6 | #include <string>
|
|---|
| 7 | #include <errno.h>
|
|---|
| 8 | #include <exception>
|
|---|
| 9 | #include <vector>
|
|---|
| 10 |
|
|---|
| 11 | #include "dis.hxx"
|
|---|
| 12 | #include "dic.hxx"
|
|---|
| 13 |
|
|---|
| 14 | #define NO_LINK (char *) "__&DIM&NOLINK&__" // Data if no link available
|
|---|
| 15 | #define STATUS_SIZE 1000 // Bytes for status service string
|
|---|
| 16 |
|
|---|
| 17 | // Class declation of Evidence server
|
|---|
| 18 | class EvidenceServer: public DimServer {
|
|---|
| 19 |
|
|---|
| 20 | private:
|
|---|
| 21 | struct ConfigItem {
|
|---|
| 22 | char *Name;
|
|---|
| 23 | char *Value;
|
|---|
| 24 | int Time;
|
|---|
| 25 | };
|
|---|
| 26 | std::vector<struct ConfigItem> ConfigList;
|
|---|
| 27 |
|
|---|
| 28 | DimService *Status;
|
|---|
| 29 |
|
|---|
| 30 | static void SignalHandler(int); // static for signal()
|
|---|
| 31 | static void Terminate(); // static for set_terminate()
|
|---|
| 32 | void errorHandler(int, int, char *);
|
|---|
| 33 | void exitHandler(int);
|
|---|
| 34 |
|
|---|
| 35 | public:
|
|---|
| 36 | EvidenceServer(const char *);
|
|---|
| 37 | ~EvidenceServer();
|
|---|
| 38 |
|
|---|
| 39 | enum StateType {INFO=0, WARN=1, ERROR=2, FATAL=3};
|
|---|
| 40 |
|
|---|
| 41 | void State(StateType, const char *, ...);
|
|---|
| 42 | char* GetConfig(const char *, const char * = NULL);
|
|---|
| 43 | static char* ToString(DimInfo *);
|
|---|
| 44 | static bool ServiceOK(DimInfo *);
|
|---|
| 45 |
|
|---|
| 46 | bool ExitRequest;
|
|---|
| 47 | };
|
|---|
| 48 |
|
|---|
| 49 | class EvidenceHistory: public DimClient {
|
|---|
| 50 |
|
|---|
| 51 | static const int WrapMark[];
|
|---|
| 52 | static const int EndMark[];
|
|---|
| 53 |
|
|---|
| 54 | std::string HistoryName;
|
|---|
| 55 | char *Buffer;
|
|---|
| 56 | int BufferSize;
|
|---|
| 57 | int Offset;
|
|---|
| 58 |
|
|---|
| 59 | public:
|
|---|
| 60 | EvidenceHistory();
|
|---|
| 61 | ~EvidenceHistory();
|
|---|
| 62 |
|
|---|
| 63 | bool GetHistory(char *);
|
|---|
| 64 | bool Next(int &, int &, void *&);
|
|---|
| 65 | };
|
|---|
| 66 | #endif
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.