Version | Date | Change |
---|---|---|
0.1 | 2016-07-10 | Initial contribution |
PortServer service provides ability to create a TCP/UDP port
server on the TCF peer host to connect to a local TCP/UDP/serial
port. The PortServer service is built on top of the PortForward
service; when a port server is created, the TCF channel used to
transmit the command will be the one used to send the PortForward
commands.
When a TCF client connect to a TCF peer and create a port server,
the TCF peer will create a local TCP or UDP server (depending on
the parameters) and will use the PortForward service to link this
port to the corresponding port on the TCF client (the one that has
sent the PortServer command). At this point, all the data that is
written to the port server will be sent to the port opened by
PortForward service and vice-versa. In case of a TCP server, the
PortForward command will be sent to the TCF client only when a
connection request is sent to the server (unless the AutoConnect
parameter is set); in case of a UDP server it is sent as soon as
the PortServer is created.
If the PortServer service is processed by a value-add, then the
PortForward commands are not sent to the TCF client (the one that
has issued the request) but instead are sent to the TCF peers (the
one connected to through the value-add).
Command are encoded as zero terminated JSON strings.
The service uses standard format for error reports, see Error Report Format.
The command retrieves information for given Port Server configuration ID.
Reply:
R <token> <error report> <Port Server properties> <port server properties>Port Forward properties consists of a list of status properties.
Predefined properties are:
"ID"
: <string> - Port Server
ID
"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
"AutoConnect"
: <string> - Indicate if Port Server
should create the port configuration automatically or wait
for a connection. This parameter is forced to true for a UDP
port server and it is recommended to keep it to its default
(false) for a TCP port unless you understand exactly what
you are doing. This parameter should not be really exposed
but is there for completeness. If AutoConnect is set to
true, we will accept only one concurrent connection to the
port server.
"AutoConnectPeriod"
: <integer> - If AutoConnect parameter is
set, indicate the period in seconds to retry the port
connection if the connection has failed or has been
disconnected. Default to 3s.
"UdpPort"
: <integer> - Allocated port server port
number in case it is a UDP port server
"TcpPort"
: <integer> - Allocated port server port
number in case it is a TCP port server
The command list available Port Server IDs
Reply:
<array of Port Server IDs> ⇒ null ⇒ [ ] ⇒ [ <Port Servers ID list> ] <Port Servers ID list> ⇒ <string: Port Forward ID> ⇒ <Port Server ID list> , <string: Port Server ID>
C <token> PortServer create <Port Server configuration>
<Port Server configuration> ⇒ <object>
The command creates a Port Server with specified properties.
Predefined properties are:
"ID"
: <string> - Port Server ID (this parameter is mandatory)
"Port"
: <string> - device port to access. Refer to PortForward service documentation for more information.
"Verbose"
: <boolean> - Indicate if a message must be displayed 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.
Refer to PortForward service documentation for more information.
"AutoConnect"
: <string>
- Indicates if the created port server should setup the port configuration
automatically or wait for a local connection. This parameter is forced to true
for a UDP port server and it is recommended to keep it to its default
(false) for a TCP port unless you understand exactly what you are doing.
This parameter should not be really exposed but is there for
completeness. If AutoConnect is set to true, we will accept only one
concurrent connection to the port server.
"AutoConnectPeriod"
: <integer>
- If AutoConnect parameter is set, indicates the period in seconds we
should try to try to connect again if the connection has failed or if we
have been disconnected. Default to 3s.
Reply:
R <token> <error report> <port server properties> <port server properties> ⇒ null ⇒ <object>
Port properties are the same as returned by the getConfig command.
C <token> PortServer delete <string: PortServer ID>
The command deletes a previously created Port Foward connection.
Reply:
R <token> <error report>
C <token> PortServer getCapabilities <string: PortServer ID>
This command retrieves PortServer service capabilities to clients so
they can adjust to different implementations of the service. Currently, only a null ("") PortServer 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. No predefined properties exist yet.
PortServer service does not currently have any event