Brunet.Security.SecurityAssociation.HandleData C# (CSharp) Метод

HandleData() публичный Метод

All incoming data filters through here.
public HandleData ( Brunet.MemBlock data, ISender return_path, object state ) : void
data Brunet.MemBlock
return_path ISender
state object
Результат void
    public void HandleData(MemBlock data, ISender return_path, object state)
    {
      if(Closed) {
        throw new Exception("Cannot send on a closed SA");
      }
      MemBlock app_data = null;
      if(!HandleIncoming(data, out app_data)) {
        return;
      }

      _receiving = State == States.Active;
      Handle(app_data, this);
    }

Usage Example

Пример #1
0
        /// <summary>This is SecureData that needs to get to an SA.</summary>
        protected void HandleData(MemBlock b, ISender return_path)
        {
            SecurityDataMessage sdm = new SecurityDataMessage(b);
            Dictionary <ISender, SecurityAssociation> sender_to_sa = null;
            SecurityAssociation sa = null;

            try {
                sender_to_sa = _spi[sdm.SPI];
                sa           = sender_to_sa[return_path];
                sa.HandleData(b, return_path, null);
            } catch {
                if (sender_to_sa == null && !SecurityPolicy.Supports(sdm.SPI))
                {
                    throw new Exception("Invalid SPI: " + sdm.SPI);
                }
                else if (sa == null)
                {
                    NoSuchSA(sdm.SPI, return_path);
                    throw new Exception("No SA for: " + return_path);
                }
                else if (sa.Closed)
                {
                    throw new Exception("SA has been closed.");
                }
                else
                {
                    throw;
                }
            }
        }