Port Spicy integration to new AST API.

This commit is contained in:
Robin Sommer 2024-02-23 10:29:59 +01:00
parent 724daa2792
commit db98dc4193
No known key found for this signature in database
GPG key ID: D8187293B3FFE5D0
16 changed files with 438 additions and 364 deletions

View file

@ -121,7 +121,7 @@ type ASN1OctetString = unit(len: uint64, constructed: bool) {
# https://www.obj-sys.com/asn1tutorial/node124.html
type ASN1String = unit(tag: ASN1Tag, len: uint64) {
var encoding: hilti::Charset;
var encoding: spicy::Charset;
on %init {
switch ( tag.type_ ) {
@ -132,7 +132,7 @@ type ASN1String = unit(tag: ASN1Tag, len: uint64) {
case ASN1Type::PrintableString,
ASN1Type::GeneralizedTime,
ASN1Type::UTCTime: {
self.encoding = hilti::Charset::ASCII;
self.encoding = spicy::Charset::ASCII;
}
case ASN1Type::UTF8String,
@ -148,7 +148,7 @@ type ASN1String = unit(tag: ASN1Tag, len: uint64) {
# BMPString and UniversalString. This *may* not be correct.
ASN1Type::BMPString,
ASN1Type::UniversalString: {
self.encoding = hilti::Charset::UTF8;
self.encoding = spicy::Charset::UTF8;
}
}
}
@ -216,7 +216,7 @@ public type ASN1Body = unit(head: ASN1Header, recursive: bool) {
ASN1Type::BitString -> bitstr_value: ASN1BitString(head.len.len, head.tag.constructed);
ASN1Type::OctetString -> str_value: ASN1OctetString(head.len.len, head.tag.constructed)
&convert=$$.value.decode(hilti::Charset::ASCII);
&convert=$$.value.decode(spicy::Charset::ASCII);
ASN1Type::ObjectIdentifier -> str_value: ASN1ObjectIdentifier(head.len.len)
&convert=$$.oidstring;

View file

@ -733,7 +733,7 @@ type SearchFilter = unit {
FilterType::FILTER_EXT -> FILTER_EXT: DecodedAttributeValue(FilterType::FILTER_EXT)
&parse-from=self.filterBytes;
FilterType::FILTER_PRESENT -> FILTER_PRESENT: ASN1::ASN1OctetString(self.filterLen, False)
&convert=$$.value.decode(hilti::Charset::ASCII)
&convert=$$.value.decode(spicy::Charset::ASCII)
&parse-from=self.filterBytes;
};

View file

@ -280,7 +280,7 @@ public type LongHeaderPacket = unit {
};
# A QUIC Frame.
public type Frame = unit(header: LongHeaderPacket, from_client: bool, crypto_sink: sink) {
public type Frame = unit(header: LongHeaderPacket, from_client: bool, inout crypto_sink: sink) {
frame_type : uint8 &convert=cast<FrameType>($$);
# TODO: add other FrameTypes as well
@ -447,7 +447,7 @@ type CryptoBuffer = unit() {
#
# A UDP datagram contains one or more QUIC packets.
##############
type Packet = unit(from_client: bool, context: ConnectionIDInfo&) {
type Packet = unit(from_client: bool, inout context: ConnectionIDInfo&) {
var decrypted_data: bytes;
var full_packet: bytes;
var start: iterator<stream>;