diff options
author | Paul Evans <leonerd@leonerd.org.uk> | 2010-11-25 20:07:23 +0000 |
---|---|---|
committer | Chris 'BinGOs' Williams <chris@bingosnet.co.uk> | 2010-11-25 20:07:23 +0000 |
commit | 4bc6101e53adda82ea90912bd4ea6ca42ed22f3f (patch) | |
tree | 50702e7665fa23fa323428e449d16b93db13c502 /ext/Socket | |
parent | c73aa44c20991e800d9dcc1f8c59404c77ce882e (diff) | |
download | perl-4bc6101e53adda82ea90912bd4ea6ca42ed22f3f.tar.gz |
[PATCH 2/3] Implement sockaddr_in6 wrapper
Signed-off-by: Chris 'BinGOs' Williams <chris@bingosnet.co.uk>
Diffstat (limited to 'ext/Socket')
-rw-r--r-- | ext/Socket/Socket.pm | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/ext/Socket/Socket.pm b/ext/Socket/Socket.pm index f1d80e84e8..d4bd73cd7f 100644 --- a/ext/Socket/Socket.pm +++ b/ext/Socket/Socket.pm @@ -147,6 +147,14 @@ representing the IP address (you can use inet_ntoa() to convert the address to the four-dotted numeric format). Will croak if the structure does not have AF_INET in the right place. +=item sockaddr_in6 PORT, IP6_ADDRESS, [ SCOPE_ID, [ FLOWINFO ] ] + +=item sockaddr_in6 SOCKADDR_IN6 + +In list context, unpacks its SOCKADDR_IN6 argument according to +unpack_sockaddr_in6(). In scalar context, packs its arguments according to +pack_sockaddr_in6(). + =item pack_sockaddr_in6 PORT, IP6_ADDRESS, [ SCOPE_ID, [ FLOWINFO ] ] Takes two to four arguments, a port number, an opaque string (as returned by @@ -221,7 +229,7 @@ require XSLoader; pack_sockaddr_in unpack_sockaddr_in pack_sockaddr_un unpack_sockaddr_un pack_sockaddr_in6 unpack_sockaddr_in6 - sockaddr_in sockaddr_un + sockaddr_in sockaddr_in6 sockaddr_un INADDR_ANY INADDR_BROADCAST INADDR_LOOPBACK INADDR_NONE AF_802 AF_AAL @@ -437,6 +445,17 @@ sub sockaddr_in { } } +sub sockaddr_in6 { + if (wantarray) { + croak "usage: (port,in6addr,scope_id,flowinfo) = sockaddr_in6(sin6_sv)" unless @_ == 1; + unpack_sockaddr_in6(@_); + } + else { + croak "usage: sin6_sv = sockaddr_in6(port,in6addr,[scope_id,[flowinfo]])" unless @_ >= 2 and @_ <= 4; + pack_sockaddr_in6(@_); + } +} + sub sockaddr_un { if (wantarray) { croak "usage: (filename) = sockaddr_un(sun_sv)" unless @_ == 1; |