示例#1
0
文件: WmKcmBroker.cs 项目: tmbx/kwm
 public KcmConnectionNotice(KasIdentifier kasID, UInt32 minorVersion)
 {
     KasID = kasID;
     MinorVersion = minorVersion;
 }
示例#2
0
文件: WmKcmBroker.cs 项目: tmbx/kwm
 public KcmAnpMsg(AnpMsg msg, KasIdentifier kasID)
 {
     Msg = msg;
     KasID = kasID;
 }
示例#3
0
文件: WmKcmBroker.cs 项目: tmbx/kwm
 /// <summary>
 /// Request a KAS to be disconnected.
 /// </summary>
 public void RequestKasDisconnect(KasIdentifier kasID)
 {
     lock (m_mutex)
     {
         m_ToKcmControlMsgArray.Add(new KcmConnectionRequest(kasID, false));
         NotifyKcm();
     }
 }
示例#4
0
文件: WmKcmBroker.cs 项目: tmbx/kwm
 public KcmDisconnectionNotice(KasIdentifier kasID, Exception ex)
 {
     KasID = kasID;
     Ex = ex;
 }
示例#5
0
文件: WmKcmBroker.cs 项目: tmbx/kwm
        ///////////////////////////////////
        // Interface methods for the WM. //
        ///////////////////////////////////
        /// <summary>
        /// Request a KAS to be connected.
        /// </summary>
        public void RequestKasConnect(KasIdentifier kasID)
        {
            lock (m_mutex)
            {
                // The following sequence of events can happen:
                // - KCM posts disconnection event.
                // - WM posts ANP message.
                // - WM receives disconnection event.
                // - WM posts connection request.
                // - KCM receives connection request and ANP message concurrently,
                //   possibly posting the ANP message incorrectly.
                // To prevent this situation, we ensure that we have no lingering
                // ANP message left for that KAS.
                List<KcmAnpMsg> newList = new List<KcmAnpMsg>();

                foreach (KcmAnpMsg m in m_ToKcmAnpMsgArray)
                {
                    if (m.KasID != kasID) newList.Add(m);
                }

                m_ToKcmAnpMsgArray = newList;

                m_ToKcmControlMsgArray.Add(new KcmConnectionRequest(kasID, true));
                NotifyKcm();
            }
        }
示例#6
0
        /// <summary>
        /// Create the WmKas object specified if it does not exist,
        /// and return a reference to the WmKas object specified.
        /// </summary>
        private WmKas GetOrCreateKas(KasIdentifier kasID)
        {
            if (!KasTree.ContainsKey(kasID))
            {
                KasTree[kasID] = new WmKas(kasID);
            }

            return KasTree[kasID];
        }
示例#7
0
文件: WmKcmBroker.cs 项目: tmbx/kwm
 public KcmConnectionRequest(KasIdentifier kasID, bool connectFlag)
 {
     KasID = kasID;
     ConnectFlag = connectFlag;
 }
示例#8
0
 /// <summary>
 /// Return the workspace having the Kas ID and external ID specified, 
 /// if any.
 /// </summary>
 public Workspace GetKwsByExternalID(KasIdentifier kasID, UInt64 externalID)
 {
     if (externalID == 0) return null;
     foreach (Workspace kws in KwsTree.Values)
         if (kws.Kas.KasID.CompareTo(kasID) == 0 && kws.CoreData.Credentials.ExternalID == externalID)
             return kws;
     return null;
 }
示例#9
0
 /// <summary>
 /// Return the KAS having the identifier specified, if any.
 /// </summary>
 public WmKas GetKasById(KasIdentifier kasID)
 {
     if (!KasTree.ContainsKey(kasID)) return null;
     return KasTree[kasID];
 }
示例#10
0
文件: WmKas.cs 项目: tmbx/kwm-release
 /// <summary>
 /// Convert the Xml representation of a KasIdentifier object to its
 /// KasIdentifier object equivalent.
 /// </summary>
 public static KasIdentifier FromXml(XmlElement elem)
 {
     UInt32 version = UInt32.Parse(elem.GetAttribute("version"));
     if (version != 1) throw new Exception("Unsupported KasIdentifier version '" + version + "'.");
     String host = Misc.GetXmlChildValue(elem, "Host", "");
     UInt16 port = UInt16.Parse(Misc.GetXmlChildValue(elem, "Port", "0"));
     KasIdentifier kasID = new KasIdentifier(host, port);
     return kasID;
 }
示例#11
0
文件: WmKas.cs 项目: tmbx/kwm-release
 /// <summary>
 /// Non-deserializing constructor.
 /// </summary>
 public WmKas(KasIdentifier kasID)
 {
     KasID = kasID;
     Initialize();
 }
示例#12
0
 public KcmKas(KasIdentifier kasID)
 {
     KasID = kasID;
     Tunnel = new AnpTunnel(KasID.Host, (int)KasID.Port);
 }