Version | Date | Change |
---|---|---|
0.1 | 2016-07-10 | Initial contribution |
PortForward service is an interface to provide ability to connect
a TCF stream to a device port (TCP port, UDP port, serial line...)
The service supports:
When a PortForward creation command is receive, the connection is
established to the specified device port and when the connection
is established two TCF streams are created and allow to read and
write to the port. Any data written by the client to the
"OuptutStream" is automatically written to the device port and any
data read from the device port is automatically sent to the
"InputStream". Reading and writing to/from TCF streams is done
using the TCF "Streams" service. The PortFoward
configuration is not persistent, when the connection to the device
port is lost or if the channel is closed, the PortForward
configuration is automatically removed and has to be created again
if you want to re-instantiate the connection.
Command are encoded as zero terminated JSON strings.
The service uses standard format for error reports, see Error Report Format.
C <token> PortForward getConfig <string: Port Forward ID>
The command retrieves information for given Port Forward configuration ID.
Reply:
R <token> <error report> <Port Forward properties> <port forward properties>Port Forward properties consists of a list of status properties.
Predefined properties are:
"ID"
: <string> -
Gdb Remote
connection
ID
"InputStream"
: <string> - TCF stream used for port
input (reading from port)
"OutputStream"
: <string> -
TCF stream used
for port input (writing to port)
"Verbose"
: <boolean> - Indicate if messages should
be printed on console
"ClientData"
: <string> - Port client data string as
specified when port was created
"Port"
: <string> - Port configuration string
"Params"
: <string> - Port configuration parameters
string
The command list available Port Forward configurations
Reply:
<array of Port Forward IDs> ⇒ null ⇒ [ ] ⇒ [ <Port Forwards ID list> ] <Port Forwards ID list> ⇒ <string: Port Forward ID> ⇒ Port Forward ID list> , <string: Port Forward ID>
C <token> PortForward create <Port Forward configuration>
<Port Forward configuration> ⇒ <object>
The command adds a Port Forward connection with specified properties. The connection to the device port is done automatically when the "create" command is issued; reply is sent only when the connection to the port is established or when an error was detected. If
Predefined properties are:
"ID"
: <string> - Port Forward ID (this parameter is mandatory)
"Port"
: <string> - device port to access. This configuration is device specified and described below
(this parameter is mandatory)
"Verbose"
: <boolean> - Indicate if Port Forward server must display message in the console when port is accessed (opened, closed...). Default to false.
"ClientData"
: <string> - Port client data string; this can be specified to any value by the client and will be returned when asking information about the port. It is not interpreted by the service.
"Params"
: <string> - Port configuration parameters (used only for serial line).
Establish a connection to TCP port
<port number> on host <host name or IP>. If <host name or IP> is not specified, then
loop back
address will be used. <port number> is mandatory.
Establish a connection to UDP port
<port number> on host <host name or IP>. If <host name or IP> is not specified, then
loop back
address will be used. <port number> is mandatory.
Establish a connect to specified serial device (e.g. COM1, /dev/ttyS0).
"9600" - Only specify baud rate, keep default for everything else
":7" - Only specify number of data bits
, keep default for everything else
"::::S" - Set flow control to XON/XOFF,
keep default for everything else
"9600:8:N:1:S" - set barud rate to 9600, 8 data bits, no parity, 1 stop bit and space parity
Reply:
R <token> <error report> <port properties> <port properties> ⇒ null ⇒ <object>
Port properties are the same as returned by the getConfig command.
C <token> PortForward delete <string: PortForward ID>
The command deletes a previously created Port Foward connection.
Reply:
R <token> <error report>
C <token> PortForward getCapabilities <string: PortForward ID>
This command retrieves PortForward service capabilities to clients so
they can adjust to different implementations of the service. Currently, only a null ("") PortForward ID is supported.
Reply:
R <token> <error report> <service capabilities> Service capabilities consist of a list of properties. All properties are optional. Tools and targets can define additional properties. Predefined properties are:
"TCP"
: <boolean>
- if true, TCP Port Forward connections are supported"UDP"
: <boolean>
- if true, UDPPort Forward connections are supported"Serial"
: <boolean>
- if true, serial Port Forward connections are supportedPortForward service events are sent to notify clients about PortFoward configurations created ordeleted. The purpose of these events is to let all clients know about PortForward connections that were created by other clients.
E PortForward configAdded <PortForward connection properties>
E PortForward configRemoved <PortForward connection ID>