Example #1
0
 internal override void matchesReceived(Session session)
 {
     changeState(session, CompareMatches.Instance(session));
 }
Example #2
0
 internal static State Instance(Session session)
 {
     if (session.evaluateReceivedConnections() == true)
     {
         Logger.log(TLogLevel.logDebug, "Info: Found proper matches between own connections and peer's connection.");
         //proper matches found, go on
         session.sendMatches();
         return WaitForMatches.Instance(session);
     }
     else
     {
         Logger.log(TLogLevel.logDebug, "Info: Did not find proper matches between own connections and peer's connection.");
         //no proper matches found, close protocol
         endProtocol(session);
         return state;
     }
 }
Example #3
0
 internal override void confirmReceived(Session session)
 {
     //if we end up here, everything went fine -> end protocol and start encryption!
     session.tearDown();
     Logger.log(TLogLevel.logDebug, "Info: Bottom protocol run completed successfully.");
     session.startSecureChannel();
 }
Example #4
0
 /// <summary>
 /// Called when an unknown message is received.
 /// </summary>
 /// <param name="session">The corresponding session.</param>
 internal virtual void unknownReceived(Session session)
 {
     invalidMessage(session);
 }
Example #5
0
 internal static State Instance(Session session)
 {
     if (session.evaluateReceivedMatches() == true)
     {
         //received matches and own matches fit together, confirm
         Logger.log(TLogLevel.logDebug, "Info: Matches from peer were successfully validated.");
         session.sendConfirm();
         return WaitForConfirmation.Instance(session);
     }
     else
     {
         //received matches and own matches do not fit together, abort
         Logger.log(TLogLevel.logDebug, "Info: Matches from peer could not be validated.");
         endProtocol(session);
         return state;
     }
 }
Example #6
0
 internal override void startProtocol(Session session)
 {
     session.sendRequestConnections();
     changeState(session, WaitingForConnectionsList.Instance(session));
 }
Example #7
0
 /// <summary>
 /// Starts a protocol run.
 /// </summary>
 /// <param name="session">The corresponding session.</param>
 internal virtual void startProtocol(Session session)
 {
     invalidMessage(session);
 }
Example #8
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();
 }
Example #9
0
 /// <summary>
 /// Called when a MATCHES message is received.
 /// </summary>
 /// <param name="session">The corresponding session.</param>
 internal virtual void matchesReceived(Session session)
 {
     invalidMessage(session);
 }
Example #10
0
 /// <summary>
 /// Called when a CLOSING message is received.
 /// </summary>
 /// <param name="session">The corresponding session.</param>
 internal virtual void closingReceived(Session session)
 {
     session.tearDown();
 }
Example #11
0
 /// <summary>
 /// Called when a CONFIRM message is received.
 /// </summary>
 /// <param name="session">The corresponding session.</param>
 internal virtual void confirmReceived(Session session)
 {
     invalidMessage(session);
 }
Example #12
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);
 }
Example #13
0
 /// <summary>
 /// Called when a ABORT message is received.
 /// </summary>
 /// <param name="session">The corresponding session.</param>
 internal virtual void abortReceived(Session session)
 {
     invalidMessage(session);
 }
Example #14
0
 /// <summary>
 /// Ends a protocol run.
 /// </summary>
 /// <param name="session">The corresponding session.</param>
 internal static void endProtocol(Session session)
 {
     session.sendAbort();
     session.tearDown();
 }
Example #15
0
 internal static State Instance(Session session)
 {
     return state;
 }
Example #16
0
 /// <summary>
 /// Called when a REQUEST_CONNECTIONS message is received.
 /// </summary>
 /// <param name="session">The corresponding session.</param>
 internal virtual void requestConnectionsReceived(Session session)
 {
     invalidMessage(session);
 }
Example #17
0
 internal override void myConnectionsReceived(Session session)
 {
     changeState(session, FindMatches.Instance(session));
 }
Example #18
0
 internal override void requestConnectionsReceived(Session session)
 {
     session.sendMyConnections();
     changeState(session, FindMatches.Instance(session));
 }