IPeerConnectorContract.cs :  » 2.6.4-mono-.net-core » System.ServiceModel » System » ServiceModel » PeerResolvers » C# / CSharp Open Source

Home
C# / CSharp Open Source
1.2.6.4 mono .net core
2.2.6.4 mono core
3.Aspect Oriented Frameworks
4.Bloggers
5.Build Systems
6.Business Application
7.Charting Reporting Tools
8.Chat Servers
9.Code Coverage Tools
10.Content Management Systems CMS
11.CRM ERP
12.Database
13.Development
14.Email
15.Forum
16.Game
17.GIS
18.GUI
19.IDEs
20.Installers Generators
21.Inversion of Control Dependency Injection
22.Issue Tracking
23.Logging Tools
24.Message
25.Mobile
26.Network Clients
27.Network Servers
28.Office
29.PDF
30.Persistence Frameworks
31.Portals
32.Profilers
33.Project Management
34.RSS RDF
35.Rule Engines
36.Script
37.Search Engines
38.Sound Audio
39.Source Control
40.SQL Clients
41.Template Engines
42.Testing
43.UML
44.Web Frameworks
45.Web Service
46.Web Testing
47.Wiki Engines
48.Windows Presentation Foundation
49.Workflows
50.XML Parsers
C# / C Sharp
C# / C Sharp by API
C# / CSharp Tutorial
C# / CSharp Open Source » 2.6.4 mono .net core » System.ServiceModel 
System.ServiceModel » System » ServiceModel » PeerResolvers » IPeerConnectorContract.cs
using System;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Channels;
using System.ServiceModel.PeerResolvers;
using System.ServiceModel.Description;

namespace System.ServiceModel.PeerResolvers{
  [ServiceContract (Namespace = Constants.NetPeer, SessionMode = SessionMode.Allowed, CallbackContract = typeof (IPeerConnectorContract))]
  internal interface IPeerConnectorContract
  {
    [OperationContract (Action = Constants.NetPeer + "/Connect", IsOneWay = true)]
    void Connect (ConnectInfo connect);

    [OperationContract (Action = Constants.NetPeer + "/Welcome", IsOneWay = true)]
    void Welcome (WelcomeInfo welcome);

    [OperationContract (Action = Constants.NetPeer + "/Refuse", IsOneWay = true)]
    void Refuse (RefuseInfo refuse);

    [OperationContract (Action = Constants.NetPeer + "/Disconnect", IsOneWay = true)]
    void Disconnect (DisconnectInfo disconnect);

    [OperationContract (Action = Constants.NetPeer + "/LinkUtility", IsOneWay = true)]
    void LinkUtility (LinkUtilityInfo linkUtility);

    [OperationContract (Action = Constants.NetPeer + "/Ping", IsOneWay = true)]
    void Ping ();

    [OperationContract (Action = "*", IsOneWay = true)]
    void SendMessage (Message msg);
  }

  // Common datatype

  [DataContract (Name = "Referral", Namespace = Constants.NetPeer)]
  internal class Referral
  {
    [DataMember]
    public ulong Id { get; set; }

    [DataMember]
    public PeerNodeAddress PeerNodeAddress { get; set; }
  }

  internal enum RefuseReason
  {
    DuplicateNeighbor,
    DuplicateNodeId,
    NodeBusy,
  }

  internal enum DisconnectReason
  {
    LeavingMesh,
    NotUsefulNeighbor,
    DuplicateNeighbor,
    DuplicateNodeId,
  }

  // Connect

  [DataContract (Name = "Connect", Namespace = Constants.NetPeer)]
  internal class ConnectInfoDC
  {
    [DataMember]
    public PeerNodeAddress Address { get; set; }
    [DataMember]
    public ulong NodeId { get; set; }
  }

  [MessageContract (IsWrapped = false)]
  internal class ConnectInfo
  {
    public ConnectInfo ()
    {
      dc = new ConnectInfoDC ();
    }

    [MessageBodyMember (Name = "Connect", Namespace = Constants.NetPeer)]
    ConnectInfoDC dc;

    public PeerNodeAddress Address {
      get { return dc.Address; }
      set { dc.Address = value; }
    }

    public ulong NodeId {
      get { return dc.NodeId; }
      set { dc.NodeId = value; }
    }
  }

  // Welcome

  [DataContract (Name = "Welcome", Namespace = Constants.NetPeer)]
  internal class WelcomeInfoDC
  {
    [DataMember]
    public ulong NodeId { get; set; }
    [DataMember]
    public Referral [] Referrals { get; set; }
  }

  [MessageContract (IsWrapped = false)]
  internal class WelcomeInfo
  {
    public WelcomeInfo ()
    {
      dc = new WelcomeInfoDC ();
    }

    [MessageBodyMember (Name = "Welcome", Namespace = Constants.NetPeer)]
    WelcomeInfoDC dc;

    public ulong NodeId {
      get { return dc.NodeId; }
      set { dc.NodeId = value; }
    }

    public Referral [] Referrals {
      get { return dc.Referrals; }
      set { dc.Referrals = value; }
    }
  }

  // Refuse

  [DataContract (Name = "Refuse", Namespace = Constants.NetPeer)]
  internal class RefuseInfoDC
  {
    [DataMember]
    public Referral [] Referrals { get; set; }
    [DataMember]
    public RefuseReason Reason { get; set; }
  }

  [MessageContract (IsWrapped = false)]
  internal class RefuseInfo
  {
    public RefuseInfo ()
    {
      dc = new RefuseInfoDC ();
    }

    [MessageBodyMember (Name = "Refuse", Namespace = Constants.NetPeer)]
    RefuseInfoDC dc;

    public Referral [] Referrals {
      get { return dc.Referrals; }
      set { dc.Referrals = value; }
    }

    public RefuseReason Reason {
      get { return dc.Reason; }
      set { dc.Reason = value; }
    }
  }

  // Disconnect

  [DataContract (Name = "Disconnect", Namespace = Constants.NetPeer)]
  internal class DisconnectInfoDC
  {
    [DataMember]
    public Referral [] Referrals { get; set; }
    [DataMember]
    public DisconnectReason Reason { get; set; }
  }

  [MessageContract (IsWrapped = false)]
  internal class DisconnectInfo
  {
    public DisconnectInfo ()
    {
      dc = new DisconnectInfoDC ();
    }

    [MessageBodyMember (Name = "Disconnect", Namespace = Constants.NetPeer)]
    DisconnectInfoDC dc;

    public Referral [] Referrals {
      get { return dc.Referrals; }
      set { dc.Referrals = value; }
    }

    public DisconnectReason Reason {
      get { return dc.Reason; }
      set { dc.Reason = value; }
    }
  }

  // LinkUtilityInfo

  [DataContract (Name = "LinkUtilityInfo", Namespace = Constants.NetPeer)]
  internal class LinkUtilityInfoDC
  {
    [DataMember]
    public uint Total { get; set; }
    [DataMember]
    public uint Useful { get; set; }
  }

  [MessageContract (IsWrapped = false)]
  internal class LinkUtilityInfo
  {
    public LinkUtilityInfo ()
    {
      dc = new LinkUtilityInfoDC ();
    }

    [MessageBodyMember (Name = "LinkUtilityInfo", Namespace = Constants.NetPeer)]
    LinkUtilityInfoDC dc;

    public uint Total {
      get { return dc.Total; }
      set { dc.Total = value; }
    }

    public uint Useful {
      get { return dc.Useful; }
      set { dc.Useful = value; }
    }
  }
}
www.java2v.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.