Imported Upstream version 4.0.0~alpha1

Former-commit-id: 806294f5ded97629b74c85c09952f2a74fe182d9
This commit is contained in:
Jo Shields
2015-04-07 09:35:12 +01:00
parent 283343f570
commit 3c1f479b9d
22469 changed files with 2931443 additions and 869343 deletions

View File

@@ -0,0 +1,38 @@
//------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//------------------------------------------------------------
using System.ServiceModel;
using System.ServiceModel.Channels;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ServiceModel.PeerResolvers;
namespace System.ServiceModel.PeerResolvers
{
[ServiceContract(Name = "IPeerResolverContract",
Namespace = PeerResolverStrings.Namespace,
SessionMode = SessionMode.Allowed)]
public interface IPeerResolverContract
{
[OperationContract(IsOneWay = false, Name = "Register", Action = PeerResolverStrings.RegisterAction, ReplyAction = PeerResolverStrings.RegisterResponseAction)]
RegisterResponseInfo Register(RegisterInfo registerInfo);
[OperationContract(IsOneWay = false, Name = "Update", Action = PeerResolverStrings.UpdateAction, ReplyAction = PeerResolverStrings.UpdateResponseAction)]
RegisterResponseInfo Update(UpdateInfo updateInfo);
[OperationContract(IsOneWay = false, Name = "Resolve", Action = PeerResolverStrings.ResolveAction, ReplyAction = PeerResolverStrings.ResolveResponseAction)]
ResolveResponseInfo Resolve(ResolveInfo resolveInfo);
[OperationContract(IsOneWay = false, Name = "Unregister", Action = PeerResolverStrings.UnregisterAction)]
void Unregister(UnregisterInfo unregisterInfo);
[OperationContract(IsOneWay = false, Name = "Refresh", Action = PeerResolverStrings.RefreshAction, ReplyAction = PeerResolverStrings.RefreshResponseAction)]
RefreshResponseInfo Refresh(RefreshInfo refreshInfo);
[OperationContract(IsOneWay = false, Name = "GetServiceInfo", Action = PeerResolverStrings.GetServiceSettingsAction, ReplyAction = PeerResolverStrings.GetServiceSettingsResponseAction)]
ServiceSettingsResponseInfo GetServiceSettings();
}
interface IPeerResolverClient : IPeerResolverContract, IClientChannel { }
}

View File

@@ -0,0 +1,95 @@
//------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//------------------------------------------------------------
namespace System.ServiceModel.PeerResolvers
{
using System;
using System.ServiceModel;
using System.ServiceModel.Description;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Configuration;
using System.Globalization;
using System.Net.Security;
using System.ServiceModel.Configuration;
using System.ServiceModel.Channels;
public class PeerCustomResolverSettings
{
EndpointAddress address;
Binding binding;
string bindingSection, bindingConfiguration;
PeerResolver resolver;
public PeerCustomResolverSettings() { }
public EndpointAddress Address
{
get
{
return address;
}
set
{
address = value;
}
}
public Binding Binding
{
get
{
if (binding == null)
{
if (!String.IsNullOrEmpty(this.bindingSection) && !String.IsNullOrEmpty(this.bindingConfiguration))
binding = ConfigLoader.LookupBinding(this.bindingSection, this.bindingConfiguration);
}
return binding;
}
set
{
binding = value;
}
}
public bool IsBindingSpecified
{
get
{
return ((this.binding != null) || (!String.IsNullOrEmpty(this.bindingSection) && !String.IsNullOrEmpty(this.bindingConfiguration)));
}
}
public PeerResolver Resolver
{
get
{
return resolver;
}
set
{
resolver = value;
}
}
internal string BindingSection
{
get
{
return bindingSection;
}
set
{
bindingSection = value;
}
}
internal string BindingConfiguration
{
get
{
return bindingConfiguration;
}
set
{
bindingConfiguration = value;
}
}
}
}

View File

