summaryrefslogtreecommitdiff
path: root/documentation/vsomeipUserGuide
blob: dd4f13d2433a9ea16ae02406f7d77f2e377eb882 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
vsomeip
=======
// This enables a nice TOC as a sidebar
:toc2:
// Show all headings in TOC
:toclevels: 4
// Show icons if e.g. TIP: or IMPORTANT is used
:icons:
// Set the directory where the default icons can be found
:iconsdir: {asciidoc-confdir}/{iconsdir}
// number all headings
:numbered:
// this embeds images (e.g. the icons for TIP: $TEXT) into the html file
:data-uri:

Copyright
+++++++
Copyright (C) 2015-2019, Bayerische Motoren Werke Aktiengesellschaft (BMW AG)

License
+++++++
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.

Version
+++++++
// set the version to the one we get from cmake
// or pass it via -a version=$VSOMEIP_VERSION to asciidoc
This documentation was generated for version {version} of vsomeip.

vsomeip Overview
----------------
The vsomeip stack implements the http://some-ip.com/[Scalable service-Oriented
MiddlewarE over IP (SOME/IP)] protocol. The stack consists out of:

* a shared library for SOME/IP (`libvsomeip.so`)
* a second shared library for SOME/IP's service discovery (`libvsomeip-sd.so`)
  which is loaded during runtime if the service discovery is enabled.

Build Instructions
------------------
Dependencies
~~~~~~~~~~~~
* A C++11 enabled compiler like gcc >= 5.2 is needed.
* vsomeip uses cmake as buildsystem.
* vsomeip uses Boost >= 1.55:
** Ubuntu 14.04:
*** `sudo apt-get install libboost-system1.55-dev libboost-thread1.55-dev
    libboost-log1.55-dev`
** Ubuntu 12.04: a PPA is necessary to use version 1.54 of Boost:
*** URL: https://launchpad.net/~boost-latest/+archive/ubuntu/ppa
*** `sudo add-apt-repository ppa:boost-latest/ppa`
*** `sudo apt-get install libboost-system1.55-dev libboost-thread1.55-dev
    libboost-log1.55-dev`
* For the tests Google's test framework
  https://code.google.com/p/googletest/[gtest] in version 1.7.0 is needed
** URL: https://googletest.googlecode.com/files/gtest-1.7.0.zip[direct link,
   version 1.7.0]
* To build the documentation asciidoc, source-highlight, doxygen and graphviz is needed:
** `sudo apt-get install asciidoc source-highlight doxygen graphviz`

Compilation
~~~~~~~~~~~
anchor:Compilation[]
For compilation call:
[source, bash]
----
mkdir build
cd build
cmake ..
make
----

To specify a installation directory (like `--prefix=` if you're used to
autotools) call cmake like:
[source, bash]
----
cmake -DCMAKE_INSTALL_PREFIX:PATH=$YOUR_PATH ..
make
make install
----

Compilation with predefined base path
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
To predefine the base path, the path that is used to create the local sockets, 
call cmake like:
[source,bash]
----
cmake -DBASE_PATH=<YOUR BASE PATH> ..
----
The default base path is /tmp.

Compilation with predefined unicast and/or diagnosis address
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
To predefine the unicast address, call cmake like:
[source,bash]
----
cmake -DUNICAST_ADDRESS=<YOUR IP ADDRESS> ..
----

To predefine the diagnosis address, call cmake like:
[source,bash]
----
cmake -DDIAGNOSIS_ADDRESS=<YOUR DIAGNOSIS ADDRESS> ..
----
The diagnosis address is a single byte value.

Compilation with custom default configuration folder
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
To change the default configuration folder, call cmake like:
[source,bash]
----
cmake -DDEFAULT_CONFIGURATION_FOLDER=<DEFAULT CONFIGURATION FOLDER> ..
----
The default configuration folder is /etc/vsomeip.

Compilation with custom default configuration file
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
To change the default configuration file, call cmake like:
[source,bash]
----
cmake -DDEFAULT_CONFIGURATION_FILE=<DEFAULT CONFIGURATION FILE> ..
----
The default configuration file is /etc/vsomeip.json.

Compilation with signal handling
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
To compile vsomeip with signal handling (SIGINT/SIGTERM) enabled,
call cmake like:
[source,bash]
----
cmake -DENABLE_SIGNAL_HANDLING=1 ..
----
In the default setting, the application has to take care of shutting
down vsomeip in case these signals are received.

Compilation with user defined "READY" message
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
To compile vsomeip with a user defined message signal the IP routing
to be ready to send/receive messages, call cmake like:
[source,bash]
----
cmake -DROUTING_READY_MESSAGE=<YOUR MESSAGE> ..
----

Compilation with configuration overlays
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
To compile vsomeip with configuration overlays enabled, call cmake
like:
[source,bash]
----
cmake -DENABLE_CONFIGURATION_OVERLAYS=1 ..
----

Compilation with vSomeIP 2 compatibility layer
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
To compile vsomeip with enabled vSomeIP 2 compatibility layer, call
cmake like:
[source,bash]
----
cmake -DENABLE_COMPAT=1 ..
----

Compilation of examples
^^^^^^^^^^^^^^^^^^^^^^^
For compilation of the examples call:
[source, bash]
----
mkdir build
cd build
cmake ..
make examples
----

Compilation of tests
^^^^^^^^^^^^^^^^^^^^
To compile the tests, first unzip gtest to location of your desire.
Some of the tests require a second node on the same network. There are two cmake
variables which are used to automatically adapt the json files to the used
network setup:

* `TEST_IP_MASTER`: The IP address of the interface which will act as test
  master.
* `TEST_IP_SLAVE`: The IP address of the interface of the second node which will
  act as test slave.

If one of this variables isn't specified, only the tests using local
communication exclusively will be runnable.

Additionally the unit tests require enabled signal handling which can be enabled
via the `ENABLE_SIGNAL_HANDLING` cmake variable.

Example, compilation of tests:
[source, bash]
----
mkdir build
cd build
export GTEST_ROOT=$PATH_TO_GTEST/gtest-1.7.0/
cmake -DENABLE_SIGNAL_HANDLING=1 -DTEST_IP_MASTER=10.0.3.1 -DTEST_IP_SLAVE=10.0.3.125 ..
make check
----

Additional make targets for the tests:

* Call `make build_tests` to only compile the tests
* Call `ctest` in the build directory to execute the tests without a verbose
  output
* To run single tests call `ctest --verbose --tests-regex $TESTNAME` short
  form: `ctest -V -R $TESTNAME`
* To list all available tests run `ctest -N`.
* For further information about the tests please have a look at the
  `readme.txt` in the `test` subdirectory.

For development purposes two cmake variables exist which control if the
json files and test scripts are copied (default) or symlinked into the build
directory. These settings are ignored on Windows.

* `TEST_SYMLINK_CONFIG_FILES`: Controls if the json and scripts needed
  to run the tests are copied or symlinked into the build directory. (Default:
  OFF, ignored on Windows)
* `TEST_SYMLINK_CONFIG_FILES_RELATIVE`: Controls if the json and scripts needed
  to run the tests are symlinked relatively into the build directory.
  (Default: OFF, ignored on Windows)

Example cmake call:
[source, bash]
----
cmake  -DTEST_SYMLINK_CONFIG_FILES=ON -DTEST_SYMLINK_CONFIG_FILES_RELATIVE=ON ..
----

For compilation of only a subset of tests (for a quick
functionality check) the cmake variable `TESTS_BAT` has
to be set:

Example cmake call:
[source, bash]
----
cmake  -DTESTS_BAT=ON ..
----

Compilation of vsomeip_ctrl
^^^^^^^^^^^^^^^^^^^^^^^^^^^
For compilation of the <<vsomeip_ctrl>> utility call:
[source, bash]
----
mkdir build
cd build
cmake ..
make vsomeip_ctrl
----

Generating the documentation
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
To generate the documentation call cmake as described in <<Compilation>> and
then call `make doc`.
This will generate:

* The README file in html: `$BUILDDIR/documentation/README.html`
* A doxygen documentation in `$BUILDDIR/documentation/html/index.html`

