|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectverinec.importer.parser.iptables.Iptable
public class Iptable
The Iptable class represents a table of the iptable configuration.
The class constructs VeriNeC <packet-filter-chain> XML elements.
| Field Summary | |
|---|---|
Vector |
chains
Result of Iptable(): a Vector containing the generated <packet-filter-chain> elements |
Hashtable |
chainTable
A table mapping chainnames to chain ids |
private ImporterEnvironment |
config
|
private String |
currentChainId
Id of chain currently being generated. |
private String |
currentChainName
Name of chain currently being generated. |
private int |
currentRule
Number of the rule in the chain generated at the moment |
private Hashtable |
interfaceTable
The table containing the ids of the interface names -> local copy of the ImporterEnvironments interfacesTable |
private Lexer |
lexer
data of the lexical analysis of the String iptdata |
private Logger |
log
Debugging. |
private Parser |
parser
data of the parsed String iptdata |
| Constructor Summary | |
|---|---|
Iptable(String iptdata,
ImporterEnvironment config)
constructor calls lexer and parser calls GenerateTable which initialises the traversation of the parse tree and the generation of the XML elements |
|
| Method Summary | |
|---|---|
private static String |
field2class(int fieldvalue)
Convert the integer field value to ecn class names. |
Element |
generateActionList(Parser.RuleParserToken rule)
Generate a VeriNeC <packet-action-list> XML element |
Element |
generateChain(Parser.ChainParserToken pchain)
Generate a VeriNeC <packet-filter-chain> XML element |
Element |
generateDsfield(Enumeration poptions)
Generate a VeriNeC <match-dsfield> XML element |
Element |
generateFlags(Parser.TcpFlagOptionParserToken pflags)
Generate a VeriNeC <match-tcp-flags> XML element |
Element |
generateIpEcn(Enumeration poptions)
Generate a VeriNeC <match-ecnfield> XML element |
Element |
generateLog(Enumeration poptions)
Generate a log attribute level |
Element |
generateMatchAddr(Parser.AddressParserToken paddr,
String type)
Generate a VeriNeC <match-source> or <match-destination> XML element The type is match-ipnet. |
Element |
generateMatchIcmp(Enumeration poptions,
boolean negate)
Generate a VeriNeC <match-icmp> XML element |
Content |
generateMatchInterface(Parser.InterfaceParserToken pif,
String direction)
Generate a VeriNeC <match-interface> XML element |
Element |
generateMatchIpv4(Parser.RuleParserToken rule)
Generate a VeriNeC <match-ipv4> XML element |
Element |
generateMatchList(Parser.RuleParserToken rule)
tagGenerate a VeriNeC <packet-match-list> XML element |
Element |
generateMatchMac(Enumeration poptions)
Generate a VeriNeC <match-mac> XML element |
Element |
generateMatchStates(Enumeration poptions)
Generate a VeriNeC <match-state> XML element |
Element |
generateMatchTcp(Enumeration poptions,
boolean negate)
Generate a VeriNeC <match-tcp> XML element |
Element |
generateMatchUdp(Enumeration poptions,
boolean negate)
Generate a VeriNeC <match-udp> XML element |
Element |
generatePolicy(Parser.ParenthesisParserToken para)
Generate a VeriNeC <default-policy> XML element |
Element |
generatePort(Parser.PortOptionParserToken port,
String type)
Generate a VeriNeC <match-xxx-port-rage> XML element for tcp and udp ports |
Element |
generateReject(Enumeration poptions)
Generate the reject attributes type and code |
Element |
generateRule(Parser.RuleParserToken rule)
Generate a VeriNeC <packet-filter-rule> XML element |
Element |
generateTcpEcn(Parser.EcnMatchOptionParserToken ptcpecn)
Generate a VeriNeC <match-tcp-ecn> XML element |
Element |
generateTcpOpt(Parser.TcpOptOptionParserToken ptcpopt)
Generate a VeriNeC <match-tcp-option> XML element |
private String |
logNumber2logString(int number)
|
private int |
rejectType2int(String word)
Parse the word as a RejectType, transform it to integer. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private Logger log
private ImporterEnvironment config
public Vector chains
private Lexer lexer
private Parser parser
public Hashtable chainTable
private Hashtable interfaceTable
private String currentChainId
private String currentChainName
private int currentRule
| Constructor Detail |
|---|
public Iptable(String iptdata,
ImporterEnvironment config)
throws VerinecImporterException
iptdata - a String containing the data of the iptable configuartion of one tableconfig - the ImporterEnvironment object of that importation.
VerinecImporterException - If the parser can not be instantiated or the table does not work.| Method Detail |
|---|
public Element generateChain(Parser.ChainParserToken pchain)
throws VerinecImporterException
pchain - The iptables chain to transform into XML
VerinecImporterException
public Element generatePolicy(Parser.ParenthesisParserToken para)
throws VerinecImporterException
para - The default policy to parse
VerinecImporterException
public Element generateRule(Parser.RuleParserToken rule)
throws VerinecImporterException
rule - The rule to parse
VerinecImporterException
public Element generateMatchList(Parser.RuleParserToken rule)
throws VerinecImporterException
rule - The match list rule to parse
VerinecImporterException
public Content generateMatchInterface(Parser.InterfaceParserToken pif,
String direction)
throws VerinecImporterException
pif - The match interface tokendirection - Direction of traffic
VerinecImporterException
public Element generateMatchMac(Enumeration poptions)
throws VerinecImporterException
poptions - The match options
VerinecImporterException
public Element generateMatchIpv4(Parser.RuleParserToken rule)
throws VerinecImporterException
rule - The rule to check for source and target addresses and attributes
VerinecImporterException
public Element generateMatchAddr(Parser.AddressParserToken paddr,
String type)
throws VerinecImporterException
paddr - The address tokentype - The direction type
VerinecImporterException
public Element generateDsfield(Enumeration poptions)
throws VerinecImporterException
poptions - DS field options
VerinecImporterExceptionprivate static String field2class(int fieldvalue)
fieldvalue - The ecn field value
public Element generateIpEcn(Enumeration poptions)
throws VerinecImporterException
poptions - The ecn field options to match
VerinecImporterException
public Element generateMatchTcp(Enumeration poptions,
boolean negate)
throws VerinecImporterException
poptions - TCP match optionsnegate - Whether to negate the options
VerinecImporterException
public Element generatePort(Parser.PortOptionParserToken port,
String type)
throws VerinecImporterException
port - The token designating the porttype - Whether it is udp or tcp
VerinecImporterException
public Element generateFlags(Parser.TcpFlagOptionParserToken pflags)
throws VerinecImporterException
pflags - The flags to match
VerinecImporterException
public Element generateTcpOpt(Parser.TcpOptOptionParserToken ptcpopt)
throws VerinecImporterException
ptcpopt - The tcp options parameter
VerinecImporterException
public Element generateTcpEcn(Parser.EcnMatchOptionParserToken ptcpecn)
throws VerinecImporterException
ptcpecn - TCP ecn options specification
VerinecImporterException
public Element generateMatchUdp(Enumeration poptions,
boolean negate)
throws VerinecImporterException
poptions - The udp match optionsnegate - If true, the test is whether the protocol is not udp
VerinecImporterException
public Element generateMatchIcmp(Enumeration poptions,
boolean negate)
throws VerinecImporterException
poptions - ICMP optionsnegate - If true, the test is that the packet is not icmp
VerinecImporterException
public Element generateMatchStates(Enumeration poptions)
throws VerinecImporterException
poptions - option tokens, possibly StateOption
VerinecImporterException
public Element generateActionList(Parser.RuleParserToken rule)
throws VerinecImporterException
rule - The action list token
VerinecImporterException
public Element generateReject(Enumeration poptions)
throws VerinecImporterException
poptions - The reject options
VerinecImporterExceptionprivate int rejectType2int(String word)
word - The icmp code word
public Element generateLog(Enumeration poptions)
throws VerinecImporterException
poptions - The log level option
VerinecImporterExceptionprivate String logNumber2logString(int number)
|
Copyright © 2005 Verinec, DIUF | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||