1docs::api::APR::SockAddUrs(e3r)Contributed Perl Documentdaotciso:n:api::APR::SockAddr(3)
2
3
4

NAME

6       APR::SockAddr - Perl API for APR socket address structure
7

Synopsis

9         use APR::SockAddr ();
10
11         my $ip = $sock_addr->ip_get;
12         my $port = $sock_addr->port;
13

Description

15       "APR::SockAddr" provides an access to a socket address structure
16       fields.
17
18       Normally you'd get a socket address object, by calling:
19
20         use Apache2::Connection ();
21         my $remote_sock_addr = $c->remote_addr;
22         my $local_sock_addr  = $c->remote_local;
23

API

25       "APR::SockAddr" provides the following functions and/or methods:
26
27       "ip_get"
28
29       Get the IP address of the socket
30
31         $ip = $sock_addr->ip_get();
32
33       obj: $sock_addr ( "APR::SockAddr object" )
34       ret: $ip ( string )
35       since: 2.0.00
36
37       If you are familiar with how perl's "Socket" works:
38
39         use Socket 'sockaddr_in';
40         my ($serverport, $serverip) = sockaddr_in(getpeername($local_sock));
41         my ($remoteport, $remoteip) = sockaddr_in(getpeername($remote_sock));
42
43       in apr-speak that'd be written as:
44
45         use APR::SockAddr ();
46         use Apache2::Connection ();
47         my $serverport = $c->local_addr->port;
48         my $serverip   = $c->local_addr->ip_get;
49         my $remoteport = $c->remote_addr->port;
50         my $remoteip   = $c->remote_addr->ip_get;
51
52       "port"
53
54       Get the IP address of the socket
55
56         $port = $sock_addr->port();
57
58       obj: $sock_addr ( "APR::SockAddr object" )
59       ret: $port ( integer )
60       since: 2.0.00
61
62       Example: see "ip_get()"
63

Unsupported API

65       "APR::SockAddr" also provides auto-generated Perl interface for a few
66       other methods which aren't tested at the moment and therefore their API
67       is a subject to change. These methods will be finalized later as a need
68       arises. If you want to rely on any of the following methods please con‐
69       tact the the mod_perl development mailing list so we can help each
70       other take the steps necessary to shift the method to an officially
71       supported API.
72
73       "equal"
74
75       META: Autogenerated - needs to be reviewed/completed
76
77       See if the IP addresses in two APR socket addresses are equivalent.
78       Appropriate logic is present for comparing IPv4-mapped IPv6 addresses
79       with IPv4 addresses.
80
81         $ret = $addr1->equal($addr2);
82
83       obj: $addr1 ( "APR::SockAddr object" )
84           One of the APR socket addresses.
85
86       arg1: $addr2 ( "APR::SockAddr object" )
87           The other APR socket address.
88
89       ret: $ret ( integer )
90       since: subject to change
91
92       The return value will be non-zero if the addresses are equivalent.
93

See Also

95       mod_perl 2.0 documentation.
96
98       mod_perl 2.0 and its core modules are copyrighted under The Apache
99       Software License, Version 2.0.
100

Authors

102       The mod_perl development team and numerous contributors.
103
104
105
106perl v5.8.8                       2006-11-19       docs::api::APR::SockAddr(3)
Impressum