diff options
author | Paul Evans <leonerd@leonerd.org.uk> | 2010-11-25 20:08:05 +0000 |
---|---|---|
committer | Chris 'BinGOs' Williams <chris@bingosnet.co.uk> | 2010-11-25 20:08:05 +0000 |
commit | d3f248d35fa98e3b8b9bcce1b564511eee77b7a3 (patch) | |
tree | 834b3284a0c2348a4d79441995080d706c8dc372 /ext/Socket | |
parent | 4bc6101e53adda82ea90912bd4ea6ca42ed22f3f (diff) | |
download | perl-d3f248d35fa98e3b8b9bcce1b564511eee77b7a3.tar.gz |
[PATCH 3/3] Provide wrappers for IN6ADDR_ANY and IN6ADDR_LOOPBACK
Signed-off-by: Chris 'BinGOs' Williams <chris@bingosnet.co.uk>
Diffstat (limited to 'ext/Socket')
-rw-r--r-- | ext/Socket/Makefile.PL | 8 | ||||
-rw-r--r-- | ext/Socket/Socket.pm | 11 |
2 files changed, 19 insertions, 0 deletions
diff --git a/ext/Socket/Makefile.PL b/ext/Socket/Makefile.PL index 7167aa4dbe..62ecab2097 100644 --- a/ext/Socket/Makefile.PL +++ b/ext/Socket/Makefile.PL @@ -71,6 +71,14 @@ push @names, value => "newSVpvn_flags((char *)&ip_address,sizeof(ip_address), SVs_TEMP)",} foreach qw(INADDR_ANY INADDR_LOOPBACK INADDR_NONE INADDR_BROADCAST); +push @names, +{name => $_, type => "SV", + macro=>["#ifdef ${_}_INIT\n", + "#endif\n"], + pre=>"struct in6_addr ip6_address = ${_}_INIT;", + value => "newSVpvn_flags((char *)&ip6_address,sizeof(ip6_address), SVs_TEMP)",} + foreach qw(IN6ADDR_ANY IN6ADDR_LOOPBACK); + WriteConstants( PROXYSUBS => {autoload => 1}, NAME => 'Socket', diff --git a/ext/Socket/Socket.pm b/ext/Socket/Socket.pm index d4bd73cd7f..b0a72e5e83 100644 --- a/ext/Socket/Socket.pm +++ b/ext/Socket/Socket.pm @@ -112,6 +112,16 @@ Note - does not return a number. Returns the 4-byte 'invalid' ip address. Normally equivalent to inet_aton('255.255.255.255'). +=item IN6ADDR_ANY + +Returns the 16-byte wildcard IPv6 address. Normally equivalent +to inet_pton(AF_INET6, "::") + +=item IN6ADDR_LOOPBACK + +Returns the 16-byte loopback IPv6 address. Normally equivalent +to inet_pton(AF_INET6, "::1") + =item sockaddr_family SOCKADDR Takes a sockaddr structure (as returned by pack_sockaddr_in(), @@ -231,6 +241,7 @@ require XSLoader; pack_sockaddr_in6 unpack_sockaddr_in6 sockaddr_in sockaddr_in6 sockaddr_un INADDR_ANY INADDR_BROADCAST INADDR_LOOPBACK INADDR_NONE + IN6ADDR_ANY IN6ADDR_LOOPBACK AF_802 AF_AAL AF_APPLETALK |