Exemplo n.º 1
0
 public KcmConnectionNotice(KasIdentifier kasID, UInt32 minorVersion)
 {
     KasID = kasID;
     MinorVersion = minorVersion;
 }
Exemplo n.º 2
0
 public KcmAnpMsg(AnpMsg msg, KasIdentifier kasID)
 {
     Msg = msg;
     KasID = kasID;
 }
Exemplo n.º 3
0
 /// <summary>
 /// Request a KAS to be disconnected.
 /// </summary>
 public void RequestKasDisconnect(KasIdentifier kasID)
 {
     lock (m_mutex)
     {
         m_ToKcmControlMsgArray.Add(new KcmConnectionRequest(kasID, false));
         NotifyKcm();
     }
 }
Exemplo n.º 4
0
 public KcmDisconnectionNotice(KasIdentifier kasID, Exception ex)
 {
     KasID = kasID;
     Ex = ex;
 }
Exemplo n.º 5
0
        ///////////////////////////////////
        // 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();
            }
        }
Exemplo n.º 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];
        }
Exemplo n.º 7
0
 public KcmConnectionRequest(KasIdentifier kasID, bool connectFlag)
 {
     KasID = kasID;
     ConnectFlag = connectFlag;
 }
Exemplo n.º 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;
 }
Exemplo n.º 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];
 }
Exemplo n.º 10
0
 /// <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;
 }
Exemplo n.º 11
0
 /// <summary>
 /// Non-deserializing constructor.
 /// </summary>
 public WmKas(KasIdentifier kasID)
 {
     KasID = kasID;
     Initialize();
 }
Exemplo n.º 12
0
 public KcmKas(KasIdentifier kasID)
 {
     KasID = kasID;
     Tunnel = new AnpTunnel(KasID.Host, (int)KasID.Port);
 }