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
a048d1ba
Commit
a048d1ba
authored
Jun 14, 2024
by
Nawasan Wisitsingkhon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
flowmod: change to add flags
parent
53c50a2e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
56 additions
and
13 deletions
+56
-13
flow_mod_flags.rs
src/openflow/ofp10/events/flow_mod/flow_mod_flags.rs
+47
-0
flow_mod_handler.rs
src/openflow/ofp10/events/flow_mod/flow_mod_handler.rs
+5
-11
mod.rs
src/openflow/ofp10/events/flow_mod/mod.rs
+4
-2
No files found.
src/openflow/ofp10/events/flow_mod/flow_mod_flags.rs
0 → 100644
View file @
a048d1ba
use
byteorder
::{
BigEndian
,
WriteBytesExt
};
pub
struct
FlowModFlags
{
pub
send_flow_rem
:
bool
,
pub
check_overlap
:
bool
,
pub
emerg
:
bool
,
}
impl
FlowModFlags
{
pub
fn
new
(
send_flow_rem
:
bool
,
check_overlap
:
bool
,
emerg
:
bool
)
->
Self
{
Self
{
send_flow_rem
,
check_overlap
,
emerg
,
}
}
pub
fn
all_false
()
->
Self
{
Self
{
check_overlap
:
false
,
emerg
:
false
,
send_flow_rem
:
false
,
}
}
pub
fn
parse
(
byte
:
u16
)
->
Self
{
let
send_flow_rem
=
byte
>>
0
&
1
!=
0
;
let
check_overlap
=
byte
>>
1
&
1
!=
0
;
let
emerg
=
byte
>>
2
&
1
!=
0
;
Self
{
send_flow_rem
,
check_overlap
,
emerg
,
}
}
pub
fn
marshal
(
&
self
,
bytes
:
&
mut
Vec
<
u8
>
)
{
let
mut
value
=
0u16
;
if
self
.send_flow_rem
{
value
|
=
1
<<
0
;
}
if
self
.check_overlap
{
value
|
=
1
<<
1
;
}
if
self
.emerg
{
value
|
=
1
<<
2
;
}
let
_
=
bytes
.write_u16
::
<
BigEndian
>
(
value
);
}
}
src/openflow/ofp10/events/flow_mod/flow_mod_handler.rs
View file @
a048d1ba
...
@@ -8,7 +8,7 @@ use crate::openflow::ofp10::{
...
@@ -8,7 +8,7 @@ use crate::openflow::ofp10::{
MessageMarshal
,
Msg
,
OfpMsgEvent
,
PseudoPort
,
MessageMarshal
,
Msg
,
OfpMsgEvent
,
PseudoPort
,
};
};
use
super
::{
FlowModCommand
,
MatchFields
};
use
super
::{
FlowModCommand
,
FlowModFlags
,
MatchFields
};
pub
enum
Timeout
{
pub
enum
Timeout
{
Permanent
,
Permanent
,
...
@@ -37,10 +37,9 @@ pub struct FlowModEvent {
...
@@ -37,10 +37,9 @@ pub struct FlowModEvent {
cookie
:
u64
,
cookie
:
u64
,
idle_timeout
:
Timeout
,
idle_timeout
:
Timeout
,
hard_timeout
:
Timeout
,
hard_timeout
:
Timeout
,
notify_when_removed
:
bool
,
flags
:
FlowModFlags
,
buffer_id
:
Option
<
u32
>
,
buffer_id
:
Option
<
u32
>
,
out_port
:
Option
<
PseudoPort
>
,
out_port
:
Option
<
PseudoPort
>
,
check_overlap
:
bool
,
}
}
impl
FlowModEvent
{
impl
FlowModEvent
{
...
@@ -58,10 +57,9 @@ impl FlowModEvent {
...
@@ -58,10 +57,9 @@ impl FlowModEvent {
cookie
:
0
,
cookie
:
0
,
idle_timeout
:
Timeout
::
Permanent
,
idle_timeout
:
Timeout
::
Permanent
,
hard_timeout
:
Timeout
::
Permanent
,
hard_timeout
:
Timeout
::
Permanent
,
notify_when_removed
:
false
,
flags
:
FlowModFlags
::
all_false
()
,
buffer_id
,
buffer_id
,
out_port
:
None
,
out_port
:
None
,
check_overlap
:
false
,
}
}
}
}
...
@@ -85,7 +83,7 @@ impl FlowModEvent {
...
@@ -85,7 +83,7 @@ impl FlowModEvent {
priority
,
priority
,
idle_timeout
,
idle_timeout
,
hard_timeout
,
hard_timeout
,
notify_when_removed
:
flags
&
1
!=
0
,
flags
:
FlowModFlags
::
parse
(
flags
)
,
buffer_id
:
{
buffer_id
:
{
match
buffer_id
{
match
buffer_id
{
-
1
=>
None
,
-
1
=>
None
,
...
@@ -93,7 +91,6 @@ impl FlowModEvent {
...
@@ -93,7 +91,6 @@ impl FlowModEvent {
}
}
},
},
out_port
,
out_port
,
check_overlap
:
flags
&
2
!=
0
,
}
}
}
}
}
}
...
@@ -123,10 +120,7 @@ impl MessageMarshal for FlowModEvent {
...
@@ -123,10 +120,7 @@ impl MessageMarshal for FlowModEvent {
None
=>
bytes
.write_u16
::
<
BigEndian
>
(
OfpPort
::
None
as
u16
)
.unwrap
(),
None
=>
bytes
.write_u16
::
<
BigEndian
>
(
OfpPort
::
None
as
u16
)
.unwrap
(),
Some
(
p
)
=>
p
.marshal
(
bytes
),
Some
(
p
)
=>
p
.marshal
(
bytes
),
}
}
let
_
=
bytes
.write_u16
::
<
BigEndian
>
(
self
.flags
.marshal
(
bytes
);
(
if
self
.check_overlap
{
1
<<
1
}
else
{
0
})
|
(
if
self
.notify_when_removed
{
1
<<
0
}
else
{
0
}),
);
for
act
in
self
.actions
.move_controller_last
()
{
for
act
in
self
.actions
.move_controller_last
()
{
match
act
{
match
act
{
Action
::
Oputput
(
PseudoPort
::
Table
)
=>
{
Action
::
Oputput
(
PseudoPort
::
Table
)
=>
{
...
...
src/openflow/ofp10/events/flow_mod/mod.rs
View file @
a048d1ba
...
@@ -4,7 +4,8 @@ pub use flow_mod_handler::FlowModEvent;
...
@@ -4,7 +4,8 @@ pub use flow_mod_handler::FlowModEvent;
pub
mod
command
;
pub
mod
command
;
pub
use
command
::
FlowModCommand
;
pub
use
command
::
FlowModCommand
;
pub
mod
match_fields
;
pub
mod
match_fields
;
pub
use
match_fields
::{
Mask
,
MatchFields
};
pub
use
match_fields
::{
Mask
,
MatchFields
};
pub
mod
flow_mod_flags
;
pub
use
flow_mod_flags
::
FlowModFlags
;
\ No newline at end of file
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