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