Handbook
Glossary
parse-message ( bytes -- message/f )
Vocabulary
bittorrent
Inputs
bytes
an
object
Outputs
message/f
an
object
Definition
USING:
combinators
endian
kernel
sequences
;
IN:
bittorrent
:
parse-message
( bytes -- message/f )
unclip
{
{
0
[
drop
choke
boa
]
}
{
1
[
drop
unchoke
boa
]
}
{
2
[
drop
interested
boa
]
}
{
3
[
drop
not-interested
boa
]
}
{
4
[
4
head
be>
have
boa
]
}
{
5
[
bitfield
boa
]
}
{
6
[
4
cut
4
cut
4
head
[
be>
]
tri@
request
boa
]
}
{
7
[
4
cut
4
cut
[
[
be>
]
bi@
]
dip
piece
boa
]
}
{
8
[
4
cut
4
cut
4
head
[
be>
]
tri@
cancel
boa
]
}
{
9
[
be>
port
boa
]
}
{
13
[
4
head
be>
suggest-piece
boa
]
}
{
14
[
drop
have-all
boa
]
}
{
15
[
drop
have-none
boa
]
}
{
16
[
4
cut
4
cut
4
head
[
be>
]
tri@
reject-request
boa
]
}
{
17
[
4
head
be>
allowed-fast
boa
]
}
{
20
[
unclip
swap
extended
boa
]
}
[
swap
unknown
boa
]
}
case
;