ROFL-pipeline  v0.6.0dev
Data Structures | Typedefs | Enumerations | Functions
of1x_match.h File Reference

OpenFlow v1.0, 1.2 and 1.3.2 matches. More...

#include <assert.h>
#include <stdlib.h>
#include <inttypes.h>
#include <string.h>
#include <stdbool.h>
#include "rofl.h"
#include "../../../common/ternary_fields.h"
#include "../../../common/packet_matches.h"
#include "of1x_utils.h"

Go to the source code of this file.

Data Structures

struct  of1x_match
 
struct  of1x_match_group
 

Typedefs

typedef struct of1x_match of1x_match_t
 
typedef struct of1x_match_group of1x_match_group_t
 

Enumerations

enum  of1x_match_type_t {
  OF1X_MATCH_IN_PORT, OF1X_MATCH_IN_PHY_PORT, OF1X_MATCH_METADATA, OF1X_MATCH_ETH_DST,
  OF1X_MATCH_ETH_SRC, OF1X_MATCH_ETH_TYPE, OF1X_MATCH_VLAN_VID, OF1X_MATCH_VLAN_PCP,
  OF1X_MATCH_MPLS_LABEL, OF1X_MATCH_MPLS_TC, OF1X_MATCH_MPLS_BOS, OF1X_MATCH_ARP_OP,
  OF1X_MATCH_ARP_SPA, OF1X_MATCH_ARP_TPA, OF1X_MATCH_ARP_SHA, OF1X_MATCH_ARP_THA,
  OF1X_MATCH_NW_PROTO, OF1X_MATCH_NW_SRC, OF1X_MATCH_NW_DST, OF1X_MATCH_IP_DSCP,
  OF1X_MATCH_IP_ECN, OF1X_MATCH_IP_PROTO, OF1X_MATCH_IPV4_SRC, OF1X_MATCH_IPV4_DST,
  OF1X_MATCH_IPV6_SRC, OF1X_MATCH_IPV6_DST, OF1X_MATCH_IPV6_FLABEL, OF1X_MATCH_ICMPV6_TYPE,
  OF1X_MATCH_ICMPV6_CODE, OF1X_MATCH_IPV6_ND_TARGET, OF1X_MATCH_IPV6_ND_SLL, OF1X_MATCH_IPV6_ND_TLL,
  OF1X_MATCH_IPV6_EXTHDR, OF1X_MATCH_TP_SRC, OF1X_MATCH_TP_DST, OF1X_MATCH_TCP_SRC,
  OF1X_MATCH_TCP_DST, OF1X_MATCH_UDP_SRC, OF1X_MATCH_UDP_DST, OF1X_MATCH_SCTP_SRC,
  OF1X_MATCH_SCTP_DST, OF1X_MATCH_ICMPV4_TYPE, OF1X_MATCH_ICMPV4_CODE, OF1X_MATCH_PBB_ISID,
  OF1X_MATCH_TUNNEL_ID, OF1X_MATCH_PPPOE_CODE, OF1X_MATCH_PPPOE_TYPE, OF1X_MATCH_PPPOE_SID,
  OF1X_MATCH_PPP_PROT, OF1X_MATCH_GTP_MSG_TYPE, OF1X_MATCH_GTP_TEID, OF1X_MATCH_CAPWAP_WBID,
  OF1X_MATCH_CAPWAP_RID, OF1X_MATCH_CAPWAP_FLAGS, OF1X_MATCH_WLAN_FC, OF1X_MATCH_WLAN_TYPE,
  OF1X_MATCH_WLAN_SUBTYPE, OF1X_MATCH_WLAN_DIRECTION, OF1X_MATCH_WLAN_ADDRESS_1, OF1X_MATCH_WLAN_ADDRESS_2,
  OF1X_MATCH_WLAN_ADDRESS_3, OF1X_MATCH_GRE_VERSION, OF1X_MATCH_GRE_PROT_TYPE, OF1X_MATCH_GRE_KEY,
  OF1X_MATCH_MAX
}
 
enum  of1x_vlan_present { OF1X_MATCH_VLAN_NONE =0, OF1X_MATCH_VLAN_ANY =1, OF1X_MATCH_VLAN_SPECIFIC =2 }
 

