1docs::api::APR::SockAddUrs(e3r)Contributed Perl Documentdaotciso:n:api::APR::SockAddr(3)
2
3
4
6 APR::SockAddr - Perl API for APR socket address structure
7
9 use APR::SockAddr ();
10
11 my $ip = $sock_addr->ip_get;
12 my $port = $sock_addr->port;
13
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
25 "APR::SockAddr" provides the following functions and/or methods:
26
27 "ip_get"
28 Get the IP address of the socket
29
30 $ip = $sock_addr->ip_get();
31
32 obj: $sock_addr ( "APR::SockAddr object" )
33 ret: $ip ( string )
34 since: 2.0.00
35
36 If you are familiar with how perl's "Socket" works:
37
38 use Socket 'sockaddr_in';
39 my ($serverport, $serverip) = sockaddr_in(getpeername($local_sock));
40 my ($remoteport, $remoteip) = sockaddr_in(getpeername($remote_sock));
41
42 in apr-speak that'd be written as:
43
44 use APR::SockAddr ();
45 use Apache2::Connection ();
46 my $serverport = $c->local_addr->port;
47 my $serverip = $c->local_addr->ip_get;
48 my $remoteport = $c->remote_addr->port;
49 my $remoteip = $c->remote_addr->ip_get;
50
51 "port"
52 Get the IP address of the socket
53
54 $port = $sock_addr->port();
55
56 obj: $sock_addr ( "APR::SockAddr object" )
57 ret: $port ( integer )
58 since: 2.0.00
59
60 Example: see "ip_get()"
61
63 "APR::SockAddr" also provides auto-generated Perl interface for a few
64 other methods which aren't tested at the moment and therefore their API
65 is a subject to change. These methods will be finalized later as a need
66 arises. If you want to rely on any of the following methods please
67 contact the the mod_perl development mailing list so we can help each
68 other take the steps necessary to shift the method to an officially
69 supported API.
70
71 "equal"
72 META: Autogenerated - needs to be reviewed/completed
73
74 See if the IP addresses in two APR socket addresses are equivalent.
75 Appropriate logic is present for comparing IPv4-mapped IPv6 addresses
76 with IPv4 addresses.
77
78 $ret = $addr1->equal($addr2);
79
80 obj: $addr1 ( "APR::SockAddr object" )
81 One of the APR socket addresses.
82
83 arg1: $addr2 ( "APR::SockAddr object" )
84 The other APR socket address.
85
86 ret: $ret ( integer )
87 since: subject to change
88
89 The return value will be non-zero if the addresses are equivalent.
90
92 mod_perl 2.0 documentation.
93
95 mod_perl 2.0 and its core modules are copyrighted under The Apache
96 Software License, Version 2.0.
97
99 The mod_perl development team and numerous contributors.
100
101
102
103perl v5.32.1 2021-01-26 docs::api::APR::SockAddr(3)