@@ -0,0 +1,398 @@
//------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//------------------------------------------------------------
namespace System.ServiceModel.PeerResolvers
{
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Net;
using System.Runtime;
using System.ServiceModel;
using System.ServiceModel.Channels;
using System.ServiceModel.Description;
using System.Threading;
class PeerDefaultCustomResolverClient : PeerResolver
{
EndpointAddress address;
Binding binding;
TimeSpan defaultLifeTime;
ClientCredentials credentials;
Guid clientId;
Guid registrationId;
IOThreadTimer timer;
bool opened = false;
string meshId;
PeerNodeAddress nodeAddress;
ChannelFactory<IPeerResolverClient> channelFactory;
PeerReferralPolicy referralPolicy;
string bindingName, bindingConfigurationName;
bool? shareReferrals;
int updateSuccessful = 1;
internal PeerDefaultCustomResolverClient()
{
this.address = null;
this.binding = null;
this.defaultLifeTime = TimeSpan.FromHours(1);
clientId = Guid.NewGuid();
timer = new IOThreadTimer(new Action<object>(RegistrationExpired), this, false);
}
public override bool CanShareReferrals
{
get
{
if (this.shareReferrals.HasValue)
return shareReferrals.Value;
if (this.referralPolicy == PeerReferralPolicy.Service && opened)
{
IPeerResolverClient proxy = GetProxy();
try
{
ServiceSettingsResponseInfo settings = proxy.GetServiceSettings();
shareReferrals = !settings.ControlMeshShape;
proxy.Close();
}
finally
{
proxy.Abort();
}
}
else
{
shareReferrals = (PeerReferralPolicy.Share == this.referralPolicy);
}
return shareReferrals.Value;
}
}
public override void Initialize(EndpointAddress address, Binding binding, ClientCredentials credentials, PeerReferralPolicy referralPolicy)
{
this.address = address;
this.binding = binding;
this.credentials = credentials;
Validate();
channelFactory = new ChannelFactory<IPeerResolverClient>(binding, address);
channelFactory.Endpoint.Behaviors.Remove<ClientCredentials>();
if (credentials != null)
channelFactory.Endpoint.Behaviors.Add(credentials);
channelFactory.Open();
this.referralPolicy = referralPolicy;
opened = true;
}
IPeerResolverClient GetProxy()
{
return (IPeerResolverClient)channelFactory.CreateChannel();
}
void Validate()
{
if (address == null || binding == null)
PeerExceptionHelper.ThrowArgument_InsufficientResolverSettings();
}
// Register address for a node participating in a mesh identified by meshId with the resolver service
public override object Register(string meshId, PeerNodeAddress nodeAddress, TimeSpan timeout)
{
if (opened)
{
long scopeId = -1;
bool multipleScopes = false;
if (nodeAddress.IPAddresses.Count == 0)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentException(SR.GetString(SR.MustRegisterMoreThanZeroAddresses)));
}
foreach (IPAddress address in nodeAddress.IPAddresses)
{
if (address.IsIPv6LinkLocal)
{
if (scopeId == -1)
{
scopeId = address.ScopeId;
}
else if (scopeId != address.ScopeId)
{
multipleScopes = true;
break;
}
}
}
List<IPAddress> addresslist = new List<IPAddress>();
foreach (IPAddress address in nodeAddress.IPAddresses)
{
if (!multipleScopes || (!address.IsIPv6LinkLocal && !address.IsIPv6SiteLocal))
addresslist.Add(address);
}
if (addresslist.Count == 0)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new CommunicationException(SR.GetString(SR.AmbiguousConnectivitySpec)));
}
ReadOnlyCollection<IPAddress> addresses = new ReadOnlyCollection<IPAddress>(addresslist);
this.meshId = meshId;
this.nodeAddress = new PeerNodeAddress(nodeAddress.EndpointAddress, addresses);
RegisterInfo info = new RegisterInfo(clientId, meshId, this.nodeAddress);
IPeerResolverClient proxy = GetProxy();
try
{
proxy.OperationTimeout = timeout;
RegisterResponseInfo response = proxy.Register(info);
this.registrationId = response.RegistrationId;
timer.Set(response.RegistrationLifetime);
this.defaultLifeTime = response.RegistrationLifetime;
proxy.Close();
}
finally
{
proxy.Abort();
}
}
return registrationId;
}
void RegistrationExpired(object state)
{
if (!opened)
return;
try
{
IPeerResolverClient proxy = GetProxy();
RefreshResponseInfo response;
try
{
int oldValue = Interlocked.Exchange(ref this.updateSuccessful, 1);
if (oldValue == 0)
{
SendUpdate(new UpdateInfo(this.registrationId, this.clientId, this.meshId, this.nodeAddress), ServiceDefaults.SendTimeout);
return;
}
RefreshInfo info = new RefreshInfo(this.meshId, this.registrationId);
response = proxy.Refresh(info);
if (response.Result == RefreshResult.RegistrationNotFound)
{
RegisterInfo registerInfo = new RegisterInfo(clientId, meshId, nodeAddress);
RegisterResponseInfo registerResponse = proxy.Register(registerInfo);
registrationId = registerResponse.RegistrationId;
this.defaultLifeTime = registerResponse.RegistrationLifetime;
}
else
{
Fx.Assert(response.Result == RefreshResult.Success, "Unrecognized value!!");
}
proxy.Close();
}
finally
{
proxy.Abort();
timer.Set(this.defaultLifeTime);
}
}
catch (CommunicationException e)
{
DiagnosticUtility.TraceHandledException(e, TraceEventType.Information);
}
catch (Exception e)
{
if (Fx.IsFatal(e)) throw;
DiagnosticUtility.TraceHandledException(e, TraceEventType.Information);
}
}
// Unregister address for a node from the resolver service
public override void Unregister(object registrationId, TimeSpan timeout)
{
if (opened)
{
UnregisterInfo info = new UnregisterInfo(this.meshId, this.registrationId);
try
{
IPeerResolverClient proxy = GetProxy();
try
{
proxy.OperationTimeout = timeout;
proxy.Unregister(info);
proxy.Close();
}
finally
{
proxy.Abort();
}
}
catch (CommunicationException e)
{
DiagnosticUtility.TraceHandledException(e, TraceEventType.Information);
}
finally
{
opened = false;
timer.Cancel();
}
}
}
// Updates a node's registration with the resolver service.
public override void Update(object registrationId, PeerNodeAddress updatedNodeAddress, TimeSpan timeout)
{
if (opened)
{
UpdateInfo info = new UpdateInfo(this.registrationId, clientId, meshId, updatedNodeAddress);
this.nodeAddress = updatedNodeAddress;
SendUpdate(info, timeout);
}
}
void SendUpdate(UpdateInfo updateInfo, TimeSpan timeout)
{
try
{
RegisterResponseInfo response;
IPeerResolverClient proxy = GetProxy();
try
{
proxy.OperationTimeout = timeout;
response = proxy.Update(updateInfo);
proxy.Close();
this.registrationId = response.RegistrationId;
this.defaultLifeTime = response.RegistrationLifetime;
Interlocked.Exchange(ref this.updateSuccessful, 1);
timer.Set(this.defaultLifeTime);
}
finally
{
proxy.Abort();
}
}
catch (CommunicationException e)
{
DiagnosticUtility.TraceHandledException(e, TraceEventType.Information);
Interlocked.Exchange(ref this.updateSuccessful, 0);
}
catch (Exception e)
{
if (Fx.IsFatal(e)) throw;
Interlocked.Exchange(ref this.updateSuccessful, 0);
throw;
}
}
// Query the resolver service for addresses associated with a mesh ID
public override ReadOnlyCollection<PeerNodeAddress> Resolve(string meshId, int maxAddresses, TimeSpan timeout)
{
ResolveResponseInfo result = null;
IList<PeerNodeAddress> addresses = null;
List<PeerNodeAddress> output_addresses = new List<PeerNodeAddress>();
if (opened)
{
ResolveInfo info = new ResolveInfo(clientId, meshId, maxAddresses);
try
{
IPeerResolverClient proxy = GetProxy();
try
{
proxy.OperationTimeout = timeout;
result = proxy.Resolve(info);
proxy.Close();
}
finally
{
proxy.Abort();
}
// If addresses couldn't be obtained, return empty collection
if (result != null && result.Addresses != null)
addresses = result.Addresses;
}
catch (CommunicationException e)
{
DiagnosticUtility.TraceHandledException(e, TraceEventType.Information);
}
catch (Exception e)
{
if (Fx.IsFatal(e)) throw;
opened = false;
throw;
}
}
if (addresses != null)
{
foreach (PeerNodeAddress nodeaddr in addresses)
{
bool valid = true;
long scopeId = -1;
if (nodeaddr == null) continue;
foreach (IPAddress addr in nodeaddr.IPAddresses)
{
if (addr.IsIPv6LinkLocal)
{
if (scopeId == -1)
{
scopeId = addr.ScopeId;
}
else if (scopeId != addr.ScopeId)
{
valid = false;
break;
}
}
}
if (valid)
{
output_addresses.Add(nodeaddr);
}
}
}
return new ReadOnlyCollection<PeerNodeAddress>(output_addresses);
}
internal string BindingName
{
get { return bindingName; }
set { this.bindingName = value; }
}
internal string BindingConfigurationName
{
get { return bindingName; }
set { this.bindingConfigurationName = value; }
}
public override bool Equals(object other)
{
PeerDefaultCustomResolverClient that = other as PeerDefaultCustomResolverClient;
if ((that == null) ||
(this.referralPolicy != that.referralPolicy) || !this.address.Equals(that.address))
return false;
if (this.BindingName != null || this.BindingConfigurationName != null)
return ((this.BindingName == that.BindingName) && (this.BindingConfigurationName == that.BindingConfigurationName));
else
return this.binding.Equals(that.binding);
}
public override int GetHashCode()
{
return base.GetHashCode();
}
}
}

