int IIpTablesModuleInternal.Feed(RuleParser parser, bool not) { switch (parser.GetCurrentArg()) { case OptionUpto: Upto = int.Parse(parser.GetNextArg()); return(1); case OptionAbove: Above = int.Parse(parser.GetNextArg()); return(1); case OptionMask: Mask = int.Parse(parser.GetNextArg()); return(1); case OptionSourceAddr: LimitMatch = AddrMode.Source; return(0); case OptionDestinationAddr: LimitMatch = AddrMode.Target; return(0); } return(0); }
public int 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 = 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); }
public int Feed(RuleParser parser, bool not) { switch (parser.GetCurrentArg()) { case OptionNameLong: Name = parser.GetNextArg(); return(1); case OptionSetLong: Mode = new ValueOrNot <RecentMode>(RecentMode.Set); return(0); case OptionRsourceLong: Rsource = true; return(0); case OptionRdestLong: Rdest = true; return(0); case OptionRcheckLong: Mode = new ValueOrNot <RecentMode>(RecentMode.Rcheck); return(0); case OptionUpdateLong: Mode = new ValueOrNot <RecentMode>(RecentMode.Update); return(0); case OptionRemoveLong: Mode = new ValueOrNot <RecentMode>(RecentMode.Remove); return(0); case OptionSecondsLong: Seconds = int.Parse(parser.GetNextArg()); return(1); case OptionReapLong: Reap = true; return(0); case OptionHitcountLong: HitCount = int.Parse(parser.GetNextArg()); return(1); case OptionRttlLong: Rttl = true; return(0); case OptionMaskLong: var oldAf = Mask.AddressFamily; Mask = IPAddress.Parse(parser.GetNextArg()); if (Mask.AddressFamily != oldAf) { throw new IpTablesNetException("Invalid address family for mask " + parser.GetNextArg() + " should be " + oldAf); } 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); 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); }
int IIpTablesModuleInternal.Feed(RuleParser parser, bool not) { switch (parser.GetCurrentArg()) { case OptionNameLong: Name = parser.GetNextArg(); return(1); case OptionSetLong: Mode = new ValueOrNot <RecentMode>(RecentMode.Set); return(0); case OptionRsourceLong: Rsource = true; return(0); case OptionRdestLong: Rdest = true; return(0); case OptionRcheckLong: Mode = new ValueOrNot <RecentMode>(RecentMode.Rcheck); return(0); case OptionUpdateLong: Mode = new ValueOrNot <RecentMode>(RecentMode.Update); return(0); case OptionRemoveLong: Mode = new ValueOrNot <RecentMode>(RecentMode.Remove); return(0); case OptionSecondsLong: Seconds = int.Parse(parser.GetNextArg()); return(1); case OptionReapLong: Reap = true; return(0); case OptionHitcountLong: HitCount = int.Parse(parser.GetNextArg()); return(1); case OptionRttlLong: Rttl = true; return(0); case OptionMaskLong: Mask = IPAddress.Parse(parser.GetNextArg()); return(1); } return(0); }
public int Feed(RuleParser parser, bool not) { switch (parser.GetCurrentArg()) { case OptionProtocolLong: case OptionProtocolShort: Protocol = new ValueOrNot <string>(parser.GetNextArg(), not); return(1); case OptionSourceLong: case OptionSourceShort: Source = new ValueOrNot <IpCidr>(IpCidr.Parse(parser.GetNextArg()), IpCidr.Any, not); return(1); case OptionDestinationLong: case OptionDestinationShort: Destination = new ValueOrNot <IpCidr>(IpCidr.Parse(parser.GetNextArg()), IpCidr.Any, not); return(1); case OptionJumpLong: case OptionJumpShort: Jump = parser.GetNextArg(); return(1); case OptionGotoLong: case OptionGotoShort: Goto = parser.GetNextArg(); return(1); case OptionInInterfaceLong: case OptionInInterfaceShort: InInterface = new ValueOrNot <string>(parser.GetNextArg(), not); return(1); case OptionOutInterfaceLong: case OptionOutInterfaceShort: OutInterface = new ValueOrNot <string>(parser.GetNextArg(), not); return(1); case OptionFragmentLong: case OptionFragmentShort: Fragmented = new ValueOrNot <bool>(true, not); return(0); case OptionSetCountersLong: case OptionSetCountersShort: SetCounters = new ValueOrNot <CounterPacketsAndBytes>( new CounterPacketsAndBytes(uint.Parse(parser.GetNextArg(1)), uint.Parse(parser.GetNextArg(2))), not); return(2); } return(0); }
public int Feed(RuleParser parser, bool not) { switch (parser.GetCurrentArg()) { case OptionSrcGroup: SrcGroup = new ValueOrNot <UInt32>(FlexibleUInt32.Parse(parser.GetNextArg()), not); return(1); case OptionDstGroup: DstGroup = new ValueOrNot <UInt32>(FlexibleUInt32.Parse(parser.GetNextArg()), not); return(1); } return(0); }
public int Feed(RuleParser parser, bool not) { switch (parser.GetCurrentArg()) { case OptionPrefixLong: LogPrefix = parser.GetNextArg(); return(1); case OptionLevelLong: LogLevel = int.Parse(parser.GetNextArg()); return(1); } return(0); }
int IIpTablesModuleInternal.Feed(RuleParser parser, bool not) { switch (parser.GetCurrentArg()) { case OptionPrefixLong: LogPrefix = parser.GetNextArg(); return(1); case OptionLevelLong: LogLevel = int.Parse(parser.GetNextArg()); 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(RuleParser parser, bool not) { switch (parser.GetCurrentArg()) { case OptionMatchSet: MatchSet = new ValueOrNot <String>(parser.GetNextArg(), not); MatchSetFlags = parser.GetNextArg(2); return(2); case OptionNoMatch: ReturnNoMatch = !not; break; case OptionUpdateCounters: UpdateCounters = !not; break; case OptionUpdateSubCounters: UpdateSubCounters = !not; break; case OptionPacketsEq: PacketsMatch = not ? MatchMode.NotEqual : MatchMode.Equal; PacketsValue = int.Parse(parser.GetNextArg()); return(1); case OptionBytesEq: BytesMatch = not ? MatchMode.NotEqual : MatchMode.Equal; BytesValue = int.Parse(parser.GetNextArg()); return(1); case OptionPacketsLt: PacketsMatch = MatchMode.Lt; PacketsValue = int.Parse(parser.GetNextArg()); return(1); case OptionBytesLt: BytesMatch = MatchMode.Lt; BytesValue = int.Parse(parser.GetNextArg()); return(1); case OptionPacketsGt: PacketsMatch = MatchMode.Gt; PacketsValue = int.Parse(parser.GetNextArg()); return(1); case OptionBytesGt: BytesMatch = MatchMode.Gt; BytesValue = int.Parse(parser.GetNextArg()); return(1); } return(0); }
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); }
int IIpTablesModuleInternal.Feed(RuleParser parser, bool not) { switch (parser.GetCurrentArg()) { case OptionHelperLong: Helper = new ValueOrNot <String>(parser.GetNextArg(), not); return(1); } return(0); }
public int Feed(RuleParser parser, bool not) { switch (parser.GetCurrentArg()) { case OptionState: State = ConnectionStateSet.Parse(parser.GetNextArg()); return(1); } return(0); }
public int Feed(RuleParser parser, bool not) { switch (parser.GetCurrentArg()) { case OptionCommentLong: CommentText = parser.GetNextArg(); return(1); } return(0); }
public int Feed(RuleParser parser, bool not) { switch (parser.GetCurrentArg()) { case OptionHelperLong: Helper = new ValueOrNot <String>(parser.GetNextArg(), not); return(1); } return(0); }
public int Feed(RuleParser parser, bool not) { switch (parser.GetCurrentArg()) { case OptionNameLong: Name = parser.GetNextArg(); return(1); } return(0); }
public int Feed(RuleParser parser, bool not) { switch (parser.GetCurrentArg()) { case OptionRejectWith: RejectWith = parser.GetNextArg(); return(1); } return(0); }
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); }
int IIpTablesModuleInternal.Feed(RuleParser parser, bool not) { switch (parser.GetCurrentArg()) { case OptionBytecode: ByteCode = parser.GetNextArg(); return(1); } return(0); }
int IIpTablesModuleInternal.Feed(RuleParser parser, bool not) { switch (parser.GetCurrentArg()) { case OptionState: State = ConnectionStateSet.Parse(parser.GetNextArg()); return(1); } return(0); }
public int Feed(RuleParser parser, bool not) { switch (parser.GetCurrentArg()) { case OptionBytecode: ByteCode = parser.GetNextArg(); return(1); } return(0); }
int IIpTablesModuleInternal.Feed(RuleParser parser, bool not) { switch (parser.GetCurrentArg()) { case OptionCommentLong: CommentText = parser.GetNextArg(); return(1); } return(0); }
int IIpTablesModuleInternal.Feed(RuleParser parser, bool not) { switch (parser.GetCurrentArg()) { case OptionRejectWith: RejectWith = parser.GetNextArg(); return(1); } return(0); }
public int Feed(RuleParser parser, bool not) { String current = parser.GetCurrentArg(); switch (current) { case OptionHashRouteMode: Mode = parser.GetNextArg(); return(1); case OptionHashRouteSrcMask: SrcMask = int.Parse(parser.GetNextArg()); return(1); case OptionHashRouteDstMask: DstMask = int.Parse(parser.GetNextArg()); return(1); case OptionHashRouteHtableSize: HtableSize = int.Parse(parser.GetNextArg()); return(1); case OptionHashRouteHtableMax: HtableMax = int.Parse(parser.GetNextArg()); return(1); case OptionHashRouteHtableExpire: HtableExpire = int.Parse(parser.GetNextArg()); return(1); case OptionHashRouteHtableGcInterval: HtableGcInterval = int.Parse(parser.GetNextArg()); return(1); case OptionHashRouteMatchOnly: MatchOnly = true; return(0); case OptionHashRouteName: Name = parser.GetNextArg(); if (Name.Length > 15) { Name = Name.Substring(0, 15); } return(1); } return(0); }
public int Feed(RuleParser 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); }
int IIpTablesModuleInternal.Feed(RuleParser parser, bool not) { int bits; switch (parser.GetCurrentArg()) { case OptionHelperLong: Helper = parser.GetNextArg(); return(1); } return(0); }
int IIpTablesModuleInternal.Feed(RuleParser parser, bool not) { switch (parser.GetCurrentArg()) { case OptionAlgorithmLong: var alg = parser.GetNextArg(); if (alg == "bm") { Algorithm = Strategy.BoyerMoore; } else if (alg == "kmp") { Algorithm = Strategy.KnuthPrattMorris; } else { throw new IpTablesNetException("Unknown algorithm: " + alg); } return(1); case OptionFromLong: From = int.Parse(parser.GetNextArg()); return(1); case OptionToLong: To = int.Parse(parser.GetNextArg()); return(1); case OptionStringLong: Pattern = new ValueOrNot <string>(parser.GetNextArg(), not); return(1); case OptionHexStringLong: SetHexString(parser.GetNextArg(), not); return(1); } return(0); }
int IIpTablesModuleInternal.Feed(RuleParser parser, bool not) { switch (parser.GetCurrentArg()) { case OptionPrefixLong: LogPrefix = parser.GetNextArg(); return(1); case OptionGroupLong: LogGroup = int.Parse(parser.GetNextArg()); return(1); case OptionRangeLong: LogRange = int.Parse(parser.GetNextArg()); return(1); case OptionThresholdLong: LogThreshold = int.Parse(parser.GetNextArg()); return(1); } return(0); }
public int Feed(RuleParser parser, bool not) { switch (parser.GetCurrentArg()) { case OptionNotrack: NoTrack = true; return(0); case OptionHelperLong: Helper = parser.GetNextArg(); return(1); case OptionCtEventsLong: CtEvents = parser.GetNextArg().Split(new char[] { ',' }).Select((a) => a.Trim()).ToList(); return(1); case OptionExpEventsLong: ExpEvents = parser.GetNextArg().Split(new char[] { ',' }).Select((a) => a.Trim()).ToList(); return(1); } return(0); }