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
3d7a789e
Commit
3d7a789e
authored
Jun 13, 2024
by
Nawasan Wisitsingkhon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
move controller_frame and tcp_listener to ofp10 and remove unused code
parent
32a24045
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
21 additions
and
17 deletions
+21
-17
controller.rs
src/controller.rs
+2
-3
main.rs
src/main.rs
+1
-1
mod.rs
src/openflow/mod.rs
+0
-3
controller_frame.rs
src/openflow/ofp10/controller_frame.rs
+7
-7
mod.rs
src/openflow/ofp10/mod.rs
+7
-0
tcp_listener.rs
src/openflow/ofp10/tcp_listener.rs
+4
-3
No files found.
src/controller.rs
View file @
3d7a789e
...
@@ -5,12 +5,11 @@ use std::{collections::HashMap, net::TcpStream};
...
@@ -5,12 +5,11 @@ use std::{collections::HashMap, net::TcpStream};
use
crate
::{
use
crate
::{
etherparser
::
ether_type
::
EtherType
,
etherparser
::
ether_type
::
EtherType
,
openflow
::{
openflow
::{
controller_frame
::
ControllerFrame
,
ofp10
::{
ofp10
::{
self
,
self
,
events
::{
flow_mod
::
MatchFields
,
Action
},
events
::{
flow_mod
::
MatchFields
,
Action
},
ofp_v1_0
::
Openflow10
,
ofp_v1_0
::
Openflow10
,
FlowModEvent
,
PacketInEvent
,
ControllerFrame10
,
FlowModEvent
,
PacketInEvent
,
},
},
traiter
::
OfpMsgEvent
,
traiter
::
OfpMsgEvent
,
},
},
...
@@ -25,7 +24,7 @@ pub struct Controller {
...
@@ -25,7 +24,7 @@ pub struct Controller {
mac_to_port
:
HashMap
<
u64
,
u16
>
,
mac_to_port
:
HashMap
<
u64
,
u16
>
,
}
}
impl
ControllerFrame
<
Openflow10
>
for
Controller
{
impl
ControllerFrame
10
for
Controller
{
fn
get_ofp
(
&
self
)
->
&
impl
OfpMsgEvent
{
fn
get_ofp
(
&
self
)
->
&
impl
OfpMsgEvent
{
&
self
.ofp
&
self
.ofp
}
}
...
...
src/main.rs
View file @
3d7a789e
use
tenjin
::{
openflow
::
controller_frame
::
ControllerFrame
,
Controller
};
use
tenjin
::{
openflow
::
ofp10
::
ControllerFrame10
,
Controller
};
extern
crate
byteorder
;
extern
crate
byteorder
;
...
...
src/openflow/mod.rs
View file @
3d7a789e
pub
mod
controller_frame
;
pub
mod
ofp10
;
pub
mod
ofp10
;
pub
mod
tcp_listener
;
pub
mod
traiter
;
pub
mod
traiter
;
\ No newline at end of file
src/openflow/controller_frame.rs
→
src/openflow/
ofp10/
controller_frame.rs
View file @
3d7a789e
use
crate
::
openflow
::
ofp10
::{
ErrorEvent
,
Msg
,
PacketInEvent
};
use
crate
::
openflow
::{
ofp10
::{
ErrorEvent
,
Msg
,
PacketInEvent
},
traiter
::{
MessageMarshal
,
OfpMsgEvent
},
};
use
std
::{
use
std
::{
io
::{
Read
,
Write
},
io
::{
Read
,
Write
},
net
::
TcpStream
,
net
::
TcpStream
,
};
};
use
super
::{
use
super
::
tcp_listener_handler
;
tcp_listener
::
tcp_listener_handler
,
traiter
::{
MessageMarshal
,
OfpMsgEvent
},
};
pub
trait
ControllerFrame
<
OME
:
OfpMsgEvent
>
{
pub
trait
ControllerFrame
10
{
fn
get_ofp
(
&
self
)
->
&
impl
OfpMsgEvent
;
fn
get_ofp
(
&
self
)
->
&
impl
OfpMsgEvent
;
fn
packet_in_handler
(
&
mut
self
,
xid
:
u32
,
packetin
:
PacketInEvent
,
stream
:
&
mut
TcpStream
);
fn
packet_in_handler
(
&
mut
self
,
xid
:
u32
,
packetin
:
PacketInEvent
,
stream
:
&
mut
TcpStream
);
fn
new
()
->
Self
;
fn
new
()
->
Self
;
fn
listener
(
address
:
&
str
)
{
fn
listener
(
address
:
&
str
)
{
tcp_listener_handler
::
<
OME
>
(
address
);
tcp_listener_handler
(
address
);
}
}
fn
handle_header
(
&
mut
self
,
buf
:
&
mut
Vec
<
u8
>
)
->
(
u8
,
usize
,
u32
)
{
fn
handle_header
(
&
mut
self
,
buf
:
&
mut
Vec
<
u8
>
)
->
(
u8
,
usize
,
u32
)
{
...
...
src/openflow/ofp10/mod.rs
View file @
3d7a789e
...
@@ -9,3 +9,9 @@ pub use events::{ErrorEvent, FlowModEvent, HelloEvent, PacketInEvent, PacketOutE
...
@@ -9,3 +9,9 @@ pub use events::{ErrorEvent, FlowModEvent, HelloEvent, PacketInEvent, PacketOutE
pub
mod
ofp_header
;
pub
mod
ofp_header
;
pub
mod
ofp_v1_0
;
pub
mod
ofp_v1_0
;
pub
mod
controller_frame
;
pub
use
controller_frame
::
ControllerFrame10
;
pub
mod
tcp_listener
;
pub
use
tcp_listener
::
tcp_listener_handler
;
\ No newline at end of file
src/openflow/tcp_listener.rs
→
src/openflow/
ofp10/
tcp_listener.rs
View file @
3d7a789e
use
crate
::
Controller
;
use
crate
::
{
openflow
::
traiter
::
OfpMsgEvent
,
Controller
}
;
use
std
::{
io
::
Read
,
net
::
TcpListener
,
thread
};
use
std
::{
io
::
Read
,
net
::
TcpListener
,
thread
};
use
super
::{
controller_frame
::
ControllerFrame
,
traiter
::
OfpMsgEvent
};
use
crate
::
openflow
::
ofp10
::
HelloEvent
;
use
crate
::
openflow
::
ofp10
::
HelloEvent
;
pub
fn
tcp_listener_handler
<
OME
:
OfpMsgEvent
>
(
address
:
&
str
)
{
use
super
::
ControllerFrame10
;
pub
fn
tcp_listener_handler
(
address
:
&
str
)
{
let
listener
=
TcpListener
::
bind
(
address
)
.unwrap
();
let
listener
=
TcpListener
::
bind
(
address
)
.unwrap
();
for
stream
in
listener
.incoming
()
{
for
stream
in
listener
.incoming
()
{
match
stream
{
match
stream
{
...
...
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