View File

@@ -0,0 +1,25 @@
//------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//------------------------------------------------------------
namespace System.ServiceModel.PeerResolvers
{
public enum PeerReferralPolicy
{
Service,
Share,
DoNotShare,
}
static class PeerReferralPolicyHelper
{
internal static bool IsDefined(PeerReferralPolicy value)
{
return (
value == PeerReferralPolicy.Service ||
value == PeerReferralPolicy.Share ||
value == PeerReferralPolicy.DoNotShare);
}
}
}

View File

@@ -0,0 +1,24 @@
//------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//------------------------------------------------------------
namespace System.ServiceModel.PeerResolvers
{
public enum PeerResolverMode
{
Auto,
Pnrp,
Custom
}
static class PeerResolverModeHelper
{
internal static bool IsDefined(PeerResolverMode value)
{
return (
value == PeerResolverMode.Auto ||
value == PeerResolverMode.Pnrp ||
value == PeerResolverMode.Custom );
}
}
}

View File

@@ -0,0 +1,60 @@
//------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//------------------------------------------------------------
namespace System.ServiceModel.PeerResolvers
{
using System;
using System.ServiceModel;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Configuration;
using System.Globalization;
using System.Net.Security;
using System.ServiceModel.Configuration;
using System.ServiceModel.Channels;
public class PeerResolverSettings
{
PeerReferralPolicy referralPolicy;
PeerResolverMode mode;
PeerCustomResolverSettings customSettings;
public PeerResolverSettings() { customSettings = new PeerCustomResolverSettings(); }
public PeerResolverMode Mode
{
get
{
return mode;
}
set
{
if (!PeerResolverModeHelper.IsDefined(value))
PeerExceptionHelper.ThrowArgument_InvalidResolverMode(value);
mode = value;
}
}
public PeerReferralPolicy ReferralPolicy
{
get { return referralPolicy; }
set
{
if (!PeerReferralPolicyHelper.IsDefined(value))
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidEnumArgumentException("value", (int)value, typeof(PeerReferralPolicy)));
}
referralPolicy = value;
}
}
public PeerCustomResolverSettings Custom
{
get
{
return customSettings;
}
}
}
}

