Deal with third-party packets #22

Open
opened 2023-04-16 11:49:15 -05:00 by W1CDN · 5 comments
Owner
{'raw': 'W1CDN-1>APDW16,K0UND-2*:}FGFFLS>APRS,TCPIP,W1CDN-1*:;FGFFLS2AA*170815z4753.10N\\09657.90Ww FLOOD }k0I8Pdd`P:88P{G2AAA', 'from': 'W1CDN-1', 'to': 'APDW16', 'path': ['K0UND-2*'], 'via': '', 'format': 'thirdparty', 'subpacket': {'raw': 'FGFFLS>APRS,TCPIP,W1CDN-1*:;FGFFLS2AA*170815z4753.10N\\09657.90Ww FLOOD }k0I8Pdd`P:88P{G2AAA', 'from': 'FGFFLS', 'to': 'APRS', 'path': ['TCPIP', 'W1CDN-1*'], 'via': '', 'object_name': 'FGFFLS2AA', 'alive': True, 'raw_timestamp': '170815z', 'timestamp': 1681719300, 'format': 'object', 'posambiguity': 0, 'symbol': 'w', 'symbol_table': '\\', 'latitude': 47.885, 'longitude': -96.965, 'comment': 'FLOOD }k0I8Pdd`P:88P{G2AAA', 'object_format': 'uncompressed'}, 'station_call': 'W1CDN-1', 'station_lat': '47.941500', 'station_lon': '-97.027000'}
Traceback (most recent call last):
  File "/Users/Matt/Sites/aprs_tools/kiss_and_db.py", line 127, in <module>
    main()
  File "/Users/Matt/Sites/aprs_tools/kiss_and_db.py", line 112, in main
    conn.execute(sql, list(a.values()))
sqlite3.InterfaceError: Error binding parameter 6 - probably unsupported type.

Under #20 I added "subpacket" as a field just to get them into the DB, but it's not a great solution.

``` {'raw': 'W1CDN-1>APDW16,K0UND-2*:}FGFFLS>APRS,TCPIP,W1CDN-1*:;FGFFLS2AA*170815z4753.10N\\09657.90Ww FLOOD }k0I8Pdd`P:88P{G2AAA', 'from': 'W1CDN-1', 'to': 'APDW16', 'path': ['K0UND-2*'], 'via': '', 'format': 'thirdparty', 'subpacket': {'raw': 'FGFFLS>APRS,TCPIP,W1CDN-1*:;FGFFLS2AA*170815z4753.10N\\09657.90Ww FLOOD }k0I8Pdd`P:88P{G2AAA', 'from': 'FGFFLS', 'to': 'APRS', 'path': ['TCPIP', 'W1CDN-1*'], 'via': '', 'object_name': 'FGFFLS2AA', 'alive': True, 'raw_timestamp': '170815z', 'timestamp': 1681719300, 'format': 'object', 'posambiguity': 0, 'symbol': 'w', 'symbol_table': '\\', 'latitude': 47.885, 'longitude': -96.965, 'comment': 'FLOOD }k0I8Pdd`P:88P{G2AAA', 'object_format': 'uncompressed'}, 'station_call': 'W1CDN-1', 'station_lat': '47.941500', 'station_lon': '-97.027000'} Traceback (most recent call last): File "/Users/Matt/Sites/aprs_tools/kiss_and_db.py", line 127, in <module> main() File "/Users/Matt/Sites/aprs_tools/kiss_and_db.py", line 112, in main conn.execute(sql, list(a.values())) sqlite3.InterfaceError: Error binding parameter 6 - probably unsupported type. ``` Under #20 I added "subpacket" as a field just to get them into the DB, but it's not a great solution.

Subpackets need to go into the database right, but I need to make sure of how APRS says they are to be used.

Subpackets need to go into the database right, but I need to make sure of how APRS says they are to be used.

Spec seems pretty clear, and seems to match what aprslib is doing. I just need to insert the subpacket into the db, not the original one.

THIRD PARTY FORMAT:  One special format character } allows any APRS
packet to be carried or transmitted by any other station.  This is 
what allows the both the ZIPLAN and IGATE messaging capability!  On 
receipt of a 3rd party packet, the original header is dropped and the 
packet is recursively parsed again, beginning at the {.  To show that 
it has been carried by another station, the call of that station is 
extracted from the as-received header and inserted  as a pseudo digi* 
in the digi path.   Example:

    W3XYZ>APRS,DIGI*:}W4ABC>APRS,WIDE:>121234zStatus

will be processed as  W4ABC>APRS,WIDE,W3XYZ,DIGI*:>121234zStatus

Notice how the "carrying station" W3XYZ is inserted as if it had been
a digi in the path

It's also probably useful to keep the original header packet around in case it is needed for debugging (http://www.aprs.org/doc/APRS101.PDF).

Action on Receiving a Third- Party packet
When another station receives a third-party packet, it can extract the callsign of the original sending station from the Third-Party Header, if it is needed to acknowledge receipt of a message. The other addresses in the Third-Party Header may be useful for network diagnostic purposes.

For example:
K0RQ-1>APDW16,KB0UGF-3,WIDE1,WIDE2-1:}KD0IOE>APRX29,TCPIP,K0RQ-1*:;KD0IOE-R *111111z4651.16N/09652.75WrPHG41504/444.625MHz +5 CC1 https://kd0ioe.com/repeater

Header: K0RQ-1>APDW16,KB0UGF-3,WIDE1,WIDE2-1:

