line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# Copyrights 2011-2020 by [Mark Overmeer]. |
2
|
|
|
|
|
|
|
# For other contributors see ChangeLog. |
3
|
|
|
|
|
|
|
# See the manual pages for details on the licensing terms. |
4
|
|
|
|
|
|
|
# Pod stripped from pm file by OODoc 2.02. |
5
|
|
|
|
|
|
|
# This code is part of distribution POSIX-1003. Meta-POD processed with |
6
|
|
|
|
|
|
|
# OODoc into POD and HTML manual-pages. See README.md |
7
|
|
|
|
|
|
|
# Copyright Mark Overmeer. Licensed under the same terms as Perl itself. |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
package POSIX::1003::Socket; |
10
|
2
|
|
|
2
|
|
861
|
use vars '$VERSION'; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
107
|
|
11
|
|
|
|
|
|
|
$VERSION = '1.02'; |
12
|
|
|
|
|
|
|
|
13
|
2
|
|
|
2
|
|
10
|
use base 'POSIX::1003::Module'; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
189
|
|
14
|
|
|
|
|
|
|
|
15
|
2
|
|
|
2
|
|
12
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
62
|
|
16
|
2
|
|
|
2
|
|
10
|
use strict; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
529
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
my (@sock, @sol, @so, @af, @pf, @constants); |
19
|
|
|
|
|
|
|
my @functions = qw/socket_names/; |
20
|
|
|
|
|
|
|
our @IN_CORE = qw//; # to be added |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
our %EXPORT_TAGS = |
23
|
|
|
|
|
|
|
( sock => \@sock |
24
|
|
|
|
|
|
|
, so => \@so |
25
|
|
|
|
|
|
|
, sol => \@sol |
26
|
|
|
|
|
|
|
, af => \@af |
27
|
|
|
|
|
|
|
, pf => \@pf |
28
|
|
|
|
|
|
|
, constants => \@constants |
29
|
|
|
|
|
|
|
, functions => \@functions |
30
|
|
|
|
|
|
|
, tables => [ qw/%sockets/ ] |
31
|
|
|
|
|
|
|
); |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
my ($socket, %socket); |
34
|
|
|
|
|
|
|
BEGIN { |
35
|
2
|
|
|
2
|
|
313
|
$socket = socket_table; |
36
|
2
|
|
|
|
|
311
|
@constants = sort keys %$socket; |
37
|
2
|
|
|
|
|
31
|
tie %socket, 'POSIX::1003::ReadOnlyTable', $socket; |
38
|
|
|
|
|
|
|
|
39
|
2
|
|
|
|
|
60
|
@sock = grep /^SOCK/, @constants; |
40
|
2
|
|
|
|
|
68
|
@so = grep /^SO_/, @constants; |
41
|
2
|
|
|
|
|
52
|
@sol = grep /^SOL_/, @constants; |
42
|
2
|
|
|
|
|
66
|
@af = grep /^AF_/, @constants; |
43
|
2
|
|
|
|
|
443
|
@pf = grep /^PF_/, @constants; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub exampleValue($) |
48
|
0
|
|
|
0
|
1
|
|
{ my ($class, $name) = @_; |
49
|
0
|
|
0
|
|
|
|
$socket{$name} // 'undef'; |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub _create_constant($) |
53
|
0
|
|
|
0
|
|
|
{ my ($class, $name) = @_; |
54
|
0
|
|
0
|
|
|
|
my $nr = $socket->{$name} // return sub() {undef}; |
55
|
0
|
|
|
0
|
|
|
sub() {$nr}; |
|
0
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
#------------- |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
# get/setsockopt in XS |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
#------------ |
63
|
|
|
|
|
|
|
|
64
|
0
|
|
|
0
|
1
|
|
sub socket_names() { keys %$socket } |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
#------------ |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
1; |