View File

@@ -0,0 +1,53 @@
//------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//------------------------------------------------------------
namespace System.ServiceModel.PeerResolvers
{
using System.ServiceModel.Channels;
using System.ServiceModel;
using System.Runtime.Serialization;
[MessageContract(IsWrapped = false)]
public class RefreshInfo
{
[DataContract(Name = "RefreshInfo", Namespace = PeerStrings.Namespace)]
class RefreshInfoDC
{
[DataMember(Name = "RegistrationId")]
public Guid RegistrationId;
[DataMember(Name = "MeshId")]
public string MeshId;
public RefreshInfoDC() { }
public RefreshInfoDC(string meshId, Guid regId)
{
MeshId = meshId;
RegistrationId = regId;
}
}
public RefreshInfo(string meshId, Guid regId)
{
this.body = new RefreshInfoDC(meshId, regId);
}
public RefreshInfo()
{
this.body = new RefreshInfoDC();
}
public string MeshId { get { return body.MeshId; } }
public Guid RegistrationId { get { return body.RegistrationId; } }
[MessageBodyMember(Name = "Refresh", Namespace = PeerStrings.Namespace)]
RefreshInfoDC body;
public bool HasBody()
{
return body != null;
}
}
}

View File

@@ -0,0 +1,73 @@
//------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//------------------------------------------------------------
namespace System.ServiceModel.PeerResolvers
{
using System.Runtime;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Channels;
[MessageContract(IsWrapped = false)]
public class RefreshResponseInfo
{
[DataContract(Name = "RefreshResponseInfo", Namespace = PeerStrings.Namespace)]
class RefreshResponseInfoDC
{
[DataMember(Name = "RegistrationLifetime")]
public TimeSpan RegistrationLifetime;
[DataMember(Name = "Result")]
public RefreshResult Result;
public RefreshResponseInfoDC(TimeSpan registrationLifetime, RefreshResult result)
{
this.RegistrationLifetime = registrationLifetime;
this.Result = result;
}
}
public RefreshResponseInfo() : this(TimeSpan.Zero, RefreshResult.RegistrationNotFound) { }
public RefreshResponseInfo(TimeSpan registrationLifetime, RefreshResult result)
{
this.body = new RefreshResponseInfoDC(registrationLifetime, result);
}
public TimeSpan RegistrationLifetime
{
get { return body.RegistrationLifetime; }
set
{
if (value < TimeSpan.Zero)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException("value", value,
SR.GetString(SR.SFxTimeoutOutOfRange0)));
}
if (TimeoutHelper.IsTooLarge(value))
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException("value", value,
SR.GetString(SR.SFxTimeoutOutOfRangeTooBig)));
}
this.body.RegistrationLifetime = value;
}
}
public RefreshResult Result
{
get { return body.Result; }
set { this.body.Result = value; }
}
[MessageBodyMember(Name = "RefreshResponse", Namespace = PeerStrings.Namespace)]
RefreshResponseInfoDC body;
public bool HasBody()
{
return body != null;
}
}
}

