public int Feed(RuleParser parser, bool not)
        {
            int bits;

            switch (parser.GetCurrentArg())
            {
            case OptionSetXorMarkLong:
                _mode = Mode.SetMark;
                bits  = FlexibleInt32.Parse(parser.GetNextArg());
                SetXorMark(bits);
                return(1);

            case OptionSetAndMarkLong:
                _mode = Mode.SetMark;
                bits  = FlexibleInt32.Parse(parser.GetNextArg());
                SetAndMark(bits);
                return(1);

            case OptionSetOrMarkLong:
                _mode = Mode.SetMark;
                bits  = FlexibleInt32.Parse(parser.GetNextArg());
                SetOrMark(bits);
                return(1);

            case OptionSetMarkLong:
                _mode = Mode.SetMark;
                var s1 = parser.GetNextArg().Split('/');

                SetMark(FlexibleInt32.Parse(s1[0]), s1.Length == 1 ? DefaultMask : FlexibleInt32.Parse(s1[1]));
                return(1);

            case OptionSetXMarkLong:
                _mode = Mode.SetMark;
                var s2 = parser.GetNextArg().Split('/');

                SetXMark(FlexibleInt32.Parse(s2[0]), s2.Length == 1 ? DefaultMask : FlexibleInt32.Parse(s2[1]));
                return(1);

            case OptionRestoreMarkLong:
                _mode = Mode.RestoreMark;
                return(0);

            case OptionSaveMarkLong:
                _mode = Mode.SaveMark;
                return(0);

            case OptionCtMaskLong:
                _ctMask = FlexibleInt32.Parse(parser.GetNextArg());
                return(1);

            case OptionNfMaskLong:
                _nfMask = FlexibleInt32.Parse(parser.GetNextArg());
                return(1);
            }

            return(0);
        }
Пример #2
0
        public int Feed(CommandParser parser, bool not)
        {
            switch (parser.GetCurrentArg())
            {
            case OptionMarkLong:
                var s = parser.GetNextArg().Split(new char[] { '/' });
                Mark.Set(not, FlexibleInt32.Parse(s[0]));
                if (s.Length != 1)
                {
                    Mask = FlexibleInt32.Parse(s[1]);
                }
                return(1);
            }

            return(0);
        }
Пример #3
0
        public int Feed(CommandParser parser, bool not)
        {
            switch (parser.GetCurrentArg())
            {
            case OptionPort:
                Port = UInt16.Parse(parser.GetNextArg());
                return(1);

            case OptionIP:
                Ip = IPAddress.Parse(parser.GetNextArg());
                return(1);

            case OptionMark:
                var s1 = parser.GetNextArg().Split('/');

                SetMark(FlexibleInt32.Parse(s1[0]), s1.Length == 1 ? DefaultMask : FlexibleInt32.Parse(s1[1]));

                return(1);
            }

            return(0);
        }
Пример #4
0
        public int Feed(CommandParser parser, bool not)
        {
            int bits;

            switch (parser.GetCurrentArg())
            {
            case OptionSetXorMarkLong:
                bits = FlexibleInt32.Parse(parser.GetNextArg());
                SetXorMark(bits);
                return(1);

            case OptionSetAndMarkLong:
                bits = FlexibleInt32.Parse(parser.GetNextArg());
                SetAndMark(bits);
                return(1);

            case OptionSetOrMarkLong:
                bits = FlexibleInt32.Parse(parser.GetNextArg());
                SetOrMark(bits);
                return(1);

            case OptionSetMarkLong:
                var s1 = parser.GetNextArg().Split('/');

                SetMark(FlexibleInt32.Parse(s1[0]), s1.Length == 1?DefaultMask:FlexibleInt32.Parse(s1[1]));
                return(1);

            case OptionSetXMarkLong:
                var s2 = parser.GetNextArg().Split('/');

                SetXMark(FlexibleInt32.Parse(s2[0]), s2.Length == 1?DefaultMask:FlexibleInt32.Parse(s2[1]));
                return(1);
            }

            return(0);
        }