Пример #1
0
        /// <summary>Whenever an SA changes amongst inactive, active, and closed
        /// this is called.</summary>
        /// <param name="o">The SA whose state changes.</summary>
        protected void SAStateChange(SecurityAssociation sa,
                                     SecurityAssociation.States state)
        {
            if (state == SecurityAssociation.States.Active)
            {
                if (_sub != null)
                {
                    sa.Subscribe(_sub.Handler, null);
                }
                else
                {
                    sa.Subscribe(this, null);
                }
            }
            else if (state == SecurityAssociation.States.Updating)
            {
                sa.Subscribe(this, null);
            }
            else if (sa.Closed)
            {
                RemoveSA(sa);
            }

            if (AnnounceSA != null)
            {
                AnnounceSA(sa, state);
            }
        }
Пример #2
0
        protected void SAStateChange(SecurityAssociation sa,
                                     SecurityAssociation.States state)
        {
            Address addr = SenderToAddress(sa);

            if (addr == null)
            {
                return;
            }

            if (state == SecurityAssociation.States.Active)
            {
                AddConnection(addr, sa);
            }
            else if (state == SecurityAssociation.States.Closed)
            {
                lock (_address_to_sender) {
                    _registered.Remove(sa);
                    if (_address_to_sender.ContainsKey(addr) && _address_to_sender[addr] == sa)
                    {
                        RemoveConnection(addr);
                    }
                }
            }
        }
Пример #3
0
        ///<summary>When a SecurityAssociation changes amongst inactive, active,
        ///or closed this gets notified.</summary>
        protected void AnnounceSA(SecurityAssociation sa,
                                  SecurityAssociation.States state)
        {
            Edge e = sa.Sender as Edge;

            // if e is an edge, let's see if he's creating a SE
            // or maybe it isn't our edge!
            if (e == null)
            {
                return;
            }
            else if (e.TAType != this.TAType)
            {
                return;
            }

            if (state == SecurityAssociation.States.Active)
            {
                SecurityAssociation stored_sa = null;
                if (!RemoveFromDictionary(e, out stored_sa))
                {
                    // May have already been here
                    return;
                }
                else if (stored_sa != null && stored_sa != sa)
                {
                    throw new Exception("Cannot have the same edge used in multiple SAs");
                }

                SecureEdge se = new SecureEdge(e, sa);
                sa.Subscribe(se, null);
                try {
                    Finalize(se);
                } catch {
                    se.Close();
                }
            }
            else if (state == SecurityAssociation.States.Closed)
            {
                e.Close();
            }
        }
Пример #4
0
 public void StateChange(SecurityAssociation sa, SecurityAssociation.States st)
 {
   state = st;
 }
Пример #5
0
 public void StateChange(SecurityAssociation sa, SecurityAssociation.States st)
 {
     state = st;
 }
Пример #6
0
 protected void AnnounceSA(SecurityAssociation sa,
                           SecurityAssociation.States state)
 {
     //  PeerSecAssociation sa = o as PeerSecAssociation;
 }