File: PROTOCOL

package info (click to toggle)
dbeacon 0.3.9.3-2
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd, wheezy
  • size: 304 kB
  • ctags: 538
  • sloc: cpp: 2,345; perl: 1,549; sh: 68; makefile: 40
file content (97 lines) | stat: -rw-r--r-- 2,526 bytes parent folder | download | duplicates (5)
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
Below is described the current dbeacon protocol version 1.

All dbeacon messages have a common header of 4 bytes. This header includes a
magic value, the protocol version and message type.

-------------------------
|  0  |  1  |  2  |  3  |
-------------------------
|   0xbeac  |  1  |  T  |
-------------------------

There are two types of messages: Probes (0) and Reports (1).

Probes
------

Probes are very simple packets which are used to gather statistics about hosts.

-------------------------
|  0  |  1  |  2  |  3  |
-------------------------
|   0xbeac  |  1  |  0  |
-------------------------
|    sequence number    |
-------------------------
|       timestamp       |
-------------------------

Reports
-------

Reports are used to report local stats to other beacons, advertise known
addr<->name mappings, etc.

-------------------------
|  0  |  1  |  2  |  3  |
-------------------------
|   0xbeac  |  1  |  1  |
-------------------------
| TTL |
-------

Following this initial header, several blocks may follow, encoded using a simple
TLV format. TTL is the original TTL when the report was sent.

Each TLV block is started by the TLV header, which consists of 2 bytes, one for
the block type, the second for the block length. The following types are
defined as of current date:

enum {
	T_BEAC_NAME = 'n',
	T_ADMIN_CONTACT = 'a',
	T_SOURCE_INFO = 'I',
	T_ASM_STATS = 'A',
	T_SSM_STATS = 'S'
};

T_BEAC_NAME and T_ADMIN_CONTACT are strings, non-zero terminated.

T_SOURCE_INFO has the following format:

-------------------------
|  0  |  1  |  2  |  3  |
-------------------------
|       source addr     |
-------------------------
|         (cont)        |
-------------------------
|         (cont)        |
-------------------------
|         (cont)        |
-------------------------
|   port    |
-------------

Following addr/port, other TLVs may be encoded inside the T_SOURCE_INFO. These
include T_BEAC_NAME, T_ADMIN_CONTACT and T_{ASM,SSM}_STATS.

T_ASM_STATS and T_SSM_STATS have the same format, only different types:

-------------------------
|  0  |  1  |  2  |  3  |
-------------------------
|     lasttimestamp     |
-------------------------
|          age          |
-------------------------
| TTL |    avgdelay     |
-------------------------
| ... |    avgjitter    |
-------------------------
| ... | loss| dup | ooo |
-------------------------

avgdelay and avgjitter are encoded using IEEE 754 single floating point format.
loss, dup and ooo have values between 0 and 255.