Packet to store or map: KD0IOE>APRX29,TCPIP,K0RQ-1*:;KD0IOE-R *111111z4651.16N/09652.75WrPHG41504/444.625MHz +5 CC1 https://kd0ioe.com/repeater

TODO:

  • store what is now in subpacket field in the main fields of the db
  • create a header field
  • store the header in the header field (could be whole raw packet or just header)
[Spec](http://www.aprs.org/APRS-docs/PROTOCOL.TXT) seems pretty clear, and seems to match what `aprslib` is doing. I just need to insert the `subpacket` into the db, not the original one. ``` THIRD PARTY FORMAT: One special format character } allows any APRS packet to be carried or transmitted by any other station. This is what allows the both the ZIPLAN and IGATE messaging capability! On receipt of a 3rd party packet, the original header is dropped and the packet is recursively parsed again, beginning at the {. To show that it has been carried by another station, the call of that station is extracted from the as-received header and inserted as a pseudo digi* in the digi path. Example: W3XYZ>APRS,DIGI*:}W4ABC>APRS,WIDE:>121234zStatus will be processed as W4ABC>APRS,WIDE,W3XYZ,DIGI*:>121234zStatus Notice how the "carrying station" W3XYZ is inserted as if it had been a digi in the path ``` It's also probably useful to keep the original header packet around in case it is needed for debugging (http://www.aprs.org/doc/APRS101.PDF). ``` Action on Receiving a Third- Party packet When another station receives a third-party packet, it can extract the callsign of the original sending station from the Third-Party Header, if it is needed to acknowledge receipt of a message. The other addresses in the Third-Party Header may be useful for network diagnostic purposes. ``` For example: `K0RQ-1>APDW16,KB0UGF-3,WIDE1,WIDE2-1:}KD0IOE>APRX29,TCPIP,K0RQ-1*:;KD0IOE-R *111111z4651.16N/09652.75WrPHG41504/444.625MHz +5 CC1 https://kd0ioe.com/repeater` Header: `K0RQ-1>APDW16,KB0UGF-3,WIDE1,WIDE2-1:` Packet to store or map: `KD0IOE>APRX29,TCPIP,K0RQ-1*:;KD0IOE-R *111111z4651.16N/09652.75WrPHG41504/444.625MHz +5 CC1 https://kd0ioe.com/repeater` TODO: - [ ] store what is now in `subpacket` field in the main fields of the db - [ ] create a `header` field - [ ] store the header in the header field (could be whole raw packet or just header)
matt added the
bug
label 2023-12-13 10:53:17 -06:00
Author
Owner

But to really show where the packets are coming from, you need to update the full path. In the example above, it should be
KD0IOE>APRX29,TCPIP,K0RQ-1,KB0UGF-3
right?

Or here's another:
K0RQ-1>APDW16,KB0UGF-3,WIDE1,WIDE2-1:}KD0IOE>APRX29,TCPIP,K0RQ-1*:;145.35-FM*111111z4652.05N/09645.35Wr145.350MHz T123 R30m W0ILO Fargo Mhd

But to really show where the packets are coming from, you need to update the full path. In the example above, it should be `KD0IOE>APRX29,TCPIP,K0RQ-1,KB0UGF-3` right? Or here's another: `K0RQ-1>APDW16,KB0UGF-3,WIDE1,WIDE2-1:}KD0IOE>APRX29,TCPIP,K0RQ-1*:;145.35-FM*111111z4652.05N/09645.35Wr145.350MHz T123 R30m W0ILO Fargo Mhd `
Author
Owner

https://www.aprs-is.net/IGateDetails.aspx and http://aprsisce.wikidot.com/me-not-3rd.

IGates must use the 3rd-party format on RF of
IGATECALL>APRS,GATEPATH}FROMCALL>TOCALL,TCPIP,IGATECALL*:original packet data
where GATEPATH is the path that the gated packet is to follow on RF. This format will allow IGates to prevent gating the packet back to APRS-IS.

Yeah, aprslib parses very simply and doesn't seem to adjust the path: https://github.com/rossengeorgiev/aprs-python/blob/master/aprslib/parsing/thirdparty.py

It's important to keep the header packet separately because it tells you that the header station is still operating as of whatever date and it can be mapped (if we have a last position for the station). The you need to keep the header info available so the routing is correct. In the above example, KB0UGF-3 would otherwise be dropped.

https://www.aprs-is.net/IGateDetails.aspx and http://aprsisce.wikidot.com/me-not-3rd. > IGates must use the 3rd-party format on RF of > `IGATECALL>APRS,GATEPATH}FROMCALL>TOCALL,TCPIP,IGATECALL*:original packet data` >where GATEPATH is the path that the gated packet is to follow on RF. This format will allow IGates to prevent gating the packet back to APRS-IS. Yeah, aprslib parses very simply and doesn't seem to adjust the path: https://github.com/rossengeorgiev/aprs-python/blob/master/aprslib/parsing/thirdparty.py It's important to keep the header packet separately because it tells you that the header station is still operating as of whatever date and it can be mapped (if we have a last position for the station). The you need to keep the header info available so the routing is correct. In the above example, KB0UGF-3 would otherwise be dropped.
Author
Owner

Still have this to do after #43:

Still have this to do after #43: - [ ] store the id of the superpacket with the subpacket - [ ] build the actual path as in http://www.aprs.org/APRS-docs/PROTOCOL.TXT ("THIRD PARTY FORMAT")
Sign in to join this conversation.
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: W1CDN/aprs_tool#22
No description provided.