GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  MAIL::SPF::MECH (3)

.ds Aq ’

NAME

Mail::SPF::Mech - SPF record mechanism base class

CONTENTS

DESCRIPTION

An object of class <B>Mail::SPF::MechB> represents a mechanism within an SPF record. Mail::SPF::Mech cannot be instantiated directly. Create an instance of a concrete sub-class instead.

    Constructors

The following constructors are provided:
<B>new(%options)B>: returns Mail::SPF::Mech Abstract. Creates a new SPF record mechanism object.

%options is a list of key/value pairs representing any of the following options:
<B>textB> A string denoting the unparsed text of the mechanism.
<B>qualifierB> A single-character string denoting the qualifier of the mechanism. Any of the following may be specified: <B>’+’B> (Pass), <B>’-’B> (Fail), <B>’~’B> (SoftFail), <B>’?’B> (Neutral). See RFC 4408, 4.6.2 and 2.5, for their meanings. Defaults to <B>’+’B>.
<B>nameB> A string denoting the name of the mechanism. Required if a generic Mail::SPF::Mech object (as opposed to a specific sub-class) is being constructed.
<B>ip_networkB> A NetAddr::IP object denoting an optional IP address network parameter of the mechanism. Can be either an IPv4 or an IPv6 address, with an optional network prefix length. IPv4-mapped IPv6 addresses (e.g. ’::ffff:192.168.0.1’) must not be specified directly, but as plain IPv4 addresses.
<B>domain_specB> Either a plain string or a Mail::SPF::MacroString object denoting an optional domain-spec parameter of the mechanism.
<B>ipv4_prefix_lengthB>
<B>ipv6_prefix_lengthB> A string denoting an optional IPv4 or IPv6 network prefix length for the domain_spec of the mechanism. Note that these options do not apply to the ip_network option, which already includes an optional network prefix length.

Other options may be specified by sub-classes of Mail::SPF::Mech.

<B>new_from_string($text, B>%options<B>)B>: returns Mail::SPF::Mech; throws Mail::SPF::ENothingToParse, Mail::SPF::EInvalidMech Abstract. Creates a new SPF record mechanism object by parsing the string and any options given.

    Class methods

The following class methods are provided:
<B>default_qualifierB>: returns string Returns the default qualifier, i.e. <B>’+’B>.
<B>default_ipv4_prefix_lengthB>: returns integer Returns the default IPv4 network prefix length, i.e. <B>32B>.
<B>default_ipv6_prefix_lengthB>: returns integer Returns the default IPv6 network prefix length, i.e. <B>128B>.
<B>qualifier_patternB>: returns Regexp Returns a regular expression that matches any legal mechanism qualifier, i.e. <B>’+’B>, <B>’-’B>, <B>’~’B>, or <B>’?’B>.
<B>nameB>: returns string Abstract. Returns the name of the mechanism.

This method is abstract and must be implemented by sub-classes of Mail::SPF::Mech.

<B>name_patternB>: returns Regexp Returns a regular expression that matches any legal mechanism name.

    Instance methods

The following instance methods are provided:
<B>textB>: returns string; throws Mail::SPF::ENoUnparsedText Returns the unparsed text of the mechanism. Throws a Mail::SPF::ENoUnparsedText exception if the mechanism was created synthetically instead of being parsed, and no text was provided.
<B>qualifierB>: returns string Returns the qualifier of the mechanism. See the description of the new constructor’s qualifier option.
<B>paramsB>: returns string Abstract. Returns the mechanism’s parameters formatted as a string.

A sub-class of Mail::SPF::Mech does not have to implement this method if it supports no parameters.

<B>stringifyB>: returns string Formats the mechanism’s qualifier, name, and parameters as a string and returns it. (A qualifier that matches the default of <B>’+’B> is omitted.) You can simply use a Mail::SPF::Mech object as a string for the same effect, see OVERLOADING.
<B>domain($server, B>$request<B>)B>: returns string Returns the target domain of the mechanism. Depending on whether the mechanism does have an explicit domain_spec parameter, this is either the macro-expanded domain_spec parameter, or the request’s authority domain (see authority_domain in Mail::SPF::Request) otherwise. Both a Mail::SPF::Server and a Mail::SPF::Request object are required for resolving the target domain.
<B>match($server, B>$request<B>)B>: returns boolean; throws Mail::SPF::Result::Error Abstract. Checks whether the mechanism matches the parameters of the given request (see Mail::SPF::Request) and returns <B>trueB> if it does, or <B>falseB> otherwise. In any case, takes both a Mail::SPF::Server and a Mail::SPF::Request object.

This method is abstract and must be implemented by sub-classes of Mail::SPF::Mech.

<B>match_in_domain($server, B>$request<B>)B>: returns boolean; throws Mail::SPF::Result::Error
<B>match_in_domain($server, B>$request<B>, B>$domain<B>)B>: returns boolean; throws Mail::SPF::Result::Error Checks whether the mechanism’s target domain name (that is, any of its DNS A or AAAA records) matches the given request’s IP address (see ip_address in Mail::SPF::Request), and returns <B>trueB> if it does, or <B>falseB> otherwise. If an explicit domain is specified, it is used instead of the mechanism’s target domain. The mechanism’s IP network prefix lengths are respected when matching DNS address records against the request’s IP address. See RFC 4408, 5, for the exact algorithm used.

This method exists mainly for the convenience of sub-classes of Mail::SPF::Mech.

<B>explain($server, B>$request<B>, B>$result<B>)B> Locally generates an explanation for why the mechanism caused the given result, and stores it in the given request object’s state.

There is no need to override this method in sub-classes. See the explanation_template method.

<B>explanation_template($server, B>$request<B>, B>$result<B>)B>: returns string Returns a macro string template for a locally generated explanation for why the mechanism caused the given result object.

Sub-classes should either define an explanation_templates_by_result_code hash constant with their own templates, or override this method.

OVERLOADING

If a Mail::SPF::Mech object is used as a string, the stringify method is used to convert the object into a string.

SEE ALSO

Mail::SPF::Mech::All, Mail::SPF::Mech::IP4, Mail::SPF::Mech::IP6, Mail::SPF::Mech::A, Mail::SPF::Mech::MX, Mail::SPF::Mech::PTR, Mail::SPF::Mech::Exists, Mail::SPF::Mech::Include

Mail::SPF, Mail::SPF::Record, Mail::SPF::Term

<http://tools.ietf.org/html/rfc4408>

For availability, support, and license information, see the README file included with Mail::SPF.

AUTHORS

Julian Mehnle <julian@mehnle.net>, Shevek <cpan@anarres.org>
Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 MAIL::SPF::MECH (3) 2016-04-03

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.