Functions

ROFL_BEGIN_DECLS of1x_match_tof1x_init_port_in_match (uint32_t value)
 Create an PORT_IN match. More...
 
of1x_match_tof1x_init_port_in_phy_match (uint32_t value)
 Create an PHY_PORT_IN match. More...
 
of1x_match_tof1x_init_metadata_match (uint64_t value, uint64_t mask)
 Create an METADATA match. More...
 
of1x_match_tof1x_init_eth_dst_match (uint64_t value, uint64_t mask)
 Create an ETH_DST match. More...
 
of1x_match_tof1x_init_eth_src_match (uint64_t value, uint64_t mask)
 Create an ETH_SRC match. More...
 
of1x_match_tof1x_init_eth_type_match (uint16_t value)
 Create an ETH_TYPE match. More...
 
of1x_match_tof1x_init_vlan_vid_match (uint16_t value, uint16_t mask, enum of1x_vlan_present vlan_present)
 Create an VLAN_VID match according to 1.2 semantics (13th bit is a flag) More...
 
of1x_match_tof1x_init_vlan_pcp_match (uint8_t value)
 Create an VLAN_PCP match. More...
 
of1x_match_tof1x_init_mpls_label_match (uint32_t value)
 Create an MPLS_LABEL match. More...
 
of1x_match_tof1x_init_mpls_tc_match (uint8_t value)
 Create an MPLS_TC match. More...
 
of1x_match_tof1x_init_mpls_bos_match (uint8_t value)
 Create an MPLS_BOS match. More...
 
of1x_match_tof1x_init_arp_opcode_match (uint16_t value)
 Create an ARP_OPCODE match. More...
 
of1x_match_tof1x_init_arp_tha_match (uint64_t value, uint64_t mask)
 Create an ARP_THA match. More...
 
of1x_match_tof1x_init_arp_sha_match (uint64_t value, uint64_t mask)
 Create an ARP_SHA match. More...
 
of1x_match_tof1x_init_arp_tpa_match (uint32_t value, uint32_t mask)
 Create an ARP_TPA match. More...
 
of1x_match_tof1x_init_arp_spa_match (uint32_t value, uint32_t mask)
 Create an ARP_SPA match. More...
 
of1x_match_tof1x_init_pppoe_code_match (uint8_t value)
 Create an PPPOE_CODE match. More...
 
of1x_match_tof1x_init_pppoe_type_match (uint8_t value)
 Create an PPPOE_TYPE match. More...
 
of1x_match_tof1x_init_pppoe_session_match (uint16_t value)
 Create an PPPOE_SESSION match. More...
 
of1x_match_tof1x_init_ppp_prot_match (uint16_t value)
 Create an PPP_PROTO match. More...
 
of1x_match_tof1x_init_gtp_msg_type_match (uint8_t value)
 Create an PPP_PROTO match. More...
 
of1x_match_tof1x_init_gtp_teid_match (uint32_t value, uint32_t mask)
 Create an PPP_PROTO match. More...
 
of1x_match_tof1x_init_capwap_wbid_match (uint8_t value, uint8_t mask)
 Create a CAPWAP_WBID match. More...
 
of1x_match_tof1x_init_capwap_rid_match (uint8_t value, uint8_t mask)
 Create a CAPWAP_RID match. More...
 
of1x_match_tof1x_init_capwap_flags_match (uint16_t value, uint16_t mask)
 Create a CAPWAP_FLAGS match. More...
 
of1x_match_tof1x_init_wlan_fc_match (uint16_t value, uint16_t mask)
 Create a WLAN_FC match. More...
 
of1x_match_tof1x_init_wlan_type_match (uint8_t value, uint8_t mask)
 Create a WLAN_TYPE match. More...
 
of1x_match_tof1x_init_wlan_subtype_match (uint8_t value, uint8_t mask)
 Create a WLAN_SUBTYPE match. More...
 
of1x_match_tof1x_init_wlan_direction_match (uint8_t value, uint8_t mask)
 Create a WLAN_DIRECTION match. More...
 
of1x_match_tof1x_init_wlan_address_1_match (uint64_t value, uint64_t mask)
 Create an WLAN_ADDRESS_1 match. More...
 
