botsense
3.2.0
RoadNarrows Client-Server Proxied Services Framework
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
cModProtocol.doxy
Go to the documentation of this file.
1
////////////////////////////////////////////////////////////////////////////////
2
// Package: BotSense
3
//
4
// File: cModProtocol.doxy
5
//
6
// Description:
7
// This file contains the doxygen directives to generate the BotSense IP
8
// Proxy Client - Server messaging protocol.
9
//
10
//////////////////////////////////////////////////////////////////////////////
11
12
/*! \file */
13
14
/*!
15
\defgroup bsprotocol BotSense Protocol
16
17
\section bsprot_intro Intro
18
The transport mechanism of all messages flowing between the bsProxy server and
19
the server's registered clients is TCP/IP.
20
A client establishes communication with the server by making a connection
21
request to the listening TCP port of the server (default port: <b>9195</b>).
22
If the server has client space, the connection is accepted and the
23
communication is established.
24
25
Closing of the client's port automatically unregisters the client from the
26
server.
27
28
There are two classes of messages:
29
\li built-in server-terminated messages
30
\li proxied device-terminated specific messages
31
32
Two different Message Exhange Patterns are supported:
33
\li client request - server response
34
\li server to client device-specific out-flow streaming
35
36
\section bsprot_framework Message Structure
37
\htmlonly
38
<div style="float:left; border:0; padding:0px 10px 0px 5px;">
39
\endhtmlonly
40
\image html bsProxyMsg.png
41
\htmlonly
42
</div>
43
\endhtmlonly
44
All requests and response messages contain an 8-byte header plus an optional
45
message body. For server-terminated request/response messages, the RoadNarrows
46
NetMsgs 8-bit Identifier-Type-Value field encoding format is used for all
47
message bodies. All fields are big-endian.
48
See the <b>NetMsgs Package</b> for more details.
49
For device-terminated specific requests and responses, the message body is
50
transparent to the server and, so, can be of any format defined by the
51
application. However it is recommended that the application developer
52
use the NetMsgs package for ease
53
of building message code and for better run-time diagnostics
54
and message tracing that is built into bsProxy.
55
56
\subsection bsprot_fw_hdr Message Header
57
The 8-byte header (\ref BSPROXY_MSG_HDR_LEN) contains 5 fields read by the
58
server to determine how to dispatch and process the request.
59
The header is formatted using the NetMsgs
60
flat encoding with big-endian byte order of all values.
61
Table 1 summarizes the header fields.
62
63
<div style="margin-left:24px; margin-right:24px;">
64
<table style="border-width:1px; border-spacing:1px; border-style:solid; border-color:#990000;">
65
<tr>
66
<td><b>Field</b></td>
67
<td style="padding-right:10px;"><b>Size</b></td>
68
<td><b>Description</b></td>
69
</tr>
70
<tr>
71
<td>m_hdrMagic</td><td>2</td>
72
<td style="padding-bottom:5px;">
73
The start-of-message magic number \ref BSPROXY_MSG_MAGIC.
74
The magic number is required to start all messages. It may be used to
75
resynchornize a message stream, i.e. anti-aliasing.
76
</td>
77
</tr>
78
<tr>
79
<td>m_hdrTid</td><td>1</td>
80
<td style="padding-bottom:5px;">
81
The request/response transaction id (tid). The client generates the tid for a
82
request and the server copies the tid to the response header. The \h_botsense
83
library libbotsense will automatically generate and match Tid's in a
84
request-response sequence. See \ref bs_tid.
85
</td>
86
</tr>
87
<tr>
88
<td>m_hdrVConn</td><td>1</td>
89
<td style="padding-bottom:5px;">
90
The virtual connection handle. The value \ref BSPROXY_VCONN_SERVER is
91
reserved for server-terminated requests. All other values are for
92
device-terminated specific requests and responses. See \ref bs_vconn_handle.
93
</td>
94
</tr>
95
<tr>
96
<td>m_hdrMsgId</td><td>2</td>
97
<td style="padding-bottom:5px;">
98
The message identifier uniquely identifies the request and response messages
99
within a virtual connection context. See \ref bs_msgid.
100
For server-terminated message ids
101
see the \ref bsProxyMsgs.h <b>NetMsgs</b> generated file.
102
</td>
103
</tr>
104
<tr>
105
<td style="padding-right:8px;">m_hdrBodyLen</td><td>2</td>
106
<td style="padding-bottom:5px;">
107
The length of the message body in bytes immediately following the header
108
in the IP packet. If there is no message body, then this value should be set
109
to 0 (zero).
110
</td>
111
</tr>
112
<tr>
113
<td colspan="3" style="{text-align:center; font-weight:bold; border:none 1px}">
114
Table 1: \h_botsense Message Header Format
115
</td>
116
</tr>
117
</table>
118
</div>
119
120
\section bsprot_msg Server-Terminated Messages
121
The set of request and response server-terminated messages are described below.
122
Server-terminated messages provide the base set of services to manage
123
proxied devices. Per each request message, libbotsense provids a functional
124
interface. See the \ref man_libbotsense_svr "libotsense Man Pages" for the full
125
list of libbotsense functions.
126
See \ref bsprot_xml for the server-terminated message specification.
127
128
For any request that fails, the bsProxy server will send a generic error
129
response message (\ref bsprot_msg_err). The library libbotsense will
130
automatically interpret server error messages, logging the error, and
131
returning the appropriate error code to the calling client function.
132
133
\subsection bsprot_msg_ver Get Version Messages
134
Get the version string of the bsProxy server.
135
\termblock
136
\term Request MsgId: \termdata \ref BsProxyMsgIdReqGetVersion \endterm
137
\term Request Body: \termdata None \endterm
138
\term Response MsgId: \termdata \ref BsProxyMsgIdRspGetVersion \endterm
139
\term Response Body: \termdata \ref BsProxyRspGetVersion_T \endterm
140
\term libbotsense Call: \termdata \ref man_bsServerReqGetVersion () \endterm
141
\endtermblock
142
143
\subsection bsprot_msg_loop Loopback Messages
144
Loopback character data sent by the client and loopbacked by the servier.
145
\termblock
146
\term Request MsgId: \termdata \ref BsProxyMsgIdReqLoopback \endterm
147
\term Request Body: \termdata \ref BsProxyReqLoopback_T \endterm
148
\term Response MsgId: \termdata \ref BsProxyMsgIdRspLoopback \endterm
149
\term Response Body: \termdata \ref BsProxyRspLoopback_T \endterm
150
\term libbotsense Call: \termdata \ref man_bsServerReqLoopback () \endterm
151
\endtermblock
152
153
\subsection bsprot_msg_log Set Diagnostic Logging Messages
154
Set the level of diagnostic logging performed by the server. The new level
155
will override the current value set either during server startup or by servicing
156
a previous 'set logging' request message. The diagnostic logging level has
157
global server impact in that it effects the logging of the server and
158
all virtual connection.
159
\termblock
160
\term Request MsgId: \termdata \ref BsProxyMsgIdReqSetLogging \endterm
161
\term Request Body: \termdata \ref BsProxyReqSetLogging_T \endterm
162
\term Response MsgId: \termdata \ref BsProxyMsgIdRspOk \endterm
163
\term Response Body: \termdata None \endterm
164
\term libbotsense Call: \termdata \ref man_bsServerReqSetLogging () \endterm
165
\endtermblock
166
167
\subsection bsprot_msg_trace Message Tracing Enable/Disable Messages
168
Enable/disable tracing of message packing/unpacking. The tracing only effects
169
the specified virtual connection. Both the bsProxy server and the libbotsense
170
library will print the tracing to stderr.
171
\termblock
172
\term Request MsgId: \termdata \ref BsProxyMsgIdReqMsgTrace \endterm
173
\term Request Body: \termdata \ref BsProxyReqMsgTrace_T \endterm
174
\term Response MsgId: \termdata \ref BsProxyMsgIdRspOk \endterm
175
\term Response Body: \termdata None \endterm
176
\term libbotsense Call: \termdata \ref man_bsServerReqMsgTrace () \endterm
177
\endtermblock
178
179
\subsection bsprot_msg_open Open a Proxied Device Messages
180
Open a proxied device. The client specifies the proxied device, the interface
181
protocol module, and any optional device-specific open parameters in a
182
packed format. The server will return a new virtual connection handle.
183
\termblock
184
\term Request MsgId: \termdata \ref BsProxyMsgIdReqDevOpen \endterm
185
\term Request Body: \termdata \ref BsProxyReqDevOpen_T \endterm
186
\term Response MsgId: \termdata \ref BsProxyMsgIdRspOk \endterm
187
\term Request Body: \termdata \ref BsProxyRspDevOpen_T \endterm
188
\term libbotsense Call: \termdata \ref man_bsServerReqOpenDev () \endterm
189
\endtermblock
190
191
\subsection bsprot_msg_close Close a Proxied Device Messages
192
Close a proxied device. The virtual connection handle is no longer valid
193
after the request is serviced.
194
\termblock
195
\term Request MsgId: \termdata \ref BsProxyMsgIdReqDevClose \endterm
196
\term Request Body: \termdata \ref BsProxyReqDevClose_T \endterm
197
\term Response MsgId: \termdata \ref BsProxyMsgIdRspOk \endterm
198
\term Response Body: \termdata None \endterm
199
\term libbotsense Call: \termdata \ref man_bsServerReqCloseDev () \endterm
200
\endtermblock
201
202
\subsection bsprot_msg_vclist Get the List of Virtual Connections Messages
203
Get the server's list of virtual connection handles for this client.
204
\termblock
205
\term Request MsgId: \termdata \ref BsProxyMsgIdReqGetVConnList \endterm
206
\term Request Body: \termdata None \endterm
207
\term Response MsgId: \termdata \ref BsProxyMsgIdRspOk \endterm
208
\term Response Body: \termdata \ref BsProxyRspGetVConnList_T \endterm
209
\term libbotsense Call: \termdata \ref man_bsServerReqGetVConnList () \endterm
210
\endtermblock
211
212
\subsection bsprot_msg_log Get Virtual Connection Information Messages
213
Get the server's information on the given virtual connection.
214
The client specifies the virtual connection handle. The response message
215
contains the details.
216
\termblock
217
\term Request MsgId: \termdata \ref BsProxyMsgIdReqGetVConnInfo \endterm
218
\term Request Body: \termdata \ref BsProxyReqGetVConnInfo_T \endterm
219
\term Response MsgId: \termdata \ref BsProxyMsgIdRspOk \endterm
220
\term Response Body: \termdata \ref BsProxyRspGetVConnInfo_T \endterm
221
\term libbotsense Call: \termdata \ref man_bsServerReqGetVConnInfo () \endterm
222
\endtermblock
223
224
\subsection bsprot_msg_ok Standard Ok Response Message
225
The \h_botsense standard ok (success) response message. The message can be
226
sent in response to either a server-terminated or a device-terminated request.
227
The libotsense library will automatically intercept the ok message and
228
return \ref BS_OK to the calling client function.
229
\termblock
230
\term Response MsgId: \termdata \ref BsProxyMsgIdRspOk \endterm
231
\term Response Body: \termdata None \endterm
232
\endtermblock
233
234
\subsection bsprot_msg_err Standard Error Response Message
235
The \h_botsense standard error (failure) response message. The message can be
236
sent in response to either a server-terminated or a device-terminated request.
237
The response contains one of the \ref bs_ecodes, plus an error string.
238
The libotsense library will automatically intercept the error message,
239
print the appropriate diagnostic, and return
240
to the calling client function with the received error code.
241
\termblock
242
\term Response MsgId: \termdata \ref BsProxyMsgIdRspErr \endterm
243
\term Response Body: \termdata \ref BsProxyRspErr_T \endterm
244
\endtermblock
245
246
* \{
247
*/
248
249
/*! \} */
250
251
/*!
252
* \ingroup bsprotocol
253
* \defgroup bsprot_xml XML Message Set
254
255
\section bsprot_xml_intro Introduction
256
The RoadNarrows BotSense NetMsgs XML message specifications define the
257
set of client-server-terminated messages supported by bsProxy.
258
259
The RoadNarrows NetMsgs package defines the supported XML format and generates
260
the appropriate c and python code.
261
262
The message encoding is 8-bit Id-Type-Value (itv). All message fields are
263
packed in big-endian order.
264
265
\include libbotsense/bsProxyMsgs.xml
266
267
* \{
268
*/
269
270
/*! \} */
docs
doxy
cModProtocol.doxy
Generated on Fri Aug 10 2018 13:54:32 for botsense by
1.8.11
©2018 RoadNarrows LLC
www.roadnarrows.com