Starting vsomeip Applications / Used environment variables
----------------------------------------------------------
On startup the following environment variables are read out:

* `VSOMEIP_APPLICATION_NAME`: This environment variable is used to specify the
  name of the application. This name is later used to map a client id to the
  application in the configuration file. It is independent from the
  application's binary name.
* `VSOMEIP_CONFIGURATION`: vsomeip uses the default configuration file `/etc/vsomeip.json`
   and/or the default configuration folder `/etc/vsomeip`. This can be overridden by a
   local configuration file `./vsomeip.json` and/or a local configuration folder `./vsomeip`.
   If `VSOMEIP_CONFIGURATION` is set to a valid file or directory path, this is used instead
   of the standard configuration (thus neither default nor local file/folder will be parsed).
* `VSOMEIP_MANDATORY_CONFIGURATION_FILES`: vsomeip allows to specify mandatory configuration
   files to speed-up application startup. While mandatory configuration files are read by all
   applications, all other configuration files are only read by the application that is 
   responsible for connections to external devices. If this configuration variable is not set,
   the default mandatory files vsomeip_std.json, vsomeip_app.json and vsomeip_plc.json are used.
* `VSOMEIP_CLIENTSIDELOGGING`: Set this variable to an empty string to enable logging of
   any received messages to DLT in all applications acting as routing manager proxies. For
   example add the following line to the  application's systemd service file:
   `Environment=VSOMEIP_CLIENTSIDELOGGING=""`
   To enable service-specific logs, provide a space- or colon-separated list of ServiceIDs (using
   4-digit hexadecimal notation, optionally followed by dot-separted InstanceID). For example:
   `Environment=VSOMEIP_CLIENTSIDELOGGING="b003.0001 f013.000a 1001 1002"`
   `Environment=VSOMEIP_CLIENTSIDELOGGING="b003.0001:f013.000a:1001:1002"`

NOTE: If the file/folder that is configured by `VSOMEIP_CONFIGURATION` does _not_ exist,
the default configuration locations will be used.

NOTE: vsomeip will parse and use the configuration from all files in a configuration folder
but will _not_ consider directories within the configuration folder.

In the following example the application `my_vsomeip_application` is started.
The settings are read from the file `my_settings.json` in the current working
directory. The client id for the application can be found under the name
`my_vsomeip_client` in the configuration file.

[source, bash]
----
#!/bin/bash
export VSOMEIP_APPLICATION_NAME=my_vsomeip_client
export VSOMEIP_CONFIGURATION=my_settings.json
./my_vsomeip_application
----

Configuration File Structure
----------------------------
The configuration files for vsomeip are http://www.json.org/[JSON]-Files and are
composed out of multiple key value pairs and arrays.

[quote, , json.org]
____
* An object is an unordered set of name/value pairs. An object begins with `{
(left brace)` and ends with `} (right brace)`. Each name is followed by `:
(colon)` and the name/value pairs are separated by `, (comma)`.

* An array is an ordered collection of values. An array begins with `[ (left
bracket)` and ends with `] (right bracket)`. Values are separated by `,
(comma)`.

* A value can be a _string_ in double quotes, or a _number_, or `true` or `false`
or `null`, or an _object_ or an _array_. These structures can be nested.
____

Configuration file element explanation:


* 'unicast'
+
The IP address of the host system.
+
* 'netmask'
+
The netmask to specify the subnet of the host system.
+
* 'device' (optional)
+
If specified, IP endpoints will be bound to this device.
+
* 'diagnosis'
+
The diagnosis address (byte) that will be used to build client identifiers. The
diagnosis address is assigned to the most significant byte in all client
identifiers if not specified otherwise (for example through a predefined client
ID).
+
* 'diagnosis_mask'
+
The diagnosis mask (2 byte) is used to control the maximum amount of allowed
concurrent vsomeip clients on an ECU and the start value of the client IDs.
+
The default value is `0xFF00` meaning
the most significant byte of the client ID is reserved for the diagnosis
address and the client IDs will start with the diagnosis address as specified.
The maximum number of clients is 255 as the Hamming weight of the inverted mask
is 8 (2^8 = 256 - 1 (for the routing manager) = 255). The resulting client ID
range with a diagnosis address of for example 0x45 would be 0x4501 to 0x45ff.
+
Setting the mask to `0xFE00` doubles client ID range to 511 clients as the
Hamming weight of the inverted mask is greater by one.  With a diagnosis address
of 0x45 the start value of client IDs is 0x4401 as bit 8 in 0x4500 is masked
out. This then yields a client ID range of 0x4400 to 0x45ff.

* 'network'
+
Network identifier used to support multiple routing managers on one host. This
setting changes the name of the shared memory segment in `/dev/shm` and the name
of the unix domain sockets in `/tmp/`. Defaults to `vsomeip` meaning the shared
memory will be named `/dev/shm/vsomeip` and the unix domain sockets will be
named `/tmp/vsomeip-$CLIENTID`
+
//Logging
* 'logging'
+
** 'level'
+
Specifies the log level (valid values: _trace_, _debug_, _info_, _warning_,
_error_, _fatal_).
+
** 'console'
+
Specifies whether logging via console is enabled (valid values: _true, false_).
+
** 'file'
+
*** 'enable'
+
Specifies whether a log file should be created (valid values: _true, false_).
+
*** 'path'
+
The absolute path of the log file.
+
** 'dlt'
+
Specifies whether Diagnostic Log and Trace (DLT) is enabled (valid values:
_true, false_).
+
** 'version'
+
Configures logging of the vsomeip version
+
*** 'enable'
+
Enable or disable cyclic logging of vsomeip version, defaults to true (valid
values: _true, false_)
+
*** 'interval'
+
Configures interval in seconds to log the vsomeip version. Default value is 10.
+
** 'memory_log_interval'
+
Configures interval in seconds in which the routing manager logs its used
memory. Setting a value greater than zero enables the logging.
+
** 'status_log_interval'
+
Configures interval in seconds in which the routing manager logs its internal
status. Setting a value greater than zero enables the logging.
+
//Tracing
* anchor:config-tracing[]'tracing' (optional)
+
** 'enable'
+
Specifies whether the tracing of the SOME/IP messages is enabled 
(valid values: _true, false_). Default value is _false_.
If tracing is enabled, the messages will be forwarded to DLT by 
the <<traceconnector, Trace Connector>>
+
** 'sd_enable'
+
Specifies whether the tracing of the SOME/IP service discovery messages is 
enabled (valid values: _true, false_). Default value is _false_.
+
** 'channels (array)' (optional)
+
Contains the channels to DLT.
+
NOTE: You can set up multiple channels to DLT over that you can forward the
messages.
+
*** 'name'
+
The name of the channel.
+
*** 'id'
+
The id of the channel. 
+
** 'filters (array)' (optional)
+
Contains the filters that are applied on the messages.
+
NOTE: You can apply filters respectively filter rules on the messages with 
specific criterias and expressions. So only the filtered messages are forwarded 
to DLT.
+
*** 'channel' (optional)
+
The id of the channel over that the filtered messages are forwarded to DLT. If
no channel is specified the default channel (TC) is used. If you want to use a
filter in several different channels, you can provide an array of channel ids.
+
NOTE: If you use a positive filter with multiple channels, the same message
will be forwared multiple times to DLT.
+
*** 'matches' (optional)
+
Specification of the criteria to include/exclude a message into/from the trace.
You can either specify lists (array) or ranges of matching elements.
+
A list may contain single identifiers which match all messages from/to all
instances of the corresponding service or tuples consisting of service-,
instance- and method-identifier. 'any' may be used as a wildcard for matching
all services, instances or methods.
+
A range is specified by two tuples "from" and "to", each consisting of 
service-, instance-and method-identifier. All messages with service-, 
instance-and method-identifiers that are greater than or equal to "from" 
and less than or equal to "to" are matched.
+
*** 'type' (optional)
+
Specifies the filter type (valid values: "positive", "negative"). When a positive
filter is used and a message matches one of the filter rules, the message will be
traced/forwarded to DLT. With a negative filter messages can be excluded. So when a
message matches one of the filter rules, the message will not be traced/forwarded to
DLT. Default value is "positive".
+
//Applications
* 'applications (array)'
+
Contains the applications of the host system that use this config file.
+
** 'name'
+
The name of the application.
+
** 'id'
+
The id of the application. Usually its high byte is equal to the diagnosis address. In this
case the low byte must be different from zero. Thus, if the diagnosis address is 0x63, valid
values range from 0x6301 until 0x63FF. It is also possible to use id values with a high byte 
different from the diagnosis address. 
+
** 'max_dispatchers' (optional)
+
The maximum number of threads that shall be used to execute the application callbacks. Default is 10.
+
** 'max_dispatch_time' (optional)
+
The maximum time in ms that an application callback may consume before the callback is
considered to be blocked (and an additional thread is used to execute pending
callbacks if max_dispatchers is configured greater than 0). The default value if not specified is 100ms.
+
** 'threads' (optional)
+
The number of internal threads to process messages and events within an application.
Valid values are 1-255. Default is 2.
+
** 'io_thread_nice' (optional)
+
The nice level for internal threads processing messages and events. POSIX/Linux only.
For actual values refer to nice() documentation.
+
** 'request_debounce_time' (optional)
+
Specifies a debounce-time interval in ms in which request-service messages are sent to
the routing manager. If an application requests many services in short same time
the load of sent messages to the routing manager and furthermore the replies from the
routing manager (which contains the routing info for the requested service if available)
can be heavily reduced. The default value if not specified is 10ms.
+
** 'plugins' (optional array)
+
Contains the plug-ins that should be loaded to extend the functionality of vsomeip.
+
*** 'name'
+
The name of the plug-in.
+
*** 'type'
+
The plug-in type (valid values: _application_plugin_).
+
An application plug-in extends the functionality on application level. It gets informed
by vsomeip over the basic application states (INIT/START/STOP) and can, based on these
notifications, access the standard "application"-API via the runtime.
+
** 'overlay' (optional)
+
Contains the path to a configuration that overwrites specific configuration elements
(unicast, netmask, device, network, diagnosis address & mask, service discovery) for the 
application. This allows to manage different network addresses from a single process.
+
NOTE: This feature is only available if vsomeip was compiled with ENABLE_CONFIGURATION_OVERLAYS.
+
* `services` (array)
+
Contains the services of the service provider.

