libdali 1.8.0
The DataLink client library
|
DataLink operates to two different modes: query mode and streaming mode. In query mode a client submits commands to a server and the server responds with either status replies or data content. In streaming mode a server sends selected data packets to a client as they become available on the server with no specific per-packet interaction from the client. A DataLink connection is always in query mode by default, switching to streaming mode only when specifically requested by the client.
Client commands and server replies are encapsulated in DataLink packet structures. All command and reply exchanges are formulated using ASCII characters with the exception of a single byte length parameter (preheader) and packet data.
Various client commands and server responses contain time stamps represented as high-precision time values defined as Unix/POSIX epoch times in microseconds. These high-precision time values are abbreviated to hptime, hppkttime, hpdatastart or hpdataend.
Packet structure: 'preheader' | 'header' [| 'data']
DataLink client commands go into the header section of a DataLink packet with any associated data in the data section.
The server will reply to most client commands with a status indicator of either OK or ERROR and include a integer value (meaning is command dependent) and an optional message.
The command description below includes the commands themselves in upper case letters with required arguments in lower case letters followed by a short description of the command.
Syntax: ID clientid
Purpose: Send client identification and receive server identification
programname:username:processid:architecture
ID DataLink <version> :: <capabilities>
Syntax: POSITION SET pktid hppkttime
Purpose: Set the client read position in the server to a specific packet
Syntax: POSITION AFTER hptime
Purpose: Set the client read position to first packet with data start time after hptime
Syntax: MATCH size|<match pattern of length size>
Purpose: Set the connection packet matching expression
Syntax: REJECT size|<reject pattern of length size>
Purpose: Set the connection packet rejecting expression
Syntax: WRITE streamid hpdatastart hpdataend flags size|<packet data of length size>
Purpose: Send data packet to DataLink server
Syntax: READ pktid
Purpose: Request data packet from DataLink server
Syntax: STREAM
Purpose: Request start of streaming mode
Syntax: ENDSTREAM
Purpose: Request end of streaming mode, connection returns to query mode
Syntax: INFO type|[match]
Purpose: Request an INFO packet from the server
Syntax: OK value size|<status message>
Syntax: ERROR value size|<error message>
Purpose: Return status of a command
value
is command dependentSyntax: INFO type size|<XML info data of length size>
Purpose: Return INFO data requested
Syntax: PACKET <streamid> <pktid> <hppackettime> <hpdatastart> <hpdataend> <size>|<packet data of length size>
Purpose: Send data packets to client
Each DataLink data packet includes the following header information:
The combination of packet ID and packet time uniquely identify a packet, using this combination is necessary as packet IDs will eventually be reused.
One of the most common client-server sequences would be a client connecting to a server, exchanging IDs, setting a stream matching pattern and collecting data in streaming mode. This is illustrated below (the preheaders of the DataLink packets have been omitted for clarity):
where C
is the client and S
is the server.