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
e17a2926
Commit
e17a2926
authored
Jun 14, 2024
by
Nawasan Wisitsingkhon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
change ofp_header to one file
parent
960dd6a2
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
14 additions
and
53 deletions
+14
-53
controller_frame.rs
src/openflow/ofp10/controller_frame.rs
+1
-1
ofp_header.rs
src/openflow/ofp10/ofp_header.rs
+5
-5
mod.rs
src/openflow/ofp10/ofp_header/mod.rs
+0
-5
ofp_header.rs
src/openflow/ofp10/ofp_header/ofp_header.rs
+0
-32
ofp_manager.rs
src/openflow/ofp10/ofp_manager.rs
+5
-5
event_trait.rs
src/openflow/ofp10/traiter/event_trait.rs
+2
-4
headers.rs
tests/headers.rs
+1
-1
No files found.
src/openflow/ofp10/controller_frame.rs
View file @
e17a2926
...
...
@@ -4,7 +4,7 @@ use std::{
net
::
TcpStream
,
};
use
super
::{
tcp_listener_handler
,
MessageMarshal
,
OfpMsgEvent
};
use
super
::{
tcp_listener_handler
,
MessageMarshal
,
OfpMsgEvent
,
OpenflowHeader
};
pub
trait
ControllerFrame10
{
fn
get_ofp
(
&
self
)
->
&
impl
OfpMsgEvent
;
...
...
src/openflow/ofp10/ofp_header
/ofp_header_v1_0
.rs
→
src/openflow/ofp10/ofp_header.rs
View file @
e17a2926
...
...
@@ -3,19 +3,19 @@ use std::{io::Cursor, mem::size_of};
use
crate
::
openflow
::
ofp10
::
OpenflowHeader
;
pub
struct
OfpHeader
10
{
pub
struct
OfpHeader
{
pub
version
:
u8
,
pub
message
:
u8
,
pub
length
:
u16
,
pub
xid
:
u32
,
}
impl
OpenflowHeader
for
OfpHeader
10
{
impl
OpenflowHeader
for
OfpHeader
{
fn
new
(
message
:
u8
,
length
:
usize
,
xid
:
usize
)
->
Self
{
Self
{
version
:
1
,
message
,
length
:
(
size_of
::
<
OfpHeader
10
>
()
+
length
)
as
u16
,
length
:
(
size_of
::
<
OfpHeader
>
()
+
length
)
as
u16
,
xid
:
xid
as
u32
,
}
}
...
...
@@ -32,10 +32,10 @@ impl OpenflowHeader for OfpHeader10 {
self
.xid
}
fn
header_size
(
&
self
)
->
usize
{
size_of
::
<
OfpHeader10
>
()
size_of
::
<
Self
>
()
}
fn
pkt_size
(
&
self
)
->
usize
{
return
self
.length
as
usize
-
size_of
::
<
OfpHeader10
>
();
return
self
.length
as
usize
-
size_of
::
<
Self
>
();
}
fn
parse
(
buf
:
&
Vec
<
u8
>
)
->
Self
{
...
...
src/openflow/ofp10/ofp_header/mod.rs
deleted
100644 → 0
View file @
960dd6a2
pub
mod
ofp_header
;
pub
use
ofp_header
::
OfpHeader
;
pub
mod
ofp_header_v1_0
;
pub
use
ofp_header_v1_0
::
OfpHeader10
;
src/openflow/ofp10/ofp_header/ofp_header.rs
deleted
100644 → 0
View file @
960dd6a2
use
crate
::
openflow
::
ofp10
::
OpenflowHeader
;
pub
struct
OfpHeader
<
OFH
:
OpenflowHeader
>
{
ofp_header
:
OFH
,
}
impl
<
OFH
:
OpenflowHeader
>
OfpHeader
<
OFH
>
{
pub
fn
new
(
ofp_header
:
OFH
)
->
Self
{
Self
{
ofp_header
}
}
pub
fn
version
(
&
self
)
->
usize
{
self
.ofp_header
.version
()
}
pub
fn
message
(
&
self
)
->
u8
{
self
.ofp_header
.message
()
}
pub
fn
length
(
&
self
)
->
usize
{
self
.ofp_header
.length
()
}
pub
fn
xid
(
&
self
)
->
u32
{
self
.ofp_header
.xid
()
}
pub
fn
header_size
(
&
self
)
->
usize
{
self
.ofp_header
.header_size
()
}
pub
fn
pkt_size
(
&
self
)
->
usize
{
self
.ofp_header
.pkt_size
()
}
pub
fn
marshal
(
&
self
,
bytes
:
&
mut
Vec
<
u8
>
)
{
self
.ofp_header
.marshal
(
bytes
);
}
}
src/openflow/ofp10/ofp_manager.rs
View file @
e17a2926
use
super
::{
events
::{
Action
,
FeaturesReqEvent
,
Payload
},
ofp_header
::
{
OfpHeader
,
OfpHeader10
}
,
ofp_header
::
OfpHeader
,
HelloEvent
,
Msg
,
OfpMsgEvent
,
OpenflowHeader
,
PacketOutEvent
,
};
...
...
@@ -13,8 +13,8 @@ impl Openflow10 {
}
impl
OfpMsgEvent
for
Openflow10
{
fn
header_parse
(
&
self
,
bytes
:
&
Vec
<
u8
>
)
->
OfpHeader
<
impl
OpenflowHeader
>
{
OfpHeader
::
new
(
OfpHeader10
::
parse
(
bytes
)
)
fn
header_parse
(
&
self
,
bytes
:
&
Vec
<
u8
>
)
->
OfpHeader
{
OfpHeader
::
parse
(
bytes
)
}
fn
header_size
(
&
self
)
->
usize
{
8
...
...
@@ -41,8 +41,8 @@ impl OfpMsgEvent for Openflow10 {
1
}
fn
header
(
&
self
,
message
:
u8
,
length
:
u16
,
xid
:
u32
)
->
OfpHeader
<
impl
OpenflowHeader
>
{
OfpHeader
::
new
(
OfpHeader10
::
new
(
message
,
length
as
usize
,
xid
as
usize
)
)
fn
header
(
&
self
,
message
:
u8
,
length
:
u16
,
xid
:
u32
)
->
OfpHeader
{
OfpHeader
::
new
(
message
,
length
as
usize
,
xid
as
usize
)
}
fn
msg_parse
(
&
self
,
msg
:
u8
)
->
Msg
{
...
...
src/openflow/ofp10/traiter/event_trait.rs
View file @
e17a2926
...
...
@@ -4,8 +4,6 @@ use crate::openflow::ofp10::{
Msg
,
};
use
super
::
header_trait
::
OpenflowHeader
;
/**
* the trait for parse value to bytes.
* for use with Controller's send_msg.
...
...
@@ -21,8 +19,8 @@ pub trait MessageMarshal {
* for works with controller to create OfpMsgEvent
*/
pub
trait
OfpMsgEvent
{
fn
header
(
&
self
,
message
:
u8
,
length
:
u16
,
xid
:
u32
)
->
OfpHeader
<
impl
OpenflowHeader
>
;
fn
header_parse
(
&
self
,
bytes
:
&
Vec
<
u8
>
)
->
OfpHeader
<
impl
OpenflowHeader
>
;
fn
header
(
&
self
,
message
:
u8
,
length
:
u16
,
xid
:
u32
)
->
OfpHeader
;
fn
header_parse
(
&
self
,
bytes
:
&
Vec
<
u8
>
)
->
OfpHeader
;
fn
version
(
&
self
)
->
usize
;
fn
ofp_version
()
->
usize
;
fn
header_size
(
&
self
)
->
usize
;
...
...
tests/headers.rs
View file @
e17a2926
#
[
cfg
(
test
)]
mod
tests
{
use
tenjin
::{
openflow
::
ofp10
::{
ControllerFrame10
,
Msg
,
OfpMsgEvent
},
openflow
::
ofp10
::{
ControllerFrame10
,
Msg
,
OfpMsgEvent
,
OpenflowHeader
},
Controller
,
};
...
...
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