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
c5a87ff1
Commit
c5a87ff1
authored
Jul 26, 2024
by
Nawasan Wisitsingkhon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add features_reply event
parent
46111381
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
76 additions
and
2 deletions
+76
-2
controller_frame.rs
src/openflow/ofp13/controller_frame.rs
+2
-0
features_reply.rs
src/openflow/ofp13/events/features_reply.rs
+69
-0
mod.rs
src/openflow/ofp13/events/mod.rs
+3
-0
mod.rs
src/openflow/ofp13/mod.rs
+2
-2
No files found.
src/openflow/ofp13/controller_frame.rs
View file @
c5a87ff1
...
...
@@ -55,6 +55,7 @@ where
Msg
::
EchoRequest
=>
{
self
.echo_request_handler
(
xid
,
EchoRequestEvent
::
new
(
payload
),
stream
)
}
Msg
::
FeaturesReply
=>
{}
Msg
::
PacketIn
=>
match
PacketInEvent
::
parse
(
&
payload
)
{
Ok
(
pkt_in
)
=>
self
.packet_in_handler
(
xid
,
pkt_in
,
stream
),
Err
(
_
)
=>
(),
...
...
@@ -87,4 +88,5 @@ where
fn
echo_request_handler
(
&
self
,
xid
:
u32
,
echo
:
EchoRequestEvent
,
stream
:
&
mut
TcpStream
)
{
self
.send_msg
(
EchoReplyEvent
::
new
(
echo
.payload
),
xid
,
stream
);
}
fn
switch_features_handler
(
&
self
)
{}
}
src/openflow/ofp13/events/features_reply.rs
0 → 100644
View file @
c5a87ff1
use
std
::
io
::{
Cursor
,
Error
};
use
byteorder
::{
BigEndian
,
ReadBytesExt
};
pub
struct
FeaturesReplyEvent
{
pub
datapath_id
:
u64
,
pub
n_buffers
:
u32
,
pub
n_tables
:
u8
,
pub
auxiliary
:
u8
,
// pad 16 bit
pub
capabilities
:
Capabilities
,
pub
reserved
:
u32
,
}
impl
FeaturesReplyEvent
{
pub
fn
parse
(
bytes
:
&
mut
Vec
<
u8
>
)
->
Result
<
Self
,
Error
>
{
let
mut
bytes
=
Cursor
::
new
(
bytes
);
let
datapath_id
=
bytes
.read_u64
::
<
BigEndian
>
()
?
;
let
n_buffers
=
bytes
.read_u32
::
<
BigEndian
>
()
?
;
let
n_tables
=
bytes
.read_u8
()
?
;
let
auxiliary
=
bytes
.read_u8
()
?
;
let
capabilities
:
Capabilities
=
bytes
.read_u32
::
<
BigEndian
>
()
?
.into
();
let
reserved
=
bytes
.read_u32
::
<
BigEndian
>
()
?
;
Ok
(
Self
{
datapath_id
,
n_buffers
,
n_tables
,
auxiliary
,
capabilities
,
reserved
,
})
}
}
pub
struct
Capabilities
{
pub
flow_stats
:
bool
,
pub
table_stats
:
bool
,
pub
port_stats
:
bool
,
pub
group_stats
:
bool
,
pub
ip_reasm
:
bool
,
pub
queue_stats
:
bool
,
pub
port_blocked
:
bool
,
}
impl
From
<
u32
>
for
Capabilities
{
fn
from
(
value
:
u32
)
->
Self
{
Self
{
flow_stats
:
value
&
1
==
1
,
table_stats
:
value
>>
1
&
1
==
1
,
port_stats
:
value
>>
2
&
1
==
1
,
group_stats
:
value
>>
3
&
1
==
1
,
ip_reasm
:
value
>>
5
&
1
==
1
,
queue_stats
:
value
>>
6
&
1
==
1
,
port_blocked
:
value
>>
8
&
1
==
1
,
}
}
}
impl
From
<
Capabilities
>
for
u32
{
fn
from
(
value
:
Capabilities
)
->
Self
{
(
value
.flow_stats
as
u32
)
|
((
value
.table_stats
as
u32
)
<<
1
)
|
(
value
.port_stats
as
u32
)
<<
2
|
(
value
.group_stats
as
u32
)
<<
3
|
(
value
.ip_reasm
as
u32
)
<<
5
|
(
value
.queue_stats
as
u32
)
<<
6
|
(
value
.port_blocked
as
u32
)
<<
8
}
}
src/openflow/ofp13/events/mod.rs
View file @
c5a87ff1
...
...
@@ -19,6 +19,9 @@ pub use hello::HelloEvent;
pub
mod
features_req
;
pub
use
features_req
::
FeaturesReqEvent
;
pub
mod
features_reply
;
pub
use
features_reply
::
FeaturesReplyEvent
;
pub
mod
payload
;
pub
use
payload
::
Payload
;
...
...
src/openflow/ofp13/mod.rs
View file @
c5a87ff1
...
...
@@ -6,8 +6,8 @@ pub use ofp_port::PseudoPort;
pub
mod
events
;
pub
use
events
::{
Action
,
EchoReplyEvent
,
EchoRequestEvent
,
ErrorEvent
,
F
lowModEvent
,
HelloEvent
,
MatchFields
,
PacketInEvent
,
PacketOutEvent
,
Action
,
EchoReplyEvent
,
EchoRequestEvent
,
ErrorEvent
,
F
eaturesReplyEvent
,
FlowModEvent
,
HelloEvent
,
MatchFields
,
PacketInEvent
,
PacketOutEvent
,
};
pub
mod
ofp_header
;
...
...
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