ngc 1.4.0
 
Loading...
Searching...
No Matches
ngcbIFC_TCP.hpp
Go to the documentation of this file.
1
7#ifndef ngcbIFC_TCP_H
8#define ngcbIFC_TCP_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 <sys/ipc.h>
16
17#ifdef SUN_COMP
18#include <sys/select.h>
19#endif
20
21#include <ngc/core/ngcb.h>
22#include <ngc/core/ngcbSocket.h>
23#include <ngc/core/ngcbIFC.hpp>
24#include <ngc/core/ngcbSIO.hpp>
25
29#define ngcbIFC_TCP_DEFAULT_SERVER "ngcbSock2Drv"
30
31
35class ngcbIFC_TCP: public ngcbIFC, private ngcbSIO
36{
37public:
39 ngcbIFC_TCP();
40
42 explicit ngcbIFC_TCP(const char *name);
43
45 virtual ~ngcbIFC_TCP();
46
47 /*
48 * Client interface
49 */
50
52 int Fd();
53
55 int Pid();
56
58 int Port();
59
61 const char *Host();
62
64 int Sim(int level);
65
67 int Open(const char *name);
68
70 int Close();
71
73 int HandleFdEvt();
74
76 int Reset();
77
79 int Timeout(int seconds);
80
82 int ReadAddr(ngcb_route_t route, int addr, int *buffer, int size,
83 int *result);
84
86 int WriteAddr(ngcb_route_t route, int addr, const int *buffer, int size,
87 int *result);
88
90 int Event(ngcbEVT *evt, int *result);
91
93 int Status(int *devStatus);
94
96 int ExecServer();
97
99 int KillServer();
100
102 int Running();
103
105 int Connect();
106
108 int Disconnect();
109
111 int Connected();
112
113protected:
114
115private:
117 void Init_();
118
119 /*
120 * Client interface
121 */
122
124 int SendToken_(int token);
125
127 int SendToken_(int token, const void *buffer, int size);
128
130 int fdCmd_;
131
133 int fdEvt_;
134
136 int stat_;
137
139 int remotePid_;
140
142 int remoteSrv_;
143
145 char remoteHost_[64];
146
148 int cmdPort_;
149
151 int evtPort_;
152
154 int connected_;
155
157 char nameOrig_[256];
158
160 void WdRemove_();
161};
162
163#endif
Definition ngcbIFC.hpp:595
int Sim(int level)
Set simulation level.
Definition ngcbIFC_TCP.cpp:349
const char * Host()
Driver interface process host.
Definition ngcbIFC_TCP.cpp:340
int Connect()
Connect through to device.
Definition ngcbIFC_TCP.cpp:451
int Fd()
Return device file descriptor.
Definition ngcbIFC_TCP.cpp:307
ngcbIFC_TCP()
Constructor without name.
Definition ngcbIFC_TCP.cpp:25
int Status(int *devStatus)
Get last communication status.
Definition ngcbIFC_TCP.cpp:923
int Port()
Driver interface process command port.
Definition ngcbIFC_TCP.cpp:332
int WriteAddr(ngcb_route_t route, int addr, const int *buffer, int size, int *result)
Write to address.
Definition ngcbIFC_TCP.cpp:680
int Connected()
Connected to device.
Definition ngcbIFC_TCP.cpp:1269
int ReadAddr(ngcb_route_t route, int addr, int *buffer, int size, int *result)
Read from address.
Definition ngcbIFC_TCP.cpp:568
int Disconnect()
Disconnect from device.
Definition ngcbIFC_TCP.cpp:482
int Reset()
Reset device.
Definition ngcbIFC_TCP.cpp:505
int Running()
Driver interface process is running.
Definition ngcbIFC_TCP.cpp:1245
int KillServer()
Terminate driver interface process.
Definition ngcbIFC_TCP.cpp:1179
int ExecServer()
Launch driver interface process.
Definition ngcbIFC_TCP.cpp:984
int Event(ngcbEVT *evt, int *result)
Activate event.
Definition ngcbIFC_TCP.cpp:801
int HandleFdEvt()
Handle event on file descriptor.
Definition ngcbIFC_TCP.cpp:1277
virtual ~ngcbIFC_TCP()
Destructor.
Definition ngcbIFC_TCP.cpp:77
int Close()
Close interface.
Definition ngcbIFC_TCP.cpp:429
int Pid()
Driver interface process id.
Definition ngcbIFC_TCP.cpp:324
virtual int Timeout()
Get timeout.
Definition ngcbIFC.cpp:585
int Open()
Open interface with current name.
Definition ngcbIFC.cpp:316
ngcbIFC()
Constructor without device name.
Definition ngcbIFC.cpp:33
ngcbSIO()
Constructor.
Definition ngcbSIO.cpp:30
Definition ngcbIFC.hpp:72