.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Mail::SPF::Request 3pm" .TH Mail::SPF::Request 3pm 2023-07-25 "perl v5.38.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME Mail::SPF::Request \- SPF request class .SH SYNOPSIS .IX Header "SYNOPSIS" .Vb 1 \& use Mail::SPF; \& \& my $request = Mail::SPF::Request\->new( \& versions => [1, 2], # optional \& scope => \*(Aqmfrom\*(Aq, # or \*(Aqhelo\*(Aq, \*(Aqpra\*(Aq \& identity => \*(Aqfred@example.com\*(Aq, \& ip_address => \*(Aq192.168.0.1\*(Aq, \& helo_identity # optional, \& => \*(Aqmta.example.com\*(Aq # for %{h} macro expansion \& ); \& \& my @versions = $request\->versions; \& my $scope = $request\->scope; \& my $authority_domain \& = $request\->authority_domain; \& my $identity = $request\->identity; # \*(Aqlocalpart@domain\*(Aq or \*(Aqdomain\*(Aq \& my $domain = $request\->domain; \& my $localpart = $request\->localpart; \& my $ip_address = $request\->ip_address; # IPv4 or IPv6 address \& my $ip_address_v6 # native IPv6 address or \& = $request\->ip_address_v6; # IPv4\-mapped IPv6 address \& my $helo_identity # additional HELO identity \& = $request\->helo_identity; # for non\-HELO scopes \& \& my $record = $request\->record; \& # the record selected during processing of the request, may be undef \& \& $request\->state(field => \*(Aqvalue\*(Aq); \& my $value = $request\->state(\*(Aqfield\*(Aq); .Ve .SH DESCRIPTION .IX Header "DESCRIPTION" An object of class \fBMail::SPF::Request\fR represents an SPF request. .SS Constructors .IX Subsection "Constructors" The following constructors are provided: .IP "\fBnew(%options)\fR: returns \fIMail::SPF::Request\fR" 4 .IX Item "new(%options): returns Mail::SPF::Request" Creates a new SPF request object. The request is considered the \&\fIroot-request\fR for any subsequent sub-requests (see the "new_sub_request" constructor). .Sp \&\f(CW%options\fR is a list of key/value pairs representing any of the following options: .RS 4 .IP \fBversions\fR 4 .IX Item "versions" A reference to an \fIarray\fR of \fIinteger\fRs listing the versions of SPF records that may be used for the SPF check. Only those record versions that cover the desired scope will actually be used. At least one applicable version must be specified. For a single record version, a simple scalar may be specified instead of an array-ref. Defaults to all versions that cover the desired scope (see below); defaults to \fB[1, 2]\fR for the default scope of \fB'mfrom'\fR. .Sp The following versions are supported: .RS 4 .IP \fB1\fR 4 .IX Item "1" Use \f(CW\*(C`v=spf1\*(C'\fR records. .IP \fB2\fR 4 .IX Item "2" Use \f(CW\*(C`spf2.0\*(C'\fR records. .RE .RS 4 .Sp \&\fIExample\fR: A value of \fB1\fR (or \fB[1]\fR) means that only \f(CW\*(C`v=spf1\*(C'\fR records should be used for the SPF check. If at the same time a scope of \fB'pra'\fR is specified, a \fIMail::SPF::EInvalidScope\fR exception will be thrown as \f(CW\*(C`v=spf1\*(C'\fR records do not cover the PRA scope. .RE .IP \fBscope\fR 4 .IX Item "scope" A string denoting the authorization scope of the identity that should be checked. Defaults to \fB'mfrom'\fR. The following scope values are supported: .RS 4 .IP \fB'helo'\fR 4 .IX Item "'helo'" The given identity is the \f(CW\*(C`HELO\*(C'\fR parameter of an SMTP transaction (RFC 2821) and should be checked against SPF records that cover the \f(CW\*(C`helo\*(C'\fR scope (\f(CW\*(C`v=spf1\*(C'\fR). See the SPFv1 specification (RFC 4408) for the formal definition of the \f(CW\*(C`HELO\*(C'\fR scope. .IP \fB'mfrom'\fR 4 .IX Item "'mfrom'" The given identity is the \f(CW\*(C`MAIL FROM\*(C'\fR parameter of an SMTP transaction (RFC 2821), and should be checked against SPF records that cover the \f(CW\*(C`mfrom\*(C'\fR scope (\f(CW\*(C`v=spf1\*(C'\fR and \f(CW\*(C`spf2.0/mfrom\*(C'\fR). See the SPFv1 specification (RFC 4408) for the formal definition of the \f(CW\*(C`MAIL FROM\*(C'\fR scope. .Sp \&\fINote\fR: In the case of an empty \f(CW\*(C`MAIL FROM\*(C'\fR SMTP transaction parameter (\f(CW\*(C`MAIL FROM:<>\*(C'\fR), you should perform a check with the \f(CW\*(C`helo\*(C'\fR scope instead. .IP \fB'pra'\fR 4 .IX Item "'pra'" The given identity is the "Purported Responsible Address" of an internet message (RFC 2822) and should be checked against SPF records that cover the \&\f(CW\*(C`pra\*(C'\fR scope (\f(CW\*(C`spf2.0/pra\*(C'\fR). See the PRA specification (RFC 4407) for the formal definition of the PRA scope. .RE .RS 4 .RE .IP \fBauthority_domain\fR 4 .IX Item "authority_domain" A string denoting the domain name that should be queried for sender policy records. Defaults to the domain of the \f(CW\*(C`identity\*(C'\fR option. There is usually no need to specify the \f(CW\*(C`authority_domain\*(C'\fR option. .IP \fBidentity\fR 4 .IX Item "identity" \&\fIRequired\fR. A string denoting the sender identity whose authorization should be checked. This is a domain name for the \f(CW\*(C`helo\*(C'\fR scope, and an e\-mail address for the \f(CW\*(C`mfrom\*(C'\fR and \f(CW\*(C`pra\*(C'\fR scopes. .Sp \&\fINote\fR: An empty identity must not be passed. In the case of an empty \f(CW\*(C`MAIL FROM\*(C'\fR SMTP transaction parameter, you should perform a check with the \f(CW\*(C`helo\*(C'\fR scope instead. .IP \fBip_address\fR 4 .IX Item "ip_address" \&\fIRequired\fR for checks with the \f(CW\*(C`helo\*(C'\fR, \f(CW\*(C`mfrom\*(C'\fR, and \f(CW\*(C`pra\*(C'\fR scopes. Either a string or a \fINetAddr::IP\fR object denoting the IP address of the host claiming the identity that is being checked. Can be either an IPv4 or an IPv6 address. An IPv4\-mapped IPv6 address (e.g. '::ffff:192.168.0.1') is treated as an IPv4 address. .IP \fBhelo_identity\fR 4 .IX Item "helo_identity" A string denoting the \f(CW\*(C`HELO\*(C'\fR SMTP transaction parameter in the case that the main identity is of a scope other than \f(CW\*(C`helo\*(C'\fR. This identity is then used merely for the expansion of \f(CW\*(C`%{h}\*(C'\fR macros during the policy evaluation of the main identity. Defaults to \fBundef\fR, which will be expanded to \fB'unknown'\fR. If the main identity is of the \f(CW\*(C`helo\*(C'\fR scope, this option is unused. .RE .RS 4 .RE .IP "\fBnew_sub_request(%options)\fR: returns \fIMail::SPF::Request\fR" 4 .IX Item "new_sub_request(%options): returns Mail::SPF::Request" Must be invoked on an existing request object. Creates a new sub-request object by cloning the invoked request, which is then considered the new request's \fIsuper-request\fR. Any specified options (see the "new" constructor) override the parameters of the super-request. There is usually no need to specify any options \fIbesides\fR the \f(CW\*(C`authority_domain\*(C'\fR option. .SS "Instance methods" .IX Subsection "Instance methods" The following instance methods are provided: .IP "\fBroot_request\fR: returns \fIMail::SPF::Request\fR" 4 .IX Item "root_request: returns Mail::SPF::Request" Returns the root of the request's chain of super-requests. Specifically, returns the request itself if it has no super-requests. .IP "\fBsuper_request\fR: returns \fIMail::SPF::Request\fR" 4 .IX Item "super_request: returns Mail::SPF::Request" Returns the super-request of the request, or \fBundef\fR if there is none. .IP "\fBversions\fR: returns \fIlist\fR of \fIstring\fR" 4 .IX Item "versions: returns list of string" Returns a list of the SPF record versions that are used for request. See the description of the "new" constructor's \f(CW\*(C`versions\*(C'\fR option. .IP "\fBscope\fR: returns \fIstring\fR" 4 .IX Item "scope: returns string" Returns the scope of the request. See the description of the "new" constructor's \f(CW\*(C`scope\*(C'\fR option. .IP "\fBauthority_domain\fR: returns \fIstring\fR" 4 .IX Item "authority_domain: returns string" Returns the authority domain of the request. See the description of the "new" constructor's \f(CW\*(C`authority_domain\*(C'\fR option. .IP "\fBidentity\fR: returns \fIstring\fR" 4 .IX Item "identity: returns string" Returns the identity of the request. See the description of the "new" constructor's \f(CW\*(C`identity\*(C'\fR option. .IP "\fBdomain\fR: returns \fIstring\fR" 4 .IX Item "domain: returns string" Returns the identity domain of the request. See the description of the "new" constructor's \f(CW\*(C`identity\*(C'\fR option. .IP "\fBlocalpart\fR: returns \fIstring\fR" 4 .IX Item "localpart: returns string" Returns the identity localpart of the request. See the description of the "new" constructor's \f(CW\*(C`identity\*(C'\fR option. .IP "\fBip_address\fR: returns \fINetAddr::IP\fR" 4 .IX Item "ip_address: returns NetAddr::IP" Returns the IP address of the request as a \fINetAddr::IP\fR object. See the description of the "new" constructor's \f(CW\*(C`ip_address\*(C'\fR option. .IP "\fBip_address_v6\fR: returns \fINetAddr::IP\fR" 4 .IX Item "ip_address_v6: returns NetAddr::IP" Like the \f(CW\*(C`ip_address\*(C'\fR method, however, an IPv4 address is returned as an IPv4\-mapped IPv6 address (e.g. '::ffff:192.168.0.1') to facilitate uniform processing. .IP "\fBhelo_identity\fR: returns \fIstring\fR" 4 .IX Item "helo_identity: returns string" Returns the \f(CW\*(C`HELO\*(C'\fR SMTP transaction parameter of the request. See the description of the "new" constructor's \f(CW\*(C`helo_identity\*(C'\fR option. .IP "\fBrecord\fR: returns \fIMail::SPF::Record\fR" 4 .IX Item "record: returns Mail::SPF::Record" Returns the SPF record selected during the processing of the request, or \&\fBundef\fR if there is none. .IP "\fBstate($field)\fR: returns anything" 4 .IX Item "state($field): returns anything" .PD 0 .ie n .IP "\fBstate($field, \fR\fB$value\fR\fB)\fR: returns anything" 4 .el .IP "\fBstate($field, \fR\f(CB$value\fR\fB)\fR: returns anything" 4 .IX Item "state($field, $value): returns anything" .PD Provides an interface for storing temporary state information with the request object. This is primarily meant to be used internally by \fIMail::SPF::Server\fR and other Mail::SPF classes. .Sp If \f(CW$value\fR is specified, stores it in a state field named \f(CW$field\fR. Returns the current (new) value of the state field named \f(CW$field\fR. This method may be used as an lvalue. .SH "SEE ALSO" .IX Header "SEE ALSO" Mail::SPF, Mail::SPF::Server .PP .PP For availability, support, and license information, see the README file included with Mail::SPF. .SH AUTHORS .IX Header "AUTHORS" Julian Mehnle , Shevek