refactor query type validation, support SIMDATA type

This commit is contained in:
Reese Norris
2024-10-22 18:34:37 -07:00
parent 1857df46f0
commit 71a4b40001
2 changed files with 23 additions and 24 deletions

View File

@@ -2,6 +2,7 @@ package protocol
import (
"fmt"
"slices"
"strings"
)
@@ -50,18 +51,7 @@ func (p *ClientQueryResponsePDU) Parse(packet string) error {
return err
}
switch pdu.QueryType {
case "ATC", "CAPS", "C?",
"RN", "SV", "ATIS",
"IP", "INF", "FP",
"IPC", "BY", "HI",
"HLP", "NOHLP", "WH",
"IT", "HT", "DR",
"FA", "TA", "BC",
"SC", "VT", "ACC",
"NEWINFO", "NEWATIS", "EST",
"GD":
default:
if _, exists := slices.BinarySearch(supportedClientQueryTypes, pdu.QueryType); !exists {
return NewGenericFSDError(SyntaxError, fields[2], "invalid query type")
}