Crates.io | fsd_interface |
lib.rs | fsd_interface |
version | 0.2.0 |
source | src |
created_at | 2023-08-25 00:03:37.901638 |
updated_at | 2024-11-23 17:24:59.322528 |
description | A Rust crate for serialising and deserialising FSD (Flight Simulator Daeomon) protocol network messages |
homepage | https://github.com/azimuth-radar/fsd-interface |
repository | https://github.com/azimuth-radar/fsd-interface |
max_upload_size | |
id | 954245 |
size | 150,225 |
The FSD (Flight Simulator Daemon) protocol is used for communication between pilot / ATC client software and FSD servers via a TCP connection. It has existed since the 90s and is still in wide use today.
The earliest version of an FSD server available online is this one here, written by Marty Bochane. It is open source and some people compile and run an instance of this software privately - often virtual flying groups.
VATSIM and IVAO also use the FSD protocol, however they have each diverged significantly from the version of the protocol used in Marty Bochane's server, in such a way that all three of these 'dialects' are incompatible with each other. That said, there are some clients, namely EuroScope and Swift which implement both the legacy FSD protocol and the modern VATSIM version, and as such are able to connect both to VATSIM and to private FSD servers.
Each message starts with a prefix which identifies the type of message, and this is followed by a variable number of colon-delimited fields. For example:
$CQEHAM_GND:@94835:WH:KLM167
&CQ
- this means the message is a client query.
EHAM_GND
- the callsign of the station sending the message.
@94835
- this is actually how radio frequencies are encoded. This would be 194.835. The astute amongst you may have noticed that this falls way outside of the range
used by airband radio - this is a 'special' frequency used by clients to pass information about aircraft.
WH
- this signifies that the message is a 'who has' request - the controller client is sending out a message to all other controller clients in the area to ask if any of them have the
aircraft assumed.
KLM123
- this is the aircraft that the controller client is asking about.
At the moment, this crate only works with the VATSIM flavour of the FSD protocol. In due course, it will support legacy FSD packets as well as IVAO packets.
// Imagine this is a message we have received from an FSD server
let message_text = String::from("$CQEHAM_GND:@94835:WH:KLM167");
// We can identify what type of message it is, deserialise it
let message_deserialised = fsd_messages::parse(&message_text).unwrap();
if let FsdMessage::ClientQueryMessage(client_query_message) = message_deserialised {
// And access its data
assert_eq!("EHAM_GND", client_query_message.from.as_str());
assert_eq!("@94835", client_query_message.to.as_str());
if let ClientQueryType::WhoHas(aircraft) = client_query_message.query_type {
assert_eq!("KLM367", aircraft.as_str());
}
// Plus, on the flip side, we can create our own messages and serialise them
let new_message = messages::ClientQuery::message::who_has("LIRF_TWR", "@94835", "ITA1561");
assert_eq!(String::from("$CQLIRF_TWR:@94835:WH:ITA1561"), new_message.to_string());
}
It is against the VATSIM Code of Conduct and User Agreement to attempt to connect to a VATSIM server with client software that has not been approved for use.
Of course, you're well within your rights to use this crate to write a client that connects to a private FSD server.
If you do obtain permission from VATSIM to connect with your own client software and decide to use this crate, you are responsible for checking that it is indeed compliant with the VATSIM FSD protocol.