<commit_before>﻿using System;
using System.Collections.Generic;
using System.Text;

namespace IPTables.Net.Iptables.Modules.TcpMss
{
    public class TcpMssModule : ModuleBase, IIpTablesModuleGod, IEquatable<TcpMssModule>
    {
        private const String OptionClampMssToPmtuLong = "--clamp-mss-to-pmtu";

        public bool ClampMssToPmtu = false;

        public bool Equals(TcpMssModule other)
        {
            if (ReferenceEquals(null, other)) return false;
            if (ReferenceEquals(this, other)) return true;
            return ClampMssToPmtu.Equals(other.ClampMssToPmtu);
        }

        public bool NeedsLoading
        {
            get { return false; }
        }

        int IIpTablesModuleInternal.Feed(RuleParser parser, bool not)
        {
            switch (parser.GetCurrentArg())
            {
                case OptionClampMssToPmtuLong:
                    ClampMssToPmtu = true;
                    return 1;
            }

            return 0;
        }

        public String GetRuleString()
        {
            var sb = new StringBuilder();

            if (ClampMssToPmtu)
            {
                if (sb.Length != 0)
                    sb.Append(" ");
                sb.Append(OptionClampMssToPmtuLong);
            }

            return sb.ToString();
        }

        public static IEnumerable<String> GetOptions()
        {
            var options = new List<string>
            {
                OptionClampMssToPmtuLong
            };
            return options;
        }

        public static ModuleEntry GetModuleEntry()
        {
            return GetTargetModuleEntryInternal("TCPMSS", typeof (TcpMssModule), GetOptions);
        }

        public override bool Equals(object obj)
        {
            if (ReferenceEquals(null, obj)) return false;
            if (ReferenceEquals(this, obj)) return true;
            if (obj.GetType() != GetType()) return false;
            return Equals((TcpMssModule) obj);
        }

        public override int GetHashCode()
        {
            return ClampMssToPmtu.GetHashCode();
        }
    }
}<commit_msg>TCPMSS --set-mtu command<commit_after>﻿using System;
using System.Collections.Generic;
using System.Text;

namespace IPTables.Net.Iptables.Modules.TcpMss
{
    public class TcpMssModule : ModuleBase, IIpTablesModuleGod, IEquatable<TcpMssModule>
    {
        private const String OptionSetMss= "--set-mss";
        private const String OptionClampMssToPmtuLong = "--clamp-mss-to-pmtu";

        public int SetMss = 0;
        public bool ClampMssToPmtu = false;

        public bool Equals(TcpMssModule other)
        {
            if (ReferenceEquals(null, other)) return false;
            if (ReferenceEquals(this, other)) return true;
            return SetMss == other.SetMss && ClampMssToPmtu.Equals(other.ClampMssToPmtu);
        }

        public bool NeedsLoading
        {
            get { return false; }
        }

        int IIpTablesModuleInternal.Feed(RuleParser parser, bool not)
        {
            switch (parser.GetCurrentArg())
            {
                case OptionClampMssToPmtuLong:
                    ClampMssToPmtu = true;
                    return 1;
                case OptionSetMss:
                    SetMss = int.Parse(parser.GetNextArg());
                    return 1;
            }

            return 0;
        }

        public String GetRuleString()
        {
            var sb = new StringBuilder();

            if (ClampMssToPmtu)
            {
                if (sb.Length != 0)
                    sb.Append(" ");
                sb.Append(OptionClampMssToPmtuLong);
            }

            if (SetMss != 0)
            {
                if (sb.Length != 0)
                    sb.Append(" ");
                sb.Append(OptionClampMssToPmtuLong);
                sb.Append(" ");
                sb.Append(SetMss);
            }

            return sb.ToString();
        }

        public static IEnumerable<String> GetOptions()
        {
            var options = new List<string>
            {
                OptionClampMssToPmtuLong,
                OptionSetMss
            };
            return options;
        }

        public static ModuleEntry GetModuleEntry()
        {
            return GetTargetModuleEntryInternal("TCPMSS", typeof (TcpMssModule), GetOptions);
        }

        public override bool Equals(object obj)
        {
            if (ReferenceEquals(null, obj)) return false;
            if (ReferenceEquals(this, obj)) return true;
            if (obj.GetType() != this.GetType()) return false;
            return Equals((TcpMssModule) obj);
        }

        public override int GetHashCode()
        {
            unchecked
            {
                return (SetMss*397) ^ ClampMssToPmtu.GetHashCode();
            }
        }
    }
}
{'fraction_non_alphanumeric': 0.0853960396039604, 'fraction_numerical': 0.0026815181518151814, 'mean_word_length': 1.4969104016477859, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '8050', 'n_tokens_mistral': 1385, 'n_tokens_neox': 1322, 'n_words': 282}