ngc 1.4.0
 
Loading...
Searching...
No Matches
ngcbTCP2DRV.hpp
Go to the documentation of this file.
1
7#ifndef ngcbTCP2DRV_H
8#define ngcbTCP2DRV_H
9
10
11#ifndef __cplusplus
12#error This is a C++ include file and cannot be used from plain C
13#endif
14
15#include <ngc/core/ngcb.h>
16#include <ngc/core/ngcbSIO.hpp>
17#include <ngc/core/ngcbIFC.hpp>
19
23#define ngcbTCP2DRV_PORT "NGC_REMOTE_PORT"
24
31
33 char setup[64];
34
36 char name[128];
37
39 char arg[256];
40
42 dev = NULL;
43 setup[0] = '\0'; name[0] = '\0'; arg[0] = '\0';
44 }
45};
46
47
51class ngcbTCP2DRV: public ngcbSIO, private ngcbSERVICE
52{
53public:
55 ngcbTCP2DRV();
56
58 virtual ~ngcbTCP2DRV();
59
62
64 int ParseArguments(int argc, char **argv);
65
67 void PrintUsage(const char *argv0);
68
70 char *ErrMsg();
71
73 void Logger(int flag, const char *msg);
74
76 void DeviceEvent(void *origin, void *event);
77
79 int Initialize();
80
82 int Abort();
83
85 int MainLoop();
86
88 void ExitSignal(int sig);
89
91 int TimerCB();
92
94 void Verbose(const char *format, ...)
95 __attribute__ ((format(printf, 2, 3)));
96
98 void Log(const char *format, ...)
99 __attribute__ ((format(printf, 2, 3)));
100
102 void Print(const char *format, ...)
103 __attribute__ ((format(printf, 2, 3)));
104
106 void AddLog(const char *format, ...)
107 __attribute__ ((format(printf, 2, 3)));
108
109protected:
111 int ProtocolBin(int fd);
112
113private:
115 char erms_[256];
116
118 int srvCmdPort_;
119
121 int srvEvtPort_;
122
124 int public_;
125
127 ngcbSHMDB *db_;
128
130 int endian_;
131
133 int aborted_;
134
136 int verboseLevel_;
137
139 int logLevel_;
140
142 int execHandle_;
143
145 int sim_;
146
148 int skip_;
149
151 int chain_;
152
154 int sideLink_;
155
157 int ProtocolDev_(int sock, ngcbIFC *dev);
158
160 void DeviceEvent_(ngcb_evt_st_t *event);
161
163 void Reset_();
164
165};
166
167#endif
Definition ngcbIFC.hpp:754
ngcbSERVICE()
Constructor.
Definition ngcbSERVICE.hpp:38
Definition ngcbSHMDB.hpp:54
ngcbSIO()
Constructor.
Definition ngcbSIO.cpp:30
int Initialize()
Initialize server.
Definition main.cpp:321
virtual ~ngcbTCP2DRV()
Destructor.
Definition main.cpp:157
void void void void AddLog(const char *format,...) __attribute__((format(printf
Add message to logging system.
Definition main.cpp:628
int ParseArguments(int argc, char **argv)
Parse arguments.
Definition main.cpp:206
void void void Print(const char *format,...) __attribute__((format(printf
Print verbose message.
Definition main.cpp:615
void Verbose(const char *format,...) __attribute__((format(printf
Verbose output.
Definition main.cpp:577
int Abort()
Abort server.
Definition main.cpp:425
int ProtocolBin(int fd)
Binary command protocol.
Definition main.cpp:640
void PrintUsage(const char *argv0)
Print usage.
Definition main.cpp:174
int MainLoop()
Enter server main-loop.
Definition main.cpp:482
char * ErrMsg()
Return error message.
Definition main.cpp:319
ngcbTCP2DRV()
Constructor.
Definition main.cpp:115
void void Log(const char *format,...) __attribute__((format(printf
Log message.
Definition main.cpp:600
void Logger(int flag, const char *msg)
Logger (from ngcbSERVICE)
Definition main.cpp:304
int TimerCB()
Timer call-back.
Definition main.cpp:549
void DeviceEvent(void *origin, void *event)
Device event handler (from ngcbSERVICE)
Definition main.cpp:293
ngcbTCP2DRV_IFC ifc
Controller device.
Definition ngcbTCP2DRV.hpp:61
void ExitSignal(int sig)
Exit-signal handler.
Definition main.cpp:524
Shared memory built-in database.
Definition ngcbTCP2DRV.hpp:28
ngcbIFC * dev
Interface device.
Definition ngcbTCP2DRV.hpp:30
char name[128]
Device name.
Definition ngcbTCP2DRV.hpp:36
char arg[256]
Device arguments.
Definition ngcbTCP2DRV.hpp:39
ngcbTCP2DRV_IFC()
Definition ngcbTCP2DRV.hpp:41
char setup[64]
Device setup.
Definition ngcbTCP2DRV.hpp:33
Definition ngcbIFC.hpp:575