botsense
3.2.0
RoadNarrows Client-Server Proxied Services Framework
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
dModServer.doxy
Go to the documentation of this file.
1
////////////////////////////////////////////////////////////////////////////////
2
// Package: BotSense
3
//
4
// File: dModServer.doxy
5
//
6
// Description:
7
// This file contains the doxygen directives to generate the bsProxy server
8
// documentation.
9
//
10
////////////////////////////////////////////////////////////////////////////////
11
12
/*! \file */
13
14
/*!
15
* \defgroup bsserver BotSense Server
16
*
17
\section bssvr_intro Intro
18
19
The \h_botsense bsProxy IP Proxy Server provides the server-side services
20
for \h_botsense clients. The bsProxy is an IP base proxy server for proxied
21
(pseudo) devices on the target system, such as a robot's
22
sensors and effectors. By providing an IP interface, the proxied hardware
23
and software resources can be read and controlled remotely, anywhere.
24
25
The bsProxy can support multiple simultaneous clients, with each client having
26
access to multiple proxied devices. Different clients can have access to the
27
same proxied device. The bsProxy provides mutual exclusion mechanisms to ensure
28
device and message correctness.
29
30
A proxied device is a target system resource, typcially a device driver
31
controlling a specific hardware device.
32
For example, a target system's
33
I<sup>2</sup>C Bus and an RS-232 serial port are proxied devices.
34
35
A proxied device may be a pseudo device in that it may proxy a software resource
36
rather than a specific piece of hardware. Shared memory is an example
37
of a proxied pseudo device.
38
39
Paired with each proxied device is a bsProxy associated Dynamic Link Library
40
plug-in interface module. The interface module provides the device-specific
41
request-response protocol termination for client requests.
42
43
When a client opens a virtual connection to a proxied device,
44
the client specifies the proxied device's (partial) URI and the protocol to
45
apply to that device. The protocol is instantiated by specifying the
46
interface module's (partial) URI.
47
For example, a valid device/module URI pair could be:\n
48
\htmlonly
49
<div style="padding-left: 30px;">/dev/ttyUSB0 , robot/libbsserver_brain</div>
50
\endhtmlonly
51
52
The opened proxied device connection is referred to as a virtual connection
53
since it is a logical connection multiplexed over the actual client/server IP
54
connection. Each virtual connection is identified by a server-wide unique
55
handle.
56
57
\section bssvr_flow Flow Control Charts
58
\subsection bssvr_flow_conn BotSense bsProxy Client Connect Flow Control
59
\htmlonly
60
<div style="float:right; border:0; text-align:center;">
61
\endhtmlonly
62
\image html bsProxyConn.png "Figure 3: bsProxy Connection Flow Chart"
63
\htmlonly
64
</div>
65
\endhtmlonly
66
67
The flow control chart in Figure 3 provides a high-level view of the
68
control and data flow within the \h_botsense bsProxy server when a new
69
client attempts to connect to the server.
70
71
When a new client connects to the bsProxy server (connect(2)), the server
72
checks if the new client will be within the server's configurable limits and
73
restrictions. If the new client is accepted, the server calls accept(2) to
74
create a new, client-specific socket, configures the socket, as inserts the
75
client data into the server's table of registered clients.
76
77
On the client side, the \h_botsense library libbotsense will automatically
78
keep track of the client's connection.
79
80
If bsProxy denies the client connection, it closes the connection. The
81
\h_botsense library libbotsense will dectect the failure and return the
82
appropiate error code back to the client.
83
\htmlonly
84
<div style="clear:both;"></div>
85
\endhtmlonly
86
87
\subsection bssvr_flow_open BotSense bsProxy Client Open Device Request Flow Control
88
\htmlonly
89
<div style="border:0; text-align:center;">
90
\endhtmlonly
91
\image html bsProxyOpenDev.png "Figure 4: bsProxy Open Device Flow Chart"
92
\htmlonly
93
</div>
94
\endhtmlonly
95
The flow control chart in Figure 4 provides a high-level view of the
96
control and data flow executed by bsProxy to open a proxied device.
97
98
When a client requests a proxied device to be opened, and a virtual connection
99
to be established, the bsProxy server receives the request over the client's
100
IP connection. The dispatcher queues the request in the server-termainated
101
request thread (not shown).
102
103
In the server request thread context,
104
a virtual connection entry is first created in the internal virtual connection
105
table and a virtual connection handle assigned.
106
Both the proxied device and interface modules Uniform Resource Identifiers
107
(file path names) are canonicalized and validated. If a URI is invalid or
108
violates security settings (future), the request is rejected.
109
110
The interface module and proxied device resources are attached to the
111
virtual connection data.
112
113
When the virtual connection has been successfully set up,
114
the server sends a response message back to the client containing the parameter
115
of the newly assigned virtual connection handle. The \h_botsense library
116
libbotsense processes the response message and returns the handle back to the
117
client's calling context.
118
119
\htmlonly
120
<span style="font-weight:bold; font-size:larger; color:#003399;">α </span>
121
\endhtmlonly
122
All client requests require a response from the server. At any time when
123
an error occurs and the bsProxy server cannot service the request successfully,
124
the flow logic delineated by the
125
\htmlonly
126
<b>α</b>
127
\endhtmlonly
128
connector is executed and the request is terminated.
129
The \h_botsense library libbotsense processes the error response message and
130
returns the appropriate error code back to the client's calling context.
131
The error branches are not shown for clarity.
132
133
\htmlonly
134
<span style="font-weight:bold; font-size:larger; color:#003399;">β </span>
135
\endhtmlonly
136
The module processing sub-flow control logic is executed starting at the
137
\htmlonly
138
<b>β</b>
139
\endhtmlonly
140
connector. If the interace module uniquely identified by its URI has already
141
been dynamically loaded into bsProxy's application execution space then
142
its reference count is incremented. Otherwise the module is dynamically loaded.
143
The command-line library search paths are first searched, followed by any
144
\h_botsense configuration file paths, and finally the default paths are
145
searched. Once the file has been loaded and dynamically linked, the required
146
module initialization function is called. The module data are inserted into
147
the internal module hash table. Finally, regardless of the conditional logic
148
above, the required module open
149
function is called with specific parameters provided by the client's request
150
message.
151
152
\htmlonly
153
<span style="font-weight:bold; font-size:larger; color:#003399;">γ </span>
154
\endhtmlonly
155
The thread processing sub-flow control logic is executed starting at the
156
\htmlonly
157
<b>γ</b>
158
\endhtmlonly
159
connector. One device thread is created per each unique proxied device URI.
160
Again, if the device thread already exists the the tis reference count is
161
increemented. Otherwise a thread control block along with its input queue
162
are created and inserted into the internal device thread hash table.
163
The thread is then created and started in its own execution context.
164
* \{
165
*/
166
167
/*! \} */
168
169
/*!
170
* \ingroup bsserver
171
* \defgroup bsrv_cfg bsProxy Configuration
172
*
173
* The bsServer XML configuration will be supported in \h_botsense v3.1.0.
174
* \{
175
*/
176
177
/*! \} */
178
docs
doxy
dModServer.doxy
Generated on Fri Aug 10 2018 13:54:32 for botsense by
1.8.11
©2018 RoadNarrows LLC
www.roadnarrows.com