of1x_match_tof1x_init_wlan_address_2_match (uint64_t value, uint64_t mask)
 Create an WLAN_ADDRESS_2 match. More...
 
of1x_match_tof1x_init_wlan_address_3_match (uint64_t value, uint64_t mask)
 Create an WLAN_ADDRESS_3 match. More...
 
of1x_match_tof1x_init_nw_proto_match (uint8_t value)
 Create an NW_PROTO match, OF1.0 ONLY! More...
 
of1x_match_tof1x_init_nw_src_match (uint32_t value, uint32_t mask)
 Create an NW_SRC match (IP/ARP), OF1.0 ONLY! More...
 
of1x_match_tof1x_init_nw_dst_match (uint32_t value, uint32_t mask)
 Create an NW_DST match (IP/ARP), OF1.0 ONLY! More...
 
of1x_match_tof1x_init_gre_version_match (uint16_t value)
 Create a GRE_VERSION match. More...
 
of1x_match_tof1x_init_gre_prot_type_match (uint16_t value)
 Create a GRE_PROT_TYPE match. More...
 
of1x_match_tof1x_init_gre_key_match (uint32_t value)
 Create a GRE_KEY match. More...
 
of1x_match_tof1x_init_ip_proto_match (uint8_t value)
 Create an IP_PROTO match. More...
 
of1x_match_tof1x_init_ip_ecn_match (uint8_t value)
 Create an IPC_ECN match. More...
 
of1x_match_tof1x_init_ip_dscp_match (uint8_t value)
 Create an IP_DSCP match. More...
 
of1x_match_tof1x_init_ip4_src_match (uint32_t value, uint32_t mask)
 Create an IP4_SRC match. More...
 
of1x_match_tof1x_init_ip4_dst_match (uint32_t value, uint32_t mask)
 Create an IP4_DST match. More...
 
of1x_match_tof1x_init_tcp_src_match (uint16_t value)
 Create an TCP_SRC match. More...
 
of1x_match_tof1x_init_tcp_dst_match (uint16_t value)
 Create an TCP_DST match. More...
 
of1x_match_tof1x_init_udp_src_match (uint16_t value)
 Create an UDP_SRC match. More...
 
of1x_match_tof1x_init_udp_dst_match (uint16_t value)
 Create an UDP_DST match. More...
 
of1x_match_tof1x_init_sctp_src_match (uint16_t value)
 Create an SCTP_SRC match. More...
 
of1x_match_tof1x_init_sctp_dst_match (uint16_t value)
 Create an SCTP_DST match. More...
 
of1x_match_tof1x_init_tp_src_match (uint16_t value)
 Create an TP_SRC match (TCP/UDP), OF1.0 ONLY! More...
 
of1x_match_tof1x_init_tp_dst_match (uint16_t value)
 Create an TP_DST match (TCP/UDP), OF1.0 ONLY! More...
 
of1x_match_tof1x_init_icmpv4_type_match (uint8_t value)
 Create an ICMPv4_TYPE match. More...
 
of1x_match_tof1x_init_icmpv4_code_match (uint8_t value)
 Create an ICMPv4_CODE match. More...
 
of1x_match_tof1x_init_ip6_src_match (uint128__t value, uint128__t mask)
 Create an IP6_SRC match. More...
 
of1x_match_tof1x_init_ip6_dst_match (uint128__t value, uint128__t mask)
 Create an IP6_DST match. More...
 
of1x_match_tof1x_init_ip6_flabel_match (uint32_t value, uint32_t mask)
 Create an IP6_FLABEL match. More...
 
of1x_match_tof1x_init_ip6_nd_target_match (uint128__t value)
 Create an IP6_ND_TARGET match. More...
 
of1x_match_tof1x_init_ip6_nd_sll_match (uint64_t value)
 Create an IP6_ND_SLL match. More...
 
of1x_match_tof1x_init_ip6_nd_tll_match (uint64_t value)
 Create an IP6_ND_TLL match. More...
 
of1x_match_tof1x_init_ip6_exthdr_match (uint16_t value, uint16_t mask)
 Create an IP6_EXTHDR match. More...
 
of1x_match_tof1x_init_icmpv6_type_match (uint8_t value)
 Create an ICMPV6_TYPE match. More...
 