View File

@@ -0,0 +1,12 @@
//------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//------------------------------------------------------------
namespace System.ServiceModel.PeerResolvers
{
public enum RefreshResult
{
Success,
RegistrationNotFound
}
}

View File

@@ -0,0 +1,65 @@
//------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//------------------------------------------------------------
namespace System.ServiceModel.PeerResolvers
{
using System.ServiceModel.Channels;
using System.ServiceModel;
using System.Runtime.Serialization;
[MessageContract(IsWrapped = false)]
public class RegisterInfo
{
[DataContract(Name = "Register", Namespace = PeerStrings.Namespace)]
class RegisterInfoDC
{
[DataMember(Name = "ClientId")]
public Guid ClientId;
[DataMember(Name = "MeshId")]
public string MeshId;
[DataMember(Name = "NodeAddress")]
public PeerNodeAddress NodeAddress;
// public TimeSpan RegistrationLifeTime;
public RegisterInfoDC() { }
public RegisterInfoDC(Guid client, string meshId, PeerNodeAddress address)
{
this.ClientId = client;
this.MeshId = meshId;
this.NodeAddress = address;
}
}
public RegisterInfo(Guid client, string meshId, PeerNodeAddress address)
{
body = new RegisterInfoDC(client, meshId, address);
}
public RegisterInfo() { body = new RegisterInfoDC(); }
[MessageBodyMember(Name = "Register", Namespace = PeerStrings.Namespace)]
RegisterInfoDC body;
public Guid ClientId
{
get { return this.body.ClientId; }
}
public string MeshId
{
get { return this.body.MeshId; }
}
public PeerNodeAddress NodeAddress
{
get { return this.body.NodeAddress; }
}
public bool HasBody()
{
return body != null;
}
}
}

View File

