line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package TunTap; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
12962
|
use 5.010001; |
|
1
|
|
|
|
|
2
|
|
4
|
1
|
|
|
1
|
|
3
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
20
|
|
5
|
1
|
|
|
1
|
|
3
|
use warnings; |
|
1
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
105
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
require Exporter; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our @ISA = qw(Exporter); |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
# Items to export into callers namespace by default. Note: do not export |
12
|
|
|
|
|
|
|
# names by default without a very good reason. Use EXPORT_OK instead. |
13
|
|
|
|
|
|
|
# Do not simply export all your public functions/methods/constants. |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
# This allows declaration use TunTap ':all'; |
16
|
|
|
|
|
|
|
# If you do not need this, moving things directly into @EXPORT or @EXPORT_OK |
17
|
|
|
|
|
|
|
# will save memory. |
18
|
|
|
|
|
|
|
our %EXPORT_TAGS = ( 'all' => [ qw( |
19
|
|
|
|
|
|
|
IFF_TUN |
20
|
|
|
|
|
|
|
IFF_TAP |
21
|
|
|
|
|
|
|
IFF_NO_PI |
22
|
|
|
|
|
|
|
TUN_READQ_SIZE |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
TUN_TUN_DEV |
25
|
|
|
|
|
|
|
TUN_TAP_DEV |
26
|
|
|
|
|
|
|
TUN_TYPE_MASK |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
TUN_FASYN |
29
|
|
|
|
|
|
|
TUN_NOCHECKSUM |
30
|
|
|
|
|
|
|
TUN_NO_PI |
31
|
|
|
|
|
|
|
TUN_ONE_QUEUE |
32
|
|
|
|
|
|
|
TUN_PERSIST |
33
|
|
|
|
|
|
|
TUN_VNET_HDR |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
tun_alloc |
36
|
|
|
|
|
|
|
) ] ); |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
our @EXPORT = qw( |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
); |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
our $VERSION = '0.02'; |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
require XSLoader; |
47
|
|
|
|
|
|
|
XSLoader::load('TunTap', $VERSION); |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
# Preloaded methods go here. |
50
|
|
|
|
|
|
|
# |
51
|
1
|
|
|
1
|
|
3
|
use constant IFF_TUN => 0x0001; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
62
|
|
52
|
1
|
|
|
1
|
|
4
|
use constant IFF_TAP => 0x0002; |
|
1
|
|
|
|
|
0
|
|
|
1
|
|
|
|
|
37
|
|
53
|
1
|
|
|
1
|
|
3
|
use constant IFF_NO_PI => 0x1000; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
35
|
|
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
# Read queue size |
57
|
1
|
|
|
1
|
|
3
|
use constant TUN_READQ_SIZE => 500; |
|
1
|
|
|
|
|
0
|
|
|
1
|
|
|
|
|
36
|
|
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
# TUN device flags |
60
|
1
|
|
|
1
|
|
3
|
use constant TUN_TUN_DEV => 0x0001; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
35
|
|
61
|
1
|
|
|
1
|
|
3
|
use constant TUN_TAP_DEV => 0x0002; |
|
1
|
|
|
|
|
0
|
|
|
1
|
|
|
|
|
35
|
|
62
|
1
|
|
|
1
|
|
3
|
use constant TUN_TYPE_MASK => 0x000f; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
32
|
|
63
|
|
|
|
|
|
|
|
64
|
1
|
|
|
1
|
|
3
|
use constant TUN_FASYNC => 0x0010; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
28
|
|
65
|
1
|
|
|
1
|
|
3
|
use constant TUN_NOCHECKSUM => 0x0020; |
|
1
|
|
|
|
|
0
|
|
|
1
|
|
|
|
|
31
|
|
66
|
1
|
|
|
1
|
|
3
|
use constant TUN_NO_PI => 0x0040; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
28
|
|
67
|
1
|
|
|
1
|
|
10
|
use constant TUN_ONE_QUEUE => 0x0080; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
29
|
|
68
|
1
|
|
|
1
|
|
3
|
use constant TUN_PERSIST => 0x0100; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
30
|
|
69
|
1
|
|
|
1
|
|
2
|
use constant TUN_VNET_HDR => 0x0200; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
43
|
|
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
1; |
72
|
|
|
|
|
|
|
__END__ |