initial RelatedA0 and RelatedB0 packets

modified HandleGamePacket so that it should encode properly; modified CSA so that it attempt to detect packets that encode into ByteVectors that are 'too big' and will attempt to split them up

separated the ControlPacket tests into invdividual files and wrote tests for RelatedA0, RelatedB0, and HandleGamePacket

proof of concept MTU packet split in CSA; example in WSA @ character select

modified session pipeline to accept n queued Actors rather than just two; special packet decoder in progress

some effort separating useful sub-operations in encryption/decryption/encoding/decoding functions; introduced PacketCodingActor , devoted to encoding and decoding packets; simplified CSA so that it is devoted just to encrypting and decrypting
This commit is contained in:
FateJH 2017-08-21 19:26:41 -04:00
parent 3e5e8a2573
commit 294d5335c9
23 changed files with 833 additions and 370 deletions

View file

@ -0,0 +1,32 @@
// Copyright (c) 2017 PSForever
package control
import org.specs2.mutable._
import net.psforever.packet._
import net.psforever.packet.control._
import scodec.bits._
class ControlSyncTest extends Specification {
val string = hex"0007 5268 0000004D 00000052 0000004D 0000007C 0000004D 0000000000000276 0000000000000275"
"decode" in {
PacketCoding.DecodePacket(string).require match {
case ControlSync(a, b, c, d, e, f, g, h) =>
a mustEqual 21096
b mustEqual 0x4d
c mustEqual 0x52
d mustEqual 0x4d
e mustEqual 0x7c
f mustEqual 0x4d
g mustEqual 0x276
h mustEqual 0x275
case _ =>
ko
}
}
"encode" in {
val encoded = PacketCoding.EncodePacket(ControlSync(21096, 0x4d, 0x52, 0x4d, 0x7c, 0x4d, 0x276, 0x275)).require
encoded.toByteVector mustEqual string
}
}