of1x_match_tof1x_init_icmpv6_code_match (uint8_t value)
 Create an ICMPV6_CODE match. More...
 
of1x_match_tof1x_init_pbb_isid_match (uint32_t value, uint32_t mask)
 
of1x_match_tof1x_init_tunnel_id_match (uint64_t value, uint64_t mask)
 Create an TUNNEL_ID match. More...
 
void of1x_destroy_match (of1x_match_t *match)
 Destroys whichever match previously created using of1x_init_match_*() More...
 
static uint8_t __of1x_get_match_val8 (const of1x_match_t *match, bool get_mask, bool raw_nbo)
 
static uint8_t of1x_get_match_value8 (const of1x_match_t *match)
 Retrieve the match value for 8 bit values (or less) in HOST BYTE ORDER. More...
 
static uint16_t __of1x_get_match_val16 (const of1x_match_t *match, bool get_mask, bool raw_nbo)
 
static uint16_t of1x_get_match_value16 (const of1x_match_t *match)
 Retrieve the match value for 16 bit values (or less) in HOST BYTE ORDER. More...
 
static uint32_t __of1x_get_match_val32 (const of1x_match_t *match, bool get_mask, bool raw_nbo)
 
static uint32_t of1x_get_match_value32 (const of1x_match_t *match)
 Retrieve the match value for 32 bit values (or less) in HOST BYTE ORDER. More...
 
static uint64_t __of1x_get_match_val64 (const of1x_match_t *match, bool get_mask, bool raw_nbo)
 
static uint64_t of1x_get_match_value64 (const of1x_match_t *match)
 Retrieve the match value for 64 bit values (or less) in HOST BYTE ORDER. More...
 
static uint128__t __of1x_get_match_val128 (const of1x_match_t *match, bool get_mask, bool raw_nbo)
 
static uint128__t of1x_get_match_value128 (const of1x_match_t *match)
 Retrieve the match value for 128 bit values (or less) in HOST BYTE ORDER. More...
 
static uint8_t of1x_get_match_mask8 (const of1x_match_t *match)
 Retrieve the match mask value for 8 bit values (or less) in HOST BYTE ORDER. More...
 
static uint16_t of1x_get_match_mask16 (const of1x_match_t *match)
 Retrieve the match mask value for 16 bit values (or less) in HOST BYTE ORDER. More...
 
static uint32_t of1x_get_match_mask32 (const of1x_match_t *match)
 Retrieve the match mask value for 32 bit values (or less) in HOST BYTE ORDER. More...
 
static uint64_t of1x_get_match_mask64 (const of1x_match_t *match)
 Retrieve the match mask value for 64 bit values (or less) in HOST BYTE ORDER. More...
 
static uint128__t of1x_get_match_mask128 (const of1x_match_t *match)
 Retrieve the match mask value for 128 bit values (or less) in HOST BYTE ORDER. More...
 
void __of1x_init_match_group (of1x_match_group_t *group)
 
void __of1x_destroy_match_group (of1x_match_group_t *group)
 
void __of1x_match_group_push_back (of1x_match_group_t *group, of1x_match_t *match)
 
rofl_result_t __of1x_add_match (of1x_match_t *root_match, of1x_match_t *add_match)
 
of1x_match_t__of1x_copy_matches (of1x_match_t *matches)
 
of1x_match_t__of1x_get_alike_match (of1x_match_t *match1, of1x_match_t *match2)
 
bool __of1x_equal_matches (of1x_match_t *match1, of1x_match_t *match2)
 
bool __of1x_is_submatch (of1x_match_t *sub_match, of1x_match_t *match)
 
static bool __of10_is_wildcard (of1x_match_group_t *matches)
 
void __of1x_dump_matches (of1x_match_t *matches, bool raw_nbo)
 

Detailed Description

OpenFlow v1.0, 1.2 and 1.3.2 matches.

Author
Marc Sune<marc.sune (at) bisdn.de>

Note regarding endianness: Conforming the convention that the pipeline works in Network Byte Order the matches need to to be initialized in NBO (Big Endian). This applies to the values comming from the packet (eth_src, eth_dst, ...) and NOT to the ones that are external to it:

There is an special alignment for non complete values as

Definition in file of1x_match.h.