/*
* Copyright (c) 2018 ETH Zürich, Educational Development and Technology (LET)
*
* 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;
using SafeExamBrowser.Contracts.Communication.Messages;
using SafeExamBrowser.Contracts.Communication.Responses;
namespace SafeExamBrowser.Contracts.Communication
{
[ServiceContract(SessionMode = SessionMode.Required)]
public interface ICommunicationHost
{
///
/// Initiates a connection to the host and must thus be called before any other opertion. To authenticate itself to the host, the
/// client can specify a security token. If the connection request was successful, a new session will be created by the host and
/// the client will subsequently be allowed to start communicating with the host.
///
[OperationContract(IsInitiating = true)]
IConnectResponse Connect(Guid? token = null);
///
/// Closes the connection to the host and instructs it to terminate the communication session.
///
[OperationContract(IsInitiating = false, IsTerminating = true)]
void Disconnect(IMessage message);
///
/// Sends a message to the host, optionally returning a response. If no response is expected, null will be returned.
///
[OperationContract(IsInitiating = false)]
IResponse Send(IMessage message);
}
}