.\" -*- 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 "docs::api::APR::SockAddr 3pm" .TH docs::api::APR::SockAddr 3pm 2024-01-10 "perl v5.38.2" "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 APR::SockAddr \- Perl API for APR socket address structure .SH Synopsis .IX Header "Synopsis" .Vb 1 \& use APR::SockAddr (); \& \& my $ip = $sock_addr\->ip_get; \& my $port = $sock_addr\->port; .Ve .SH Description .IX Header "Description" \&\f(CW\*(C`APR::SockAddr\*(C'\fR provides an access to a socket address structure fields. .PP Normally you'd get a socket address object, by calling: .PP .Vb 3 \& use Apache2::Connection (); \& my $remote_sock_addr = $c\->remote_addr; \& my $local_sock_addr = $c\->remote_local; .Ve .SH API .IX Header "API" \&\f(CW\*(C`APR::SockAddr\*(C'\fR provides the following functions and/or methods: .ie n .SS """ip_get""" .el .SS \f(CWip_get\fP .IX Subsection "ip_get" Get the IP address of the socket .PP .Vb 1 \& $ip = $sock_addr\->ip_get(); .Ve .ie n .IP "obj: $sock_addr ( ""APR::SockAddr object"" )" 4 .el .IP "obj: \f(CW$sock_addr\fR ( \f(CWAPR::SockAddr object\fR )" 4 .IX Item "obj: $sock_addr ( APR::SockAddr object )" .PD 0 .ie n .IP "ret: $ip ( string )" 4 .el .IP "ret: \f(CW$ip\fR ( string )" 4 .IX Item "ret: $ip ( string )" .IP "since: 2.0.00" 4 .IX Item "since: 2.0.00" .PD .PP If you are familiar with how perl's \f(CW\*(C`Socket\*(C'\fR works: .PP .Vb 3 \& use Socket \*(Aqsockaddr_in\*(Aq; \& my ($serverport, $serverip) = sockaddr_in(getpeername($local_sock)); \& my ($remoteport, $remoteip) = sockaddr_in(getpeername($remote_sock)); .Ve .PP in apr-speak that'd be written as: .PP .Vb 6 \& use APR::SockAddr (); \& use Apache2::Connection (); \& my $serverport = $c\->local_addr\->port; \& my $serverip = $c\->local_addr\->ip_get; \& my $remoteport = $c\->remote_addr\->port; \& my $remoteip = $c\->remote_addr\->ip_get; .Ve .ie n .SS """port""" .el .SS \f(CWport\fP .IX Subsection "port" Get the IP address of the socket .PP .Vb 1 \& $port = $sock_addr\->port(); .Ve .ie n .IP "obj: $sock_addr ( ""APR::SockAddr object"" )" 4 .el .IP "obj: \f(CW$sock_addr\fR ( \f(CWAPR::SockAddr object\fR )" 4 .IX Item "obj: $sock_addr ( APR::SockAddr object )" .PD 0 .ie n .IP "ret: $port ( integer )" 4 .el .IP "ret: \f(CW$port\fR ( integer )" 4 .IX Item "ret: $port ( integer )" .IP "since: 2.0.00" 4 .IX Item "since: 2.0.00" .PD .PP Example: see \f(CWip_get()\fR .SH "Unsupported API" .IX Header "Unsupported API" \&\f(CW\*(C`APR::SockAddr\*(C'\fR also provides auto-generated Perl interface for a few other methods which aren't tested at the moment and therefore their API is a subject to change. These methods will be finalized later as a need arises. If you want to rely on any of the following methods please contact the the mod_perl development mailing list so we can help each other take the steps necessary to shift the method to an officially supported API. .ie n .SS """equal""" .el .SS \f(CWequal\fP .IX Subsection "equal" META: Autogenerated \- needs to be reviewed/completed .PP See if the IP addresses in two APR socket addresses are equivalent. Appropriate logic is present for comparing IPv4\-mapped IPv6 addresses with IPv4 addresses. .PP .Vb 1 \& $ret = $addr1\->equal($addr2); .Ve .ie n .IP "obj: $addr1 ( ""APR::SockAddr object"" )" 4 .el .IP "obj: \f(CW$addr1\fR ( \f(CWAPR::SockAddr object\fR )" 4 .IX Item "obj: $addr1 ( APR::SockAddr object )" One of the APR socket addresses. .ie n .IP "arg1: $addr2 ( ""APR::SockAddr object"" )" 4 .el .IP "arg1: \f(CW$addr2\fR ( \f(CWAPR::SockAddr object\fR )" 4 .IX Item "arg1: $addr2 ( APR::SockAddr object )" The other APR socket address. .ie n .IP "ret: $ret ( integer )" 4 .el .IP "ret: \f(CW$ret\fR ( integer )" 4 .IX Item "ret: $ret ( integer )" .PD 0 .IP "since: subject to change" 4 .IX Item "since: subject to change" .PD .PP The return value will be non-zero if the addresses are equivalent. .SH "See Also" .IX Header "See Also" mod_perl 2.0 documentation. .SH Copyright .IX Header "Copyright" mod_perl 2.0 and its core modules are copyrighted under The Apache Software License, Version 2.0. .SH Authors .IX Header "Authors" The mod_perl development team and numerous contributors.