Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
T
Tenjin
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Nawasan Wisitsingkhon
Tenjin
Commits
dbafd143
Commit
dbafd143
authored
Aug 04, 2024
by
Nawasan Wisitsingkhon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
clear warning and unused;
parent
35dbe4ad
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
62 additions
and
63 deletions
+62
-63
controller_frame.rs
src/openflow/ofp13/controller_frame.rs
+1
-0
actions.rs
src/openflow/ofp13/events/actions.rs
+0
-0
error_type.rs
src/openflow/ofp13/events/error/error_type.rs
+0
-7
flow_mod_handler.rs
src/openflow/ofp13/events/flow_mod/flow_mod_handler.rs
+2
-2
instructions.rs
src/openflow/ofp13/events/flow_mod/instructions.rs
+14
-14
match_fields.rs
src/openflow/ofp13/events/flow_mod/match_fields.rs
+42
-37
packet_out.rs
src/openflow/ofp13/events/packet_out.rs
+3
-3
No files found.
src/openflow/ofp13/controller_frame.rs
View file @
dbafd143
...
@@ -92,6 +92,7 @@ where
...
@@ -92,6 +92,7 @@ where
fn
echo_request_handler
(
&
self
,
xid
:
u32
,
echo
:
EchoRequestEvent
,
stream
:
&
mut
TcpStream
)
{
fn
echo_request_handler
(
&
self
,
xid
:
u32
,
echo
:
EchoRequestEvent
,
stream
:
&
mut
TcpStream
)
{
self
.send_msg
(
EchoReplyEvent
::
new
(
echo
.payload
),
xid
,
stream
);
self
.send_msg
(
EchoReplyEvent
::
new
(
echo
.payload
),
xid
,
stream
);
}
}
#
[
allow
(
unused
)]
fn
switch_features_handler
(
fn
switch_features_handler
(
&
self
,
&
self
,
xid
:
u32
,
xid
:
u32
,
...
...
src/openflow/ofp13/events/actions.rs
View file @
dbafd143
This diff is collapsed.
Click to expand it.
src/openflow/ofp13/events/error/error_type.rs
View file @
dbafd143
...
@@ -366,10 +366,3 @@ impl TableFeaturesFailed {
...
@@ -366,10 +366,3 @@ impl TableFeaturesFailed {
}
}
}
}
}
}
#[derive(Debug)]
pub
struct
ErrorExperimenter
{
typ
:
u16
,
exp_typ
:
u16
,
experimenter
:
u32
,
}
src/openflow/ofp13/events/flow_mod/flow_mod_handler.rs
View file @
dbafd143
...
@@ -113,8 +113,8 @@ impl MessageMarshal for FlowModEvent {
...
@@ -113,8 +113,8 @@ impl MessageMarshal for FlowModEvent {
self
.flags
.marshal
(
bytes
);
self
.flags
.marshal
(
bytes
);
// padding
// padding
bytes
.write_u16
::
<
BigEndian
>
(
0
);
let
_
=
bytes
.write_u16
::
<
BigEndian
>
(
0
);
self
.match_fields
.marshal
(
bytes
);
let
_
=
self
.match_fields
.marshal
(
bytes
);
self
.instruction
.marshal
(
bytes
);
self
.instruction
.marshal
(
bytes
);
}
}
}
}
src/openflow/ofp13/events/flow_mod/instructions.rs
View file @
dbafd143
...
@@ -20,7 +20,7 @@ pub enum InstructType {
...
@@ -20,7 +20,7 @@ pub enum InstructType {
impl
InstructType
{
impl
InstructType
{
pub
fn
marshal
(
&
self
,
bytes
:
&
mut
Vec
<
u8
>
)
{
pub
fn
marshal
(
&
self
,
bytes
:
&
mut
Vec
<
u8
>
)
{
bytes
.write_u16
::
<
BigEndian
>
(
self
.clone
()
.into
());
let
_
=
bytes
.write_u16
::
<
BigEndian
>
(
self
.clone
()
.into
());
}
}
}
}
...
@@ -49,11 +49,11 @@ impl GotoTable {
...
@@ -49,11 +49,11 @@ impl GotoTable {
impl
InstructTrait
for
GotoTable
{
impl
InstructTrait
for
GotoTable
{
fn
marshal
(
&
self
,
bytes
:
&
mut
Vec
<
u8
>
)
{
fn
marshal
(
&
self
,
bytes
:
&
mut
Vec
<
u8
>
)
{
self
.typ
.marshal
(
bytes
);
self
.typ
.marshal
(
bytes
);
bytes
.write_u16
::
<
BigEndian
>
(
self
.len
);
let
_
=
bytes
.write_u16
::
<
BigEndian
>
(
self
.len
);
bytes
.write_u8
(
self
.table_id
);
let
_
=
bytes
.write_u8
(
self
.table_id
);
// padding
// padding
bytes
.write_u16
::
<
BigEndian
>
(
0
);
let
_
=
bytes
.write_u16
::
<
BigEndian
>
(
0
);
bytes
.write_u8
(
0
);
let
_
=
bytes
.write_u8
(
0
);
}
}
}
}
...
@@ -78,12 +78,12 @@ impl WriteMetadata {
...
@@ -78,12 +78,12 @@ impl WriteMetadata {
impl
InstructTrait
for
WriteMetadata
{
impl
InstructTrait
for
WriteMetadata
{
fn
marshal
(
&
self
,
bytes
:
&
mut
Vec
<
u8
>
)
{
fn
marshal
(
&
self
,
bytes
:
&
mut
Vec
<
u8
>
)
{
self
.typ
.marshal
(
bytes
);
self
.typ
.marshal
(
bytes
);
bytes
.write_u16
::
<
BigEndian
>
(
self
.len
);
let
_
=
bytes
.write_u16
::
<
BigEndian
>
(
self
.len
);
// padding
// padding
bytes
.write_u32
::
<
BigEndian
>
(
0
);
let
_
=
bytes
.write_u32
::
<
BigEndian
>
(
0
);
// *******
// *******
bytes
.write_u64
::
<
BigEndian
>
(
self
.metadata
);
let
_
=
bytes
.write_u64
::
<
BigEndian
>
(
self
.metadata
);
bytes
.write_u64
::
<
BigEndian
>
(
self
.meta_mask
);
let
_
=
bytes
.write_u64
::
<
BigEndian
>
(
self
.meta_mask
);
}
}
}
}
...
@@ -110,12 +110,12 @@ impl InstructTrait for InstructActions {
...
@@ -110,12 +110,12 @@ impl InstructTrait for InstructActions {
fn
marshal
(
&
self
,
bytes
:
&
mut
Vec
<
u8
>
)
{
fn
marshal
(
&
self
,
bytes
:
&
mut
Vec
<
u8
>
)
{
let
mut
builder
=
Vec
::
new
();
let
mut
builder
=
Vec
::
new
();
for
act
in
self
.actions
.iter
()
{
for
act
in
self
.actions
.iter
()
{
act
.marshal
(
&
mut
builder
);
let
_
=
act
.marshal
(
&
mut
builder
);
}
}
self
.typ
.marshal
(
bytes
);
self
.typ
.marshal
(
bytes
);
bytes
.write_u16
::
<
BigEndian
>
(
self
.len
+
(
builder
.len
()
as
u16
));
let
_
=
bytes
.write_u16
::
<
BigEndian
>
(
self
.len
+
(
builder
.len
()
as
u16
));
// padding
// padding
bytes
.write_u32
::
<
BigEndian
>
(
0
);
let
_
=
bytes
.write_u32
::
<
BigEndian
>
(
0
);
bytes
.append
(
&
mut
builder
);
bytes
.append
(
&
mut
builder
);
}
}
}
}
...
@@ -139,8 +139,8 @@ impl InstructMeter {
...
@@ -139,8 +139,8 @@ impl InstructMeter {
impl
InstructTrait
for
InstructMeter
{
impl
InstructTrait
for
InstructMeter
{
fn
marshal
(
&
self
,
bytes
:
&
mut
Vec
<
u8
>
)
{
fn
marshal
(
&
self
,
bytes
:
&
mut
Vec
<
u8
>
)
{
self
.typ
.marshal
(
bytes
);
self
.typ
.marshal
(
bytes
);
bytes
.write_u16
::
<
BigEndian
>
(
self
.len
);
let
_
=
bytes
.write_u16
::
<
BigEndian
>
(
self
.len
);
bytes
.write_u32
::
<
BigEndian
>
(
self
.meter_id
);
let
_
=
bytes
.write_u32
::
<
BigEndian
>
(
self
.meter_id
);
}
}
}
}
...
...
src/openflow/ofp13/events/flow_mod/match_fields.rs
View file @
dbafd143
...
@@ -30,11 +30,13 @@ impl OfpMatch {
...
@@ -30,11 +30,13 @@ impl OfpMatch {
oxm_fields
:
Vec
::
new
(),
oxm_fields
:
Vec
::
new
(),
}
}
}
}
pub
fn
marshal
(
&
self
,
bytes
:
&
mut
Vec
<
u8
>
)
{
pub
fn
marshal
(
&
self
,
bytes
:
&
mut
Vec
<
u8
>
)
->
Result
<
(),
Error
>
{
bytes
.write_u16
::
<
BigEndian
>
(
self
.typ
.clone
()
.into
());
bytes
.write_u16
::
<
BigEndian
>
(
self
.typ
.clone
()
.into
())
?
;
bytes
.write_u16
::
<
BigEndian
>
(
self
.length
+
(
self
.oxm_fields
.len
()
as
u16
));
bytes
.write_u16
::
<
BigEndian
>
(
self
.length
+
(
self
.oxm_fields
.len
()
as
u16
))
?
;
bytes
.append
(
&
mut
self
.oxm_fields
.clone
());
bytes
.append
(
&
mut
self
.oxm_fields
.clone
());
bytes
.write_u32
::
<
BigEndian
>
(
0
);
// padding
bytes
.write_u32
::
<
BigEndian
>
(
0
)
?
;
Ok
(())
}
}
}
}
...
@@ -73,6 +75,7 @@ impl From<MatchType> for u16 {
...
@@ -73,6 +75,7 @@ impl From<MatchType> for u16 {
*
*
*/
*/
#[allow(unused)]
pub
struct
OxmHeader
{
pub
struct
OxmHeader
{
class
:
OxmClass
,
// Match class: member class or reserved class
class
:
OxmClass
,
// Match class: member class or reserved class
field
:
OxmMatchFields
,
// 7bit Match field within the class
field
:
OxmMatchFields
,
// 7bit Match field within the class
...
@@ -91,14 +94,15 @@ impl OxmHeader {
...
@@ -91,14 +94,15 @@ impl OxmHeader {
experimenter
:
None
,
experimenter
:
None
,
}
}
}
}
pub
fn
marshal
(
&
self
,
bytes
:
&
mut
Vec
<
u8
>
)
{
pub
fn
marshal
(
&
self
,
bytes
:
&
mut
Vec
<
u8
>
)
->
Result
<
(),
Error
>
{
bytes
.write_u16
::
<
BigEndian
>
(
self
.class
.clone
()
.into
());
bytes
.write_u16
::
<
BigEndian
>
(
self
.class
.clone
()
.into
())
?
;
let
field
:
u8
=
self
.field
.clone
()
.into
();
let
field
:
u8
=
self
.field
.clone
()
.into
();
bytes
.write_u8
(
field
<<
1
|
if
self
.hasmask
{
1
}
else
{
0
});
bytes
.write_u8
(
field
<<
1
|
if
self
.hasmask
{
1
}
else
{
0
})
?
;
bytes
.write_u8
(
self
.length
);
bytes
.write_u8
(
self
.length
)
?
;
// if let Some(exp) = self.experimenter {
// if let Some(exp) = self.experimenter {
// bytes.write_u32::<BigEndian>(exp);
// bytes.write_u32::<BigEndian>(exp);
// }
// }
Ok
(())
}
}
}
}
...
@@ -221,84 +225,85 @@ impl MatchFields {
...
@@ -221,84 +225,85 @@ impl MatchFields {
udp_dst
:
None
,
udp_dst
:
None
,
}
}
}
}
pub
fn
marshal
(
&
self
,
bytes
:
&
mut
Vec
<
u8
>
)
{
pub
fn
marshal
(
&
self
,
bytes
:
&
mut
Vec
<
u8
>
)
->
Result
<
(),
Error
>
{
let
mut
ofp_match
=
OfpMatch
::
new
();
let
mut
ofp_match
=
OfpMatch
::
new
();
let
ofp_byte
=
ofp_match
.oxm_fields
.as_mut
();
let
ofp_byte
=
ofp_match
.oxm_fields
.as_mut
();
if
let
Some
(
in_port
)
=
&
self
.in_port
{
if
let
Some
(
in_port
)
=
&
self
.in_port
{
let
header
=
OxmHeader
::
new
(
OxmMatchFields
::
InPort
,
4
,
false
);
let
header
=
OxmHeader
::
new
(
OxmMatchFields
::
InPort
,
4
,
false
);
header
.marshal
(
ofp_byte
);
header
.marshal
(
ofp_byte
)
?
;
ofp_byte
.write_u32
::
<
BigEndian
>
(
*
in_port
);
ofp_byte
.write_u32
::
<
BigEndian
>
(
*
in_port
)
?
;
}
}
if
let
Some
(
eth_dst
)
=
&
self
.eth_dst
{
if
let
Some
(
eth_dst
)
=
&
self
.eth_dst
{
let
header
=
OxmHeader
::
new
(
OxmMatchFields
::
EthDst
,
12
,
true
);
let
header
=
OxmHeader
::
new
(
OxmMatchFields
::
EthDst
,
12
,
true
);
header
.marshal
(
ofp_byte
);
header
.marshal
(
ofp_byte
)
?
;
eth_dst
.marshal
(
ofp_byte
);
eth_dst
.marshal
(
ofp_byte
);
// mac mask
// mac mask
MacAddr
::
from
(
!
0
)
.marshal
(
ofp_byte
);
MacAddr
::
from
(
!
0
)
.marshal
(
ofp_byte
);
}
}
if
let
Some
(
eth_src
)
=
&
self
.eth_src
{
if
let
Some
(
eth_src
)
=
&
self
.eth_src
{
let
header
=
OxmHeader
::
new
(
OxmMatchFields
::
EthSrc
,
12
,
true
);
let
header
=
OxmHeader
::
new
(
OxmMatchFields
::
EthSrc
,
12
,
true
);
header
.marshal
(
ofp_byte
);
header
.marshal
(
ofp_byte
)
?
;
eth_src
.marshal
(
ofp_byte
);
eth_src
.marshal
(
ofp_byte
);
// mac mask
// mac mask
MacAddr
::
from
(
!
0
)
.marshal
(
ofp_byte
);
MacAddr
::
from
(
!
0
)
.marshal
(
ofp_byte
);
}
}
if
let
Some
(
eth_typ
)
=
&
self
.eth_typ
{
if
let
Some
(
eth_typ
)
=
&
self
.eth_typ
{
OxmHeader
::
new
(
OxmMatchFields
::
EthType
,
2
,
false
)
.marshal
(
ofp_byte
);
OxmHeader
::
new
(
OxmMatchFields
::
EthType
,
2
,
false
)
.marshal
(
ofp_byte
)
?
;
ofp_byte
.write_u16
::
<
BigEndian
>
(
*
eth_typ
);
ofp_byte
.write_u16
::
<
BigEndian
>
(
*
eth_typ
)
?
;
}
}
if
let
Some
(
ip_proto
)
=
&
self
.ip_proto
{
if
let
Some
(
ip_proto
)
=
&
self
.ip_proto
{
OxmHeader
::
new
(
OxmMatchFields
::
IpProto
,
1
,
false
)
.marshal
(
ofp_byte
);
OxmHeader
::
new
(
OxmMatchFields
::
IpProto
,
1
,
false
)
.marshal
(
ofp_byte
)
?
;
ofp_byte
.write_u8
(
*
ip_proto
);
ofp_byte
.write_u8
(
*
ip_proto
)
?
;
}
}
if
let
Some
(
ipv4_src
)
=
&
self
.ipv4_src
{
if
let
Some
(
ipv4_src
)
=
&
self
.ipv4_src
{
OxmHeader
::
new
(
OxmMatchFields
::
Ipv4Src
,
8
,
true
)
.marshal
(
ofp_byte
);
OxmHeader
::
new
(
OxmMatchFields
::
Ipv4Src
,
8
,
true
)
.marshal
(
ofp_byte
)
?
;
bytes
.write_u32
::
<
BigEndian
>
(
ipv4_src
.clone
()
.into
());
bytes
.write_u32
::
<
BigEndian
>
(
ipv4_src
.clone
()
.into
())
?
;
bytes
.write_u32
::
<
BigEndian
>
(
!
0
);
bytes
.write_u32
::
<
BigEndian
>
(
!
0
)
?
;
}
}
if
let
Some
(
ipv4_dst
)
=
&
self
.ipv4_dst
{
if
let
Some
(
ipv4_dst
)
=
&
self
.ipv4_dst
{
OxmHeader
::
new
(
OxmMatchFields
::
Ipv4Dst
,
8
,
true
)
.marshal
(
ofp_byte
);
OxmHeader
::
new
(
OxmMatchFields
::
Ipv4Dst
,
8
,
true
)
.marshal
(
ofp_byte
)
?
;
bytes
.write_u32
::
<
BigEndian
>
(
ipv4_dst
.clone
()
.into
());
bytes
.write_u32
::
<
BigEndian
>
(
ipv4_dst
.clone
()
.into
())
?
;
bytes
.write_u32
::
<
BigEndian
>
(
!
0
);
bytes
.write_u32
::
<
BigEndian
>
(
!
0
)
?
;
}
}
if
let
Some
(
ipv6_src
)
=
&
self
.ipv6_src
{
if
let
Some
(
ipv6_src
)
=
&
self
.ipv6_src
{
OxmHeader
::
new
(
OxmMatchFields
::
Ipv6Src
,
32
,
true
)
.marshal
(
ofp_byte
);
OxmHeader
::
new
(
OxmMatchFields
::
Ipv6Src
,
32
,
true
)
.marshal
(
ofp_byte
)
?
;
ofp_byte
.write_u128
::
<
BigEndian
>
(
ipv6_src
.clone
()
.into
());
ofp_byte
.write_u128
::
<
BigEndian
>
(
ipv6_src
.clone
()
.into
())
?
;
ofp_byte
.write_u128
::
<
BigEndian
>
(
!
0
);
ofp_byte
.write_u128
::
<
BigEndian
>
(
!
0
)
?
;
}
}
if
let
Some
(
ipv6_dst
)
=
&
self
.ipv6_dst
{
if
let
Some
(
ipv6_dst
)
=
&
self
.ipv6_dst
{
OxmHeader
::
new
(
OxmMatchFields
::
Ipv6Dst
,
32
,
true
)
.marshal
(
ofp_byte
);
OxmHeader
::
new
(
OxmMatchFields
::
Ipv6Dst
,
32
,
true
)
.marshal
(
ofp_byte
)
?
;
ofp_byte
.write_u128
::
<
BigEndian
>
(
ipv6_dst
.clone
()
.into
());
ofp_byte
.write_u128
::
<
BigEndian
>
(
ipv6_dst
.clone
()
.into
())
?
;
ofp_byte
.write_u128
::
<
BigEndian
>
(
!
0
);
ofp_byte
.write_u128
::
<
BigEndian
>
(
!
0
)
?
;
}
}
if
let
Some
(
tcp_src
)
=
&
self
.tcp_src
{
if
let
Some
(
tcp_src
)
=
&
self
.tcp_src
{
OxmHeader
::
new
(
OxmMatchFields
::
TcpSrc
,
2
,
false
);
OxmHeader
::
new
(
OxmMatchFields
::
TcpSrc
,
2
,
false
);
ofp_byte
.write_u16
::
<
BigEndian
>
(
*
tcp_src
);
ofp_byte
.write_u16
::
<
BigEndian
>
(
*
tcp_src
)
?
;
}
}
if
let
Some
(
tcp_dst
)
=
&
self
.tcp_dst
{
if
let
Some
(
tcp_dst
)
=
&
self
.tcp_dst
{
OxmHeader
::
new
(
OxmMatchFields
::
TcpDst
,
2
,
false
);
OxmHeader
::
new
(
OxmMatchFields
::
TcpDst
,
2
,
false
);
ofp_byte
.write_u16
::
<
BigEndian
>
(
*
tcp_dst
);
ofp_byte
.write_u16
::
<
BigEndian
>
(
*
tcp_dst
)
?
;
}
}
if
let
Some
(
udp_src
)
=
&
self
.udp_src
{
if
let
Some
(
udp_src
)
=
&
self
.udp_src
{
OxmHeader
::
new
(
OxmMatchFields
::
UdpSrc
,
2
,
false
);
OxmHeader
::
new
(
OxmMatchFields
::
UdpSrc
,
2
,
false
);
ofp_byte
.write_u16
::
<
BigEndian
>
(
*
udp_src
);
ofp_byte
.write_u16
::
<
BigEndian
>
(
*
udp_src
)
?
;
}
}
if
let
Some
(
udp_dst
)
=
&
self
.udp_dst
{
if
let
Some
(
udp_dst
)
=
&
self
.udp_dst
{
OxmHeader
::
new
(
OxmMatchFields
::
UdpDst
,
2
,
false
);
OxmHeader
::
new
(
OxmMatchFields
::
UdpDst
,
2
,
false
);
ofp_byte
.write_u16
::
<
BigEndian
>
(
*
udp_dst
);
ofp_byte
.write_u16
::
<
BigEndian
>
(
*
udp_dst
)
?
;
}
}
ofp_match
.marshal
(
bytes
);
ofp_match
.marshal
(
bytes
)
?
;
Ok
(())
}
}
pub
fn
parse
(
bytes
:
&
mut
Cursor
<
Vec
<
u8
>>
)
->
Result
<
MatchFields
,
Error
>
{
pub
fn
parse
(
bytes
:
&
mut
Cursor
<
Vec
<
u8
>>
)
->
Result
<
MatchFields
,
Error
>
{
let
mut
matcher
=
MatchFields
::
match_all
();
let
mut
matcher
=
MatchFields
::
match_all
();
let
typ
:
MatchType
=
bytes
.read_u16
::
<
BigEndian
>
()
?
.into
();
let
_
typ
:
MatchType
=
bytes
.read_u16
::
<
BigEndian
>
()
?
.into
();
let
length
=
bytes
.read_u16
::
<
BigEndian
>
()
?
;
let
length
=
bytes
.read_u16
::
<
BigEndian
>
()
?
;
let
mut
pkt_len
=
length
-
4
;
let
mut
pkt_len
=
length
-
4
;
while
pkt_len
>
0
{
while
pkt_len
>
0
{
let
oxm_class
=
bytes
.read_u16
::
<
BigEndian
>
()
?
;
let
_
oxm_class
=
bytes
.read_u16
::
<
BigEndian
>
()
?
;
let
oxm_field
=
bytes
.read_u8
()
?
;
let
oxm_field
=
bytes
.read_u8
()
?
;
let
hash_mask
=
oxm_field
&
1
==
1
;
let
hash_mask
=
oxm_field
&
1
==
1
;
let
oxm_field
:
OxmMatchFields
=
(
oxm_field
>>
1
)
.into
();
let
oxm_field
:
OxmMatchFields
=
(
oxm_field
>>
1
)
.into
();
...
@@ -306,7 +311,7 @@ impl MatchFields {
...
@@ -306,7 +311,7 @@ impl MatchFields {
match
oxm_field
{
match
oxm_field
{
OxmMatchFields
::
InPort
=>
{
OxmMatchFields
::
InPort
=>
{
let
port
=
bytes
.read_u32
::
<
BigEndian
>
()
?
;
let
port
=
bytes
.read_u32
::
<
BigEndian
>
()
?
;
let
mask
=
if
hash_mask
{
let
_
mask
=
if
hash_mask
{
Some
(
bytes
.read_u32
::
<
BigEndian
>
())
Some
(
bytes
.read_u32
::
<
BigEndian
>
())
}
else
{
}
else
{
None
None
...
...
src/openflow/ofp13/events/packet_out.rs
View file @
dbafd143
...
@@ -29,12 +29,12 @@ impl MessageMarshal for PacketOutEvent {
...
@@ -29,12 +29,12 @@ impl MessageMarshal for PacketOutEvent {
}
}
let
mut
action_byte
:
Vec
<
u8
>
=
Vec
::
new
();
let
mut
action_byte
:
Vec
<
u8
>
=
Vec
::
new
();
for
act
in
self
.actions
.iter
()
{
for
act
in
self
.actions
.iter
()
{
act
.marshal
(
&
mut
action_byte
);
let
_
=
act
.marshal
(
&
mut
action_byte
);
}
}
let
_
=
bytes
.write_u16
::
<
BigEndian
>
(
action_byte
.len
()
as
u16
);
let
_
=
bytes
.write_u16
::
<
BigEndian
>
(
action_byte
.len
()
as
u16
);
// padding 48 bit
// padding 48 bit
bytes
.write_u32
::
<
BigEndian
>
(
0
);
let
_
=
bytes
.write_u32
::
<
BigEndian
>
(
0
);
bytes
.write_u16
::
<
BigEndian
>
(
0
);
let
_
=
bytes
.write_u16
::
<
BigEndian
>
(
0
);
bytes
.append
(
&
mut
action_byte
);
bytes
.append
(
&
mut
action_byte
);
self
.payload
.marshal
(
bytes
);
self
.payload
.marshal
(
bytes
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment