Package org.apache.james.jspf.terms
Class AMechanism
java.lang.Object
org.apache.james.jspf.terms.GenericMechanism
org.apache.james.jspf.terms.AMechanism
- All Implemented Interfaces:
MacroExpandEnabled
,SPFChecker
,SPFCheckerDNSResponseListener
,ConfigurationEnabled
,Mechanism
- Direct Known Subclasses:
MXMechanism
This class represent the a mechanism
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
ABNF: A = "a" [ ":" domain-spec ] [ dual-cidr-length ]Fields inherited from class org.apache.james.jspf.terms.GenericMechanism
DUAL_CIDR_LENGTH_REGEX, IP4_CIDR_LENGTH_REGEX, IP6_CIDR_LENGTH_REGEX, macroExpand
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
checkAddressList
(IPAddr checkAddress, List<String> addressList, int cidr) Check if the given ipaddress array contains the provided ip.checkSPF
(SPFSession spfData) Run check for SPF with the given values.void
config
(Configuration params) ConfigurationgetAAAARecords
(String strServer) Retrieve a list of AAAA recordsgetARecords
(String strServer) Get a list of IPAddr's for a serverprotected int
protected int
onDNSResponse
(DNSResponse response, SPFSession spfSession) Continue the check for SPF with the given values and the given DNSResponsetoString()
protected String
Methods inherited from class org.apache.james.jspf.terms.GenericMechanism
enableMacroExpand, expandHost, getDomain
-
Field Details
-
REGEX
ABNF: A = "a" [ ":" domain-spec ] [ dual-cidr-length ]- See Also:
-
-
Constructor Details
-
AMechanism
public AMechanism()
-
-
Method Details
-
checkSPF
public DNSLookupContinuation checkSPF(SPFSession spfData) throws PermErrorException, TempErrorException, NeutralException, NoneException Description copied from interface:SPFChecker
Run check for SPF with the given values.- Specified by:
checkSPF
in interfaceSPFChecker
- Parameters:
spfData
- The SPF1Data which should be used to run the check- Throws:
PermErrorException
- Get thrown if an error was detectedTempErrorException
- Get thrown if a DNS problem was detectedNeutralException
- Get thrown if the result should be neutralNoneException
- Get thrown if no Record was foundNoneException
- See Also:
-
config
Description copied from interface:ConfigurationEnabled
Configuration- Specified by:
config
in interfaceConfigurationEnabled
- Overrides:
config
in classGenericMechanism
- Parameters:
params
- the ConfigurationMatch which should used- Throws:
PermErrorException
- get thrown if a PermError should returned- See Also:
-
checkAddressList
public boolean checkAddressList(IPAddr checkAddress, List<String> addressList, int cidr) throws PermErrorException Check if the given ipaddress array contains the provided ip.- Parameters:
checkAddress
- The ip wich should be contained in the given ArrayListaddressList
- The ip ArrayList.- Returns:
- true or false
- Throws:
PermErrorException
-
getIp4cidr
protected int getIp4cidr()- Returns:
- Returns the ip4cidr.
-
getIp6cidr
protected int getIp6cidr()- Returns:
- Returns the ip6cidr.
-
toString
-
toString
- See Also:
-
getAAAARecords
Retrieve a list of AAAA records -
getARecords
Get a list of IPAddr's for a server- Parameters:
strServer
- The hostname or ipAddress whe should get the A-Records for- Returns:
- The ipAddresses
-
onDNSResponse
public DNSLookupContinuation onDNSResponse(DNSResponse response, SPFSession spfSession) throws PermErrorException, TempErrorException, NoneException, NeutralException Description copied from interface:SPFCheckerDNSResponseListener
Continue the check for SPF with the given values and the given DNSResponse- Specified by:
onDNSResponse
in interfaceSPFCheckerDNSResponseListener
- Parameters:
response
- The DNSResponse which should be used to run the checkspfSession
- The SPFSession which should be used to run the check- Throws:
PermErrorException
- Get thrown if an error was detectedTempErrorException
- Get thrown if a DNS problem was detectedNoneException
- Get thrown if no Record was foundNeutralException
- Get thrown if the result should be neutral- See Also:
-