** `service`
+
The id of the service.

** `instance`
+
The id of the service instance.

** `protocol` (optional)
+
The protocol that is used to implement the service instance. The default setting
is _someip_. If a different setting is provided, vsomeip does not open the specified
port (server side) or does not connect to the specified port (client side). Thus,
this option can be used to let the service discovery announce a service that is
externally implemented. 

** `unicast` (optional)
+
The unicast that hosts the service instance.
+
NOTE: The unicast address is needed if external service instances shall be used,
but service discovery is disabled. In this case, the provided unicast address
is used to access the service instance. 

** `reliable`
+
Specifies that the communication with the service is reliable respectively the
TCP protocol is used for communication.

*** `port`
+
The port of the TCP endpoint.

*** `enable-magic-cookies`
+
Specifies whether magic cookies are enabled (valid values: _true_, _false_).

** `unreliable`
+
Specifies that the communication with the service is unreliable respectively the
UDP protocol is used for communication (valid values: the _port_ of the UDP
endpoint).

** `events` (array)
+
Contains the events of the service.

*** `event`
+
The id of the event.

*** `is_field`
+
Specifies whether the event is of type field.
+
NOTE: A field is a combination of getter, setter and notification event. It
contains at least a getter, a setter, or a notifier. The notifier sends an event
message that transports the current value of a field on change.

*** `is_reliable`
+
Specifies whether the communication is reliable respectively whether the event
is sent with the TCP protocol (valid values: _true_,_false_).
+
If the value is _false_ the UDP protocol will be used.

** `eventgroups` (array)
+
Events can be grouped together into on event group. For a client it is thus
possible to subscribe for an event group and to receive the appropriate events
within the group.

*** `eventgroup`
+
The id of the event group.

*** `events` (array)
+
Contains the ids of the appropriate events.

*** `multicast`
+
Specifies the multicast that is used to publish the eventgroup.

**** `address`
+
The multicast address.

**** `port`
+
The multicast port.

*** `threshold`
+
Specifies when to use multicast and when to use unicast to send a notification event.
Must be set to a non-negative number. If it is set to zero, all events of the eventgroup
will be sent by unicast. Otherwise, the events will be sent by unicast as long as the
number of subscribers is lower than the threshold and by multicast if the number
of subscribers is greater or equal. This means, a threshold of 1 will lead to all events
being sent by multicast. The default value is _0_.  

** `debounce-times` (object)
+
Used to configure the nPDU feature. This is described in detail in 
<<npdu,vSomeIP nPDU feature>>.

** `someip-tp` (object)
+
Used to configure the SOME/IP-TP feature. There's an example available at
<<someiptp, SOME/IP-TP>>.

*** `service-to-client` (array)
+
Contains the IDs for responses, fields and events which are sent from the node
to a remote client which can be segmented via SOME/IP-TP if they exceed the
maximum message size for UDP communication. If an ID isn't listed here the
message will otherwise be dropped if the maximum message size is exceeded.

*** `client-to-service` (array)
+
Contains the IDs for requests, which are sent from the node
to a remote service which can be segmented via SOME/IP-TP if they exceed the
maximum message size for UDP communication. If an ID isn't listed here the
message will otherwise be dropped if the maximum message size is exceeded.
Please note that the unicast key has to be set to the remote IP address of the
offering node for this setting to take effect.


* `clients` (array)
+
The client-side ports that shall be used to connect to a specific service.
For each service, an array of ports to be used for reliable / unreliable
communication can be specified. vsomeip will take the first free port of
the list. If no free port can be found, the connection will fail. If 
vsomeip is asked to connect to a service instance without specified port(s),
the port will be selected by the system. This implies that the user has
to ensure that the ports configured here do not overlap with the ports
automatically selected by the IP stack.

** `service`
** `instance`
+
Together they specify the service instance the port configuration shall be applied to.

** `reliable` (array)
+
The list of client ports to be used for reliable (TCP) communication to the given
service instance. 

** `unreliable` (array)
+
The list of client ports to be used for unreliable (UDP) communication to the given
service instance. 

+
Additionally there is the possibility to configure mappings between ranges of client
ports and ranges of remote service ports.
(If a client port is configured for a specific service / instance, the port range mapping is ignored)

** `reliable_remote_ports`
+
Specifies a range of reliable remote service ports

** `unreliable_remote_ports`
+
Specifies a range of unreliable remote service ports

** `reliable_client_ports`
+
Specifies the range of reliable client ports to be mapped to the reliable_remote_ports range

** `unreliable_client_ports`
+
Specifies the range of unreliable client ports to be mapped to the unreliable_remote_ports range


** `first`
+
Specifies the lower bound of a port range

** `last`
+
Specifies the upper bound of a port range

* `payload-sizes` (array)
+
Array to limit the maximum allowed payload sizes per IP and port. If not
specified otherwise the allowed payload sizes are unlimited. The settings in
this array only affect communication over TCP. To limit the local payload size
`max-payload-size-local` can be used.

** `unicast`
+
On client side: the IP of the remote service for which the payload size should
be limited.
+
On service side: the IP of the offered service for which the payload size for
receiving and sending should be limited.

** `ports` (array)
+
Array which holds pairs of port and payload size statements.

*** `port`
+
On client side: the port of the remote service for which the payload size should
be limited.
+
On service side: the port of the offered service for which the payload size for
receiving and sending should be limited.

*** `max-payload-size`
+
On client side: the payload size limit in bytes of a message sent to the
remote service hosted on beforehand specified IP and port.
+
On service side: the payload size limit in bytes of messages received and sent
by the service offered on previously specified IP and port.
+
If multiple services are hosted on the same port they all share the limit
specified.

* `max-payload-size-local`
+
The maximum allowed payload size for node internal communication in bytes. By
default the payload size for node internal communication is unlimited. It can be
limited via this setting.

* `max-payload-size-reliable`
+
The maximum allowed payload size for TCP communication in
bytes. By default the payload size for TCP communication is
unlimited. It can be limited via this setting.

* `max-payload-size-unreliable`
+
The maximum allowed payload size for UDP communication via SOME/IP-TP in
bytes. By default the payload size for UDP via SOME/IP-TP communication is
unlimited. It can be limited via this setting. This setting only applies for
SOME/IP-TP enabled methods/events/fields (otherwise the UDP default of 1400
bytes applies). See <<someiptp, SOME/IP-TP>> for an example configuration.

* `endpoint-queue-limits` (array)
+
Array to limit the maximum allowed size in bytes of cached outgoing messages per
IP and port (message queue size per endpoint). If not specified otherwise the
allowed queue size is unlimited. The settings in this array only affect external
communication. To limit the local queue size `endpoint-queue-limit-local` can
be used.

** `unicast`
+
On client side: the IP of the remote service for which the queue size of sent
requests should be limited.
+
On service side: the IP of the offered service for which the queue size for
sent responses should be limited. This IP address is therefore
identical to the IP address specified via `unicast` setting on top level of the
json file.

** `ports` (array)
+
Array which holds pairs of port and queue size statements.

*** `port`
+
On client side: the port of the remote service for which the queue size of sent
requests should be limited.
+
On service side: the port of the offered service for which the queue size for
send responses should be limited.

*** `queue-size-limit`
+
On client side: the queue size limit in bytes of messages sent to the
remote service hosted on beforehand specified IP and port.
+
On service side: the queue size limit in bytes for responses sent by the service
offered on previously specified IP and port.
+
If multiple services are hosted on the same port they all share the limit
specified.

* `endpoint-queue-limit-external`
+
Setting to limit the maximum allowed size in bytes of cached outgoing messages
for external communication (message queue size per endpoint). By default the
queue size for external communication is unlimited. It can be limited via this
setting. Settings done in the `endpoint-queue-limits` array override this
setting.

* `endpoint-queue-limit-local`
+
Setting to limit the maximum allowed size in bytes of cached outgoing messages
for local communication (message queue size per endpoint). By default the queue
size for node internal communication is unlimited. It can be limited via this
setting.

* `buffer-shrink-threshold`
+
The number of processed messages which are half the size or smaller than the
allocated buffer used to process them before the memory for the buffer is
released and starts to grow dynamically again. This setting can be useful in
scenarios where only a small number of the overall messages are a lot bigger
then the rest and the memory allocated to process them should be released in a
timely manner. If the value is set to zero the buffer sizes aren't reseted and
are as big as the biggest processed message. (default is 5)
+
Example: `buffer-shrink-threshold` is set to 50. A message with 500 bytes has to
be processed and the buffers grow accordingly. After this message 50 consecutive
messages smaller than 250 bytes have to be processed before the buffer size is
reduced and starts to grow dynamically again.

* `tcp-restart-aborts-max`
+
Setting to limit the number of TCP client endpoint restart aborts due to unfinished TCP handshake.
After the limit is reached, a forced restart of the TCP client endpoint is done if the connection attempt is still pending.

* `tcp-connect-time-max`
+
Setting to define the maximum time until the TCP client endpoint connection attempt should be finished.
If `tcp-connect-time-max` is elapsed, the TCP client endpoint is forcely restarted if the connection attempt is still pending.

* `udp-receive-buffer-size`
+
Specifies the size of the socket receive buffer (`SO_RCVBUF`) used for
UDP client and server endpoints in bytes. (default: 1703936)

* `internal_services` (optional array)
+
Specifies service/instance ranges for pure internal service-instances.
This information is used by vsomeip to avoid sending Find-Service messages
via the Service-Discovery when a client is requesting a not available service-
instance. Its can either be done on service/instance level or on service level
only which then includes all instance from 0x0000-0xffff.

** `first`
+
The lowest entry of the internal service range.

*** `service`
+
The lowest Service-ID in hex of the internal service range.

*** `instance` (optional)
+
The lowest Instance-ID in hex of a internal service-instance range.
If not specified the lowest Instance-ID is 0x0000.

** `last`
+
The highest entry of the internal service range.

*** `service`
+
The highest Service-ID in hex of a internal service range.

*** `instance` (optional)
+
The highest Instance-ID in hex of a internal service-instance range.
If not specified the highest Instance-ID is 0xFFFF.

* `debounce` (optional array)
+
Events/fields sent by external devices will be forwarded to the
applications only if a configurable function evaluates to true. The
function checks whether the event/field payload has changed and whether
a specified interval has been elapsed since the last forwarding.

** `service`
+
Service ID which hosts the events to be debounced.

** `instance`
+
Instance ID which hosts the events to be debounced.

** `events`
+
Array of events which shall be debounced based on the following 
configuration options.

*** `event`
+
Event ID.

*** `on_change`
+
Specifies whether the event is only forwared on 
paylaod change or not. (valid values: _true_, _false_).

*** `ignore`
+
Array of payload indexes with given bit mask (optional) 
to be ignored in payload change evaluation. 
Instead of specifying an index / bitmask pair, one can only define the paylaod index 
which shall be ignored in the evaluation.

**** `index`
+
Payload index to be checked with given bitmask.

**** `mask`
+
1Byte bitmask applied to byte at given payload index.
Example mask: 0x0f ignores payload changes in low nibble of the byte at given index. 

*** `interval`
+
Specifies if the event shall be debounced based on elapsed time interval.
(valid values: _time in ms_, _never_).

*** `on_change_resets_interval_` (optional)
Specifies if interval timer is reset when payload change was detected.
(valid values: _false_, _true_).

* `routing`
+
The name of the application that is responsible for the routing.

* `routing-credentials`
+
The UID / GID of the application acting as routing manager.
(Must be specified if credentials checks are enabled using _check_credentials_ set to _true_ in order to successfully check the routing managers credentials passed on connect)

** `uid`
+
The routing managers UID.

** `gid`
+
The routing managers GID.

* `shutdown_timeout`
+
Configures the time in milliseconds local clients wait for acknowledgement of
their deregistration from the routing manager during shutdown. Defaults to
5000ms.

* `warn_fill_level`
+
The routing manager regulary checks the fill level of the send buffers to its
clients. This variable defines the minimum fill level in percent that leads to
a warning being logged. Defaults to 67.

* `service-discovery`
+
Contains settings related to the Service Discovery of the host application.

** `enable`
+
Specifies whether the Service Discovery is enabled (valid values: _true_,
_false_). The default value is _true_.

** `multicast`
+
The multicast address which the messages of the Service Discovery will be sent
to. The default value is _224.0.0.1_.

** `port`
+
The port of the Service Discovery. The default setting is _30490_.

** `protocol`
+
The protocol that is used for sending the Service Discovery messages (valid
values: _tcp_, _udp_). The default setting is _udp_.

** `initial_delay_min`
+
Minimum delay before first offer message.

** `initial_delay_max`
+
Maximum delay before first offer message.

** `repetitions_base_delay`
+
Base delay sending offer messages within the repetition phase.
 
** `repetitions_max`
+
Maximum number of repetitions for provided services within the 
repetition phase.
 
** `ttl`
+
Lifetime of entries for provided services as well as consumed services and eventgroups.

** `ttl_factor_offers` (optional array)
+
Array which holds correction factors for incoming remote offers. If a value
greater than one is specified for a service instance, the TTL field of the
corresponding service entry will be multiplied with the specified factor. +
Example: An offer of a service is received with a TTL of 3 sec and the TTL
factor is set to 5. The remote node stops offering the service w/o sending a
StopOffer message. The service will then expire (marked as unavailable) 15 seconds
after the last offer has been received.

*** `service`
+
The id of the service.

*** `instance`
+
The id of the service instance.

*** `ttl_factor`
+
TTL correction factor

