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
ecaef6a6
Commit
ecaef6a6
authored
Jun 15, 2024
by
Nawasan Wisitsingkhon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
write all messages and change method to convet u8 to Msg
parent
0c981725
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
16 deletions
+28
-16
controller_frame.rs
src/openflow/ofp10/controller_frame.rs
+2
-2
features_req.rs
src/openflow/ofp10/events/features_req.rs
+2
-2
message.rs
src/openflow/ofp10/message.rs
+23
-11
ofp_manager.rs
src/openflow/ofp10/ofp_manager.rs
+1
-1
No files found.
src/openflow/ofp10/controller_frame.rs
View file @
ecaef6a6
...
@@ -39,13 +39,13 @@ pub trait ControllerFrame10 {
...
@@ -39,13 +39,13 @@ pub trait ControllerFrame10 {
println!
(
"Error {:?}"
,
error
.error_type
);
println!
(
"Error {:?}"
,
error
.error_type
);
()
()
}
}
Msg
::
FeaturesReq
=>
(),
Msg
::
FeaturesReq
uest
=>
(),
Msg
::
PacketIn
=>
{
Msg
::
PacketIn
=>
{
self
.packet_in_handler
(
xid
,
PacketInEvent
::
parse
(
&
payload
),
stream
);
self
.packet_in_handler
(
xid
,
PacketInEvent
::
parse
(
&
payload
),
stream
);
}
}
Msg
::
PacketOut
=>
(),
Msg
::
PacketOut
=>
(),
Msg
::
FlowMod
=>
(),
Msg
::
FlowMod
=>
(),
Msg
::
NotFound
=>
(),
_
=>
(),
}
}
}
}
...
...
src/openflow/ofp10/events/features_req.rs
View file @
ecaef6a6
...
@@ -12,7 +12,7 @@ impl MessageMarshal for FeaturesReqEvent {
...
@@ -12,7 +12,7 @@ impl MessageMarshal for FeaturesReqEvent {
fn
marshal
(
&
self
,
_
:
&
mut
Vec
<
u8
>
)
{}
fn
marshal
(
&
self
,
_
:
&
mut
Vec
<
u8
>
)
{}
fn
msg_code
(
&
self
)
->
Msg
{
fn
msg_code
(
&
self
)
->
Msg
{
Msg
::
FeaturesReq
Msg
::
FeaturesReq
uest
}
}
fn
size_of
(
&
self
)
->
usize
{
fn
size_of
(
&
self
)
->
usize
{
...
@@ -20,6 +20,6 @@ impl MessageMarshal for FeaturesReqEvent {
...
@@ -20,6 +20,6 @@ impl MessageMarshal for FeaturesReqEvent {
}
}
fn
msg_usize
<
OFP
:
OfpMsgEvent
>
(
&
self
,
ofp
:
&
OFP
)
->
usize
{
fn
msg_usize
<
OFP
:
OfpMsgEvent
>
(
&
self
,
ofp
:
&
OFP
)
->
usize
{
ofp
.msg_usize
(
Msg
::
FeaturesReq
)
ofp
.msg_usize
(
Msg
::
FeaturesReq
uest
)
}
}
}
}
src/openflow/ofp10/message.rs
View file @
ecaef6a6
use
std
::
mem
::
transmute
;
#[derive(Clone)]
#[derive(Clone)]
pub
enum
Msg
{
pub
enum
Msg
{
Hello
=
0
,
Hello
=
0
,
Error
=
1
,
Error
=
1
,
FeaturesReq
=
5
,
EchoRequest
=
2
,
EchoReply
=
3
,
Vendor
=
4
,
FeaturesRequest
=
5
,
FeaturesReply
=
6
,
ConfigRequest
=
7
,
ConfigReply
=
8
,
SetConfig
=
9
,
PacketIn
=
10
,
PacketIn
=
10
,
FlowRemove
=
11
,
PortStatus
=
12
,
PacketOut
=
13
,
PacketOut
=
13
,
FlowMod
=
14
,
FlowMod
=
14
,
PortMod
=
15
,
StatsRequest
=
16
,
StateReply
=
17
,
BarrierRequest
=
18
,
BarrierReply
=
19
,
QueueGetConfigRequest
=
20
,
QueueGetConfigReply
=
21
,
NotFound
=
0xff
,
NotFound
=
0xff
,
}
}
...
@@ -13,16 +31,10 @@ impl Msg {
...
@@ -13,16 +31,10 @@ impl Msg {
pub
fn
to_int
(
&
self
)
->
u8
{
pub
fn
to_int
(
&
self
)
->
u8
{
self
.clone
()
as
u8
self
.clone
()
as
u8
}
}
pub
fn
parse
(
msg_code
:
u8
)
->
Self
{
pub
fn
from
(
msg_code
:
u8
)
->
Self
{
type
ConvTyp
=
u8
;
if
msg_code
>
21
{
match
msg_code
{
return
Self
::
NotFound
;
m
if
m
==
(
Self
::
Hello
as
ConvTyp
)
=>
Self
::
Hello
,
m
if
m
==
(
Self
::
Error
as
ConvTyp
)
=>
Self
::
Error
,
m
if
m
==
(
Self
::
FeaturesReq
as
ConvTyp
)
=>
Self
::
FeaturesReq
,
m
if
m
==
(
Self
::
PacketIn
as
ConvTyp
)
=>
Self
::
PacketIn
,
m
if
m
==
(
Self
::
PacketOut
as
ConvTyp
)
=>
Self
::
PacketOut
,
m
if
m
==
(
Self
::
FlowMod
as
ConvTyp
)
=>
Self
::
FlowMod
,
_
=>
Self
::
NotFound
,
}
}
unsafe
{
transmute
::
<
u8
,
Msg
>
(
msg_code
)
}
}
}
}
}
src/openflow/ofp10/ofp_manager.rs
View file @
ecaef6a6
...
@@ -46,7 +46,7 @@ impl OfpMsgEvent for Openflow10 {
...
@@ -46,7 +46,7 @@ impl OfpMsgEvent for Openflow10 {
}
}
fn
msg_parse
(
&
self
,
msg
:
u8
)
->
Msg
{
fn
msg_parse
(
&
self
,
msg
:
u8
)
->
Msg
{
Msg
::
parse
(
msg
)
Msg
::
from
(
msg
)
}
}
fn
msg_usize
(
&
self
,
msg
:
Msg
)
->
usize
{
fn
msg_usize
(
&
self
,
msg
:
Msg
)
->
usize
{
...
...
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