Home Page Toolkit Overview Using GML User Input Services Finger Tracker Calibrator Frame Grabber Obtaining GML Installing GML Licence Developer Documentation Tcl/Tk API The GML Canvas Image processing Tcl Scripts Library List of Classes List of Files C/C++ API List of Classes List of Files |
BIP/1.0: Basic Interconnection Protocol for Event Flow Services
Abstract This document describes low-level and high-level aspects of the BIP/1.0 protocol that allows the cooperation of services used to build interactive systems. Contents IntroductionBIP is designed to meet a number of requirements encountered when constructing interactive systems:
These requirements have a number of consequences that influence how BIP is designed:
The minimal BIP protocol only consists in an exchange of ASCII messages with 1-line message headers over a TCP socket. This allows for minimal interoperability with a very low effort. Implementors of BIP can enrich the inteconnection by adding support for UDP communications, multicast UDP, DNS-based dynamic discovery, and finally service control through an XML control protocol. Terminology
Services overviewDiscovering a serviceBIP services advertize themselves using the DNS-SD1 convention over Multicast DNS2. They use the local. domain, TCP transport, and the bip service name; in other words, fully qualified names for BIP services names must be as follows: <name>._bip._tcp.local. where <name> is chosen by the service instanciator. The TCP port number advertized in the DNS-SD SRV record is the port used for control channel to the service (see below). The DNS-SD TXT record fields listed below must or may be present for each service. They must not change during the lifetime of a service.
Additionally, there must exist a field for each channel. The field key is the channel name, and the field value is of the form port/type, where port is the channel's TCP port, as a decimal number, and type is one of i, o or d, for input channels, output channels, and duplex channels, respectively. Example record: id=FADA97CE class=bip.source.noise owner=mezis events=123/d noise=456/o
Notes:
Connecting to a serviceThere are four possible types of channels within a service:
A service accepts TCP link on one TCP port for control links, and one TCP port for each input and output. For inputs, it also accepts messages over UDP if a TCP link has been established (see below). For outputs, it can emit over UDP if requested. Data that transits over any link with service obeys the message format described below (in Low-level message format). For the control link, data inside messages obeys further specification (see the sections on inspection and control below). Service parametersServices may define any number of parameters. All services must define at least the following so-called "universal" parameters.
Communicating with servicesMotivation: the communication protocol must not impose any software requirements on the peers that connect to a service. Low-level message formatMessages are the lowest-level of the protocol, i.e. what transits over a network connection to a service. They contain a fixed-size (34 bytes) header and a variable-size payload; the header is the concatenation of the following ASCII strings:
Both the header and the payload are immediately followed by the <cr> carriage-return plus <lf> line-feed line termination sequence (bytes 0x0A and 0x0D), which are not taken into account for length calculations. In the case of an empty payload (length zero), the termination sequence must still be appended; in other words, the message end with two successive <cr><lf> sequences. Example message: BIP/1.0 DEADBEEF 00000000 0000000<cr><lf><cr><lf> BIP/1.0 DEADBEEF 00000000 000000D<cr><lf>hello, world!<cr><lf> Note that the format of message contents is not specified for input, or output duplex links to a service. However, it is specified for the control connections (see the sections on inspection and control below). It is strongly advised to keep the format of message contents for a particular service as simple as possible, for the sake of inter-operability with other systems and services. In particular, service designers should:
Establishing a linkA service must accept only one control link at a time. A service may choose to only accept one link to any input, output or inoutput channel at a time. To establish a link to a service, a peer must:
These two messages allow the peers to identify eachother, thanks to the peer ID provided with each message. The order of steps 2 and 3 is not specified. These initial messages may be empty or contain one or several lines of meta-information about the link, the channel, or the service. For instance, suppose peer A with peer ID DEADBEEF opens a TCP connection to peer B with peer ID DADABABA. Peer A then sends the message: BIP/1.0 DEADBEEF 00000000 00000000<cr><lf><cr><lf> to peer B, and peer B sends the message: BIP/1.0 DADABABA 00000000 00000000<cr><lf><cr><lf> to peer A. The link is then considered to be established. Link meta-information is formatted a la RFC822, in successive key-value pairs. Keys must be formed of lower-case letters, digits and hyphens. Values must be formed of printable 7-bit ASCII characters. Key and value are separated by a colon and any number of space or tab characters. Successive key-value pairs are separated by the <cr><lf> line delimiter. Example (delimiters ommited): BIP/1.0 DEADBEEF 00000000 00000066 service-name: Dummy Service channel-name: Dummy output channel udp-port: 21587 status: Up and running content-type: text/xml A number of keys are reserved (though optional):
Communicating over TCPCommunicating over TCP is possible for any service link. Once a link has been established as described above, communication is acheived by sending and receiving any number of successive messages. It is recommended that services that require low-latency communication over TCP send and receive messages (e.g. empty messages) at all times. This is to ensure that the TCP window stays as open as possible, and that occasional "bursts" of data are not limited by the enpoints' TCP stacks. The actual minimal data throughput to maintain depends on you local implementation(s) of TCP; it is however recommended that you maintain an overall average throughput of half your maximal throughput between the two peers. Communicating over UDPCommunicating over UDP is possible for any link (for service input, output and inoutput channels), except control links. A "source" peer may send messages over UDP to a "destination" peer if
Each UDP datagram must contain exactly one message. A service should ignore incoming UDP messages from a peer if no link is established. Communicating over multicast UDPThe above paragraph (Communicating over UDP) remains valid for communication over multicast UDP. No protocol is specified when choosing a multicast group. It is recommended to select a group at random. Inspection and control of servicesService inspection is achieved by sending controlQuery events and receiving controlAnswer events over a control link to a service. The TCP port for the control link to a service can be determined using the service discovery mechanism. Inspection provides information on service parameters, inputs and outputs. Control allows to modify the values of a service's parameters. Services not implementing the control protocol must emit the following message immediately after any connection has been established with their control port: <controlError id="00000000" type="not-implemented"/> Communication over the control channel obey the companion XML Schema in bip-control.xsd. For instance, the following query and answer show how to inspect a service parameter: <controlQuery id="DADADEAD"> <variable name="stars"/> </controlQuery> <controlAnswer id="DADADEAD"> <variable name="stars"> <value>123</value> <default>100</default> <type>integer</type> <access>read</access> <description>current number of stars in the sky</description> </variable> </controlAnswer> The control protocol is still subject to change and is not normative. |
||||||||||||||
Contact: julien (dot) letessier (at) gmail (dot) com.
Copyright (c) 2000-2007 CLIPS-IMAG Laboratory, Grenoble, France. All rights reserved. W3CXHTML 1.0 W3CCSS 2.0 |