line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::WebSocket::Constants; |
2
|
|
|
|
|
|
|
|
3
|
9
|
|
|
9
|
|
70
|
use strict; |
|
9
|
|
|
|
|
23
|
|
|
9
|
|
|
|
|
284
|
|
4
|
9
|
|
|
9
|
|
57
|
use warnings; |
|
9
|
|
|
|
|
23
|
|
|
9
|
|
|
|
|
416
|
|
5
|
|
|
|
|
|
|
|
6
|
9
|
|
|
|
|
879
|
use constant OPCODE => { |
7
|
|
|
|
|
|
|
continuation => 0, |
8
|
|
|
|
|
|
|
text => 1, |
9
|
|
|
|
|
|
|
binary => 2, |
10
|
|
|
|
|
|
|
close => 8, |
11
|
|
|
|
|
|
|
ping => 9, |
12
|
|
|
|
|
|
|
pong => 10, |
13
|
9
|
|
|
9
|
|
62
|
}; |
|
9
|
|
|
|
|
22
|
|
14
|
|
|
|
|
|
|
|
15
|
9
|
|
|
9
|
|
69
|
use constant PROTOCOL_VERSION => 13; |
|
9
|
|
|
|
|
20
|
|
|
9
|
|
|
|
|
767
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
#These names are taken from: |
18
|
|
|
|
|
|
|
#https://msdn.microsoft.com/en-us/library/windows/desktop/hh449350(v=vs.85).aspx |
19
|
9
|
|
|
|
|
2013
|
use constant STATUS => { |
20
|
|
|
|
|
|
|
SUCCESS => 1000, |
21
|
|
|
|
|
|
|
ENDPOINT_UNAVAILABLE => 1001, |
22
|
|
|
|
|
|
|
PROTOCOL_ERROR => 1002, |
23
|
|
|
|
|
|
|
INVALID_DATA_TYPE => 1003, |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
#These are never actually sent. |
26
|
|
|
|
|
|
|
#EMPTY_CLOSE => 1005, |
27
|
|
|
|
|
|
|
#ABORTED_CLOSE => 1006, |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
INVALID_PAYLOAD => 1007, |
30
|
|
|
|
|
|
|
POLICY_VIOLATION => 1008, |
31
|
|
|
|
|
|
|
MESSAGE_TOO_BIG => 1009, |
32
|
|
|
|
|
|
|
UNSUPPORTED_EXTENSIONS => 1010, |
33
|
|
|
|
|
|
|
SERVER_ERROR => 1011, |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
#RFC says not to use this one, |
36
|
|
|
|
|
|
|
#but MS has it in their enum. |
37
|
|
|
|
|
|
|
#SECURE_HANDSHAKE_ERROR => 1015, |
38
|
9
|
|
|
9
|
|
71
|
}; |
|
9
|
|
|
|
|
28
|
|
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
#---------------------------------------------------------------------- |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
my %status_code_name; |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub status_name_to_code { |
45
|
0
|
|
|
0
|
0
|
|
my ($name) = @_; |
46
|
|
|
|
|
|
|
|
47
|
0
|
|
|
|
|
|
return STATUS()->{$name}; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub status_code_to_name { |
51
|
0
|
|
|
0
|
0
|
|
my ($code) = @_; |
52
|
|
|
|
|
|
|
|
53
|
0
|
0
|
|
|
|
|
%status_code_name = reverse %{ STATUS() } if !%status_code_name; |
|
0
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
|
55
|
0
|
|
|
|
|
|
return $status_code_name{$code}; |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
#---------------------------------------------------------------------- |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
my %opcode_type; |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
sub opcode_to_type { |
63
|
0
|
|
|
0
|
0
|
|
my ($opcode) = @_; |
64
|
|
|
|
|
|
|
|
65
|
0
|
0
|
|
|
|
|
%opcode_type = reverse %{ OPCODE() } if !%opcode_type; |
|
0
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
|
67
|
0
|
|
|
|
|
|
return $opcode_type{$opcode}; |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
1; |