** `ttl_factor_subscriptions` (optional array)
+
Array which holds correction factors for incoming remote subscriptions. If a
value greater than one is specified for a service instance, the TTL field of the
corresponding eventgroup entry will be multiplied with the specified factor. +
Example: A remote subscription to an offered service is received with a TTL of 3
sec and the TTL factor is set to 5. The remote node stops resubscribing to the
service w/o sending a StopSubscribeEventgroup message. The subscription will
then expire 15 seconds after the last resubscription has been received.

*** `service`
+
The id of the service.

*** `instance`
+
The id of the service instance.

*** `ttl_factor`
+
TTL correction factor

** `cyclic_offer_delay`
+
Cycle of the OfferService messages in the main phase.


** `request_response_delay`
+
Minimum delay of a unicast message to a multicast message for
provided services and eventgroups.
+

** `offer_debounce_time`
+
Time which the stack collects new service offers before they enter the
repetition phase. This can be used to reduce the number of
sent messages during startup. The default setting is _500ms_.
+

** `max_remote_subscribers`
+
Limit the number of possible remote subscribers from same remote IP address
to an eventgroup provided by a service/instance if the remote subscriber uses
different ports for its subscriptions. The default setting is _3_.
+

//Watchdog
* anchor:config-watchdog[]`watchdog` (optional)
+
The Watchdog sends periodically pings to all known local clients.
If a client isn't responding within a configurred time/amount of pongs
the watchdog deregisters this application/client.
If not configured the watchdog isn't activated.
+
** `enable`
+
Specifies whether the watchdog is enabled or disabled.
(valid values: _true, false_), (default is _false_).
+
** `timeout`
+
Specifies the timeout in ms the watchdog gets activated if a ping
isn't answered with a pong by a local client within that time.
(valid values: _2 - 2^32_), (default is _5000_ ms).
+
** `allowed_missing_pongs`
+
Specifies the amount of allowed missing pongs.
(valid values: _1 - 2^32_), (default is _3_ pongs).
+
//CAPI-Selective Broadcasts support
* anchor:config-supports_selective_broadcasts[]`supports_selective_broadcasts` (optional array)
+
This nodes allow to add a list of IP addresses on which CAPI-Selective-Broadcasts feature is supported.
If not specified the feature can't be used and the subscription behavior of the stack is same as with
normal events.
+
** `address`
+
Specifies an IP-Address (in IPv4 or IPv6 notation) on which the "selective"-feature is supported.
Multiple addresses can be configured.

Security
--------
vsomeip has a security implementation based on UNIX credentials.
If activated every local connection is authenticated during connect using the standard UNIX credential passing mechanism.
During authentication a client transfers its client identifier together with its credentials (UID / GID) to the server which is then matched against the configuration.
If received credentials don't match the policy the socket will be immediately closed by the server and an message is logged.
If accepted the client identifier is bound to the receiving socket and can therefore be used to do further security checks on incoming messages (vsomeip messages as well as internal commands).

In general clients can be configured to be allowed/denied to request (means communicate with) and offer different service instances.
Every incoming vsomeip message (request/response/notification) as well as offer service requests or local subscriptions are then checked against the policy.
If an incoming vsomeip message or another operation (e.g. offer/subscribe) violates the configured policies it is skipped and a message is logged.

Furthermore if an application receives informations about other clients/services in the system, it must be received from the authenticated routing manager. 
This is to avoid malicious applications faking the routing manager and therefore being able to wrongly inform other clients about services running on the system.
Therefore, whenever the "security" tag is specified, the routing manager (e.g. routingmanagerd/vsomeipd) must be a configured application with a fixed client identifier. 
See chapter "Configuration File Structure" on how to configure an application to use a specific client identifier.

Credential passing is only possible via Unix-Domain-Sockets and therefore only available for local communication.
However if security is activated method calls from remote clients to local services are checked as well which means remote clients needs to be explicitly allowed.
Such a policy looks same in case for local clients except the _credentials_ tag can be skipped.

Security configuration
~~~~~~~~~~~~~~~~~~~~~~
The available configuration switches for the security feature are: 

// Security
* anchor:config-policy[]`security` (optional)
+
If specified the credential passing mechanism is activated. However no credential or security checks are done as long as _check_credentials_ isn't set to _true_, but the routing manager client ID must be configured if security tag is specified and shall not be set to 0x6300.
If _check_credentials_ is set to _true_, the routing managers UID and GID needs to be specified using _routing-credentials_ tag.

** `check_credentials` (optional)
+
Specifies whether security checks are active or not. This includes credentials checks on connect as well as all policies checks configured in follow.
(valid values: _true, false_), (default is _false_).

** `allow_remote_clients` (optional)
+
Specifies whether incoming remote requests / subscriptions are allowed to be sent to a local proxy / client.
If not specified, all remote requests / subscriptions are allowed to be received by default.
(valid values are 'true' and 'false')

** `policies` (array)
+
Specifies the security policies. Each policy at least needs to specify _allow_ or _deny_.

*** `credentials`
+
Specifies the credentials for which a security policy will be applied.
If _check_credentials_ is set to _true_ the credentials of a local application needs to be specified correctly to ensure local socket authentication can succeed.

**** `uid`
+
Specifies the LINUX user id of the client application as decimal number.
As a wildcard "any" can be used.

**** `gid`
+
Specifies the LINUX group id of the client application as decimal number.
As a wildcard "any" can be used.

**** `allow` / `deny` (optional)
+
Specifies whether the LINUX user and group ids are allowed or denied for the policy.

. `uid` (array)
+
Specifies a list of LINUX user ids. These may either be specified as decimal numbers or as ranges. Ranges
are specified by the first and the last valid id (see example below).

. `gid` (array)
+
Specifies a list of LINUX group ids. These may either be specified as decimal numbers or as ranges. Ranges
are specified by the first and the last valid id (see example below).

*** `allow` / `deny`
+
This tag specifies either _allow_ or _deny_ depending on white- or blacklisting is needed. Specifing _allow_ and _deny_ entries in one policy is therefore not allowed.
With _allow_ a whitelisting of what is allowed can be done which means an empty _allow_ tag implies everything is denied.
With _deny_ a blacklisting of what is allowed can be done which means an empty _deny_ tag implies everything is allowed.

**** `requests` (array)
+
Specifies a set of service instance pairs which the above client application using the credentials above is allowed/denied to communicate with.

. `service`
+
Specifies a service for the _requests_.

. `instance` (deprecated)
+
Specifies a instance for the _requests_
As a wildcard "any" can be used which means a range from instance ID 0x01 to 0xFFFF
which also implies a method ID range from 0x01 to 0xFFFF.

. `instances` (array)
+
Specifies a set of instance ID and method ID range pairs which are allowed/denied to communicate with.
If the `ids` tag below is not used to specify allowed/denied requests on method ID level one can also
only specify a a set of instance ID ranges which are allowed/denied to be requested analogous to the
allowed/denied `offers` section.
If no method IDs are specified, the allowed/denied methods are by default a range from 0x01 to 0xFFFF.

.. `ids`
+
Specifies a set of instance ID ranges which are allowed/denied to communicate with.
It is also possible to specify a single instance ID as array element without giving an upper / lower range bound.
As a wildcard "any" can be used which means a range from instance ID 0x01 to 0xFFFF.
+
`first` - The lower bound of the instance range.
+
`last`  - The upper bound of the instance range.

.. `methods`
+
Specifies a set of method ID ranges which are allowed/denied to communicate with.
It is also possible to specify a single method ID as array element without giving an upper / lower range bound.
As a wildcard "any" can be used which means a range from method ID 0x01 to 0xFFFF.
+
`first` - The lower bound of the method range.
+
`last`  - The upper bound of the method range.

**** `offers` (array)
+
Specifies a set of service instance pairs which are allowed/denied to be offered by the client application using the credentials above.

. `service`
+
Specifies a service for the _offers_.

. `instance` (deprecated)
+
Specifies a instance for the _offers_
As a wildcard "any" can be used which means a range from instance ID 0x01 to 0xFFFF.

. `instances` (array)
+
Specifies a set of instance ID ranges which are allowed/denied to be offered by the client application using the credentials above.
It is also possible to specify a single instance ID as array element without giving an upper / lower range bound.
As a wildcard "any" can be used which means a range from instance ID 0x01 to 0xFFFF.

