ngc 1.5.0
 
Loading...
Searching...
No Matches
ngcbIFC_TCP.hpp
Go to the documentation of this file.
1
8#ifndef ngcbIFC_TCP_H
9#define ngcbIFC_TCP_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 <sys/ipc.h>
17
18#ifdef SUN_COMP
19#include <sys/select.h>
20#endif
21
22#include <ngc/core/ngcb.h>
23#include <ngc/core/ngcbSocket.h>
24#include <ngc/core/ngcbIFC.hpp>
25#include <ngc/core/ngcbSIO.hpp>
26
30#define ngcbIFC_TCP_DEFAULT_SERVER "ngcbSock2Drv"
31
32
36class ngcbIFC_TCP: public ngcbIFC, private ngcbSIO
37{
38public:
40 ngcbIFC_TCP();
41
43 explicit ngcbIFC_TCP(const char *name);
44
46 virtual ~ngcbIFC_TCP();
47
48 /*
49 * Client interface
50 */
51
53 int Fd();
54
56 int Pid();
57
59 int Port();
60
62 const char *Host();
63
65 int Sim(int level);
66
68 int Open(const char *name);
69
71 int Close();
72
74 int HandleFdEvt();
75
77 int Reset();
78
80 int Timeout(int seconds);
81
83 int ReadAddr(ngcb_route_t route, int addr, int *buffer, int size,
84 int *result);
85
87 int WriteAddr(ngcb_route_t route, int addr, const int *buffer, int size,
88 int *result);
89
91 int Event(ngcbEVT *evt, int *result);
92
94 int Status(int *devStatus);
95
97 int ExecServer();
98
100 int KillServer();
101
103 int Running();
104
106 int Connect();
107
109 int Disconnect();
110
112 int Connected();
113
114protected:
115
116private:
118 void Init_();
119
120 /*
121 * Client interface
122 */
123
125 int SendToken_(int token);
126
128 int SendToken_(int token, const void *buffer, int size);
129
131 int fdCmd_;
132
134 int fdEvt_;
135
137 int stat_;
138
140 int remotePid_;
141
143 int remoteSrv_;
144
146 char remoteHost_[64];
147
149 int cmdPort_;
150
152 int evtPort_;
153
155 int connected_;
156
158 char nameOrig_[256];
159
161 void WdRemove_();
162};
163
164#endif
Definition ngcbIFC.hpp:601
int Sim(int level)
Set simulation level.
Definition ngcbIFC_TCP.cpp:350
const char * Host()
Driver interface process host.
Definition ngcbIFC_TCP.cpp:341
int Connect()
Connect through to device.
Definition ngcbIFC_TCP.cpp:452
int Fd()
Return device file descriptor.
Definition ngcbIFC_TCP.cpp:308
ngcbIFC_TCP()
Constructor without name.
Definition ngcbIFC_TCP.cpp:26
int Status(int *devStatus)
Get last communication status.
Definition ngcbIFC_TCP.cpp:924
int Port()
Driver interface process command port.
Definition ngcbIFC_TCP.cpp:333
int WriteAddr(ngcb_route_t route, int addr, const int *buffer, int size, int *result)
Write to address.
Definition ngcbIFC_TCP.cpp:681
int Connected()
Connected to device.
Definition ngcbIFC_TCP.cpp:1270
int ReadAddr(ngcb_route_t route, int addr, int *buffer, int size, int *result)
Read from address.
Definition ngcbIFC_TCP.cpp:569
int Disconnect()
Disconnect from device.
Definition ngcbIFC_TCP.cpp:483
int Reset()
Reset device.
Definition ngcbIFC_TCP.cpp:506
int Running()
Driver interface process is running.
Definition ngcbIFC_TCP.cpp:1246
int KillServer()
Terminate driver interface process.
Definition ngcbIFC_TCP.cpp:1180
int ExecServer()
Launch driver interface process.
Definition ngcbIFC_TCP.cpp:985
int Event(ngcbEVT *evt, int *result)
Activate event.
Definition ngcbIFC_TCP.cpp:802
int HandleFdEvt()
Handle event on file descriptor.
Definition ngcbIFC_TCP.cpp:1278
virtual ~ngcbIFC_TCP()
Destructor.
Definition ngcbIFC_TCP.cpp:78
int Close()
Close interface.
Definition ngcbIFC_TCP.cpp:430
int Pid()
Driver interface process id.
Definition ngcbIFC_TCP.cpp:325
virtual int Timeout()
Get timeout.
Definition ngcbIFC.cpp:588
int Open()
Open interface with current name.
Definition ngcbIFC.cpp:319
ngcbIFC()
Constructor without device name.
Definition ngcbIFC.cpp:36
ngcbSIO()
Constructor.
Definition ngcbSIO.cpp:31
Definition ngcbIFC.hpp:78