internal override void unknownReceived(Session session, bool authentic = false) { invalidMessage(session); }
internal override void btm2btmReceived(Session session, bool authentic = false) { if (authentic != true) return; session.deployBtm2Btm(); }
internal override void krypt2kryptReceived(Session session, bool authentic = false) { session.deployKrypt2Krypt(); }
internal override void securityStatusChanged(Session session) { //check if session has gone secure if (session.isSecure != true) { //this should never happen session._tearDown(); } session.changeState(Routing.Instance(session)); }
internal static State Instance(Session session) { session.initBottomProtocol(session.startedProtocol); return state; }
internal override void ackReceived(Session session, bool authentic = false) { changeState(session, SessionConfirmed.Instance(session)); }
internal override void synReceived(Session session, bool authentic = false) { //TODO: version checks here session.sendACK(); changeState(session, SessionConfirmed.Instance(session)); }
/// <summary> /// Starts a protocol run. /// </summary> /// <param name="session">The corresponding session.</param> internal virtual void startProtocol(Session session) { invalidMessage(session); }
/// <summary> /// Called when a SYN message is received. /// </summary> /// <param name="session">The corresponding session.</param> /// <param name="authentic">Flag indicating whether the received message was properly signed.</param> internal virtual void synReceived(Session session, bool authentic = false) { invalidMessage(session); }
/// <summary> /// Default handler for non protocol-conform events. /// Ends the respective protocol run. /// </summary> /// <param name="session">Corresponding Surface protocol run.</param> internal virtual void invalidMessage(Session session) { session._tearDown(); }
/// <summary> /// Called whenever the security status of a session has changed. /// </summary> /// <param name="session">The corresponding session.</param> internal virtual void securityStatusChanged(Session session) { session._tearDown(); }
/// <summary> /// Ends a protocol run. /// </summary> /// <param name="session">The corresponding session.</param> internal void endProtocol(Session session) { session.sendCLOSING(); session._tearDown(); }
/// <summary> /// Called when a CLOSING message is received. /// </summary> /// <param name="session">The corresponding session.</param> /// <param name="authentic">Flag indicating whether the received message was properly signed.</param> internal virtual void closingReceived(Session session, bool authentic = false) { session._tearDown(); }
/// <summary> /// Default function for a state-transition. /// </summary> /// <param name="session">Corresponding Surface protocol run.</param> /// <param name="state">Next state.</param> internal virtual void changeState(Session session, State state) { session.changeState(state); }
internal static State Instance(Session session) { if (session.isSecure == true) { return Routing.Instance(session); } else { //need to do a key-exchange before we can start routing return ExchangingKeys.Instance(session); } }
internal static State Instance(Session session) { session.initKryptoniteProtocol(session.startedProtocol); return state; }
internal static State Instance(Session session) { return state; }
internal override void krypt2kryptReceived(Session session, bool authentic = false) { //no auth-check in this state of the protocol session.deployKrypt2Krypt(); }
//since NACK is al valid message for this state, it is implemented explicitly internal override void nackReceived(Session session, bool authentic = false) { session._tearDown(); }
internal override void startProtocol(Session session) { session.sendSYN(); changeState(session, WaitingForACK.Instance(session)); }