public ProtocolKeyAttribute(string name, string defaultValue, KeyUsagePhase phase, KeySender sender, KeyType type)
 {
     _name = name;
     _default = defaultValue;
     _phase = phase;
     _sender = sender;
     _type = type;
 }
Exemple #2
0
 public ProtocolKeyAttribute(string name, string defaultValue, KeyUsagePhase phase, KeySender sender, KeyType type)
 {
     Name         = name;
     DefaultValue = defaultValue;
     Phase        = phase;
     Sender       = sender;
     Type         = type;
 }
 public ProtocolKeyAttribute(string name, string defaultValue, KeyUsagePhase phase, KeySender sender, KeyType type)
 {
     _name    = name;
     _default = defaultValue;
     _phase   = phase;
     _sender  = sender;
     _type    = type;
 }
Exemple #4
0
 internal bool ShouldTransmit(object currentValue, Type valueType, KeyUsagePhase phase, bool discoverySession)
 {
     return
         ((Phase & phase) != 0 &&
          (discoverySession ? UsedForDiscovery : true) &&
          currentValue != null &&
          GetValueAsString(currentValue, valueType) != DefaultValue &&
          (Sender & KeySender.Initiator) != 0);
 }
Exemple #5
0
        private void GetParametersToNegotiate(TextBuffer parameters, KeyUsagePhase phase, SessionType sessionType)
        {
            PropertyInfo[] properties = GetType().GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
            foreach (PropertyInfo propInfo in properties)
            {
                ProtocolKeyAttribute attr = (ProtocolKeyAttribute)ReflectionHelper.GetCustomAttribute(propInfo, typeof(ProtocolKeyAttribute));
                if (attr != null)
                {
                    object value = propInfo.GetGetMethod(true).Invoke(this, null);

                    if (attr.ShouldTransmit(value, propInfo.PropertyType, phase, sessionType == SessionType.Discovery))
                    {
                        parameters.Add(attr.Name, ProtocolKeyAttribute.GetValueAsString(value, propInfo.PropertyType));
                        _negotiatedParameters.Add(attr.Name, string.Empty);
                    }
                }
            }
        }
 internal bool ShouldTransmit(object currentValue, Type valueType, KeyUsagePhase phase, bool discoverySession)
 {
     return
         (Phase & phase) != 0
         && (discoverySession ? (UsedForDiscovery == true) : true)
         && currentValue != null
         && GetValueAsString(currentValue, valueType) != DefaultValue
         && (Sender & KeySender.Initiator) != 0;
 }