-
Notifications
You must be signed in to change notification settings - Fork 70
/
PROTOCOLS
258 lines (160 loc) · 7.79 KB
/
PROTOCOLS
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
Protocols spoken by APRX
There are a few protocols spoken by the APRX:
1) APRS-IS interchange
2) Proprietary monitoring via shared memory segment
3) APRX-APRXC linkage
APRS-IS interchange
This protocol is fairly simple.
http://wiki.ham.fi/IGate_properties
APRS iGate Common Properties
Communication is over TCP streams of text lines terminating
at CR+LF pair. No CR or LF is permitted inside the text
line, however.
APRS-IS user authentication:
user USERID pass PASSCODE vers VERS STRINGS \
filter FILTER STRINGS
where 'USERID' is uppercase callsign plus possible "-SSID" tail.
The 'PASSCODE' is calculated with semi-secret algorithm out of
the uppercase callsign characters without '-' and SSID tail.
The 'VERS STRINGS' are free to be anything, except string 'filter',
and the 'FILTER STRINGS' are explained in document:
http://www.aprs-is.net/ServerCmds.htm
http://www.aprs-is.net/javAPRSSrvr/javaprsfilter.htm
Messages:
Lines beginning with '#' character are line noise (usually
something that the server replies..)
After successfull login, communication carries "TNC2" format
APRS messages. Namely text encoding of AX.25 UI frames in
what became known as "TNC2 monitor style":
SOURCE>DESTIN:payload
SOURCE>DESTIN,VIA,VIA:payload
The SOURCE, DESTIN, and VIA fields are AX.25 address fields,
and have "-SSID" value annexed if the SSID is not zero.
Also in VIA-fields, if the "HAS BEEN DIGIPEATED" bit is set
(AX.25 v2 protocol feature) a star ('*') character is appended.
VIA-fields are separated by comma (',') from DESTIN, and each
other.
A double-colon (':') separates address data from payload.
The payload is passed _AS_IS_ without altering any message
content bytes, however ending at first CR or LF character
encountered in the packet.
APRS-RX iGate Basic Rules
Packets with source addresses: NOCALL*, N0CALL*, WIDE*, TRACE*,
TCP*, are dropped and not relayed to APRS-IS.
Packets with VIA addresses: RFONLY, NOGATE, TCPIP, TCPXX are not
to be relayed to APRS-IS. Sometimes the VIA fields have '*' on
their tails.
Packets with payload beginning with character '?' are not to be
relayed to APRS-IS.
Packets with payload beginning with character '}' are so called
3rd-party frames, and they are to be re-processed starting from
character following the '}' character.
When packet is sent to APRS-IS, the address gets appended
either a "q-construct", or equivalent:
,qAR,gatecallsign
,gatecallsign,I
The "qAR" et.al. are explained at: http://www.aprs-is.net/q.aspx
APRS-TX iGate has additional rules:
All rules:
http://www.aprs-is.net/IGateDetails.aspx
Specifically forbidden to relay to RF is "qAX", maybe some others too.
(See: http://www.aprs-is.net/q.aspx)
If the packet VIA-path received from APRS-IS contains TCPXX,
NOGATE, RFONLY, then the packet is to be dropped, and not relayed
to radio network. (Note: TCPIP is permitted.)
Packets relayed from APRS-IS to radio must use so called 3rd-party
format. Signature is '}' character.
Rules on re-sending recently heard packets are a bit more complex,
and are covered adequately in above referenced document.
Proprietary monitoring mechanism
There is a tool for monitoring channel activity.
See aprx-stat(8)
APRX-APRXC linkage
(For a feature in planning...)
With introduction of APRX-Cluster (APRXC) mode, multiple APRX
instances are used as remote attachments to TNCs, and one central
system runs more complicated business logic deciding which messages
to pass where, what beacons to send, etc. The central business-logic
server runs also connection with APRS-IS, and all things that it
implies.
Actually the APRX-Cluster-Server is APRX program version with
embedded Perl for business logic. Some very flexibly configurable
APRS digi software has practical limitations of what the config
can do.
Environmental pre-requisite: APRXC and APRX nodes are in NTP sync!
The Protocol:
Communication is of text lines over TCP stream, they are canonic
Internet format ending with CRLF pairs. However no embedded CR,
nor LF is permitted.
(detail under study: UDP frames, or SCTP SEQPACKET ?)
The protocol is bidirectional, and is intended to be connected from
edge systems to cluster server. Upon receiving a connection the
server sends a greeting containing time-varying string. This will
be used by the connecting party to do authentication in APOP-style.
The timestamps in this protocol are "U" format:
sprintf(timestamp, "U%ld", (long)time(NULL));
which is to say, integer presentation of UNIX internal time in whole
seconds.
In following ">>" mean data sent by central system and received by
the edge, whereas "<<" means data sent by edge system to central
system.
<< (connection formation from edge to the server)
>> <timestamp> Hello <++counter> some greeting string
<< <timestamp> LOGIN <userid> <authenticator>
>> <timestamp> OK
<< <timestamp> SERVICE <ifname> <speed> { RX | TX <areaspecifiers> }
>> <timestamp> OK
The <authenticator> is formed by hex (lower case) encoding of 16 byte
MD5() checksum over the whole greeting string (sans CRLF), plus userid,
plus shared plaintext password.
Replies can also be "FAIL", if "LOGIN" or "SERVICE" is somehow bad.
The <ifname> is local interface name in given node. The <speed> is
radio channel bitrate. The <areaspecifiers> are filter statements
in APRS-IS style.
The edge system compares every received timestamp (aside of the
login-sequence above) with its internal time reference, and if
the time varies more than 3 seconds from expected, the received
frame is discarded.
If APRXC Server notes that the time stamp it received is more than
3 seconds in future or in past, it rejects the message.
(This does not apply to ERLANG verbs.)
The APRXC server acknowledges every received message with:
>> <timestamp> OK
Link idle jabber is by done by both systems by sending "TIME" verbs.
They are sent every 20 seconds since previous transmit of anything
on the connection, and if either notes that link has not received
anything for 120 seconds, the link is considered to be down, closed,
and re-initiated.
<< <timestamp> TIME
>> <timestamp> OK
>> <timestamp> TIME
<< <timestamp> OK
Either system can initiate the "heartbeat", sometimes even both
may send the TIME verbs at the same time, but both are not required
to do so.
The edge system sends received APRS frames to the central system
in "TNC2" format in a command:
<< <timestamp> APRS <ifname> <TNC2frame>
The <TNC2frame> is the data received from radio as is without any
APRS-IS -type additional parameters inserted into address field.
When central system wants that a TX capable edge system transmits
something, it sends following message:
>> <timestamp> APRSTX <ifname> <TNC2frame>
the edge system will transmit the frame as is (the APRXC will format
the message to be ready for transmit.) If the edge system can not
transmit on given interface, it reports:
<< <timestamp> FAILTX <ifname>
which results from APRXC and/or APRX software bug listing/flagging
tx-interface to be non-tx-interface.. Otherwise it acks the packet
with "OK" message.
<< <timestamp> OK
Edge systems send 1 minute ERLANG data to central system with verb:
<< <timestamp> ERLANG <ifname> <rxbytes> <rxpackets> \
<txbytes> <txpackets> [ <rxerlang> <txerlang> ]
>> <timestamp> OK
(Long line is folded in UNIX-style in this documentation.
Data is ACKed with OK.)
The APRXC collates these to 1 minute, 10 minute and 60 minute datasets
of given timestamp. The measured erlang-values are optional, if edge
system can produce truthfull ones.
The time-series collation database is persistent, for example RRD.