⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rule.java

📁 sifi-0.1.6.tar.gz 出自http://www.ifi.unizh.ch/ikm/SINUS/firewall/ 一个linux的防火墙工具。
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
  {"echo reply",		/*  0 */  "type 1",			/*  1 */  "type 2",			/*  2 */  "dest. unr.",			/*  3 */  "src quench",			/*  4 */  "redirect",			/*  5 */  "alt. addr.",			/*  6 */  "type 7",			/*  7 */  "echo req.",			/*  8 */  "router adv.",		/*  9 */  "router sel.",		/* 10 */  "time xceed",			/* 11 */  "param probl",		/* 12 */  "time req.",			/* 13 */  "time reply",			/* 14 */  "info req.",			/* 15 */  "info reply",			/* 16 */  "addr req.",			/* 17 */  "addr reply",			/* 18 */  "type 19",			/* 19 */  "type 20",			/* 20 */  "type 21",			/* 21 */  "type 22",			/* 22 */  "type 23",			/* 23 */  "type 24",			/* 24 */  "type 25",			/* 25 */  "type 26",			/* 26 */  "type 27",			/* 27 */  "type 28",			/* 28 */  "type 29",			/* 29 */  "traceroute",			/* 30 */  "data cerr",			/* 31 */  "mobl redir",			/* 32 */  "where r u",			/* 33 */  "i am here",			/* 34 */  "mobil req.",			/* 35 */  "mobil repl",			/* 36 */  "dom req.",			/* 37 */  "dom reply",			/* 38 */  "skip",			/* 39 */  "photuris",			/* 40 */  };} // Rule// dialog box for editing rulesclass RuleEditDialog	extends Dialog	implements Refreshable, Serializable,						 ActionListener, ItemListener, TextListener {  public RuleEditDialog(Frame p, Rule r, ManageDomain md, Refreshable rp, boolean nr) {    super(p, "Rule", true);    parent = p;    rule = r;    mgDomain = md;    callingObject = rp;    newRule = nr; // if set: delete rule from vector on cancel    gbl = new GridBagLayout();    gbc = new GridBagConstraints();    gbc.fill = GridBagConstraints.BOTH;    gbc.insets = new Insets(3,3,3,3);    setLayout(gbl);    // workaround for bug in some Java versions: Lists must be >= 3 lines high    int minListSize = 3;    boolean useBorderPanel = true;    // Action Panel    // ============    Panel ap;    if (useBorderPanel)      ap = new BorderPanel(BorderPanel.OUT);    else      ap = new Panel();    GridBagLayout agbl = new GridBagLayout();    GridBagConstraints agbc = new GridBagConstraints();    agbc.fill = GridBagConstraints.NONE;    agbc.anchor = GridBagConstraints.NORTHWEST;    agbc.insets = new Insets(3,3,3,3);    ap.setLayout(agbl);    CheckboxGroup ag = new CheckboxGroup();    acceptBox = new Checkbox("Accept", ag, rule.fw_rc == Rule.FW_ACCEPT);		acceptBox.addItemListener(this);    Utils.add_component(ap, acceptBox, agbl, agbc, 0, 0, 1, 1, 0, 0);    blockBox = new Checkbox("Block", ag, rule.fw_rc == Rule.FW_BLOCK);		blockBox.addItemListener(this);    Utils.add_component(ap, blockBox, agbl, agbc, 0, 1, 1, 1, 0, 0);    observeBox = new Checkbox("Observe", ag, rule.fw_rc == Rule.SF_RC_OBSERVE);		observeBox.addItemListener(this);    Utils.add_component(ap, observeBox, agbl, agbc, 0, 2, 1, 1, 0, 0);    rejectBox = new Checkbox("Reject with", ag, rule.fw_rc < 0 ||       rule.fw_rc == Rule.SF_RC_BEST || rule.fw_rc == Rule.SF_RC_TREJECT ||       rule.fw_rc == Rule.SF_RC_ECHO);		rejectBox.addItemListener(this);    Utils.add_component(ap, rejectBox, agbl, agbc, 0, 3, 1, 1, 0, 0);    ap.add(rejectBox);    rejectChoice = new Choice();		rejectChoice.addItemListener(this);    for (int i=0; i < rejectNumber; i++)      rejectChoice.add(rejectText[i]);    if (rejectBox.getState())       for (int i=0; i < rejectNumber; i++)        if (rule.fw_rc == rejectRC[i])          rejectChoice.select(rejectText[i]);    Utils.add_component(ap, rejectChoice, agbl, agbc, 0, 4, 1, 1, 0, 0);    Utils.add_component(this, ap, gbl, gbc, 0, 0, 4, 6, 25, 50);    // Options Panel    // =============    if (useBorderPanel)      ap = new BorderPanel(BorderPanel.OUT);    else      ap = new Panel();    agbl = new GridBagLayout();    agbc = new GridBagConstraints();    agbc.fill = GridBagConstraints.NONE;    agbc.anchor = GridBagConstraints.NORTHWEST;    agbc.insets = new Insets(3,3,3,3);    ap.setLayout(agbl);    optionsBox = new Checkbox("IP Options");		optionsBox.addItemListener(this);    optionsBox.setState((rule.fw_flags & Rule.SF_FW_CHECK_OPT) != 0);    Utils.add_component(ap, optionsBox, agbl, agbc, 0, 0, 3, 1, 0, 0);    optionsList = new List(3, true);    for (int i=0; i < optionsNumber; i++)       optionsList.add(optionsText[i]);    if ((rule.fw_flags & Rule.SF_FW_CHECK_OPT) != 0)      for (int i=0; i < optionsNumber; i++)        if ((rule.fw_flags & optionsFlags[i]) != 0)          optionsList.select(i);    Utils.add_component(ap, optionsList, agbl, agbc, 0, 1, 3, 3, 100, 100);    ttlBox = new Checkbox("TTL");		ttlBox.addItemListener(this);    ttlBox.setState((rule.fw_flags & Rule.SF_FW_CHECK_TTL) != 0);    Utils.add_component(ap, ttlBox, agbl, agbc, 0, 4, 1, 1, 0, 0);    ttlChoice = new Choice();		ttlChoice.addItemListener(this);    for (int i=0; i < ttlNumber; i++)      ttlChoice.add(ttlText[i]);    if ((rule.fw_flags & Rule.SF_FW_CHECK_TTL) != 0)      for (int i=0; i < ttlNumber; i++)        if ((rule.fw_flags & Rule.SF_FW_TTL) == ttlFlags[i])          ttlChoice.select(ttlText[i]);    Utils.add_component(ap, ttlChoice, agbl, agbc, 1, 4, 1, 1, 0, 0);    ttlValue = new TextField(Integer.toString(rule.ttl), 3);    Utils.add_component(ap, ttlValue, agbl, agbc, 2, 4, 1, 1, 0, 0);        Utils.add_component(this, ap, gbl, gbc, 0, 6, 4, 6, 25, 50);    // Protocol Panel    // ==============    if (useBorderPanel)      ap = new BorderPanel(BorderPanel.OUT);    else      ap = new Panel();    agbl = new GridBagLayout();    agbc = new GridBagConstraints();    agbc.fill = GridBagConstraints.NONE;    agbc.anchor = GridBagConstraints.NORTHWEST;    agbc.insets = new Insets(3,3,3,3);    ap.setLayout(agbl);    ag = new CheckboxGroup();    pallBox = new Checkbox("All protocols", ag,       (rule.fw_flags & Rule.SF_FW_PROT) == Rule.SF_FW_PROT_ALL);    pallBox.addItemListener(this);		Utils.add_component(ap, pallBox, agbl, agbc, 0, 0, 2, 1, 0, 0);    ptcpBox = new Checkbox("TCP", ag,       (rule.fw_flags & Rule.SF_FW_PROT) == Rule.SF_FW_CHECK_PROTOCOL &&      rule.protocol == Rule.IPPROTO_TCP);		ptcpBox.addItemListener(this);    Utils.add_component(ap, ptcpBox, agbl, agbc, 0, 1, 2, 1, 0, 0);    pudpBox = new Checkbox("UDP", ag,      (rule.fw_flags & Rule.SF_FW_PROT) == Rule.SF_FW_CHECK_PROTOCOL &&      rule.protocol == Rule.IPPROTO_UDP);		pudpBox.addItemListener(this);    Utils.add_component(ap, pudpBox, agbl, agbc, 0, 2, 2, 1, 0, 0);    picmpBox = new Checkbox("ICMP", ag,      (rule.fw_flags & Rule.SF_FW_PROT) == Rule.SF_FW_CHECK_PROTOCOL &&      rule.protocol == Rule.IPPROTO_ICMP);		picmpBox.addItemListener(this);    Utils.add_component(ap, picmpBox, agbl, agbc, 0, 3, 2, 1, 0, 0);    pigmpBox = new Checkbox("IGMP", ag,      (rule.fw_flags & Rule.SF_FW_PROT) == Rule.SF_FW_CHECK_PROTOCOL &&      rule.protocol == Rule.IPPROTO_IGMP);		pigmpBox.addItemListener(this);    Utils.add_component(ap, pigmpBox, agbl, agbc, 0, 4, 2, 1, 0, 0);    pripBox = new Checkbox("RIP", ag,      (rule.fw_flags & Rule.SF_FW_PROT) == Rule.SF_FW_PROT_RIP);    Utils.add_component(ap, pripBox, agbl, agbc, 0, 5, 2, 1, 0, 0);		pripBox.addItemListener(this);    pnumBox = new Checkbox("Prot. #", ag,      (rule.fw_flags & Rule.SF_FW_PROT) == Rule.SF_FW_CHECK_PROTOCOL &&      rule.protocol != Rule.IPPROTO_TCP && rule.protocol != Rule.IPPROTO_UDP &&      rule.protocol != Rule.IPPROTO_ICMP && rule.protocol != Rule.IPPROTO_IGMP);		pnumBox.addItemListener(this);    Utils.add_component(ap, pnumBox, agbl, agbc, 0, 6, 1, 1, 0, 0);     pnumLabel = new Label("", Label.RIGHT);    if (pnumBox.getState()) {      pnumText = new TextField(Integer.toString(rule.protocol), 3);      if (rule.protocol > 0 && rule.protocol <= Rule.MAX_PROTOCOL)        pnumLabel.setText("("+Rule.protocols[rule.protocol]+")");    }    else      pnumText = new TextField(3);		pnumText.addTextListener(this);    Utils.add_component(ap, pnumText, agbl, agbc, 1, 6, 1, 1, 0, 0);    agbc.fill = GridBagConstraints.HORIZONTAL;    Utils.add_component(ap, pnumLabel, agbl, agbc, 0, 7, 2, 1, 100, 0);    agbc.fill = GridBagConstraints.NONE;          Utils.add_component(this, ap, gbl, gbc, 4, 0, 4, 12, 25, 100);    // FTP Panel    // =========    if (useBorderPanel)      ap = new BorderPanel(BorderPanel.OUT);    else      ap = new Panel();    FTPPanel = ap;    agbl = new GridBagLayout();    agbc = new GridBagConstraints();    agbc.fill = GridBagConstraints.NONE;    agbc.anchor = GridBagConstraints.NORTHWEST;    agbc.insets = new Insets(3,3,3,3);    ap.setLayout(agbl);    Utils.add_component(ap, new Label("FTP Settings"), agbl, agbc, 0, 0, 1, 1, 0, 0);    ag = new CheckboxGroup();    int actpassmask = Rule.SF_FTP_NO_ACTIVE | Rule.SF_FTP_NO_PASSIVE;    FTPallBox = new Checkbox("Both", ag,       (rule.fw_flags & actpassmask) == 0);		FTPallBox.addItemListener(this);    Utils.add_component(ap, FTPallBox, agbl, agbc, 0, 1, 1, 1, 0, 0);    FTPactBox = new Checkbox("Active mode", ag,      (rule.fw_flags & actpassmask) == Rule.SF_FTP_NO_PASSIVE);		FTPactBox.addItemListener(this);    Utils.add_component(ap, FTPactBox, agbl, agbc, 0, 2, 1, 1, 0, 0);    FTPpassBox = new Checkbox("Passive mode", ag,      (rule.fw_flags & actpassmask) == Rule.SF_FTP_NO_ACTIVE);		FTPpassBox.addItemListener(this);    Utils.add_component(ap, FTPpassBox, agbl, agbc, 0, 3, 1, 1, 0, 0);    FTPnoneBox = new Checkbox("None", ag,      (rule.fw_flags & actpassmask) == actpassmask);		FTPnoneBox.addItemListener(this);    Utils.add_component(ap, FTPnoneBox, agbl, agbc, 0, 4, 1, 1, 0, 0);    FTPlogBox = new Checkbox("Log data conn.",													(rule.fw_flags & Rule.SF_FTP_DATA_LOG) != 0);		FTPlogBox.addItemListener(this);    Utils.add_component(ap, FTPlogBox, agbl, agbc, 0, 6, 1, 1, 0, 0);    // ICMP Panel    // ==========    if (useBorderPanel)      ap = new BorderPanel(BorderPanel.OUT);    else      ap = new Panel();    ICMPPanel = ap;    agbl = new GridBagLayout();    agbc = new GridBagConstraints();    agbc.fill = GridBagConstraints.NONE;    agbc.anchor = GridBagConstraints.NORTHWEST;    agbc.insets = new Insets(3,3,3,3);    ap.setLayout(agbl);    Utils.add_component(ap, new Label("ICMP Types"), agbl, agbc, 0, 0, 1, 1, 0, 0);    ICMPallBox = new Checkbox("All types");		ICMPallBox.addItemListener(this);    ICMPallBox.setState(picmpBox.getState() &&      (rule.fw_flags & Rule.SF_TYPE_MASK) == Rule.SF_ICMP_ALLTYPES);    Utils.add_component(ap, ICMPallBox, agbl, agbc, 0, 1, 1, 1, 0, 0);     ICMPList = new List(10, true);    for (int i=0; i < ICMPNumber; i++)      ICMPList.add(ICMPText[i]);    if (picmpBox.getState())      for (int i=0; i < ICMPNumber; i++)        if ((rule.fw_flags & ICMPFlags[i]) != 0)          ICMPList.select(i);    Utils.add_component(ap, ICMPList, agbl, agbc, 0, 2, 1, 10, 100, 100);    // IGMP Panel    // ==========    if (useBorderPanel)      ap = new BorderPanel(BorderPanel.OUT);    else      ap = new Panel();    IGMPPanel = ap;    agbl = new GridBagLayout();    agbc = new GridBagConstraints();    agbc.fill = GridBagConstraints.NONE;    agbc.anchor = GridBagConstraints.NORTHWEST;    agbc.insets = new Insets(3,3,3,3);    ap.setLayout(agbl);    Utils.add_component(ap, new Label("IGMP Types"), agbl, agbc, 0, 0, 1, 1, 0, 0);    IGMPallBox = new Checkbox("All types");		IGMPallBox.addItemListener(this);    IGMPallBox.setState(picmpBox.getState() &&      (rule.fw_flags & Rule.SF_TYPE_MASK) == Rule.SF_IGMP_ALLTYPES);    Utils.add_component(ap, IGMPallBox, agbl, agbc, 0, 1, 1, 1, 0, 0);     IGMPList = new List(10, true);    for (int i=0; i < IGMPNumber; i++)      IGMPList.add(IGMPText[i]);    if (picmpBox.getState())      for (int i=0; i < IGMPNumber; i++)        if ((rule.fw_flags & IGMPFlags[i]) != 0)          IGMPList.select(i);    Utils.add_component(ap, IGMPList, agbl, agbc, 0, 2, 1, 10, 100, 100);    // RIP Panel    // =========    if (useBorderPanel)      ap = new BorderPanel(BorderPanel.OUT);    else      ap = new Panel();    RIPPanel = ap;    agbl = new GridBagLayout();    agbc = new GridBagConstraints();    agbc.fill = GridBagConstraints.NONE;    agbc.anchor = GridBagConstraints.NORTHWEST;    agbc.insets = new Insets(3,3,3,3);    ap.setLayout(agbl);    ripList = new List(minListSize, false);		ripList.addItemListener(this);    Macro.constructList(ripList, mgDomain.Macros, rule.fw_rip_idx);    Utils.add_component(ap, new Label("RIP Addresses"), agbl, agbc, 0, 0, 1, 1, 0, 0);    Utils.add_component(ap, ripList, agbl, agbc, 0, 1, 1, 1, 0, 0);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -