2018-01-23 15:33:54 +01:00
|
|
|
|
/*
|
2024-03-05 18:37:42 +01:00
|
|
|
|
* Copyright (c) 2024 ETH Zürich, IT Services
|
2018-01-23 15:33:54 +01:00
|
|
|
|
*
|
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
using System;
|
|
|
|
|
using System.ServiceModel;
|
2019-08-30 09:55:26 +02:00
|
|
|
|
using SafeExamBrowser.Communication.Contracts.Data;
|
|
|
|
|
using SafeExamBrowser.Configuration.Contracts;
|
|
|
|
|
using ServiceConfiguration = SafeExamBrowser.Configuration.Contracts.ServiceConfiguration;
|
2018-01-23 15:33:54 +01:00
|
|
|
|
|
2019-08-30 09:55:26 +02:00
|
|
|
|
namespace SafeExamBrowser.Communication.Contracts
|
2018-01-23 15:33:54 +01:00
|
|
|
|
{
|
2018-03-06 11:38:12 +01:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Defines the API for all communication between the three application components (runtime, service and client).
|
|
|
|
|
/// </summary>
|
2018-01-23 15:33:54 +01:00
|
|
|
|
[ServiceContract(SessionMode = SessionMode.Required)]
|
2018-02-15 15:42:54 +01:00
|
|
|
|
[ServiceKnownType(typeof(AuthenticationResponse))]
|
|
|
|
|
[ServiceKnownType(typeof(ClientConfiguration))]
|
2018-03-08 15:27:12 +01:00
|
|
|
|
[ServiceKnownType(typeof(ConfigurationResponse))]
|
2020-07-31 19:57:08 +02:00
|
|
|
|
[ServiceKnownType(typeof(ExamSelectionReplyMessage))]
|
|
|
|
|
[ServiceKnownType(typeof(ExamSelectionRequestMessage))]
|
2018-12-14 12:31:31 +01:00
|
|
|
|
[ServiceKnownType(typeof(MessageBoxReplyMessage))]
|
|
|
|
|
[ServiceKnownType(typeof(MessageBoxRequestMessage))]
|
2018-07-04 09:53:33 +02:00
|
|
|
|
[ServiceKnownType(typeof(PasswordReplyMessage))]
|
|
|
|
|
[ServiceKnownType(typeof(PasswordRequestMessage))]
|
2018-03-08 15:27:12 +01:00
|
|
|
|
[ServiceKnownType(typeof(ReconfigurationMessage))]
|
2018-07-04 09:53:33 +02:00
|
|
|
|
[ServiceKnownType(typeof(ReconfigurationDeniedMessage))]
|
2020-07-31 20:35:18 +02:00
|
|
|
|
[ServiceKnownType(typeof(ServerFailureActionReplyMessage))]
|
|
|
|
|
[ServiceKnownType(typeof(ServerFailureActionRequestMessage))]
|
2019-06-11 09:53:33 +02:00
|
|
|
|
[ServiceKnownType(typeof(ServiceConfiguration))]
|
2019-06-18 10:18:56 +02:00
|
|
|
|
[ServiceKnownType(typeof(SessionStartMessage))]
|
|
|
|
|
[ServiceKnownType(typeof(SessionStopMessage))]
|
2018-03-08 15:27:12 +01:00
|
|
|
|
[ServiceKnownType(typeof(SimpleMessage))]
|
2018-02-16 13:15:16 +01:00
|
|
|
|
[ServiceKnownType(typeof(SimpleResponse))]
|
2018-01-24 12:34:32 +01:00
|
|
|
|
public interface ICommunication
|
2018-01-23 15:33:54 +01:00
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
2018-02-14 15:26:05 +01:00
|
|
|
|
/// Initiates a connection and must thus be called before any other opertion. Where applicable, an authentication token should be
|
|
|
|
|
/// specified. Returns a response indicating whether the connection request was successful or not.
|
2018-01-23 15:33:54 +01:00
|
|
|
|
/// </summary>
|
|
|
|
|
[OperationContract(IsInitiating = true)]
|
2018-02-15 15:42:54 +01:00
|
|
|
|
ConnectionResponse Connect(Guid? token = null);
|
2018-01-23 15:33:54 +01:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
2018-02-14 15:26:05 +01:00
|
|
|
|
/// Closes a connection. Returns a response indicating whether the disconnection request was successful or not.
|
2018-01-23 15:33:54 +01:00
|
|
|
|
/// </summary>
|
|
|
|
|
[OperationContract(IsInitiating = false, IsTerminating = true)]
|
2018-02-15 15:42:54 +01:00
|
|
|
|
DisconnectionResponse Disconnect(DisconnectionMessage message);
|
2018-01-23 15:33:54 +01:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
2018-02-14 15:26:05 +01:00
|
|
|
|
/// Sends a message, optionally returning a response. If no response is expected, <c>null</c> will be returned.
|
2018-01-23 15:33:54 +01:00
|
|
|
|
/// </summary>
|
|
|
|
|
[OperationContract(IsInitiating = false)]
|
2018-02-15 15:42:54 +01:00
|
|
|
|
Response Send(Message message);
|
2018-01-23 15:33:54 +01:00
|
|
|
|
}
|
|
|
|
|
}
|