RegisterInfo.cs 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. //------------------------------------------------------------
  2. // Copyright (c) Microsoft Corporation. All rights reserved.
  3. //------------------------------------------------------------
  4. namespace System.ServiceModel.PeerResolvers
  5. {
  6. using System.ServiceModel.Channels;
  7. using System.ServiceModel;
  8. using System.Runtime.Serialization;
  9. [MessageContract(IsWrapped = false)]
  10. public class RegisterInfo
  11. {
  12. [DataContract(Name = "Register", Namespace = PeerStrings.Namespace)]
  13. class RegisterInfoDC
  14. {
  15. [DataMember(Name = "ClientId")]
  16. public Guid ClientId;
  17. [DataMember(Name = "MeshId")]
  18. public string MeshId;
  19. [DataMember(Name = "NodeAddress")]
  20. public PeerNodeAddress NodeAddress;
  21. // public TimeSpan RegistrationLifeTime;
  22. public RegisterInfoDC() { }
  23. public RegisterInfoDC(Guid client, string meshId, PeerNodeAddress address)
  24. {
  25. this.ClientId = client;
  26. this.MeshId = meshId;
  27. this.NodeAddress = address;
  28. }
  29. }
  30. public RegisterInfo(Guid client, string meshId, PeerNodeAddress address)
  31. {
  32. body = new RegisterInfoDC(client, meshId, address);
  33. }
  34. public RegisterInfo() { body = new RegisterInfoDC(); }
  35. [MessageBodyMember(Name = "Register", Namespace = PeerStrings.Namespace)]
  36. RegisterInfoDC body;
  37. public Guid ClientId
  38. {
  39. get { return this.body.ClientId; }
  40. }
  41. public string MeshId
  42. {
  43. get { return this.body.MeshId; }
  44. }
  45. public PeerNodeAddress NodeAddress
  46. {
  47. get { return this.body.NodeAddress; }
  48. }
  49. public bool HasBody()
  50. {
  51. return body != null;
  52. }
  53. }
  54. }