@@ -0,0 +1,77 @@
//------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//------------------------------------------------------------
namespace System.ServiceModel.PeerResolvers
{
using System.Runtime;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Channels;
[MessageContract(IsWrapped = false)]
public class RegisterResponseInfo
{
[DataContract(Name = "RegisterResponse", Namespace = PeerStrings.Namespace)]
class RegisterResponseInfoDC
{
[DataMember(Name = "RegistrationLifetime")]
public TimeSpan RegistrationLifetime;
[DataMember(Name = "RegistrationId")]
public Guid RegistrationId;
public RegisterResponseInfoDC() { }
public RegisterResponseInfoDC(Guid registrationId, TimeSpan registrationLifetime)
{
this.RegistrationLifetime = registrationLifetime;
this.RegistrationId = registrationId;
}
}
public RegisterResponseInfo(Guid registrationId, TimeSpan registrationLifetime)
{
body = new RegisterResponseInfoDC(registrationId, registrationLifetime);
}
public RegisterResponseInfo()
{
body = new RegisterResponseInfoDC();
}
public Guid RegistrationId
{
get { return this.body.RegistrationId; }
set { this.body.RegistrationId = value; }
}
public TimeSpan RegistrationLifetime
{
get { return this.body.RegistrationLifetime; }
set
{
if (value < TimeSpan.Zero)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException("value", value,
SR.GetString(SR.SFxTimeoutOutOfRange0)));
}
if (TimeoutHelper.IsTooLarge(value))
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException("value", value,
SR.GetString(SR.SFxTimeoutOutOfRangeTooBig)));
}
this.body.RegistrationLifetime = value;
}
}
[MessageBodyMember(Name = "Update", Namespace = PeerStrings.Namespace)]
RegisterResponseInfoDC body;
public bool HasBody()
{
return body != null;
}
}
}

View File

@@ -0,0 +1,68 @@
//------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//------------------------------------------------------------
namespace System.ServiceModel.PeerResolvers
{
using System.ServiceModel.Channels;
using System.ServiceModel;
using System.Runtime.Serialization;
[MessageContract(IsWrapped = false)]
public class ResolveInfo
{
[DataContract(Name = "ResolveInfo", Namespace = PeerStrings.Namespace)]
class ResolveInfoDC
{
[DataMember(Name = "ClientId")]
public Guid ClientId;
[DataMember(Name = "MeshId")]
public string MeshId;
[DataMember(Name = "MaxAddresses")]
public int MaxAddresses;
public ResolveInfoDC(Guid clientId, string meshId, int maxAddresses)
{
this.ClientId = clientId;
this.MeshId = meshId;
this.MaxAddresses = maxAddresses;
}
public ResolveInfoDC() { }
}
[MessageBodyMember(Name = "Resolve", Namespace = PeerStrings.Namespace)]
ResolveInfoDC body;
public ResolveInfo(Guid clientId, string meshId, int maxAddresses)
{
body = new ResolveInfoDC(clientId, meshId, maxAddresses);
}
public ResolveInfo()
{
body = new ResolveInfoDC();
}
public Guid ClientId
{
get { return this.body.ClientId; }
}
public string MeshId
{
get { return this.body.MeshId; }
}
public int MaxAddresses
{
get { return this.body.MaxAddresses; }
}
public bool HasBody()
{
return body != null;
}
}
}

View File

@@ -0,0 +1,48 @@
//------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//------------------------------------------------------------
namespace System.ServiceModel.PeerResolvers
{
using System.Collections.Generic;
using System.ServiceModel.Channels;
using System.ServiceModel;
using System.Runtime.Serialization;
[MessageContract(IsWrapped = false)]
public class ResolveResponseInfo
{
[DataContract(Name = "ResolveResponseInfo", Namespace = PeerStrings.Namespace)]
class ResolveResponseInfoDC
{
[DataMember(Name = "Addresses")]
public IList<PeerNodeAddress> Addresses;
public ResolveResponseInfoDC(PeerNodeAddress[] addresses)
{
this.Addresses = (IList<PeerNodeAddress>)addresses;
}
}
public ResolveResponseInfo() : this(null) { }
public ResolveResponseInfo(PeerNodeAddress[] addresses)
{
this.body = new ResolveResponseInfoDC(addresses);
}
public IList<PeerNodeAddress> Addresses
{
get { return body.Addresses; }
set { this.body.Addresses = value; }
}
[MessageBodyMember(Name = "ResolveResponse", Namespace = PeerStrings.Namespace)]
ResolveResponseInfoDC body;
public bool HasBody()
{
return body != null;
}
}
}

View File

@@ -0,0 +1,47 @@
//------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//------------------------------------------------------------
namespace System.ServiceModel.PeerResolvers
{
using System.ServiceModel.Channels;
using System.ServiceModel;
using System.Runtime.Serialization;
[MessageContract(IsWrapped = false)]
public class ServiceSettingsResponseInfo
{
[DataContract(Name = "ServiceSettingsResponseInfo", Namespace = PeerStrings.Namespace)]
class ServiceSettingsResponseInfoDC
{
[DataMember(Name = "ControlMeshShape")]
public bool ControlMeshShape;
public ServiceSettingsResponseInfoDC(bool control)
{
ControlMeshShape = control;
}
}
public ServiceSettingsResponseInfo() : this(false) { }
public ServiceSettingsResponseInfo(bool control)
{
this.body = new ServiceSettingsResponseInfoDC(control);
}
[MessageBodyMember(Name = "ServiceSettings", Namespace = PeerStrings.Namespace)]
ServiceSettingsResponseInfoDC body;
public bool ControlMeshShape
{
get { return body.ControlMeshShape; }
set { body.ControlMeshShape = value; }
}
public bool HasBody()
{
return body != null;
}
}
}

View File

@@ -0,0 +1,55 @@
//------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//------------------------------------------------------------
namespace System.ServiceModel.PeerResolvers
{
using System.ServiceModel.Channels;
using System.ServiceModel;
using System.Runtime.Serialization;
[MessageContract(IsWrapped = false)]
public class UnregisterInfo
{
[DataContract(Name = "UnregisterInfo", Namespace = PeerStrings.Namespace)]
class UnregisterInfoDC
{
[DataMember(Name = "RegistrationId")]
public Guid RegistrationId;
[DataMember(Name = "MeshId")]
public string MeshId;
public UnregisterInfoDC() { }
public UnregisterInfoDC(string meshId, Guid registrationId)
{
this.MeshId = meshId;
this.RegistrationId = registrationId;
}
}
[MessageBodyMember(Name = "Unregister", Namespace = PeerStrings.Namespace)]
UnregisterInfoDC body;
public Guid RegistrationId
{
get { return body.RegistrationId; }
}
public string MeshId
{
get { return body.MeshId; }
}
public UnregisterInfo() { body = new UnregisterInfoDC(); }
public UnregisterInfo(string meshId, Guid registrationId)
{
this.body = new UnregisterInfoDC(meshId, registrationId);
}
public bool HasBody()
{
return body != null;
}
}
}

View File

@@ -0,0 +1,72 @@
//------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//------------------------------------------------------------
namespace System.ServiceModel.PeerResolvers
{
using System.ServiceModel.Channels;
using System.ServiceModel;
using System.Runtime.Serialization;
[MessageContract(IsWrapped = false)]
public class UpdateInfo
{
[DataContract(Name = "Update", Namespace = PeerStrings.Namespace)]
class UpdateInfoDC
{
[DataMember(Name = "ClientId")]
public Guid ClientId;
[DataMember(Name = "MeshId")]
public string MeshId;
[DataMember(Name = "NodeAddress")]
public PeerNodeAddress NodeAddress;
[DataMember(Name = "RegistrationId")]
public Guid RegistrationId;
public UpdateInfoDC() { }
public UpdateInfoDC(Guid registrationId, Guid client, string meshId, PeerNodeAddress address)
{
this.ClientId = client;
this.MeshId = meshId;
this.NodeAddress = address;
this.RegistrationId = registrationId;
}
}
public UpdateInfo(Guid registrationId, Guid client, string meshId, PeerNodeAddress address)
{
body = new UpdateInfoDC(registrationId, client, meshId, address);
}
public UpdateInfo() { body = new UpdateInfoDC(); }
public Guid ClientId
{
get { return this.body.ClientId; }
}
public Guid RegistrationId
{
get { return this.body.RegistrationId; }
}
public string MeshId
{
get { return this.body.MeshId; }
}
public PeerNodeAddress NodeAddress
{
get { return this.body.NodeAddress; }
}
[MessageBodyMember(Name = "Update", Namespace = PeerStrings.Namespace)]
UpdateInfoDC body;
public bool HasBody()
{
return body != null;
}
}
}