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
8a49beb1
Commit
8a49beb1
authored
Jun 11, 2024
by
Nawasan Wisitsingkhon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
move trait to outside ofp10
parent
14945b63
Show whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
51 additions
and
32 deletions
+51
-32
controller.rs
src/controller.rs
+1
-1
controller_frame.rs
src/openflow/controller_frame.rs
+1
-2
mod.rs
src/openflow/mod.rs
+2
-0
error_handler.rs
src/openflow/ofp10/events/error/error_handler.rs
+11
-6
features_req.rs
src/openflow/ofp10/events/features_req.rs
+4
-2
flow_mod_handler.rs
src/openflow/ofp10/events/flow_mod/flow_mod_handler.rs
+8
-2
hello.rs
src/openflow/ofp10/events/hello.rs
+4
-3
packet_out.rs
src/openflow/ofp10/events/packet_out.rs
+2
-2
mod.rs
src/openflow/ofp10/mod.rs
+0
-1
mod.rs
src/openflow/ofp10/ofp_header/mod.rs
+0
-3
ofp_header.rs
src/openflow/ofp10/ofp_header/ofp_header.rs
+1
-1
ofp_header_v1_0.rs
src/openflow/ofp10/ofp_header/ofp_header_v1_0.rs
+2
-1
ofp_v1_0.rs
src/openflow/ofp10/ofp_v1_0.rs
+2
-2
tcp_listener.rs
src/openflow/tcp_listener.rs
+2
-2
event_trait.rs
src/openflow/traiter/event_trait.rs
+5
-3
header_trait.rs
src/openflow/traiter/header_trait.rs
+0
-0
mod.rs
src/openflow/traiter/mod.rs
+5
-0
headers.rs
tests/headers.rs
+1
-1
No files found.
src/controller.rs
View file @
8a49beb1
...
...
@@ -10,9 +10,9 @@ use crate::{
self
,
events
::{
flow_mod
::
MatchFields
,
Action
},
ofp_v1_0
::
Openflow10
,
traiter
::
OfpMsgEvent
,
FlowModEvent
,
PacketInEvent
,
},
traiter
::
OfpMsgEvent
,
},
};
/**
...
...
src/openflow/controller_frame.rs
View file @
8a49beb1
use
crate
::
openflow
::
ofp10
::{
traiter
::{
MessageMarshal
,
OfpMsgEvent
},
ErrorEvent
,
Msg
,
PacketInEvent
,
};
use
std
::{
...
...
@@ -7,7 +6,7 @@ use std::{
net
::
TcpStream
,
};
use
super
::
tcp_listener
::
tcp_listener_handler
;
use
super
::
{
tcp_listener
::
tcp_listener_handler
,
traiter
::{
MessageMarshal
,
OfpMsgEvent
}}
;
pub
trait
ControllerFrame
<
OME
:
OfpMsgEvent
>
{
fn
get_ofp
(
&
self
)
->
&
impl
OfpMsgEvent
;
...
...
src/openflow/mod.rs
View file @
8a49beb1
pub
mod
controller_frame
;
pub
mod
ofp10
;
pub
mod
tcp_listener
;
pub
mod
traiter
;
\ No newline at end of file
src/openflow/ofp10/events/error/error_handler.rs
View file @
8a49beb1
use
std
::{
io
::{
BufRead
,
Cursor
},
mem
::
size_of
};
use
crate
::
openflow
::
ofp10
::{
traiter
::
MessageMarshal
,
Msg
};
use
byteorder
::{
BigEndian
,
ReadBytesExt
};
use
std
::{
io
::{
BufRead
,
Cursor
},
mem
::
size_of
,
};
use
super
::
error_type
::
ErrorType
;
use
crate
::
openflow
::{
ofp10
::
Msg
,
traiter
::{
MessageMarshal
,
OfpMsgEvent
},
};
use
byteorder
::{
BigEndian
,
ReadBytesExt
};
pub
struct
ErrorEvent
{
pub
error_type
:
ErrorType
,
...
...
@@ -34,11 +39,11 @@ impl MessageMarshal for ErrorEvent {
Msg
::
Error
}
fn
msg_usize
<
OFP
:
crate
::
openflow
::
ofp10
::
traiter
::
OfpMsgEvent
>
(
&
self
,
ofp
:
&
OFP
)
->
usize
{
fn
msg_usize
<
OFP
:
OfpMsgEvent
>
(
&
self
,
ofp
:
&
OFP
)
->
usize
{
ofp
.msg_usize
(
Msg
::
Error
)
}
fn
size_of
(
&
self
)
->
usize
{
size_of
::
<
(
u16
,
u16
)
>
()
+
self
.payload
.len
()
size_of
::
<
(
u16
,
u16
)
>
()
+
self
.payload
.len
()
}
}
src/openflow/ofp10/events/features_req.rs
View file @
8a49beb1
use
crate
::
openflow
::
ofp10
::{
traiter
::{
MessageMarshal
,
OfpMsgEvent
},
Msg
};
use
crate
::
openflow
::{
ofp10
::
Msg
,
traiter
::{
MessageMarshal
,
OfpMsgEvent
},
};
pub
struct
FeaturesReqEvent
{}
...
...
src/openflow/ofp10/events/flow_mod/flow_mod_handler.rs
View file @
8a49beb1
...
...
@@ -2,11 +2,17 @@ use std::io::Cursor;
use
byteorder
::{
BigEndian
,
ReadBytesExt
,
WriteBytesExt
};
use
crate
::
openflow
::
ofp10
::{
events
::{
actions
::
SizeCheck
,
Action
},
ofp_port
::
OfpPort
,
traiter
::{
MessageMarshal
,
OfpMsgEvent
},
Msg
,
PseudoPort
};
use
crate
::
openflow
::{
ofp10
::{
events
::{
actions
::
SizeCheck
,
Action
},
ofp_port
::
OfpPort
,
Msg
,
PseudoPort
,
},
traiter
::{
MessageMarshal
,
OfpMsgEvent
},
};
use
super
::{
FlowModCommand
,
MatchFields
};
pub
enum
Timeout
{
Permanent
,
ExpireAfter
(
u16
),
...
...
src/openflow/ofp10/events/hello.rs
View file @
8a49beb1
use
crate
::
openflow
::
ofp10
::{
traiter
::{
MessageMarshal
,
OfpMsgEvent
},
Msg
};
use
crate
::
openflow
::{
ofp10
::
Msg
,
traiter
::{
MessageMarshal
,
OfpMsgEvent
},
};
pub
struct
HelloEvent
{}
...
...
src/openflow/ofp10/events/packet_out.rs
View file @
8a49beb1
...
...
@@ -4,9 +4,9 @@ use std::{
};
use
crate
::
openflow
::
ofp10
::{
ofp_port
::
OfpPort
,
Msg
};
use
crate
::
openflow
::
ofp10
::{
use
crate
::
openflow
::{
ofp10
::
PseudoPort
,
traiter
::{
MessageMarshal
,
OfpMsgEvent
},
PseudoPort
,
};
use
byteorder
::{
BigEndian
,
ReadBytesExt
,
WriteBytesExt
};
...
...
src/openflow/ofp10/mod.rs
View file @
8a49beb1
...
...
@@ -9,4 +9,3 @@ pub use events::{ErrorEvent, FlowModEvent, HelloEvent, PacketInEvent, PacketOutE
pub
mod
ofp_header
;
pub
mod
ofp_v1_0
;
pub
mod
traiter
;
src/openflow/ofp10/ofp_header/mod.rs
View file @
8a49beb1
pub
mod
header_traiter
;
pub
use
header_traiter
::
OpenflowHeader
;
pub
mod
ofp_header
;
pub
use
ofp_header
::
OfpHeader
;
...
...
src/openflow/ofp10/ofp_header/ofp_header.rs
View file @
8a49beb1
use
super
::
OpenflowHeader
;
use
crate
::
openflow
::
traiter
::
header_trait
::
OpenflowHeader
;
pub
struct
OfpHeader
<
OFH
:
OpenflowHeader
>
{
ofp_header
:
OFH
,
...
...
src/openflow/ofp10/ofp_header/ofp_header_v1_0.rs
View file @
8a49beb1
use
super
::
OpenflowHeader
;
use
byteorder
::{
BigEndian
,
ReadBytesExt
,
WriteBytesExt
};
use
std
::{
io
::
Cursor
,
mem
::
size_of
};
use
crate
::
openflow
::
traiter
::
header_trait
::
OpenflowHeader
;
pub
struct
OfpHeader10
{
pub
version
:
u8
,
pub
message
:
u8
,
...
...
src/openflow/ofp10/ofp_v1_0.rs
View file @
8a49beb1
use
super
::{
events
::{
Action
,
FeaturesReqEvent
,
Payload
},
ofp_header
::{
OfpHeader
,
OfpHeader10
,
OpenflowHeader
},
traiter
::
OfpMsgEvent
,
ofp_header
::{
OfpHeader
,
OfpHeader10
},
HelloEvent
,
Msg
,
PacketOutEvent
,
};
use
crate
::
openflow
::
traiter
::{
event_trait
::
OfpMsgEvent
,
header_trait
::
OpenflowHeader
};
pub
struct
Openflow10
{}
...
...
src/openflow/tcp_listener.rs
View file @
8a49beb1
use
crate
::
Controller
;
use
std
::{
io
::
Read
,
net
::
TcpListener
,
thread
};
use
super
::
controller_frame
::
ControllerFrame
;
use
crate
::
openflow
::
ofp10
::
{
traiter
::
OfpMsgEvent
,
HelloEvent
}
;
use
super
::
{
controller_frame
::
ControllerFrame
,
traiter
::
OfpMsgEvent
}
;
use
crate
::
openflow
::
ofp10
::
HelloEvent
;
pub
fn
tcp_listener_handler
<
OME
:
OfpMsgEvent
>
(
address
:
&
str
)
{
let
listener
=
TcpListener
::
bind
(
address
)
.unwrap
();
...
...
src/openflow/
ofp10/traiter
.rs
→
src/openflow/
traiter/event_trait
.rs
View file @
8a49beb1
use
crate
::
openflow
::{
ofp10
::
events
::{
FeaturesReqEvent
,
Action
,
HelloEvent
,
PacketOutEvent
,
Payload
},
use
crate
::
openflow
::
ofp10
::{
events
::{
Action
,
FeaturesReqEvent
,
HelloEvent
,
PacketOutEvent
,
Payload
},
ofp_header
::
OfpHeader
,
Msg
,
};
use
super
::
{
ofp_header
::{
OfpHeader
,
OpenflowHeader
},
Msg
}
;
use
super
::
header_trait
::
OpenflowHeader
;
/**
* the trait for parse value to bytes.
...
...
src/openflow/
ofp10/ofp_header/header_traiter
.rs
→
src/openflow/
traiter/header_trait
.rs
View file @
8a49beb1
File moved
src/openflow/traiter/mod.rs
0 → 100644
View file @
8a49beb1
pub
mod
header_trait
;
pub
use
header_trait
::
OpenflowHeader
;
pub
mod
event_trait
;
pub
use
event_trait
::{
MessageMarshal
,
OfpMsgEvent
};
tests/headers.rs
View file @
8a49beb1
#
[
cfg
(
test
)]
mod
tests
{
use
tenjin
::{
openflow
::{
controller_frame
::
ControllerFrame
,
ofp10
::
traiter
::
OfpMsgEvent
,
ofp10
::
Msg
},
openflow
::{
controller_frame
::
ControllerFrame
,
ofp10
::
Msg
,
traiter
::
OfpMsgEvent
},
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