.. `first`
+
The lower bound of the instance range.

.. `last`
+
The upper bound of the instance range.

<<<

Security configuration example
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[source, bash]
----
...
"security" :
{
    ...
    "policies" :
    [
        {
            ...
            "credentials" :
            {
                "uid" : "44",
                "gid" : "any"
             },
             "allow" :
             [
                 "requests" :
                 [
                     {
                         "service" : "0x6731",
                         "instance" : "0x0001"
                     }
                 ]
             ]
         },
         {
            "credentials" :
            {
                "deny" :
                [
                    {
                        "uid" : [ "1000", { "first" : "1002", "last" : "max" }],
                        "gid" : [ "0", { "first" : "100", "last" : "243" }, "300"]
                    },
                    {
                        "uid" : ["55"],
                        "gid" : ["55"]
                    }
                 ]
             },
             "allow" :
             [
                 "offers" :
                 [
                     {
                        "service" : "0x6728",
                        "instances" : [ "0x0001", { "first" : "0x0003", "last" : "0x0007" }, "0x0009"]
                     },
                     {
                        "service" : "0x6729",
                        "instances" : ["0x88"]
                     },
                     {
                        "service" : "0x6730",
                        "instance" : "any"
                     }
                 ],
                 "requests" :
                 [
                     {
                         "service" : "0x6732",
                         "instances" :
                         [
                             {
                                 "ids" : [ "0x0001", { "first" : "0x0003", "last" : "0x0007" }],
                                 "methods" : [ "0x0001", "0x0003", { "first" : "0x8001", "last" : "0x8006" } ]
                             },
                             {
                                 "ids" : [ "0x0009" ],
                                 "methods" : "any"
                             }
                         ]
                     },
                     {
                        "service" : "0x6733",
                        "instance" : "0x1"
                     },
                     {
                        "service" : "0x6733",
                        "instances" : [ "0x0002", { "first" : "0x0003", "last" : "0x0007" }, "0x0009"]
                     }
                 ]
             ]
         }
     ]
}
----

The config/ folder contains some addition vsomeip configuration files to run the vsomeip
examples with activated security checks.
Additionally there's a security test in the `test/` subfolder which can be used
for further reference. +
They give a basic overview how to use the security related configuration tags described 
in this chapter to run a simple request/response or subscribe/notify example locally or
remotely.

Audit Mode
~~~~~~~~~~
vsomeip's security implementation can be put in a so called 'Audit Mode' where
all security violations will be logged but allowed. This mode can be used to
build a security configuration.

To activate the 'Audit Mode' the 'security' object has to be included in the
json file but the 'check_credentials' switch has to be set to false. For
example:

[source, bash]
----
    [...]
    "services" :
    [
        [...]
    ],
    "security" :
    {
        "check_credentials" : "false"
    },
    "routing" : "service-sample",
    [...]
----

Autoconfiguration
-----------------
vsomeip supports the automatic configuration of client identifiers and the routing.
The first application that starts using vsomeip will automatically become the
routing manager if it is _not_ explicitly configured. The client identifiers
are generated from the diagnosis address that can be specified by defining
DIAGNOSIS_ADDRESS when compiling vsomeip. vsomeip will use the diagnosis address
as the high byte and enumerate the connecting applications within the low byte
of the client identifier.

