wiki:Documentation/Configuration

Configuration

The pingpong sample uses a text-based configuration file for reading parameters like local endpoints to use or bootstrapping information. This information is then set e.g. using AribaModule::setProperty when starting up. Therefore, using a configuration file is optional, you can use your own configuration file format or hardcode such information in your code.

AribaModule Properties

Currently the AribaModule class supports two properties that can be set

  • endpoints
  • bootstrap.hints

All other information -- like node names or spovnet names are set directly using the Ariba interface (see e.g. PingPong.cpp).

The endpoints property defines the local endpoints where Ariba opens up server instances. If you don't configure the endpoints defaults will be used. A detailed description of the endpoint format is given further down. The bootstrap.hints property defines bootstrapping information the node uses to find the SpoVNet instance. This can either be static nodes or automatic bootstrap modules like mDNS. Again, see further down this page for a description of the bootstrap hints format.

Configuration class

If you want to read information from a settings file, you can use the built-in Configuration class. To define the filename, use the

StartupWrapper::initConfig( config );

function, as in the main.cpp of the PingPong sample. The given configuration file will be read and is accessible throughout the whole process. You can check if there is a configuration file available using

if( Configuration::haveConfig() )

and get a reference to the configuration singleton using

Configuration& config = Configuration::instance();

The format of the configuration file is one item per line using

name = value

where value can be a string, integer, or true|false. Reading from the configuration file is parametrized using the desired type:

string name = config.read<string>("name");
int count = config.read<int>("count");
bool enable = config.read<bool>("enable");

The PingPong sample uses the following to read the endpoint and bootstrap.hints from the configuration file:

if (config.exists("ariba.endpoints"))
  ariba->setProperty("endpoints", config.read<string>("ariba.endpoints"));
if (config.exists("ariba.bootstrap.hints"))
  ariba->setProperty("bootstrap.hints", config.read<string>("ariba.bootstrap.hints"));

Endpoint format

The format of the endpoints property that you can set on the AribaModule object is:

protocol1{address1};protocol2{address2};...

If there is no address it can be omitted. This will be the case further down with the bootstrapping modules when no parametrization is required:

protocol1;protocol2

Exemplarily you can set the tcp port to 5003 using

tcp{5003}

and the local IP address to bind to 192.168.1.2 using

ip{192.168.1.2}

If you have several values, e.g. an IPv4 and an IPv6 address you can use the | operator: ip{192.168.1.2 | 2001:0DB8:AC10:FE01::}

Available endpoint protocols and their addresses are:

  • ip - IPv4 and/or IPv6 address, e.g. 192.168.1.2 or 2001:0DB8:AC10:FE01::
  • tcp - TCP listen port, e.g. 5003
  • bluetooth - MAC address, e.g. 00:18:fe:23:ab:22
  • rfcomm - RFCOMM channel, e.g. 10

You can use multiple such protocol{address} definitions and append them using a semicolon ;

Bootstrap hints

Definition of the bootstrap.hints property is the same as the endpoints format but with some extensions. First, bootstrap hints are defined per SpoVNet instance, second, configuration of automatic bootstrap modules is available.

You define the bootstrap.hints property using

spovnet1{,,,};spovnet2{...};

And insert the hints in the format same as the endpoints. The following defines a bootstrap hint the connect to port 5003 using tcp on the local machine:

ariba.bootstrap.hints=pingpong{ip{127.0.0.1};tcp{5002}};

Ariba provides several automatic bootstrapping modules:

  • broadcast - A periodic broadcasting protocol using IPv4 and IPv6
  • mdns - Multicast DNS using the Avahi library
  • sdp - Bluetooth service discovery protocol

All three search for bootstrapping information and allow to automatically connect to running SpoVNets. Note, that the bootstrapping mechanism is independent of the actual protocol used to join the SpoVNet. E.g. you can find a SpoVNet using SDP and then connect using IPv4 through the LAN. A bootstrap module is named using the protocol{info} naming. Here, info is used for parametrization of the bootstrapping modules. Note, that currently none of the available bootstrapping modules provides parametrization, which will change in the future, e.g. to parametrize periodic intervals.

If you want to use a static IP/port to connect to a node but also use mDNS:

ariba.bootstrap.hints=pingpong{ip{127.0.0.1};tcp{5002};mdns}

To only enable automatic bootstrapping modules:

ariba.bootstrap.hints=pingpong{mdns;broadcast;sdp}
Last modified 15 years ago Last modified on Feb 4, 2010, 6:07:04 PM
Note: See TracWiki for help on using the wiki.