mirror of
https://github.com/2revoemag/PSF-BotServer.git
synced 2026-02-19 22:53:37 +00:00
Organize packets in to their own packages
Also remove legacy CryptoStateManager
This commit is contained in:
parent
e41d0ac9c4
commit
ff4ea792ce
23 changed files with 65 additions and 90 deletions
|
|
@ -11,6 +11,9 @@ import scodec.{Attempt, Codec, Err}
|
|||
import scodec.codecs.{bytes, uint16L, uint8L}
|
||||
import java.security.SecureRandom
|
||||
|
||||
import net.psforever.packet.control.{ClientStart, ServerStart}
|
||||
import net.psforever.packet.crypto._
|
||||
|
||||
/**
|
||||
* Actor that stores crypto state for a connection and filters away any packet metadata.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@ import java.net.{InetAddress, InetSocketAddress}
|
|||
|
||||
import akka.actor.{Actor, ActorLogging, ActorRef, Identify, MDCContextAware}
|
||||
import net.psforever.packet._
|
||||
import net.psforever.packet.control.{ConnectionClose, SlottedMetaPacket}
|
||||
import net.psforever.packet.game._
|
||||
import scodec.Attempt.{Failure, Successful}
|
||||
import scodec.bits._
|
||||
|
||||
|
|
@ -61,7 +63,7 @@ class LoginSessionActor extends Actor with MDCContextAware {
|
|||
}
|
||||
|
||||
def handleGamePkt(pkt : PlanetSideGamePacket) = {
|
||||
|
||||
log.debug(s"Unhandled GamePacket ${pkt}")
|
||||
}
|
||||
|
||||
def failWithError(error : String) = {
|
||||
|
|
|
|||
|
|
@ -1,41 +0,0 @@
|
|||
// Copyright (c) 2016 PSForever.net to present
|
||||
package net.psforever.crypto
|
||||
|
||||
import akka.actor.{Actor, ActorLogging, FSM}
|
||||
import akka.util.ByteString
|
||||
import scodec.Codec
|
||||
import scodec.bits.ByteVector
|
||||
|
||||
sealed trait CryptoState
|
||||
final case class ClientStart() extends CryptoState
|
||||
final case class ServerStart() extends CryptoState
|
||||
final case class ClientChallengeXchg() extends CryptoState
|
||||
final case class ServerChallengeXchg() extends CryptoState
|
||||
final case class ClientFinished() extends CryptoState
|
||||
final case class ServerFinished() extends CryptoState
|
||||
|
||||
sealed trait CryptoData
|
||||
final case class Uninitialized() extends CryptoData
|
||||
|
||||
class CryptoStateManager extends Actor with ActorLogging with FSM[CryptoState, CryptoData] {
|
||||
startWith(ClientStart(), Uninitialized())
|
||||
|
||||
when(ClientStart()) {
|
||||
/*case Event(RawPacket(msg), _) => {
|
||||
val decoded = Codec.decode[net.psforever.net.ClientStart](msg.bits)
|
||||
try {
|
||||
val packet = decoded.require.value
|
||||
println("Got cNonce: " + packet.clientNonce)
|
||||
}
|
||||
catch {
|
||||
case e : Exception =>
|
||||
println("Invalid packet: " + e.getMessage)
|
||||
}
|
||||
|
||||
stay
|
||||
}*/
|
||||
case _ => stay
|
||||
}
|
||||
|
||||
initialize()
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue