You've already forked linux-packaging-mono
Imported Upstream version 4.6.0.125
Former-commit-id: a2155e9bd80020e49e72e86c44da02a8ac0e57a4
This commit is contained in:
parent
a569aebcfd
commit
e79aa3c0ed
@ -0,0 +1,237 @@
|
||||
//----------------------------------------------------------------
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//----------------------------------------------------------------
|
||||
|
||||
namespace System.ServiceModel.Discovery.Version11
|
||||
{
|
||||
using System.ComponentModel;
|
||||
using System.Runtime;
|
||||
using System.ServiceModel.Description;
|
||||
using System.Threading;
|
||||
|
||||
class AnnouncementInnerClient11 : ClientBase<IAnnouncementContract11>, IAnnouncementInnerClient
|
||||
{
|
||||
DiscoveryMessageSequenceGenerator discoveryMessageSequenceGenerator;
|
||||
|
||||
BeginOperationDelegate onBeginHelloOperationDelegate;
|
||||
EndOperationDelegate onEndHelloOperationDelegate;
|
||||
SendOrPostCallback onHelloOperationCompletedDelegate;
|
||||
|
||||
BeginOperationDelegate onBeginByeOperationDelegate;
|
||||
EndOperationDelegate onEndByeOperationDelegate;
|
||||
SendOrPostCallback onByeOperationCompletedDelegate;
|
||||
|
||||
public AnnouncementInnerClient11(AnnouncementEndpoint announcementEndpoint)
|
||||
: base(announcementEndpoint)
|
||||
{
|
||||
this.discoveryMessageSequenceGenerator = new DiscoveryMessageSequenceGenerator();
|
||||
}
|
||||
|
||||
event EventHandler<AsyncCompletedEventArgs> HelloOperationCompletedEventHandler;
|
||||
event EventHandler<AsyncCompletedEventArgs> ByeOperationCompletedEventHandler;
|
||||
|
||||
event EventHandler<AsyncCompletedEventArgs> IAnnouncementInnerClient.HelloOperationCompleted
|
||||
{
|
||||
add
|
||||
{
|
||||
this.HelloOperationCompletedEventHandler += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
this.HelloOperationCompletedEventHandler -= value;
|
||||
}
|
||||
}
|
||||
|
||||
event EventHandler<AsyncCompletedEventArgs> IAnnouncementInnerClient.ByeOperationCompleted
|
||||
{
|
||||
add
|
||||
{
|
||||
this.ByeOperationCompletedEventHandler += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
this.ByeOperationCompletedEventHandler -= value;
|
||||
}
|
||||
}
|
||||
|
||||
public DiscoveryMessageSequenceGenerator DiscoveryMessageSequenceGenerator
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.discoveryMessageSequenceGenerator;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.discoveryMessageSequenceGenerator = value;
|
||||
}
|
||||
}
|
||||
|
||||
public new ChannelFactory ChannelFactory
|
||||
{
|
||||
get
|
||||
{
|
||||
return base.ChannelFactory;
|
||||
}
|
||||
}
|
||||
|
||||
public new IClientChannel InnerChannel
|
||||
{
|
||||
get
|
||||
{
|
||||
return base.InnerChannel;
|
||||
}
|
||||
}
|
||||
|
||||
public new ServiceEndpoint Endpoint
|
||||
{
|
||||
get
|
||||
{
|
||||
return base.Endpoint;
|
||||
}
|
||||
}
|
||||
|
||||
public ICommunicationObject InnerCommunicationObject
|
||||
{
|
||||
get
|
||||
{
|
||||
return this as ICommunicationObject;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void HelloOperation(EndpointDiscoveryMetadata endpointDiscoveryMetadata)
|
||||
{
|
||||
HelloMessage11 message = HelloMessage11.Create(DiscoveryMessageSequenceGenerator.Next(), endpointDiscoveryMetadata);
|
||||
base.Channel.HelloOperation(message);
|
||||
}
|
||||
|
||||
public void ByeOperation(EndpointDiscoveryMetadata endpointDiscoveryMetadata)
|
||||
{
|
||||
ByeMessage11 message = ByeMessage11.Create(DiscoveryMessageSequenceGenerator.Next(), endpointDiscoveryMetadata);
|
||||
base.Channel.ByeOperation(message);
|
||||
}
|
||||
|
||||
public IAsyncResult BeginHelloOperation(EndpointDiscoveryMetadata endpointDiscoveryMetadata, AsyncCallback callback, object state)
|
||||
{
|
||||
HelloMessage11 message = HelloMessage11.Create(DiscoveryMessageSequenceGenerator.Next(), endpointDiscoveryMetadata);
|
||||
return base.Channel.BeginHelloOperation(message, callback, state);
|
||||
}
|
||||
|
||||
public void EndHelloOperation(IAsyncResult result)
|
||||
{
|
||||
base.Channel.EndHelloOperation(result);
|
||||
}
|
||||
|
||||
public IAsyncResult BeginByeOperation(EndpointDiscoveryMetadata endpointDiscoveryMetadata, AsyncCallback callback, object state)
|
||||
{
|
||||
ByeMessage11 message = ByeMessage11.Create(DiscoveryMessageSequenceGenerator.Next(), endpointDiscoveryMetadata);
|
||||
return base.Channel.BeginByeOperation(message, callback, state);
|
||||
}
|
||||
|
||||
public void EndByeOperation(IAsyncResult result)
|
||||
{
|
||||
base.Channel.EndByeOperation(result);
|
||||
}
|
||||
|
||||
public void HelloOperationAsync(EndpointDiscoveryMetadata endpointDiscoveryMetadata, object userState)
|
||||
{
|
||||
HelloMessage11 message = HelloMessage11.Create(DiscoveryMessageSequenceGenerator.Next(), endpointDiscoveryMetadata);
|
||||
|
||||
if ((this.onBeginHelloOperationDelegate == null))
|
||||
{
|
||||
this.onBeginHelloOperationDelegate = new BeginOperationDelegate(this.OnBeginHelloOperation);
|
||||
}
|
||||
if ((this.onEndHelloOperationDelegate == null))
|
||||
{
|
||||
this.onEndHelloOperationDelegate = new EndOperationDelegate(this.OnEndHelloOperation);
|
||||
}
|
||||
if ((this.onHelloOperationCompletedDelegate == null))
|
||||
{
|
||||
this.onHelloOperationCompletedDelegate = Fx.ThunkCallback(new SendOrPostCallback(this.OnHelloOperationCompleted));
|
||||
}
|
||||
base.InvokeAsync(
|
||||
this.onBeginHelloOperationDelegate,
|
||||
new object[] { message },
|
||||
this.onEndHelloOperationDelegate,
|
||||
this.onHelloOperationCompletedDelegate,
|
||||
userState);
|
||||
}
|
||||
|
||||
public void ByeOperationAsync(EndpointDiscoveryMetadata endpointDiscoveryMetadata, object userState)
|
||||
{
|
||||
ByeMessage11 message = ByeMessage11.Create(DiscoveryMessageSequenceGenerator.Next(), endpointDiscoveryMetadata);
|
||||
|
||||
if (this.onBeginByeOperationDelegate == null)
|
||||
{
|
||||
this.onBeginByeOperationDelegate = new BeginOperationDelegate(this.OnBeginByeOperation);
|
||||
}
|
||||
if ((this.onEndByeOperationDelegate == null))
|
||||
{
|
||||
this.onEndByeOperationDelegate = new EndOperationDelegate(this.OnEndByeOperation);
|
||||
}
|
||||
if ((this.onByeOperationCompletedDelegate == null))
|
||||
{
|
||||
this.onByeOperationCompletedDelegate = Fx.ThunkCallback(new SendOrPostCallback(this.OnByeOperationCompleted));
|
||||
}
|
||||
base.InvokeAsync(
|
||||
this.onBeginByeOperationDelegate,
|
||||
new object[] { message },
|
||||
this.onEndByeOperationDelegate,
|
||||
this.onByeOperationCompletedDelegate,
|
||||
userState);
|
||||
}
|
||||
|
||||
IAsyncResult BeginHelloOperation(HelloMessage11 message, AsyncCallback callback, object state)
|
||||
{
|
||||
return base.Channel.BeginHelloOperation(message, callback, state);
|
||||
}
|
||||
|
||||
IAsyncResult BeginByeOperation(ByeMessage11 message, AsyncCallback callback, object state)
|
||||
{
|
||||
return base.Channel.BeginByeOperation(message, callback, state);
|
||||
}
|
||||
|
||||
|
||||
IAsyncResult OnBeginHelloOperation(object[] inValues, System.AsyncCallback callback, object asyncState)
|
||||
{
|
||||
HelloMessage11 message = ((HelloMessage11)(inValues[0]));
|
||||
return this.BeginHelloOperation(message, callback, asyncState);
|
||||
}
|
||||
|
||||
object[] OnEndHelloOperation(System.IAsyncResult result)
|
||||
{
|
||||
this.EndHelloOperation(result);
|
||||
return null;
|
||||
}
|
||||
|
||||
void OnHelloOperationCompleted(object state)
|
||||
{
|
||||
if ((this.HelloOperationCompletedEventHandler != null))
|
||||
{
|
||||
InvokeAsyncCompletedEventArgs e = ((InvokeAsyncCompletedEventArgs)(state));
|
||||
this.HelloOperationCompletedEventHandler(this, new System.ComponentModel.AsyncCompletedEventArgs(e.Error, e.Cancelled, e.UserState));
|
||||
}
|
||||
}
|
||||
|
||||
IAsyncResult OnBeginByeOperation(object[] inValues, System.AsyncCallback callback, object asyncState)
|
||||
{
|
||||
ByeMessage11 message = ((ByeMessage11)(inValues[0]));
|
||||
return this.BeginByeOperation(message, callback, asyncState);
|
||||
}
|
||||
|
||||
object[] OnEndByeOperation(System.IAsyncResult result)
|
||||
{
|
||||
this.EndByeOperation(result);
|
||||
return null;
|
||||
}
|
||||
|
||||
void OnByeOperationCompleted(object state)
|
||||
{
|
||||
if (this.ByeOperationCompletedEventHandler != null)
|
||||
{
|
||||
InvokeAsyncCompletedEventArgs e = ((InvokeAsyncCompletedEventArgs)(state));
|
||||
this.ByeOperationCompletedEventHandler(this, new System.ComponentModel.AsyncCompletedEventArgs(e.Error, e.Cancelled, e.UserState));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
//----------------------------------------------------------------
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//----------------------------------------------------------------
|
||||
|
||||
namespace System.ServiceModel.Discovery.Version11
|
||||
{
|
||||
using System.ServiceModel;
|
||||
|
||||
[MessageContract(IsWrapped = false)]
|
||||
class ByeMessage11
|
||||
{
|
||||
private ByeMessage11()
|
||||
{
|
||||
}
|
||||
|
||||
[MessageHeader(Name = ProtocolStrings.SchemaNames.AppSequenceElement, Namespace = ProtocolStrings.Version11.Namespace)]
|
||||
public DiscoveryMessageSequence11 MessageSequence
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
[MessageBodyMember(Name = ProtocolStrings.SchemaNames.ByeElement, Namespace = ProtocolStrings.Version11.Namespace)]
|
||||
public EndpointDiscoveryMetadata11 Bye
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
public static ByeMessage11 Create(DiscoveryMessageSequence messageSequence, EndpointDiscoveryMetadata endpointDiscoveryMetadata)
|
||||
{
|
||||
return new ByeMessage11()
|
||||
{
|
||||
MessageSequence = DiscoveryMessageSequence11.FromDiscoveryMessageSequence(messageSequence),
|
||||
Bye = EndpointDiscoveryMetadata11.FromEndpointDiscoveryMetadata(endpointDiscoveryMetadata)
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
//----------------------------------------------------------------
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//----------------------------------------------------------------
|
||||
|
||||
namespace System.ServiceModel.Discovery.Version11
|
||||
{
|
||||
using System.Runtime;
|
||||
|
||||
sealed class ByeOperation11AsyncResult : ByeOperationAsyncResult<ByeMessage11>
|
||||
{
|
||||
public ByeOperation11AsyncResult(
|
||||
IAnnouncementServiceImplementation announcementServiceImpl,
|
||||
ByeMessage11 message,
|
||||
AsyncCallback callback,
|
||||
object state)
|
||||
: base(announcementServiceImpl, message, callback, state)
|
||||
{
|
||||
}
|
||||
|
||||
public static void End(IAsyncResult result)
|
||||
{
|
||||
AsyncResult.End<ByeOperation11AsyncResult>(result);
|
||||
}
|
||||
|
||||
protected override bool ValidateContent(ByeMessage11 message)
|
||||
{
|
||||
return (message.Bye != null);
|
||||
}
|
||||
|
||||
protected override DiscoveryMessageSequence GetMessageSequence(ByeMessage11 message)
|
||||
{
|
||||
return DiscoveryUtility.ToDiscoveryMessageSequenceOrNull(message.MessageSequence);
|
||||
}
|
||||
|
||||
protected override EndpointDiscoveryMetadata GetEndpointDiscoveryMetadata(ByeMessage11 message)
|
||||
{
|
||||
return message.Bye.ToEndpointDiscoveryMetadata();
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,239 @@
|
||||
//----------------------------------------------------------------
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//----------------------------------------------------------------
|
||||
|
||||
namespace System.ServiceModel.Discovery.Version11
|
||||
{
|
||||
using System;
|
||||
using System.Runtime;
|
||||
using System.ServiceModel.Description;
|
||||
|
||||
class DiscoveryInnerClientAdhoc11 : IDiscoveryInnerClient, IDiscoveryResponseContract11
|
||||
{
|
||||
IDiscoveryInnerClientResponse responseReceiver;
|
||||
DuplexClient11 duplexInnerClient;
|
||||
|
||||
public DiscoveryInnerClientAdhoc11(DiscoveryEndpoint discoveryEndpoint, IDiscoveryInnerClientResponse responseReceiver)
|
||||
{
|
||||
Fx.Assert(discoveryEndpoint != null, "The discoveryEndpoint parameter cannot be null");
|
||||
Fx.Assert(responseReceiver != null, "The responseReceiver parameter cannot be null");
|
||||
|
||||
this.responseReceiver = responseReceiver;
|
||||
if (discoveryEndpoint.Behaviors.Find<DiscoveryCallbackBehavior>() == null)
|
||||
{
|
||||
discoveryEndpoint.Behaviors.Insert(0, new DiscoveryCallbackBehavior());
|
||||
}
|
||||
|
||||
this.duplexInnerClient = new DuplexClient11(this, discoveryEndpoint);
|
||||
}
|
||||
|
||||
public ClientCredentials ClientCredentials
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.duplexInnerClient.ClientCredentials;
|
||||
}
|
||||
}
|
||||
|
||||
public ChannelFactory ChannelFactory
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.duplexInnerClient.ChannelFactory;
|
||||
}
|
||||
}
|
||||
|
||||
public IClientChannel InnerChannel
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.duplexInnerClient.InnerChannel;
|
||||
}
|
||||
}
|
||||
|
||||
public ServiceEndpoint Endpoint
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.duplexInnerClient.Endpoint;
|
||||
}
|
||||
}
|
||||
|
||||
public ICommunicationObject InnerCommunicationObject
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.duplexInnerClient as ICommunicationObject;
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsRequestResponse
|
||||
{
|
||||
get
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public IAsyncResult BeginProbeOperation(FindCriteria findCriteria, AsyncCallback callback, object state)
|
||||
{
|
||||
ProbeMessage11 request = new ProbeMessage11();
|
||||
request.Probe = FindCriteria11.FromFindCriteria(findCriteria);
|
||||
return this.duplexInnerClient.BeginProbeOperation(request, callback, state);
|
||||
}
|
||||
|
||||
public IAsyncResult BeginResolveOperation(ResolveCriteria resolveCriteria, AsyncCallback callback, object state)
|
||||
{
|
||||
ResolveMessage11 request = new ResolveMessage11();
|
||||
request.Resolve = ResolveCriteria11.FromResolveCriteria(resolveCriteria);
|
||||
return this.duplexInnerClient.BeginResolveOperation(request, callback, state);
|
||||
}
|
||||
|
||||
public void EndProbeOperation(IAsyncResult result)
|
||||
{
|
||||
this.duplexInnerClient.EndProbeOperation(result);
|
||||
}
|
||||
|
||||
public void EndResolveOperation(IAsyncResult result)
|
||||
{
|
||||
this.duplexInnerClient.EndResolveOperation(result);
|
||||
}
|
||||
|
||||
public void ProbeOperation(FindCriteria findCriteria)
|
||||
{
|
||||
ProbeMessage11 request = new ProbeMessage11();
|
||||
request.Probe = FindCriteria11.FromFindCriteria(findCriteria);
|
||||
this.duplexInnerClient.ProbeOperation(request);
|
||||
}
|
||||
|
||||
public void ResolveOperation(ResolveCriteria resolveCriteria)
|
||||
{
|
||||
ResolveMessage11 request = new ResolveMessage11();
|
||||
request.Resolve = ResolveCriteria11.FromResolveCriteria(resolveCriteria);
|
||||
this.duplexInnerClient.ResolveOperation(request);
|
||||
}
|
||||
|
||||
public IAsyncResult BeginProbeMatchOperation(ProbeMatchesMessage11 response, AsyncCallback callback, object state)
|
||||
{
|
||||
Fx.Assert(response != null, "The response message cannot be null.");
|
||||
if ((response.MessageSequence != null) && (response.ProbeMatches != null))
|
||||
{
|
||||
this.responseReceiver.ProbeMatchOperation(
|
||||
OperationContext.Current.IncomingMessageHeaders.RelatesTo,
|
||||
response.MessageSequence.ToDiscoveryMessageSequence(),
|
||||
DiscoveryUtility.ToEndpointDiscoveryMetadataCollection(response.ProbeMatches),
|
||||
false);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (TD.DiscoveryMessageWithNullMessageSequenceIsEnabled() && response.MessageSequence == null)
|
||||
{
|
||||
TD.DiscoveryMessageWithNullMessageSequence(
|
||||
ProtocolStrings.TracingStrings.ProbeMatches,
|
||||
OperationContext.Current.IncomingMessageHeaders.MessageId.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
return new CompletedAsyncResult(callback, state);
|
||||
}
|
||||
|
||||
public void EndProbeMatchOperation(IAsyncResult result)
|
||||
{
|
||||
CompletedAsyncResult.End(result);
|
||||
}
|
||||
|
||||
public IAsyncResult BeginResolveMatchOperation(ResolveMatchesMessage11 response, AsyncCallback callback, object state)
|
||||
{
|
||||
Fx.Assert(response != null, "The response message cannot be null.");
|
||||
if ((response.MessageSequence != null) && (response.ResolveMatches != null) && (response.ResolveMatches.ResolveMatch != null))
|
||||
{
|
||||
this.responseReceiver.ResolveMatchOperation(
|
||||
OperationContext.Current.IncomingMessageHeaders.RelatesTo,
|
||||
response.MessageSequence.ToDiscoveryMessageSequence(),
|
||||
response.ResolveMatches.ResolveMatch.ToEndpointDiscoveryMetadata());
|
||||
}
|
||||
else
|
||||
{
|
||||
if (TD.DiscoveryMessageWithNullMessageSequenceIsEnabled() && response.MessageSequence == null)
|
||||
{
|
||||
TD.DiscoveryMessageWithNullMessageSequence(
|
||||
ProtocolStrings.TracingStrings.ResolveMatches,
|
||||
OperationContext.Current.IncomingMessageHeaders.MessageId.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
return new CompletedAsyncResult(callback, state);
|
||||
}
|
||||
|
||||
public void EndResolveMatchOperation(IAsyncResult result)
|
||||
{
|
||||
CompletedAsyncResult.End(result);
|
||||
}
|
||||
|
||||
public IAsyncResult BeginHelloOperation(HelloMessage11 message, AsyncCallback callback, object state)
|
||||
{
|
||||
Fx.Assert(message != null, "The message cannot be null.");
|
||||
if ((message.MessageSequence != null) && (message.Hello != null))
|
||||
{
|
||||
this.responseReceiver.HelloOperation(
|
||||
OperationContext.Current.IncomingMessageHeaders.RelatesTo,
|
||||
message.MessageSequence.ToDiscoveryMessageSequence(),
|
||||
message.Hello.ToEndpointDiscoveryMetadata());
|
||||
}
|
||||
else
|
||||
{
|
||||
if (TD.DiscoveryMessageWithNullMessageSequenceIsEnabled() && message.MessageSequence == null)
|
||||
{
|
||||
TD.DiscoveryMessageWithNullMessageSequence(
|
||||
ProtocolStrings.TracingStrings.Hello,
|
||||
OperationContext.Current.IncomingMessageHeaders.MessageId.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
return new CompletedAsyncResult(callback, state);
|
||||
}
|
||||
|
||||
public void EndHelloOperation(IAsyncResult result)
|
||||
{
|
||||
CompletedAsyncResult.End(result);
|
||||
}
|
||||
|
||||
class DuplexClient11 : DuplexClientBase<IDiscoveryContractAdhoc11>
|
||||
{
|
||||
public DuplexClient11(object callbackInstance, DiscoveryEndpoint discoveryEndpoint)
|
||||
: base(callbackInstance, discoveryEndpoint)
|
||||
{
|
||||
}
|
||||
|
||||
public void ProbeOperation(ProbeMessage11 request)
|
||||
{
|
||||
base.Channel.ProbeOperation(request);
|
||||
}
|
||||
|
||||
public void ResolveOperation(ResolveMessage11 request)
|
||||
{
|
||||
base.Channel.ResolveOperation(request);
|
||||
}
|
||||
|
||||
public IAsyncResult BeginProbeOperation(ProbeMessage11 request, AsyncCallback callback, object state)
|
||||
{
|
||||
return base.Channel.BeginProbeOperation(request, callback, state);
|
||||
}
|
||||
|
||||
public IAsyncResult BeginResolveOperation(ResolveMessage11 request, AsyncCallback callback, object state)
|
||||
{
|
||||
return base.Channel.BeginResolveOperation(request, callback, state);
|
||||
}
|
||||
|
||||
public void EndProbeOperation(IAsyncResult result)
|
||||
{
|
||||
base.Channel.EndProbeOperation(result);
|
||||
}
|
||||
|
||||
public void EndResolveOperation(IAsyncResult result)
|
||||
{
|
||||
base.Channel.EndResolveOperation(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,161 @@
|
||||
//----------------------------------------------------------------
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//----------------------------------------------------------------
|
||||
|
||||
namespace System.ServiceModel.Discovery.Version11
|
||||
{
|
||||
using System;
|
||||
using System.ServiceModel;
|
||||
using System.ServiceModel.Channels;
|
||||
using System.Runtime;
|
||||
using System.ServiceModel.Description;
|
||||
|
||||
class DiscoveryInnerClientManaged11 : ClientBase<IDiscoveryContractManaged11>, IDiscoveryInnerClient
|
||||
{
|
||||
IDiscoveryInnerClientResponse responseReceiver;
|
||||
|
||||
internal DiscoveryInnerClientManaged11(DiscoveryEndpoint discoveryEndpoint, IDiscoveryInnerClientResponse responseReceiver)
|
||||
: base(discoveryEndpoint)
|
||||
{
|
||||
Fx.Assert(responseReceiver != null, "The responseReceiver parameter cannot be null");
|
||||
this.responseReceiver = responseReceiver;
|
||||
}
|
||||
|
||||
public new ClientCredentials ClientCredentials
|
||||
{
|
||||
get
|
||||
{
|
||||
return base.ClientCredentials;
|
||||
}
|
||||
}
|
||||
|
||||
public new ChannelFactory ChannelFactory
|
||||
{
|
||||
get
|
||||
{
|
||||
return base.ChannelFactory;
|
||||
}
|
||||
}
|
||||
|
||||
public new IClientChannel InnerChannel
|
||||
{
|
||||
get
|
||||
{
|
||||
return base.InnerChannel;
|
||||
}
|
||||
}
|
||||
|
||||
public new ServiceEndpoint Endpoint
|
||||
{
|
||||
get
|
||||
{
|
||||
return base.Endpoint;
|
||||
}
|
||||
}
|
||||
|
||||
public ICommunicationObject InnerCommunicationObject
|
||||
{
|
||||
get
|
||||
{
|
||||
return this as ICommunicationObject;
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsRequestResponse
|
||||
{
|
||||
get
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public IAsyncResult BeginProbeOperation(FindCriteria findCriteria, AsyncCallback callback, object state)
|
||||
{
|
||||
ProbeMessage11 request = new ProbeMessage11();
|
||||
request.Probe = FindCriteria11.FromFindCriteria(findCriteria);
|
||||
return base.Channel.BeginProbeOperation(request, callback, state);
|
||||
}
|
||||
|
||||
public IAsyncResult BeginResolveOperation(ResolveCriteria resolveCriteria, AsyncCallback callback, object state)
|
||||
{
|
||||
ResolveMessage11 request = new ResolveMessage11();
|
||||
request.Resolve = ResolveCriteria11.FromResolveCriteria(resolveCriteria);
|
||||
|
||||
return base.Channel.BeginResolveOperation(request, callback, state);
|
||||
}
|
||||
|
||||
public void EndProbeOperation(IAsyncResult result)
|
||||
{
|
||||
ProbeMatchesMessage11 response = base.Channel.EndProbeOperation(result);
|
||||
AsyncOperationContext context = (AsyncOperationContext)result.AsyncState;
|
||||
if ((response != null) && (response.ProbeMatches != null))
|
||||
{
|
||||
this.responseReceiver.ProbeMatchOperation(
|
||||
context.OperationId,
|
||||
DiscoveryUtility.ToDiscoveryMessageSequenceOrNull(response.MessageSequence),
|
||||
DiscoveryUtility.ToEndpointDiscoveryMetadataCollection(response.ProbeMatches),
|
||||
true);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.responseReceiver.PostFindCompletedAndRemove(context.OperationId, false, null);
|
||||
}
|
||||
}
|
||||
|
||||
public void EndResolveOperation(IAsyncResult result)
|
||||
{
|
||||
ResolveMatchesMessage11 response = base.Channel.EndResolveOperation(result);
|
||||
AsyncOperationContext context = (AsyncOperationContext)result.AsyncState;
|
||||
if ((response != null) && (response.ResolveMatches != null) && (response.ResolveMatches.ResolveMatch != null))
|
||||
{
|
||||
this.responseReceiver.ResolveMatchOperation(
|
||||
context.OperationId,
|
||||
DiscoveryUtility.ToDiscoveryMessageSequenceOrNull(response.MessageSequence),
|
||||
response.ResolveMatches.ResolveMatch.ToEndpointDiscoveryMetadata());
|
||||
}
|
||||
else
|
||||
{
|
||||
this.responseReceiver.PostResolveCompletedAndRemove(context.OperationId, false, null);
|
||||
}
|
||||
}
|
||||
|
||||
public void ProbeOperation(FindCriteria findCriteria)
|
||||
{
|
||||
ProbeMessage11 request = new ProbeMessage11();
|
||||
request.Probe = FindCriteria11.FromFindCriteria(findCriteria);
|
||||
|
||||
ProbeMatchesMessage11 response = base.Channel.ProbeOperation(request);
|
||||
if ((response != null) && (response.ProbeMatches != null))
|
||||
{
|
||||
this.responseReceiver.ProbeMatchOperation(
|
||||
OperationContext.Current.IncomingMessageHeaders.RelatesTo,
|
||||
DiscoveryUtility.ToDiscoveryMessageSequenceOrNull(response.MessageSequence),
|
||||
DiscoveryUtility.ToEndpointDiscoveryMetadataCollection(response.ProbeMatches),
|
||||
true);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.responseReceiver.PostFindCompletedAndRemove(OperationContext.Current.IncomingMessageHeaders.RelatesTo, false, null);
|
||||
}
|
||||
}
|
||||
|
||||
public void ResolveOperation(ResolveCriteria resolveCriteria)
|
||||
{
|
||||
ResolveMessage11 request = new ResolveMessage11();
|
||||
request.Resolve = ResolveCriteria11.FromResolveCriteria(resolveCriteria);
|
||||
|
||||
ResolveMatchesMessage11 response = base.Channel.ResolveOperation(request);
|
||||
if ((response != null) && (response.ResolveMatches != null) && (response.ResolveMatches.ResolveMatch != null))
|
||||
{
|
||||
this.responseReceiver.ResolveMatchOperation(
|
||||
OperationContext.Current.IncomingMessageHeaders.RelatesTo,
|
||||
DiscoveryUtility.ToDiscoveryMessageSequenceOrNull(response.MessageSequence),
|
||||
response.ResolveMatches.ResolveMatch.ToEndpointDiscoveryMetadata());
|
||||
}
|
||||
else
|
||||
{
|
||||
this.responseReceiver.PostResolveCompletedAndRemove(OperationContext.Current.IncomingMessageHeaders.RelatesTo, false, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,68 @@
|
||||
//----------------------------------------------------------------
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//----------------------------------------------------------------
|
||||
|
||||
namespace System.ServiceModel.Discovery.Version11
|
||||
{
|
||||
using System.Runtime;
|
||||
using System.Xml;
|
||||
using System.Xml.Schema;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
[XmlSchemaProvider("GetSchema")]
|
||||
[Fx.Tag.XamlVisible(false)]
|
||||
public class DiscoveryMessageSequence11 : IXmlSerializable
|
||||
{
|
||||
DiscoveryMessageSequence discoveryMessageSequence;
|
||||
|
||||
DiscoveryMessageSequence11()
|
||||
{
|
||||
this.discoveryMessageSequence = new DiscoveryMessageSequence();
|
||||
}
|
||||
|
||||
DiscoveryMessageSequence11(DiscoveryMessageSequence discoveryMessageSequence)
|
||||
{
|
||||
this.discoveryMessageSequence = discoveryMessageSequence;
|
||||
}
|
||||
|
||||
public static DiscoveryMessageSequence11 FromDiscoveryMessageSequence(DiscoveryMessageSequence discoveryMessageSequence)
|
||||
{
|
||||
if (discoveryMessageSequence == null)
|
||||
{
|
||||
throw FxTrace.Exception.ArgumentNull("discoveryMessageSequence");
|
||||
}
|
||||
return new DiscoveryMessageSequence11(discoveryMessageSequence);
|
||||
}
|
||||
|
||||
public static XmlQualifiedName GetSchema(XmlSchemaSet schemaSet)
|
||||
{
|
||||
if (schemaSet == null)
|
||||
{
|
||||
throw FxTrace.Exception.ArgumentNull("schemaSet");
|
||||
}
|
||||
|
||||
return SchemaUtility.EnsureAppSequenceSchema(DiscoveryVersion.WSDiscovery11, schemaSet);
|
||||
}
|
||||
|
||||
public DiscoveryMessageSequence ToDiscoveryMessageSequence()
|
||||
{
|
||||
return this.discoveryMessageSequence;
|
||||
}
|
||||
|
||||
public XmlSchema GetSchema()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
[Fx.Tag.InheritThrows(From = "ReadFrom", FromDeclaringType = typeof(DiscoveryMessageSequence))]
|
||||
public void ReadXml(XmlReader reader)
|
||||
{
|
||||
this.discoveryMessageSequence.ReadFrom(reader);
|
||||
}
|
||||
|
||||
public void WriteXml(XmlWriter writer)
|
||||
{
|
||||
this.discoveryMessageSequence.WriteTo(writer);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,217 @@
|
||||
//----------------------------------------------------------------
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//----------------------------------------------------------------
|
||||
|
||||
namespace System.ServiceModel.Discovery.Version11
|
||||
{
|
||||
using System.Runtime.Serialization;
|
||||
using System.ServiceModel.Channels;
|
||||
using System.Runtime;
|
||||
using System.ServiceModel.Description;
|
||||
using System.Globalization;
|
||||
|
||||
class DiscoveryVersion11Implementation : IDiscoveryVersionImplementation
|
||||
{
|
||||
static readonly Uri ScopeMatchByExact = new Uri(ProtocolStrings.Version11.ScopeMatchByExact);
|
||||
static readonly Uri ScopeMatchByLdap = new Uri(ProtocolStrings.Version11.ScopeMatchByLdap);
|
||||
static readonly Uri ScopeMatchByPrefix = new Uri(ProtocolStrings.Version11.ScopeMatchByPrefix);
|
||||
static readonly Uri ScopeMatchByUuid = new Uri(ProtocolStrings.Version11.ScopeMatchByUuid);
|
||||
static readonly Uri ScopeMatchByNone = new Uri(ProtocolStrings.Version11.ScopeMatchByNone);
|
||||
|
||||
Uri discoveryAddress;
|
||||
DataContractSerializer eprSerializer;
|
||||
DiscoveryVersion.SchemaQualifiedNames qualifiedNames;
|
||||
|
||||
ContractDescription adhocDiscoveryContract;
|
||||
ContractDescription managedDiscoveryContract;
|
||||
ContractDescription announcementContract;
|
||||
|
||||
[Fx.Tag.SynchronizationObject()]
|
||||
object contractLock;
|
||||
|
||||
public DiscoveryVersion11Implementation()
|
||||
{
|
||||
this.contractLock = new object();
|
||||
}
|
||||
|
||||
public string WsaNamespace
|
||||
{
|
||||
get
|
||||
{
|
||||
return ProtocolStrings.WsaNamespace10;
|
||||
}
|
||||
}
|
||||
|
||||
public Uri DiscoveryAddress
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.discoveryAddress == null)
|
||||
{
|
||||
this.discoveryAddress = new Uri(ProtocolStrings.Version11.AdhocAddress);
|
||||
}
|
||||
return this.discoveryAddress;
|
||||
}
|
||||
}
|
||||
|
||||
public MessageVersion MessageVersion
|
||||
{
|
||||
get
|
||||
{
|
||||
return MessageVersion.Soap12WSAddressing10;
|
||||
}
|
||||
}
|
||||
|
||||
public DiscoveryVersion.SchemaQualifiedNames QualifiedNames
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.qualifiedNames == null)
|
||||
{
|
||||
this.qualifiedNames = new DiscoveryVersion.SchemaQualifiedNames(ProtocolStrings.Version11.Namespace, this.WsaNamespace);
|
||||
}
|
||||
return this.qualifiedNames;
|
||||
}
|
||||
}
|
||||
|
||||
public DataContractSerializer EprSerializer
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.eprSerializer == null)
|
||||
{
|
||||
this.eprSerializer = new DataContractSerializer(typeof(EndpointAddress10));
|
||||
}
|
||||
return this.eprSerializer;
|
||||
}
|
||||
}
|
||||
|
||||
public ContractDescription GetDiscoveryContract(ServiceDiscoveryMode discoveryMode)
|
||||
{
|
||||
if (discoveryMode == ServiceDiscoveryMode.Adhoc)
|
||||
{
|
||||
if (this.adhocDiscoveryContract == null)
|
||||
{
|
||||
lock (this.contractLock)
|
||||
{
|
||||
if (this.adhocDiscoveryContract == null)
|
||||
{
|
||||
this.adhocDiscoveryContract = DiscoveryUtility.GetContract(typeof(IDiscoveryContractAdhoc11));
|
||||
}
|
||||
}
|
||||
}
|
||||
return this.adhocDiscoveryContract;
|
||||
}
|
||||
else if (discoveryMode == ServiceDiscoveryMode.Managed)
|
||||
{
|
||||
if (this.managedDiscoveryContract == null)
|
||||
{
|
||||
lock (this.contractLock)
|
||||
{
|
||||
if (this.managedDiscoveryContract == null)
|
||||
{
|
||||
this.managedDiscoveryContract = DiscoveryUtility.GetContract(typeof(IDiscoveryContractManaged11));
|
||||
}
|
||||
}
|
||||
}
|
||||
return this.managedDiscoveryContract;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw FxTrace.Exception.AsError(new ArgumentException(SR.DiscoveryIncorrectMode(discoveryMode)));
|
||||
}
|
||||
}
|
||||
|
||||
public ContractDescription GetAnnouncementContract()
|
||||
{
|
||||
if (this.announcementContract == null)
|
||||
{
|
||||
lock (this.contractLock)
|
||||
{
|
||||
if (this.announcementContract == null)
|
||||
{
|
||||
this.announcementContract = DiscoveryUtility.GetContract(typeof(IAnnouncementContract11));
|
||||
}
|
||||
}
|
||||
}
|
||||
return this.announcementContract;
|
||||
}
|
||||
|
||||
public IDiscoveryInnerClient CreateDiscoveryInnerClient(DiscoveryEndpoint discoveryEndpoint, IDiscoveryInnerClientResponse responseReceiver)
|
||||
{
|
||||
if (discoveryEndpoint.DiscoveryMode == ServiceDiscoveryMode.Adhoc)
|
||||
{
|
||||
return new DiscoveryInnerClientAdhoc11(discoveryEndpoint, responseReceiver);
|
||||
}
|
||||
else if (discoveryEndpoint.DiscoveryMode == ServiceDiscoveryMode.Managed)
|
||||
{
|
||||
return new DiscoveryInnerClientManaged11(discoveryEndpoint, responseReceiver);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw FxTrace.Exception.AsError(new ArgumentException(SR.DiscoveryIncorrectMode(discoveryEndpoint.DiscoveryMode)));
|
||||
}
|
||||
}
|
||||
|
||||
public IAnnouncementInnerClient CreateAnnouncementInnerClient(AnnouncementEndpoint announcementEndpoint)
|
||||
{
|
||||
return new AnnouncementInnerClient11(announcementEndpoint);
|
||||
}
|
||||
|
||||
public Uri ToVersionIndependentScopeMatchBy(Uri versionDependentScopeMatchBy)
|
||||
{
|
||||
Uri scopeMatchBy = versionDependentScopeMatchBy;
|
||||
|
||||
if (versionDependentScopeMatchBy == DiscoveryVersion11Implementation.ScopeMatchByExact)
|
||||
{
|
||||
scopeMatchBy = FindCriteria.ScopeMatchByExact;
|
||||
}
|
||||
else if (versionDependentScopeMatchBy == DiscoveryVersion11Implementation.ScopeMatchByPrefix)
|
||||
{
|
||||
scopeMatchBy = FindCriteria.ScopeMatchByPrefix;
|
||||
}
|
||||
else if (versionDependentScopeMatchBy == DiscoveryVersion11Implementation.ScopeMatchByLdap)
|
||||
{
|
||||
scopeMatchBy = FindCriteria.ScopeMatchByLdap;
|
||||
}
|
||||
else if (versionDependentScopeMatchBy == DiscoveryVersion11Implementation.ScopeMatchByUuid)
|
||||
{
|
||||
scopeMatchBy = FindCriteria.ScopeMatchByUuid;
|
||||
}
|
||||
else if (versionDependentScopeMatchBy == DiscoveryVersion11Implementation.ScopeMatchByNone)
|
||||
{
|
||||
scopeMatchBy = FindCriteria.ScopeMatchByNone;
|
||||
}
|
||||
|
||||
return scopeMatchBy;
|
||||
}
|
||||
|
||||
public Uri ToVersionDependentScopeMatchBy(Uri versionIndependentScopeMatchBy)
|
||||
{
|
||||
Uri scopeMatchBy = versionIndependentScopeMatchBy;
|
||||
|
||||
if (versionIndependentScopeMatchBy == FindCriteria.ScopeMatchByExact)
|
||||
{
|
||||
scopeMatchBy = DiscoveryVersion11Implementation.ScopeMatchByExact;
|
||||
}
|
||||
else if (versionIndependentScopeMatchBy == FindCriteria.ScopeMatchByPrefix)
|
||||
{
|
||||
scopeMatchBy = DiscoveryVersion11Implementation.ScopeMatchByPrefix;
|
||||
}
|
||||
else if (versionIndependentScopeMatchBy == FindCriteria.ScopeMatchByLdap)
|
||||
{
|
||||
scopeMatchBy = DiscoveryVersion11Implementation.ScopeMatchByLdap;
|
||||
}
|
||||
else if (versionIndependentScopeMatchBy == FindCriteria.ScopeMatchByUuid)
|
||||
{
|
||||
scopeMatchBy = DiscoveryVersion11Implementation.ScopeMatchByUuid;
|
||||
}
|
||||
else if (versionIndependentScopeMatchBy == FindCriteria.ScopeMatchByNone)
|
||||
{
|
||||
scopeMatchBy = DiscoveryVersion11Implementation.ScopeMatchByNone;
|
||||
}
|
||||
|
||||
return scopeMatchBy;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,69 @@
|
||||
//----------------------------------------------------------------
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//----------------------------------------------------------------
|
||||
|
||||
namespace System.ServiceModel.Discovery.Version11
|
||||
{
|
||||
using System.Runtime;
|
||||
using System.Xml;
|
||||
using System.Xml.Schema;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
[XmlSchemaProvider("GetSchema")]
|
||||
[Fx.Tag.XamlVisible(false)]
|
||||
public class EndpointDiscoveryMetadata11 : IXmlSerializable
|
||||
{
|
||||
EndpointDiscoveryMetadata endpointDiscoveryMetadata;
|
||||
|
||||
EndpointDiscoveryMetadata11()
|
||||
{
|
||||
endpointDiscoveryMetadata = new EndpointDiscoveryMetadata();
|
||||
}
|
||||
|
||||
EndpointDiscoveryMetadata11(EndpointDiscoveryMetadata endpointDiscoveryMetadata)
|
||||
{
|
||||
this.endpointDiscoveryMetadata = endpointDiscoveryMetadata;
|
||||
}
|
||||
|
||||
public static EndpointDiscoveryMetadata11 FromEndpointDiscoveryMetadata(EndpointDiscoveryMetadata endpointDiscoveryMetadata)
|
||||
{
|
||||
if (endpointDiscoveryMetadata == null)
|
||||
{
|
||||
throw FxTrace.Exception.ArgumentNull("endpointDiscoveryMetadata");
|
||||
}
|
||||
|
||||
return new EndpointDiscoveryMetadata11(endpointDiscoveryMetadata);
|
||||
}
|
||||
|
||||
public static XmlQualifiedName GetSchema(XmlSchemaSet schemaSet)
|
||||
{
|
||||
if (schemaSet == null)
|
||||
{
|
||||
throw FxTrace.Exception.ArgumentNull("schemaSet");
|
||||
}
|
||||
|
||||
return SchemaUtility.EnsureProbeMatchSchema(DiscoveryVersion.WSDiscovery11, schemaSet);
|
||||
}
|
||||
|
||||
public EndpointDiscoveryMetadata ToEndpointDiscoveryMetadata()
|
||||
{
|
||||
return this.endpointDiscoveryMetadata;
|
||||
}
|
||||
|
||||
public XmlSchema GetSchema()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
[Fx.Tag.InheritThrows(From = "ReadFrom", FromDeclaringType = typeof(EndpointDiscoveryMetadata))]
|
||||
public void ReadXml(XmlReader reader)
|
||||
{
|
||||
this.endpointDiscoveryMetadata.ReadFrom(DiscoveryVersion.WSDiscovery11, reader);
|
||||
}
|
||||
|
||||
public void WriteXml(XmlWriter writer)
|
||||
{
|
||||
this.endpointDiscoveryMetadata.WriteTo(DiscoveryVersion.WSDiscovery11, writer);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,69 @@
|
||||
//----------------------------------------------------------------
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//----------------------------------------------------------------
|
||||
|
||||
namespace System.ServiceModel.Discovery.Version11
|
||||
{
|
||||
using System.Runtime;
|
||||
using System.Xml;
|
||||
using System.Xml.Schema;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
[XmlSchemaProvider("GetSchema")]
|
||||
[Fx.Tag.XamlVisible(false)]
|
||||
public class FindCriteria11 : IXmlSerializable
|
||||
{
|
||||
FindCriteria findCriteria;
|
||||
|
||||
FindCriteria11()
|
||||
{
|
||||
this.findCriteria = new FindCriteria();
|
||||
}
|
||||
|
||||
FindCriteria11(FindCriteria findCriteria)
|
||||
{
|
||||
this.findCriteria = findCriteria;
|
||||
}
|
||||
|
||||
public static FindCriteria11 FromFindCriteria(FindCriteria findCriteria)
|
||||
{
|
||||
if (findCriteria == null)
|
||||
{
|
||||
throw FxTrace.Exception.ArgumentNull("findCriteria");
|
||||
}
|
||||
|
||||
return new FindCriteria11(findCriteria);
|
||||
}
|
||||
|
||||
public static XmlQualifiedName GetSchema(XmlSchemaSet schemaSet)
|
||||
{
|
||||
if (schemaSet == null)
|
||||
{
|
||||
throw FxTrace.Exception.ArgumentNull("schemaSet");
|
||||
}
|
||||
|
||||
return SchemaUtility.EnsureProbeSchema(DiscoveryVersion.WSDiscovery11, schemaSet);
|
||||
}
|
||||
|
||||
public FindCriteria ToFindCriteria()
|
||||
{
|
||||
return this.findCriteria;
|
||||
}
|
||||
|
||||
public XmlSchema GetSchema()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
[Fx.Tag.InheritThrows(From = "ReadFrom", FromDeclaringType = typeof(FindCriteria))]
|
||||
public void ReadXml(XmlReader reader)
|
||||
{
|
||||
this.findCriteria.ReadFrom(DiscoveryVersion.WSDiscovery11, reader);
|
||||
}
|
||||
|
||||
public void WriteXml(XmlWriter writer)
|
||||
{
|
||||
this.findCriteria.WriteTo(DiscoveryVersion.WSDiscovery11, writer);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
//----------------------------------------------------------------
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//----------------------------------------------------------------
|
||||
|
||||
namespace System.ServiceModel.Discovery.Version11
|
||||
{
|
||||
using System.ServiceModel;
|
||||
|
||||
[MessageContract(IsWrapped = false)]
|
||||
class HelloMessage11
|
||||
{
|
||||
private HelloMessage11()
|
||||
{
|
||||
}
|
||||
|
||||
[MessageHeader(Name = ProtocolStrings.SchemaNames.AppSequenceElement, Namespace = ProtocolStrings.Version11.Namespace)]
|
||||
public DiscoveryMessageSequence11 MessageSequence
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
[MessageBodyMember(Name = ProtocolStrings.SchemaNames.HelloElement, Namespace = ProtocolStrings.Version11.Namespace)]
|
||||
public EndpointDiscoveryMetadata11 Hello
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
public static HelloMessage11 Create(DiscoveryMessageSequence messageSequence, EndpointDiscoveryMetadata endpointDiscoveryMetadata)
|
||||
{
|
||||
return new HelloMessage11()
|
||||
{
|
||||
MessageSequence = DiscoveryMessageSequence11.FromDiscoveryMessageSequence(messageSequence),
|
||||
Hello = EndpointDiscoveryMetadata11.FromEndpointDiscoveryMetadata(endpointDiscoveryMetadata)
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
//----------------------------------------------------------------
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//----------------------------------------------------------------
|
||||
|
||||
namespace System.ServiceModel.Discovery.Version11
|
||||
{
|
||||
using System.Runtime;
|
||||
|
||||
sealed class HelloOperation11AsyncResult : HelloOperationAsyncResult<HelloMessage11>
|
||||
{
|
||||
public HelloOperation11AsyncResult(
|
||||
IAnnouncementServiceImplementation announcementServiceImpl,
|
||||
HelloMessage11 message,
|
||||
AsyncCallback callback,
|
||||
object state)
|
||||
: base(announcementServiceImpl, message, callback, state)
|
||||
{
|
||||
}
|
||||
|
||||
public static void End(IAsyncResult result)
|
||||
{
|
||||
AsyncResult.End<HelloOperation11AsyncResult>(result);
|
||||
}
|
||||
|
||||
protected override bool ValidateContent(HelloMessage11 message)
|
||||
{
|
||||
return (message.Hello != null);
|
||||
}
|
||||
|
||||
protected override DiscoveryMessageSequence GetMessageSequence(HelloMessage11 message)
|
||||
{
|
||||
return DiscoveryUtility.ToDiscoveryMessageSequenceOrNull(message.MessageSequence);
|
||||
}
|
||||
|
||||
protected override EndpointDiscoveryMetadata GetEndpointDiscoveryMetadata(HelloMessage11 message)
|
||||
{
|
||||
return message.Hello.ToEndpointDiscoveryMetadata();
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
//----------------------------------------------------------------
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//----------------------------------------------------------------
|
||||
|
||||
namespace System.ServiceModel.Discovery.Version11
|
||||
{
|
||||
using System;
|
||||
using System.ServiceModel;
|
||||
|
||||
[ServiceContract(
|
||||
Name = ProtocolStrings.ContractNames.AnnouncementContractName,
|
||||
Namespace = ProtocolStrings.Version11.Namespace)]
|
||||
interface IAnnouncementContract11
|
||||
{
|
||||
[OperationContract(IsOneWay = true, Action = ProtocolStrings.Version11.HelloAction)]
|
||||
void HelloOperation(HelloMessage11 message);
|
||||
|
||||
[OperationContract(IsOneWay = true, Action = ProtocolStrings.Version11.HelloAction, AsyncPattern = true)]
|
||||
IAsyncResult BeginHelloOperation(HelloMessage11 message, AsyncCallback callback, Object state);
|
||||
|
||||
void EndHelloOperation(IAsyncResult result);
|
||||
|
||||
[OperationContract(IsOneWay = true, Action = ProtocolStrings.Version11.ByeAction)]
|
||||
void ByeOperation(ByeMessage11 message);
|
||||
|
||||
[OperationContract(IsOneWay = true, Action = ProtocolStrings.Version11.ByeAction, AsyncPattern = true)]
|
||||
IAsyncResult BeginByeOperation(ByeMessage11 message, AsyncCallback callback, Object state);
|
||||
|
||||
void EndByeOperation(IAsyncResult result);
|
||||
}
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
//----------------------------------------------------------------
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//----------------------------------------------------------------
|
||||
|
||||
namespace System.ServiceModel.Discovery.Version11
|
||||
{
|
||||
using System.ServiceModel;
|
||||
|
||||
[ServiceContract(
|
||||
Name = ProtocolStrings.ContractNames.DiscoveryAdhocContractName,
|
||||
Namespace = ProtocolStrings.Version11.Namespace,
|
||||
CallbackContract = typeof(IDiscoveryResponseContract11))]
|
||||
interface IDiscoveryContractAdhoc11
|
||||
{
|
||||
[OperationContract(Action = ProtocolStrings.Version11.ProbeAction, IsOneWay = true)]
|
||||
void ProbeOperation(ProbeMessage11 request);
|
||||
|
||||
[OperationContract(Action = ProtocolStrings.Version11.ProbeAction, IsOneWay = true, AsyncPattern = true)]
|
||||
IAsyncResult BeginProbeOperation(ProbeMessage11 request, AsyncCallback callback, object state);
|
||||
|
||||
void EndProbeOperation(IAsyncResult result);
|
||||
|
||||
[OperationContract(Action = ProtocolStrings.Version11.ResolveAction, IsOneWay = true)]
|
||||
void ResolveOperation(ResolveMessage11 request);
|
||||
|
||||
[OperationContract(Action = ProtocolStrings.Version11.ResolveAction, IsOneWay = true, AsyncPattern = true)]
|
||||
IAsyncResult BeginResolveOperation(ResolveMessage11 request, AsyncCallback callback, object state);
|
||||
|
||||
void EndResolveOperation(IAsyncResult result);
|
||||
}
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
//----------------------------------------------------------------
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//----------------------------------------------------------------
|
||||
|
||||
namespace System.ServiceModel.Discovery.Version11
|
||||
{
|
||||
using System.ServiceModel;
|
||||
|
||||
[ServiceContract(
|
||||
Name = ProtocolStrings.ContractNames.DiscoveryManagedContractName,
|
||||
Namespace = ProtocolStrings.Version11.Namespace)]
|
||||
interface IDiscoveryContractManaged11
|
||||
{
|
||||
[OperationContract(Action = ProtocolStrings.Version11.ProbeAction, ReplyAction = ProtocolStrings.Version11.ProbeMatchesAction)]
|
||||
ProbeMatchesMessage11 ProbeOperation(ProbeMessage11 request);
|
||||
|
||||
[OperationContract(Action = ProtocolStrings.Version11.ProbeAction, ReplyAction = ProtocolStrings.Version11.ProbeMatchesAction, AsyncPattern = true)]
|
||||
IAsyncResult BeginProbeOperation(ProbeMessage11 request, AsyncCallback callback, object state);
|
||||
|
||||
ProbeMatchesMessage11 EndProbeOperation(IAsyncResult result);
|
||||
|
||||
[OperationContract(Action = ProtocolStrings.Version11.ResolveAction, ReplyAction = ProtocolStrings.Version11.ResolveMatchesAction)]
|
||||
ResolveMatchesMessage11 ResolveOperation(ResolveMessage11 request);
|
||||
|
||||
[OperationContract(Action = ProtocolStrings.Version11.ResolveAction, ReplyAction = ProtocolStrings.Version11.ResolveMatchesAction, AsyncPattern = true)]
|
||||
IAsyncResult BeginResolveOperation(ResolveMessage11 request, AsyncCallback callback, object state);
|
||||
|
||||
ResolveMatchesMessage11 EndResolveOperation(IAsyncResult result);
|
||||
}
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
//----------------------------------------------------------------
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//----------------------------------------------------------------
|
||||
|
||||
namespace System.ServiceModel.Discovery.Version11
|
||||
{
|
||||
using System.ServiceModel;
|
||||
|
||||
[ServiceContract(
|
||||
Name = ProtocolStrings.ContractNames.DiscoveryAdhocResposeContractName,
|
||||
Namespace = ProtocolStrings.Version11.Namespace)]
|
||||
interface IDiscoveryResponseContract11
|
||||
{
|
||||
[OperationContract(Action = ProtocolStrings.Version11.ProbeMatchesAction, IsOneWay = true, AsyncPattern = true)]
|
||||
IAsyncResult BeginProbeMatchOperation(ProbeMatchesMessage11 response, AsyncCallback callback, object state);
|
||||
|
||||
void EndProbeMatchOperation(IAsyncResult result);
|
||||
|
||||
[OperationContract(Action = ProtocolStrings.Version11.ResolveMatchesAction, IsOneWay = true, AsyncPattern = true)]
|
||||
IAsyncResult BeginResolveMatchOperation(ResolveMatchesMessage11 response, AsyncCallback callback, object state);
|
||||
|
||||
void EndResolveMatchOperation(IAsyncResult result);
|
||||
|
||||
[OperationContract(Action = ProtocolStrings.Version11.HelloAction, IsOneWay = true, AsyncPattern = true)]
|
||||
IAsyncResult BeginHelloOperation(HelloMessage11 message, AsyncCallback callback, object state);
|
||||
|
||||
void EndHelloOperation(IAsyncResult result);
|
||||
}
|
||||
}
|
@ -0,0 +1,84 @@
|
||||
//----------------------------------------------------------------
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//----------------------------------------------------------------
|
||||
|
||||
namespace System.ServiceModel.Discovery.Version11
|
||||
{
|
||||
using System.Runtime;
|
||||
|
||||
sealed class ProbeDuplex11AsyncResult : ProbeDuplexAsyncResult<ProbeMessage11, IDiscoveryResponseContract11>
|
||||
{
|
||||
internal ProbeDuplex11AsyncResult(ProbeMessage11 probeMessage,
|
||||
IDiscoveryServiceImplementation discoveryServiceImpl,
|
||||
IMulticastSuppressionImplementation multicastSuppressionImpl,
|
||||
AsyncCallback callback,
|
||||
object state)
|
||||
: base(probeMessage, discoveryServiceImpl, multicastSuppressionImpl, callback, state)
|
||||
{
|
||||
}
|
||||
|
||||
public static void End(IAsyncResult result)
|
||||
{
|
||||
AsyncResult.End<ProbeDuplex11AsyncResult>(result);
|
||||
}
|
||||
|
||||
protected override bool ValidateContent(ProbeMessage11 probeMessage)
|
||||
{
|
||||
if ((probeMessage == null) || (probeMessage.Probe == null))
|
||||
{
|
||||
if (TD.DiscoveryMessageWithNoContentIsEnabled())
|
||||
{
|
||||
TD.DiscoveryMessageWithNoContent(null, ProtocolStrings.TracingStrings.Probe);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
protected override FindCriteria GetFindCriteria(ProbeMessage11 probeMessage)
|
||||
{
|
||||
return probeMessage.Probe.ToFindCriteria();
|
||||
}
|
||||
|
||||
protected override IAsyncResult BeginSendFindResponse(
|
||||
IDiscoveryResponseContract11 responseChannel,
|
||||
DiscoveryMessageSequence discoveryMessageSequence,
|
||||
EndpointDiscoveryMetadata matchingEndpoint,
|
||||
AsyncCallback callback,
|
||||
object state)
|
||||
{
|
||||
return responseChannel.BeginProbeMatchOperation(
|
||||
ProbeMatchesMessage11.Create(
|
||||
discoveryMessageSequence,
|
||||
matchingEndpoint),
|
||||
callback,
|
||||
state);
|
||||
}
|
||||
|
||||
protected override void EndSendFindResponse(IDiscoveryResponseContract11 responseChannel, IAsyncResult result)
|
||||
{
|
||||
responseChannel.EndProbeMatchOperation(result);
|
||||
}
|
||||
|
||||
protected override IAsyncResult BeginSendProxyAnnouncement(
|
||||
IDiscoveryResponseContract11 responseChannel,
|
||||
DiscoveryMessageSequence discoveryMessageSequence,
|
||||
EndpointDiscoveryMetadata proxyEndpointDiscoveryMetadata,
|
||||
AsyncCallback callback,
|
||||
object state)
|
||||
{
|
||||
return responseChannel.BeginHelloOperation(
|
||||
HelloMessage11.Create(
|
||||
discoveryMessageSequence,
|
||||
proxyEndpointDiscoveryMetadata),
|
||||
callback,
|
||||
state);
|
||||
}
|
||||
|
||||
protected override void EndSendProxyAnnouncement(IDiscoveryResponseContract11 responseChannel, IAsyncResult result)
|
||||
{
|
||||
responseChannel.EndHelloOperation(result);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
//----------------------------------------------------------------
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//----------------------------------------------------------------
|
||||
|
||||
namespace System.ServiceModel.Discovery.Version11
|
||||
{
|
||||
using System.Runtime.Serialization;
|
||||
using System.Collections.ObjectModel;
|
||||
|
||||
[CollectionDataContract(ItemName = ProtocolStrings.SchemaNames.ProbeMatchElement, Namespace = ProtocolStrings.Version11.Namespace)]
|
||||
class ProbeMatches11 : Collection<EndpointDiscoveryMetadata11>
|
||||
{
|
||||
private ProbeMatches11()
|
||||
{
|
||||
}
|
||||
|
||||
public static ProbeMatches11 Create(EndpointDiscoveryMetadata endpointDiscoveryMetadata)
|
||||
{
|
||||
return new ProbeMatches11()
|
||||
{
|
||||
EndpointDiscoveryMetadata11.FromEndpointDiscoveryMetadata(endpointDiscoveryMetadata)
|
||||
};
|
||||
}
|
||||
|
||||
public static ProbeMatches11 Create(Collection<EndpointDiscoveryMetadata> endpointDiscoveryMetadatas)
|
||||
{
|
||||
ProbeMatches11 probeMatches = new ProbeMatches11();
|
||||
if (endpointDiscoveryMetadatas != null)
|
||||
{
|
||||
foreach (EndpointDiscoveryMetadata endpointDiscoveryMetadata in endpointDiscoveryMetadatas)
|
||||
{
|
||||
probeMatches.Add(EndpointDiscoveryMetadata11.FromEndpointDiscoveryMetadata(endpointDiscoveryMetadata));
|
||||
}
|
||||
};
|
||||
|
||||
return probeMatches;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,50 @@
|
||||
//----------------------------------------------------------------
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//----------------------------------------------------------------
|
||||
|
||||
namespace System.ServiceModel.Discovery.Version11
|
||||
{
|
||||
using System.ServiceModel;
|
||||
using System.Collections.ObjectModel;
|
||||
|
||||
[MessageContract(IsWrapped = false)]
|
||||
class ProbeMatchesMessage11
|
||||
{
|
||||
private ProbeMatchesMessage11()
|
||||
{
|
||||
}
|
||||
|
||||
[MessageHeader(Name = ProtocolStrings.SchemaNames.AppSequenceElement, Namespace = ProtocolStrings.Version11.Namespace)]
|
||||
public DiscoveryMessageSequence11 MessageSequence
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
[MessageBodyMember(Name = ProtocolStrings.SchemaNames.ProbeMatchesElement, Namespace = ProtocolStrings.Version11.Namespace)]
|
||||
public ProbeMatches11 ProbeMatches
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
public static ProbeMatchesMessage11 Create(DiscoveryMessageSequence messageSequence, EndpointDiscoveryMetadata endpointDiscoveryMetadata)
|
||||
{
|
||||
return new ProbeMatchesMessage11()
|
||||
{
|
||||
MessageSequence = DiscoveryMessageSequence11.FromDiscoveryMessageSequence(messageSequence),
|
||||
ProbeMatches = ProbeMatches11.Create(endpointDiscoveryMetadata)
|
||||
};
|
||||
}
|
||||
|
||||
public static ProbeMatchesMessage11 Create(DiscoveryMessageSequence messageSequence,
|
||||
Collection<EndpointDiscoveryMetadata> endpointDiscoveryMetadatas)
|
||||
{
|
||||
return new ProbeMatchesMessage11()
|
||||
{
|
||||
MessageSequence = DiscoveryMessageSequence11.FromDiscoveryMessageSequence(messageSequence),
|
||||
ProbeMatches = ProbeMatches11.Create(endpointDiscoveryMetadatas)
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
//----------------------------------------------------------------
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//----------------------------------------------------------------
|
||||
|
||||
namespace System.ServiceModel.Discovery.Version11
|
||||
{
|
||||
using System.ServiceModel;
|
||||
|
||||
[MessageContract(IsWrapped = false)]
|
||||
class ProbeMessage11
|
||||
{
|
||||
[MessageBodyMember(Name = ProtocolStrings.SchemaNames.ProbeElement, Namespace = ProtocolStrings.Version11.Namespace)]
|
||||
public FindCriteria11 Probe
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,53 @@
|
||||
//----------------------------------------------------------------
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//----------------------------------------------------------------
|
||||
|
||||
namespace System.ServiceModel.Discovery.Version11
|
||||
{
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Runtime;
|
||||
|
||||
sealed class ProbeRequestResponse11AsyncResult : ProbeRequestResponseAsyncResult<ProbeMessage11, ProbeMatchesMessage11>
|
||||
{
|
||||
internal ProbeRequestResponse11AsyncResult(ProbeMessage11 probeMessage,
|
||||
IDiscoveryServiceImplementation discoveryServiceImpl,
|
||||
AsyncCallback callback,
|
||||
object state)
|
||||
: base(probeMessage, discoveryServiceImpl, callback, state)
|
||||
{
|
||||
}
|
||||
|
||||
public static ProbeMatchesMessage11 End(IAsyncResult result)
|
||||
{
|
||||
ProbeRequestResponse11AsyncResult thisPtr = AsyncResult.End<ProbeRequestResponse11AsyncResult>(result);
|
||||
return thisPtr.End();
|
||||
}
|
||||
|
||||
protected override bool ValidateContent(ProbeMessage11 probeMessage)
|
||||
{
|
||||
if ((probeMessage == null) || (probeMessage.Probe == null))
|
||||
{
|
||||
if (TD.DiscoveryMessageWithNoContentIsEnabled())
|
||||
{
|
||||
TD.DiscoveryMessageWithNoContent(null, ProtocolStrings.TracingStrings.Probe);
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
protected override FindCriteria GetFindCriteria(ProbeMessage11 probeMessage)
|
||||
{
|
||||
return probeMessage.Probe.ToFindCriteria();
|
||||
}
|
||||
|
||||
protected override ProbeMatchesMessage11 GetProbeResponse(
|
||||
DiscoveryMessageSequence discoveryMessageSequence,
|
||||
Collection<EndpointDiscoveryMetadata> matchingEndpoints)
|
||||
{
|
||||
return ProbeMatchesMessage11.Create(discoveryMessageSequence, matchingEndpoints);
|
||||
}
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user