Beispiel #1
0
 internal override void unknownReceived(Session session, bool authentic = false)
 {
     invalidMessage(session);
 }
Beispiel #2
0
        internal override void btm2btmReceived(Session session, bool authentic = false)
        {
            if (authentic != true)
                return;

            session.deployBtm2Btm();
        }
Beispiel #3
0
 internal override void krypt2kryptReceived(Session session, bool authentic = false)
 {
     session.deployKrypt2Krypt();
 }
Beispiel #4
0
 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));
 }
Beispiel #5
0
 internal static State Instance(Session session)
 {
     session.initBottomProtocol(session.startedProtocol);
     return state;
 }
Beispiel #6
0
 internal override void ackReceived(Session session, bool authentic = false)
 {
     changeState(session, SessionConfirmed.Instance(session));
 }
Beispiel #7
0
 internal override void synReceived(Session session, bool authentic = false)
 {
     //TODO: version checks here
     session.sendACK();
     changeState(session, SessionConfirmed.Instance(session));
 }
Beispiel #8
0
 /// <summary>
 /// Starts a protocol run.
 /// </summary>
 /// <param name="session">The corresponding session.</param>
 internal virtual void startProtocol(Session session)
 {
     invalidMessage(session);
 }
Beispiel #9
0
 /// <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);
 }
Beispiel #10
0
 /// <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();
 }
Beispiel #11
0
 /// <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();
 }
Beispiel #12
0
 /// <summary>
 /// Ends a protocol run.
 /// </summary>
 /// <param name="session">The corresponding session.</param>
 internal void endProtocol(Session session)
 {
     session.sendCLOSING();
     session._tearDown();
 }
Beispiel #13
0
 /// <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();
 }
Beispiel #14
0
 /// <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);
 }
Beispiel #15
0
 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);
     }
 }
Beispiel #16
0
 internal static State Instance(Session session)
 {
     session.initKryptoniteProtocol(session.startedProtocol);
     return state;
 }
Beispiel #17
0
 internal static State Instance(Session session)
 {
     return state;
 }
Beispiel #18
0
 internal override void krypt2kryptReceived(Session session, bool authentic = false)
 {
     //no auth-check in this state of the protocol
     session.deployKrypt2Krypt();
 }
Beispiel #19
0
 //since NACK is al valid message for this state, it is implemented explicitly
 internal override void nackReceived(Session session, bool authentic = false)
 {
     session._tearDown();
 }
Beispiel #20
0
 internal override void startProtocol(Session session)
 {
     session.sendSYN();
     changeState(session, WaitingForACK.Instance(session));
 }