Autoconfiguration of client identifiers isn't meant to be used together with vsomeip Security.
Every client running locally needs to have at least its own credentials configured when security is activated to ensure the credential checks can pass.
Practically that means if a client requests its identifier over the autoconfiguration for which no credentials are configured (at least it isn't known which client identifier is used beforehand) it is impossible for that client to establish a connection to a server endpoint.
However if the credentials for all clients are same it's possible to configure them for the overall (or DIAGNOSIS_ADDRESS) client identifier range to mix autoconfiguration together with activated security.

routingmanagerd
---------------
The routingmanagerd is a minimal vsomeip application intended to offer routing
manager functionality on a node where one system wide configuration file is
present. It can be found in the examples folder.

Example: Starting the daemon on a system where the system wide configuration is
stored under `/etc/vsomeip.json`:
[source, bash]
----
VSOMEIP_CONFIGURATION=/etc/vsomeip.json ./routingmanagerd
----

When using the daemon it should be ensured that:

* In the system wide configuration file the routingmanagerd is defined as
  routing manager, meaning it contains the line `"routing" : "routingmanagerd"`.
  If the default name is overridden the entry has to be adapted accordingly.
  The system wide configuration file should contain the information about all
  other offered services on the system as well.
* There's no other vsomeip configuration file used on the system which contains
  a `"routing"` entry. As there can only be one routing manager per system.


vsomeip Hello World
-------------------
In this paragraph a Hello World program consisting out of a client and a service
is developed. The client sends a message containing a string to the service.
The service appends the received string to the string `Hello` and sends it back
to the client.
Upon receiving a response from the service the client prints the payload of the
response ("Hello World").
This example is intended to be run on the same host.

All files listed here are contained in the `examples\hello_world` subdirectory.

Build instructions
~~~~~~~~~~~~~~~~~~
The example can build with its own CMakeFile, please compile the vsomeip stack
before hand as described in <<Compilation>>. Then compile the example starting
from the repository root directory as followed:
[source, bash]
----
cd examples/hello_world
mkdir build
cd build
cmake ..
make
----

Starting and expected output
~~~~~~~~~~~~~~~~~~~~~~~~~~~

Starting and expected output of service
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[source, bash]
----
$ VSOMEIP_CONFIGURATION=../helloworld-local.json \
  VSOMEIP_APPLICATION_NAME=hello_world_service \
  ./hello_world_service
2015-04-01 11:31:13.248437 [info] Using configuration file: ../helloworld-local.json
2015-04-01 11:31:13.248766 [debug] Routing endpoint at /tmp/vsomeip-0
2015-04-01 11:31:13.248913 [info] Service Discovery disabled. Using static routing information.
2015-04-01 11:31:13.248979 [debug] Application(hello_world_service, 4444) is initialized.
2015-04-01 11:31:22.705010 [debug] Application/Client 5555 got registered!
----

Starting and expected output of client
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[source, bash]
----
$ VSOMEIP_CONFIGURATION=../helloworld-local.json \
  VSOMEIP_APPLICATION_NAME=hello_world_client \
  ./hello_world_client
2015-04-01 11:31:22.704166 [info] Using configuration file: ../helloworld-local.json
2015-04-01 11:31:22.704417 [debug] Connecting to [0] at /tmp/vsomeip-0
2015-04-01 11:31:22.704630 [debug] Listening at /tmp/vsomeip-5555
2015-04-01 11:31:22.704680 [debug] Application(hello_world_client, 5555) is initialized.
Sending: World
Received: Hello World
----

CMakeFile
~~~~~~~~~

[source, bash]
----
include::../examples/hello_world/CMakeLists.txt[]
----

Configuration File For Client and Service
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

[source, bash]
----
include::../examples/hello_world/helloworld-local.json[]
----

Service
~~~~~~~

[source, bash]
----
include::../examples/hello_world/hello_world_service.cpp[]
----

The service example results in the following program execution:

:numbered!:

[float]

Main
^^^^^

. __main()__
+
First the application is initialized. After the initialization is
finished the application is started.

[float]
Initialization
^^^^^^^^^^^^^^

[start=2]
. __init()__
+
The initialization contains the registration of a message
handler and an event handler.
+
The message handler declares a callback (__on_message_cbk__) for messages that
are sent to the specific service (specifying the service id, the service
instance id and the service method id).
+
The event handler declares a callback (__on_event_cbk__) for events that occur.
One event can be the successful registration of the application at the runtime.

[float]
Start
^^^^^

[start=3]
. __start()__
+
The application will be started. This function only returns when the application
will be stopped.

[float]
Callbacks
^^^^^^^^^

[start=4]
. __on_state_cbk()__
+
This function is called by the application when an state change occurred. If
the application was successfully registered at the runtime then the specific
service is offered.

. __on_message_cbk()__
+
This function is called when a message/request from a client for the specified
service was received.
+
First a response based upon the request is created.
Afterwards the string 'Hello' will be concatenated with the payload of the
client's request.
After that the payload of the response is created. The payload data is set with
the previously concatenated string.
Finally the response is sent back to the client and the application is stopped.

[float]
Stop
^^^^

[start=6]
. __stop()__
+
This function stops offering the service, unregister the message and the event
handler and shuts down the application.

:numbered:

Client
~~~~~~
[source, bash]
----
include::../examples/hello_world/hello_world_client.cpp[]
----

The client example results in the following program execution:

:numbered!:

[float]
Main
^^^^^

. __main()__
+
First the application is initialized. After the initialization is finished the
application is started.

[float]
Initialization
^^^^^^^^^^^^^^

[start=2]
. __init()__
+
The initialization contains the registration of a message handler, an event
handler and an availability handler.
+
The event handler declares again a callback (__on_state_cbk__) for state changes
that occur.
+
The message handler declares a callback (__on_message_cbk__) for messages that
are received from any service, any service instance and any method.
+
The availability handler declares a callback (__on_availability_cbk__) which is
called when the specific service is available (specifying the service id and the
service instance id).

[float]
Start
^^^^^

[start=3]
. __start()__
+
The application will be started. This function only returns when the application
will be stopped.

[float]
Callbacks
^^^^^^^^^

[start=4]
. __on_state_cbk()__
+

This function is called by the application when an state change occurred. If the
application was successfully registered at the runtime then the specific service
is requested.

. __on_availability_cbk()__
+
This function is called when the requested service is available or no longer
available.
+
First there is a check if the change of the availability is related to the
'hello world service' and the availability changed to true.
If the check is successful a service request is created and the appropriate
service information are set (service id, service instance id, service method
id).
After that the payload of the request is created. The data of the payload is
'World' and will be set afterwards.
Finally the request is sent to the service.

. __on_message_cbk()__
+
This function is called when a message/response was received.
If the response is from the requested service, of type 'RESPONSE' and the return
code is 'OK' then the payload of the response is printed. Finally the
application is stopped.

[float]
Stop
^^^^

[start=7]
. __stop()__
+
This function unregister the event and the message handler and shuts down the
application.

:numbered:

Trace Connector
---------------
anchor:traceconnector[]

Overview/Prerequisites
~~~~~~~~~~~~~~~~~~~~~~

The Trace Connector is used to forward the internal messages that are sent over
the Unix Domain Sockets to DLT. +
Thus, it requires that DLT is installed and the DLT module can be found in the
context of CMake.

Configuration
~~~~~~~~~~~~~

Static Configuration
^^^^^^^^^^^^^^^^^^^^

The Trace Connector can be configured statically over the 
<<config-tracing,JSON configuration file>>. +

[float]
Example 1 (Minimal Configuration)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

[source, bash]
----
{
    ...

    "tracing" :
    {
        "enable" : "true"
    },

    ...
----

This is the minimal configuration of the Trace Connector. This just enables the
tracing and all of the sent internal messages will be traced/forwarded to DLT.

[float]
Example 2 (Using Filters)
^^^^^^^^^^^^^^^^^^^^^^^^^

[source, bash]
----
{
    ...

    "tracing" :
    {
        "enable" : "true",
        "channels" : 
        [
            {
                "name" : "My channel",
                "id" : "MC"
            }
        ],
        "filters" : [
            {
                "channel" : "MC",
                "matches" : [ { "service" : "0x1234", "instance" : "any", "method" : "0x80e8" } ],
                "type" : "positive"
            }
        ]
    },

    ...
----

As it is a positive filter, the example filter ensures that only messages 
representing method '0x80e8' from instances of service '0x1234' will be
forwarded to the DLT. If it was specified as a negative filter, all messages
except messages representing method '0x80e8' from instances of service
'0x1234' would be forwarded to the DLT.

The general filter rules are:

* The default filter is a positive filter for all messages.
* The default filter is active on a channel as long as no other positive
filter is specified.
* Negative filters block matching messages. Negative filters overrule
positive filters. Thus, as soon as a messages matches a negative filter it
will not be forwarded.
* The identifier '0xffff' is a wildcard that matches any service, instance or method.
The keyword 'any' can be used as a replacement for '0xffff'.
* Wildcards must not be used within range filters.

Dynamic Configuration
^^^^^^^^^^^^^^^^^^^^^

The Trace Connector can also be configured dynamically over its interfaces.
You need to include '<vsomeip/trace.hpp>' to access its public interface.

[float]
Example:
^^^^^^^^

[source, bash]
----
    // get trace connector
    std::shared_ptr<vsomeip::trace::connector> its_connector 
	= vsomeip::trace::connector::get();

    // add channel
    std::shared_ptr<vsomeip::trace::channel> its_channel
	= its_connector->create_channel("MC", "My channel");

    // add filter rule
    vsomeip::trace::match_t its_match
        = std::make_tuple(0x1234, 0xffff, 0x80e8);    
    vsomeip::trace::filter_id_t its_filter_id 
	= its_channel->add_filter(its_match, true);

    // init trace connector    
    its_connector->init();

    // enable trace connector
    its_connector->set_enabled(true);

    // remove the filter
    its_channel->remove_filter(its_filter_id);
----

anchor:npdu[]

vsomeip nPDU feature
------------------

This is the add-on documentation for the nPDU feature, aka. _Zugverfahren_.

The nPDU feature can be used to reduce network load as it enables the vsomeip
stack to combine multiple vsomeip messages in one single ethernet frame.

Some general _important_ things regarding the nPDU feature first:

* Due to its nature the nPDU feature trades lower network load for speed.
* As the nPDU feature requires some settings which are not transmitted
through the service discovery, it's *not* sufficient anymore to have an json
file without a "services" section on the client side.
* As the client- and server-endpoints of a node are managed by the routing
 manager (which is the application entered at "routing" in the json file)
 the nPDU feature settings *always* have to be defined in the json file used by
 the application acting as routing manager.
* The nPDU feature timings are defined in milliseconds.
* Node internal communication over UNIX domain sockets is not affected by the
  nPDU feature.
* If the debounce times configuration for a method in the json file is missing
  or incomplete the default values are used: 2ms debounce time and 5ms max
  retention time. The global default values can be overwritten via the
  `npdu-default-timings` json object.

Configuration
~~~~~~~~~~~~~
There are two parameters specific for the nPDU feature:

* *debounce time*: minimal time between sending a message to the same method of
  a remote service over the same connection (src/dst address + src/dst port).
* *max retention time*: the maximum time which a message to the same method of a
  remote service over the same connection (src/dst address + src/dst port) is
  allowed to be buffered on sender side.

For more information please see the corresponding requirement documents.


The nPDU feature specific settings are configured in the json file in the 
"services" section on service level in a special _debounce-times_ section:

[source, bash]
----
[...]
"services":
[
    {
        "service":"0x1000",
        "instance":"0x0001",
        "unreliable":"30509",
        "debounce-times":
        {
            // nPDU feature configuration for this
            // service here
        }
    }
],
[...]
----

Additionally nPDU default timings can be configured globally.

The global default timings can be overwritten via the `npdu-default-timings`
json object. For example the following configuration snippet shows how to set
all default timings to zero:

[source, bash]
----
{
    "unicast":"192.168.1.9",
    [...]
    "npdu-default-timings" : {
        "debounce-time-request" : "0",
        "debounce-time-response" : "0",
        "max-retention-time-request" : "0",
        "max-retention-time-response" : "0"
    },
    "routing":"[...]",
    "service-discovery": { [...] }
}
----


Example 1: One service with one method offered over UDP
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

* The service is hosted on IP: 192.168.1.9.
* The service is offered on port 30509 via UDP.
* The service has the ID 0x1000
* The method has the ID 0x0001
* The client accesses the service from IP: 192.168.1.77

Service side
++++++++++++

* Debounce time for responses should have a:
** debounce time of 10 milliseconds
** maximum retention time of 100 milliseconds

[source, bash]
----
{
    "unicast":"192.168.1.9",
    "logging": { [...] },
    "applications": [ [...] ],
    "services":
    [
        {
            "service":"0x1000",
            "instance":"0x0001",
            "unreliable":"30509",
            "debounce-times":
            {
                "responses": {
                    "0x1001" : {
                        "debounce-time":"10",
                        "maximum-retention-time":"100"
                    }
                }
            }
        }
    ],
    "routing":"[...]",
    "service-discovery": { [...] }
}
----
Client side
++++++++++++

* Debounce time for requests to the service on 192.168.1.9 should have a:
** debounce time of 20 milliseconds
** maximum retention time of 200 milliseconds

[source, bash]
----
{
    "unicast":"192.168.1.77",
    "logging": { [...] },
    "applications": [ [...] ],
    "services":
    [
        {
            "service":"0x1000",
            "instance":"0x0001",
            "unicast":"192.168.1.9", // required to mark service as external
            "unreliable":"30509",
            "debounce-times":
            {
                "requests": {
                    "0x1001" : {
                        "debounce-time":"20",
                        "maximum-retention-time":"200"
                    }
                }
            }
        }
    ],
    "routing":"[...]",
    "service-discovery": { [...] }
}
----

Example 2: One service with two methods offered over UDP
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

* The service is hosted on IP: 192.168.1.9.
* The service is offered on port 30509 via UDP.
* The service has the ID 0x1000
* The method has the ID 0x0001
* The second method has the ID 0x0002
* The client accesses the service from IP: 192.168.1.77

Service side
++++++++++++

* Debounce time for responses should have a:
** debounce time of 10 milliseconds for method 0x1001 and 20 for 0x1002
** maximum retention time of 100 milliseconds for method 0x1001 and 200 for 0x1002

[source, bash]
----
{
    "unicast":"192.168.1.9",
    "logging": { [...] },
    "applications": [ [...] ],
    "services":
    [
        {
            "service":"0x1000",
            "instance":"0x0001",
            "unreliable":"30509",
            "debounce-times":
            {
                "responses": {
                    "0x1001" : {
                        "debounce-time":"10",
                        "maximum-retention-time":"100"
                    },
                    "0x1002" : {
                        "debounce-time":"20",
                        "maximum-retention-time":"200"
                    }
                }
            }
        }
    ],
    "routing":"[...]",
    "service-discovery": { [...] }
}
----
Client side
++++++++++++

* Debounce time for requests to the service on 192.168.1.9 should have a:
** debounce time of 20 milliseconds for method 0x1001 and 40 for 0x1002
** maximum retention time of 200 milliseconds for method 0x1001 and 400 for 0x1002

[source, bash]
----
{
    "unicast":"192.168.1.77",
    "logging": { [...] },
    "applications": [ [...] ],
    "services":
    [
        {
            "service":"0x1000",
            "instance":"0x0001",
            "unicast":"192.168.1.9", // required to mark service as external
            "unreliable":"30509",
            "debounce-times":
            {
                "requests": {
                    "0x1001" : {
                        "debounce-time":"20",
                        "maximum-retention-time":"200"
                    },
                    "0x1002" : {
                        "debounce-time":"40",
                        "maximum-retention-time":"400"
                    }
                }
            }
        }
    ],
    "routing":"[...]",
    "service-discovery": { [...] }
}
----

Example 3: One service with one method offered over UDP and TCP
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

* The service is hosted on IP: 192.168.1.9.
* The service is offered on port 30509 via UDP.
* The service is offered on port 30510 via TCP.
* The service has the ID 0x1000
* The method has the ID 0x0001
* The client accesses the service from IP: 192.168.1.77

Service side
++++++++++++

* Debounce time for responses should have a:
** debounce time of 10 milliseconds
** maximum retention time of 100 milliseconds
** TCP should use the same settings as UDP

[source, bash]
----
{
    "unicast":"192.168.1.9",
    "logging": { [...] },
    "applications": [ [...] ],
    "services":
    [
        {
            "service":"0x1000",
            "instance":"0x0001",
            "unreliable":"30509",
            "reliable":
            {
                "port":"30510",
                "enable-magic-cookies":"false"
            },
            "debounce-times":
            {
                "responses": {
                    "0x1001" : {
                        "debounce-time":"10",
                        "maximum-retention-time":"100",
                    }
                }
            }
        }
    ],
    "routing":"[...]",
    "service-discovery": { [...] }
}
----
Client side
++++++++++++

* Debounce time for requests to the service on 192.168.1.9 should have a:
** debounce time of 20 milliseconds
** maximum retention time of 200 milliseconds
** TCP should use the same settings as UDP

[source, bash]
----
{
    "unicast":"192.168.1.77",
    "logging": { [...] },
    "applications": [ [...] ],
    "services":
    [
        {
            "service":"0x1000",
            "instance":"0x0001",
            "unicast":"192.168.1.9", // required to mark service as external
            "unreliable":"30509",
            "reliable":
            {
                "port":"30510",
                "enable-magic-cookies":"false"
            },
            "debounce-times":
            {
                "requests": {
                    "0x1001" : {
                        "debounce-time":"20",
                        "maximum-retention-time":"200",
                    }
                }
            }
        }
    ],
    "routing":"[...]",
    "service-discovery": { [...] }
}
----


anchor:someiptp[]

SOME/IP TP
----------
With SOME/IP Transport Protocol (TP) it is possible to transport messages which
exceed the UDP payload size limit of 1400 byte. If enabled the message is
segmented and send in multiple UDP datagrams.

Example configuration:

* Service 0x1111/0x1 is hosted on 192.168.0.1 on UDP port 40000
* Client is running on 192.168.0.100
* The service has two methods with ID: 0x1 and 0x2 which require large requests
  and large responses. Additionally the service offers a field with ID 0x8001
  which requires a large payloads as well.
* The maximum payload size on service side should be limited to 5000 bytes.

Configuration service side:
[source, bash]
----
{
    "unicast":"192.168.0.1",
    "logging": { [...] },
    "applications": [ [...] ],
    "services":
    [
        {
            "service":"0x1000",
            "instance":"0x1",
            "unreliable":"40000",
            "someip-tp": {
                "service-to-client": [
                    "0x1", "0x2", "0x8001"
                ]
            }
        }
    ],
    "max-payload-size-unreliable" : "5000",
    "routing":"[...]",
    "service-discovery": { [...] }
}
----

Configuration client side:

[source, bash]
----
{
    "unicast":"192.168.0.100",
    "logging": { [...] },
    "applications": [ [...] ],
    "services":
    [
        {
            "service":"0x1000",
            "instance":"0x1",
            "unicast":"192.168.0.1", // required to mark service as external
            "unreliable":"40000", // required to mark service as external
            "someip-tp": {
                "client-to-service": [
                    "0x1", "0x2"
                ]
            }
        }
    ],
    "routing":"[...]",
    "service-discovery": { [...] }
}
----

Tools
-----

vsomeip_ctrl
~~~~~~~~~~~~
anchor:vsomeip_ctrl[]
`vsomeip_ctrl` is a small utility which can be used to send SOME/IP messages
from the commandline. If a response arrives within 5 seconds the response will
be printed.

* It can be build via `vsomeip_ctrl` make target (`make vsomeip_ctrl`).
* The instance id of the target service has to be passed in hexadecimal
  notation.
* The complete message has to be passed in hexadecimal notation.
* See the `--help` parameter for available options.
* If `vsomeip_ctrl` is used to send messages to a remote service and no
 `routingmanagerd` is running on the local machine, make sure to pass a json
 configuration file where `vsomeip_ctrl` is set as routing manager via
 environment variable.
* If `vsomeip_ctrl` is used to send messages to a local service and no
 `routingmanagerd` is running on the local machine, make sure to use the same json
 configuration file as the local service.

Example: Calling method with method id 0x80e8 on service with service id 0x1234,
instance id 0x5678:
[source, bash]
----
./vsomeip_ctrl --instance 5678 --message 123480e800000015134300030100000000000009efbbbf576f726c6400
----

Example: Sending a message to service with service id 0x1234, instance id
0x5678 and method id 0x0bb8 via TCP
[source, bash]
----
./vsomeip_ctrl --tcp --instance 5678 --message 12340bb8000000081344000101010000
----