ngc 1.5.0
 
Loading...
Searching...
No Matches
ngcbTCP2DRV.hpp
Go to the documentation of this file.
1
8#ifndef ngcbTCP2DRV_H
9#define ngcbTCP2DRV_H
10
11
12#ifndef __cplusplus
13#error This is a C++ include file and cannot be used from plain C
14#endif
15
16#include <ngc/core/ngcb.h>
17#include <ngc/core/ngcbSIO.hpp>
18#include <ngc/core/ngcbIFC.hpp>
20
24#define ngcbTCP2DRV_PORT "NGC_REMOTE_PORT"
25
32
34 char setup[64];
35
37 char name[128];
38
40 char arg[256];
41
43 dev = NULL;
44 setup[0] = '\0'; name[0] = '\0'; arg[0] = '\0';
45 }
46};
47
48
52class ngcbTCP2DRV: public ngcbSIO, private ngcbSERVICE
53{
54public:
56 ngcbTCP2DRV();
57
59 virtual ~ngcbTCP2DRV();
60
63
65 int ParseArguments(int argc, char **argv);
66
68 void PrintUsage(const char *argv0);
69
71 char *ErrMsg();
72
74 void Logger(int flag, const char *msg);
75
77 void DeviceEvent(void *origin, void *event);
78
80 int Initialize();
81
83 int Abort();
84
86 int MainLoop();
87
89 void ExitSignal(int sig);
90
92 int TimerCB();
93
95 void Verbose(const char *format, ...)
96 __attribute__ ((format(printf, 2, 3)));
97
99 void Log(const char *format, ...)
100 __attribute__ ((format(printf, 2, 3)));
101
103 void Print(const char *format, ...)
104 __attribute__ ((format(printf, 2, 3)));
105
107 void AddLog(const char *format, ...)
108 __attribute__ ((format(printf, 2, 3)));
109
110protected:
112 int ProtocolBin(int fd);
113
114private:
116 char erms_[256];
117
119 int srvCmdPort_;
120
122 int srvEvtPort_;
123
125 int public_;
126
128 ngcbSHMDB *db_;
129
131 int endian_;
132
134 int aborted_;
135
137 int verboseLevel_;
138
140 int logLevel_;
141
143 int execHandle_;
144
146 int sim_;
147
149 int skip_;
150
152 int chain_;
153
155 int sideLink_;
156
158 int ProtocolDev_(int sock, ngcbIFC *dev);
159
161 void DeviceEvent_(ngcb_evt_st_t *event);
162
164 void Reset_();
165
166};
167
168#endif
Definition ngcbIFC.hpp:760
ngcbSERVICE()
Constructor.
Definition ngcbSERVICE.hpp:39
Definition ngcbSHMDB.hpp:55
ngcbSIO()
Constructor.
Definition ngcbSIO.cpp:31
int Initialize()
Initialize server.
Definition main.cpp:322
virtual ~ngcbTCP2DRV()
Destructor.
Definition main.cpp:158
void void void void AddLog(const char *format,...) __attribute__((format(printf
Add message to logging system.
Definition main.cpp:629
int ParseArguments(int argc, char **argv)
Parse arguments.
Definition main.cpp:207
void void void Print(const char *format,...) __attribute__((format(printf
Print verbose message.
Definition main.cpp:616
void Verbose(const char *format,...) __attribute__((format(printf
Verbose output.
Definition main.cpp:578
int Abort()
Abort server.
Definition main.cpp:426
int ProtocolBin(int fd)
Binary command protocol.
Definition main.cpp:641
void PrintUsage(const char *argv0)
Print usage.
Definition main.cpp:175
int MainLoop()
Enter server main-loop.
Definition main.cpp:483
char * ErrMsg()
Return error message.
Definition main.cpp:320
ngcbTCP2DRV()
Constructor.
Definition main.cpp:116
void void Log(const char *format,...) __attribute__((format(printf
Log message.
Definition main.cpp:601
void Logger(int flag, const char *msg)
Logger (from ngcbSERVICE)
Definition main.cpp:305
int TimerCB()
Timer call-back.
Definition main.cpp:550
void DeviceEvent(void *origin, void *event)
Device event handler (from ngcbSERVICE)
Definition main.cpp:294
ngcbTCP2DRV_IFC ifc
Controller device.
Definition ngcbTCP2DRV.hpp:62
void ExitSignal(int sig)
Exit-signal handler.
Definition main.cpp:525
Shared memory built-in database.
Definition ngcbTCP2DRV.hpp:29
ngcbIFC * dev
Interface device.
Definition ngcbTCP2DRV.hpp:31
char name[128]
Device name.
Definition ngcbTCP2DRV.hpp:37
char arg[256]
Device arguments.
Definition ngcbTCP2DRV.hpp:40
ngcbTCP2DRV_IFC()
Definition ngcbTCP2DRV.hpp:42
char setup[64]
Device setup.
Definition ngcbTCP2DRV.hpp:34
Definition ngcbIFC.hpp:581