int IIpTablesModuleInternal.Feed(RuleParser parser, bool not) { switch (parser.GetCurrentArg()) { case OptionSourcePortLong: case OptionSourcePortShort: SourcePort.Set(not, PortOrRange.Parse(parser.GetNextArg(), ':')); return(1); case OptionDestinationPortLong: case OptionDestinationPortShort: DestinationPort.Set(not, PortOrRange.Parse(parser.GetNextArg(), ':')); return(1); case OptionDestinationTcpFlags: TcpFlags = TcpFlagMatch.Parse(parser.GetNextArg(), parser.GetNextArg(2)); return(2); case OptionSyn: TcpFlags = not ? TcpFlagMatch.NotSyn : TcpFlagMatch.Syn; return(0); case OptionTcpOption: TcpOption.Set(not, int.Parse(parser.GetNextArg())); return(1); } return(0); }
public int Feed(CommandParser parser, bool not) { switch (parser.GetCurrentArg()) { case OptionSourcePortLong: case OptionSourcePortShort: SourcePort.Set(not, PortOrRange.Parse(parser.GetNextArg(), ':')); return(1); case OptionDestinationPortLong: case OptionDestinationPortShort: DestinationPort.Set(not, PortOrRange.Parse(parser.GetNextArg(), ':')); return(1); case OptionDestinationTcpFlags: TcpFlags = new ValueOrNot <TcpFlagMatch>(TcpFlagMatch.Parse(parser.GetNextArg(), parser.GetNextArg(2)), not); return(2); case OptionSyn: TcpFlags = new ValueOrNot <TcpFlagMatch>(TcpFlagMatch.Syn, not); return(0); case OptionTcpOption: TcpOption.Set(not, int.Parse(parser.GetNextArg())); return(1); } return(0); }
private HashSet <PortOrRange> ParseListOfPortOrRanges(String csv) { var ret = new HashSet <PortOrRange>(); foreach (string a in csv.Split(new[] { ',' })) { ret.Add(PortOrRange.Parse(a, ':')); } return(ret); }
int IIpTablesModuleInternal.Feed(RuleParser parser, bool not) { switch (parser.GetCurrentArg()) { case OptionLengthLong: Length = new ValueOrNot <PortOrRange>(PortOrRange.Parse(parser.GetNextArg(), ':'), not); return(1); } return(0); }
public int Feed(CommandParser parser, bool not) { switch (parser.GetCurrentArg()) { case OptionLengthLong: Length = new ValueOrNot <PortOrRange>(PortOrRange.Parse(parser.GetNextArg(), ':'), not); return(1); } return(0); }
public int Feed(CommandParser parser, bool not) { switch (parser.GetCurrentArg()) { case OptionMss: var range = PortOrRange.Parse(parser.GetNextArg(), ':'); MssRange = new ValueOrNot <PortOrRange>(range, not); return(1); } return(0); }
int IIpTablesModuleInternal.Feed(RuleParser parser, bool not) { switch (parser.GetCurrentArg()) { case OptionSourcePortLong: case OptionSourcePortShort: SourcePort.Set(not, PortOrRange.Parse(parser.GetNextArg(), ':')); return(1); case OptionDestinationPortLong: case OptionDestinationPortShort: DestinationPort.Set(not, PortOrRange.Parse(parser.GetNextArg(), ':')); return(1); } return(0); }
public int Feed(CommandParser parser, bool not) { switch (parser.GetCurrentArg()) { case OptionSourcePortLong: case OptionSourcePortShort: SourcePort.Set(not, PortOrRange.Parse(parser.GetNextArg(), ':')); return(1); case OptionDestinationPortLong: case OptionDestinationPortShort: DestinationPort.Set(not, PortOrRange.Parse(parser.GetNextArg(), ':')); return(1); } return(0); }
/// <summary> /// Consume arguments /// </summary> /// <param name="position">Rhe position to parse</param> /// <returns>number of arguments consumed</returns> public int FeedToSkip(int position, bool first) { Position = position; String option = GetCurrentArg(); if (first) { _set.InternalName = option; _set.Type = IpSetTypeHelper.StringToType(GetNextArg()); return(1); } switch (option) { case "timeout": _set.Timeout = int.Parse(GetNextArg()); break; case "family": _set.Family = GetNextArg(); break; case "hashsize": _set.HashSize = int.Parse(GetNextArg()); break; case "maxelem": _set.MaxElem = UInt32.Parse(GetNextArg()); break; case "range": _set.BitmapRange = PortOrRange.Parse(GetNextArg(), '-'); break; default: _set.CreateOptions.Add(GetCurrentArg()); return(0); } return(1); }