line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Protocol::DBus::Connect; |
2
|
|
|
|
|
|
|
|
3
|
8
|
|
|
8
|
|
746
|
use strict; |
|
8
|
|
|
|
|
12
|
|
|
8
|
|
|
|
|
197
|
|
4
|
8
|
|
|
8
|
|
44
|
use warnings; |
|
8
|
|
|
|
|
11
|
|
|
8
|
|
|
|
|
149
|
|
5
|
|
|
|
|
|
|
|
6
|
8
|
|
|
8
|
|
33
|
use Socket (); |
|
8
|
|
|
|
|
8
|
|
|
8
|
|
|
|
|
1208
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub create_socket { |
9
|
2
|
|
|
2
|
0
|
21
|
my ($addr_obj) = @_; |
10
|
|
|
|
|
|
|
|
11
|
2
|
50
|
|
|
|
27
|
if ($addr_obj->transport() eq 'unix') { |
12
|
2
|
|
|
|
|
48
|
my $path = $addr_obj->attribute('abstract'); |
13
|
|
|
|
|
|
|
|
14
|
2
|
50
|
|
|
|
13
|
if ($path) { |
15
|
0
|
|
|
|
|
0
|
substr($path, 0, 0, "\0"); |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
else { |
18
|
2
|
50
|
|
|
|
20
|
$path = $addr_obj->attribute('path') or do { |
19
|
0
|
|
|
|
|
0
|
die( "No “path” nor “abstract”: " . $addr_obj->to_string() ); |
20
|
|
|
|
|
|
|
}; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
2
|
50
|
|
|
|
133
|
socket my $s, Socket::AF_UNIX(), Socket::SOCK_STREAM(), 0 or do { |
24
|
0
|
|
|
|
|
0
|
die "socket(AF_UNIX, SOCK_STREAM): $!"; |
25
|
|
|
|
|
|
|
}; |
26
|
|
|
|
|
|
|
|
27
|
2
|
|
|
|
|
38
|
return ($s, Socket::pack_sockaddr_un($path), $path); |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
# TODO: Handle TCP addresses. |
31
|
|
|
|
|
|
|
|
32
|
0
|
|
|
|
|
|
die( "Unrecognized path: " . $addr_obj->to_string() ); |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
1; |