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
b2b05232
Commit
b2b05232
authored
Jun 24, 2024
by
Nawasan Wisitsingkhon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
modify match_fields; add OxmMatchFields
parent
1b3d278d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
83 additions
and
90 deletions
+83
-90
match_fields.rs
src/openflow/ofp13/events/flow_mod/match_fields.rs
+83
-90
No files found.
src/openflow/ofp13/events/flow_mod/match_fields.rs
View file @
b2b05232
...
@@ -94,6 +94,12 @@ impl Wildcards {
...
@@ -94,6 +94,12 @@ impl Wildcards {
}
}
}
}
pub
struct
OfpMatch
{
typ
:
MatchType
,
length
:
u16
,
oxm_fields
:
OxmClass
,
}
pub
enum
MatchType
{
pub
enum
MatchType
{
Standard
=
0
,
Standard
=
0
,
OXM
=
1
,
//, the OpenFlow 1.1 match type OFPMT_STANDARD is deprecated
OXM
=
1
,
//, the OpenFlow 1.1 match type OFPMT_STANDARD is deprecated
...
@@ -106,10 +112,10 @@ pub enum MatchType {
...
@@ -106,10 +112,10 @@ pub enum MatchType {
*/
*/
pub
struct
OxmHeader
{
pub
struct
OxmHeader
{
class
:
OxmClass
,
// Match class: member class or reserved class
class
:
OxmClass
,
// Match class: member class or reserved class
field
:
u8
,
// 7bit Match field within the class
field
:
OxmMatchFields
,
// 7bit Match field within the class
hasmask
:
u8
,
// 1bit Set if OXM include a bitmask in payload
hasmask
:
bool
,
// 1bit Set if OXM include a bitmask in payload
length
:
u8
,
// Length of OXM payload
length
:
u8
,
// Length of OXM payload
}
}
/**
/**
...
@@ -120,108 +126,95 @@ pub struct OxmHeader {
...
@@ -120,108 +126,95 @@ pub struct OxmHeader {
#[repr(u16)]
#[repr(u16)]
pub
enum
OxmClass
{
pub
enum
OxmClass
{
Nxm0
=
0x0000
,
Nxm0
=
0x0000
,
// Backward compatibility with NXM
Nxm1
=
0x0001
,
Nxm1
=
0x0001
,
// Backward compatibility with NXM
OpenflowBasic
=
0x8000
,
OpenflowBasic
=
0x8000
,
// Basic class for OpenFlow
Experimenter
=
0xffff
,
Experimenter
=
0xffff
,
// Experimenter class
}
}
/* OXM Flow match field types for OpenFlow basic class. */
/* OXM Flow match field types for OpenFlow basic class. */
pub
struct
MatchFields
{
pub
enum
Oxm
MatchFields
{
pub
in_port
:
Option
<
u32
>
,
InPort
=
1
,
in_phy_port
:
Option
<
u32
>
,
InPhyPort
=
2
,
metadata
:
Option
<
i64
>
,
Metadata
=
3
,
pub
mac_dest
:
Option
<
MacAddr
>
,
MacDest
=
4
,
pub
mac_src
:
Option
<
MacAddr
>
,
MacSrc
=
5
,
pub
ethernet_type
:
Option
<
u16
>
,
EthernetType
=
6
,
pub
vlan_vid
:
Option
<
u16
>
,
// vlan type
VlanVid
=
7
,
// vlan type
pub
vlan_pcp
:
Option
<
u8
>
,
VlanPcp
=
8
,
// ToS from IPv4 packet
// ToS from IPv4 packet
pub
ip_dscp
:
Option
<
u8
>
,
// IP DSCP (6 bits in ToS field).
IpDscp
=
9
,
// IP DSCP (6 bits in ToS field).
pub
ip_ecn
:
Option
<
u8
>
,
// IP ECN (2 bits in ToS field).
IpEcn
=
10
,
// IP ECN (2 bits in ToS field).
pub
protocol
:
Option
<
u8
>
,
Protocol
=
11
,
pub
ip_src
:
Option
<
Ipv4Addr
>
,
IpSrc
=
12
,
pub
ip_dst
:
Option
<
Ipv4Addr
>
,
IpDst
=
13
,
pub
tcp_src
:
Option
<
u16
>
,
TcpSrc
=
14
,
pub
tcp_dst
:
Option
<
u16
>
,
TcpDst
=
15
,
pub
udp_src
:
Option
<
u16
>
,
UdpSrc
=
16
,
pub
udp_dst
:
Option
<
u16
>
,
UdpDst
=
17
,
pub
sctp_src
:
Option
<
u16
>
,
SctpSrc
=
18
,
pub
sctp_dst
:
Option
<
u16
>
,
SctpDst
=
19
,
Icmpv4Type
=
20
,
Icmpv4Code
=
21
,
ArpOp
=
22
,
ArpSpa
=
23
,
// ARP source IPv4 address
ArpTpa
=
24
,
// ARP target IPv4 address
ArpSha
=
25
,
// ARP source Mac
ArpPha
=
26
,
// ARP target Mac
Ipv6Src
=
27
,
// IPv6 address
Ipv6Dst
=
28
,
// IPv6 address
Ipv6Flabel
=
29
,
// IPv6 Flow Lable
Icmpv6Type
=
30
,
// ICMPv6 type
Icmpv6Code
=
31
,
// ICMPv6 code
Ipv6NdTarget
=
32
,
// Target address for ND
Ipv6NdSll
=
33
,
// MAC , source link-layer for ND
Ipv6NdTll
=
34
,
// Mac , Target link-layer for ND
MplsLabel
=
35
,
// MPLS label
MplsTc
=
36
,
// MPLS TC
MplsBos
=
37
,
// MPLS Bos bit
PbbIsid
=
38
,
// 24bit PBB I-SID
TunnelId
=
39
,
// Logical Port Metadata
Ipv6Exthdr
=
40
,
// IPv6 Extension Header pseudo-field
PbbUca
=
41
,
// PBB UCA Header
TcpFlags
=
42
,
// TCP Flags
ActsetOutput
=
43
,
// Output port from action set metadata
}
pub
icmpv4_type
:
Option
<
u8
>
,
// Required match fields.
pub
icmpv4_code
:
Option
<
u8
>
,
pub
struct
MatchFields
{
pub
arp_op
:
Option
<
u16
>
,
in_port
:
Option
<
u32
>
,
// Ingress port. This may be a physical or switch-defined logical port.
pub
arp_spa
:
Option
<
Ipv4Addr
>
,
// ARP source IPv4 address
eth_dst
:
Option
<
MacAddr
>
,
// Ethernet source address. Can use arbitrary bitmask
pub
arp_tpa
:
Option
<
Ipv4Addr
>
,
// ARP target IPv4 address
eth_src
:
Option
<
MacAddr
>
,
// Ethernet destination address. Can use arbitrary bitmask
pub
arp_sha
:
Option
<
MacAddr
>
,
// ARP source Mac
eth_typ
:
Option
<
u16
>
,
// Ethernet type of the OpenFlow packet payload, after VLAN tags.
pub
arp_tha
:
Option
<
MacAddr
>
,
// ARP target Mac
ip_proto
:
Option
<
u8
>
,
// IPv4 or IPv6 protocol number
pub
ipv6_src
:
Option
<
Ipv6Addr
>
,
// IPv6 address
ipv4_src
:
Option
<
Ipv4Addr
>
,
// IPv4 source address. Can use subnet mask or arbitrary bitmask
pub
ipv6_dst
:
Option
<
Ipv6Addr
>
,
// IPv6 address
ipv4_dst
:
Option
<
Ipv4Addr
>
,
// IPv4 destination address. Can use subnet mask or arbitrary bitmask
pub
ipv6_flabel
:
Option
<
u32
>
,
// IPv6 Flow Lable
ipv6_src
:
Option
<
Ipv6Addr
>
,
// IPv6 source address. Can use subnet mask or arbitrary bitmask
pub
icmpv6_type
:
Option
<
u8
>
,
// ICMPv6 type
ipv6_dst
:
Option
<
Ipv6Addr
>
,
// IPv6 destination address. Can use subnet mask or arbitrary bitmask
pub
icmpv6_code
:
Option
<
u8
>
,
// ICMPv6 code
tcp_src
:
Option
<
u16
>
,
// TCP source port
pub
ipv6_nd_target
:
Option
<
u128
>
,
// Target address for ND
tcp_dst
:
Option
<
u16
>
,
// TCP destination port
pub
ipv6_nd_sll
:
Option
<
MacAddr
>
,
// MAC , source link-layer for ND
udp_src
:
Option
<
u16
>
,
// UDP source port
pub
ipv6_nd_tll
:
Option
<
MacAddr
>
,
// Mac , Target link-layer for ND
udp_dst
:
Option
<
u16
>
,
// UDP destination port
pub
mpls_label
:
Option
<
u32
>
,
// MPLS label
pub
mpls_tc
:
Option
<
u8
>
,
// MPLS TC
pub
mpls_bos
:
Option
<
u8
>
,
// MPLS Bos bit
pub
pbb_isid
:
Option
<
u32
>
,
// 24bit PBB I-SID
pub
tunnel_id
:
Option
<
u64
>
,
// Logical Port Metadata
pub
ipv6_exthdr
:
Option
<
u64
>
,
// IPv6 Extension Header pseudo-field
pub
pbb_uca
:
Option
<
u8
>
,
// PBB UCA Header
pub
tcp_flags
:
Option
<
u16
>
,
// TCP Flags
pub
actset_output
:
Option
<
u32
>
,
// Output port from action set metadata
}
}
impl
MatchFields
{
impl
MatchFields
{
pub
fn
match_all
()
->
Self
{
pub
fn
match_all
()
->
Self
{
Self
{
Self
{
in_port
:
None
,
in_port
:
None
,
in_phy_port
:
None
,
eth_dst
:
None
,
metadata
:
None
,
eth_src
:
None
,
mac_dest
:
None
,
eth_typ
:
None
,
mac_src
:
None
,
ip_proto
:
None
,
ethernet_type
:
None
,
ipv4_src
:
None
,
vlan_vid
:
None
,
ipv4_dst
:
None
,
vlan_pcp
:
None
,
ipv6_src
:
None
,
ip_dscp
:
None
,
ipv6_dst
:
None
,
ip_ecn
:
None
,
protocol
:
None
,
ip_src
:
None
,
ip_dst
:
None
,
tcp_src
:
None
,
tcp_src
:
None
,
tcp_dst
:
None
,
tcp_dst
:
None
,
udp_src
:
None
,
udp_src
:
None
,
udp_dst
:
None
,
udp_dst
:
None
,
sctp_src
:
None
,
sctp_dst
:
None
,
icmpv4_type
:
None
,
icmpv4_code
:
None
,
arp_op
:
None
,
arp_spa
:
None
,
arp_tpa
:
None
,
arp_sha
:
None
,
arp_tha
:
None
,
ipv6_src
:
None
,
ipv6_dst
:
None
,
ipv6_flabel
:
None
,
icmpv6_type
:
None
,
icmpv6_code
:
None
,
ipv6_nd_target
:
None
,
ipv6_nd_sll
:
None
,
ipv6_nd_tll
:
None
,
mpls_label
:
None
,
mpls_tc
:
None
,
mpls_bos
:
None
,
pbb_isid
:
None
,
tunnel_id
:
None
,
ipv6_exthdr
:
None
,
pbb_uca
:
None
,
tcp_flags
:
None
,
actset_output
:
None
,
}
}
}
}
pub
fn
marshal
(
&
self
,
bytes
:
&
mut
Vec
<
u8
>
)
{
pub
fn
marshal
(
&
self
,
bytes
:
&
mut
Vec
<
u8
>
)
{
...
...
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