예제 #1
0
 /**
  * Instantiates a new unsigned short list option.
  *
  * @param uByteListOption the option request option
  */
 public BaseUnsignedByteListOption(unsignedByteListOptionType uByteListOption) : base()
 {
     if (uByteListOption != null)
     {
         if (uByteListOption.unsignedByte != null)
         {
             unsignedByteList = uByteListOption.unsignedByte;
         }
     }
 }
예제 #2
0
        /* (non-Javadoc)
         * @see com.jagornet.dhcpv6.option.DhcpComparableOption#matches(com.jagornet.dhcp.xml.OptionExpression)
         */
        public bool Matches(optionExpression expression)
        {
            if (expression == null)
            {
                return(false);
            }
            if (expression.code != this.GetCode())
            {
                return(false);
            }
            if (unsignedByteList == null)
            {
                return(false);
            }

            unsignedByteListOptionType exprOption = (unsignedByteListOptionType)expression.Item;

            if (exprOption != null)
            {
                List <short> exprUbytes = exprOption.unsignedByte;
                @operator    op         = expression.@operator;
                if (op.Equals(@operator.equals))
                {
                    return(unsignedByteList.Equals(exprUbytes));
                }
                else if (op.Equals(@operator.contains))
                {
                    foreach (var item in exprUbytes)
                    {
                        if (!unsignedByteList.Contains(item))
                        {
                            return(false);
                        }
                    }
                    return(true);
                }
                else
                {
                    log.Warn("Unsupported expression operator: " + op);
                }
            }

            return(false);
        }