ROFL-pipeline  v0.6.0dev
of1x_match.h
Go to the documentation of this file.
1 #ifndef __OF1X_MATCH_H__
2 #define __OF1X_MATCH_H__
3 
4 #include <assert.h>
5 #include <stdlib.h>
6 #include <inttypes.h>
7 #include <string.h>
8 #include <stdbool.h>
9 #include "rofl.h"
10 #include "../../../common/ternary_fields.h"
11 #include "../../../common/packet_matches.h"
12 #include "of1x_utils.h"
13 
38 //Fwd declarations
39 union of_packet_matches;
40 
41 /* Defines possible matchings. This is EXPLICITELY copied from openflow.h, to simplify names, avoid collisions and add extensions */
42 typedef enum{
43  /* phy */
44  OF1X_MATCH_IN_PORT, /* Switch input port. */ //required
45  OF1X_MATCH_IN_PHY_PORT, /* Switch physical input port. */
46 
47  /* metadata */
48  OF1X_MATCH_METADATA, /* Metadata passed between tables. */
49 
50  /* eth */
51  OF1X_MATCH_ETH_DST, /* Ethernet destination address. */ //required
52  OF1X_MATCH_ETH_SRC, /* Ethernet source address. */ //required
53  OF1X_MATCH_ETH_TYPE, /* Ethernet frame type. */ //required
54  OF1X_MATCH_VLAN_VID, /* VLAN id. */
55  OF1X_MATCH_VLAN_PCP, /* VLAN priority. */
56 
57  /* mpls */
58  OF1X_MATCH_MPLS_LABEL, /* MPLS label. */
59  OF1X_MATCH_MPLS_TC, /* MPLS TC. */
60  OF1X_MATCH_MPLS_BOS, /* MPLS BoS flag. */
61 
62  /* arp */
63  OF1X_MATCH_ARP_OP, /* ARP opcode. */
64  OF1X_MATCH_ARP_SPA, /* ARP source IPv4 address. */
65  OF1X_MATCH_ARP_TPA, /* ARP target IPv4 address. */
66  OF1X_MATCH_ARP_SHA, /* ARP source hardware address. */
67  OF1X_MATCH_ARP_THA, /* ARP target hardware address. */
68 
69  /* network layer */
70  OF1X_MATCH_NW_PROTO, /* Network layer Ip proto/arp code. OF10 ONLY */ //required
71  OF1X_MATCH_NW_SRC, /* Network layer source address. OF10 ONLY */ //required
72  OF1X_MATCH_NW_DST, /* Network layer destination address. OF10 ONLY */ //required
73 
74  /* ipv4 */
75  OF1X_MATCH_IP_DSCP, /* IP DSCP (6 bits in ToS field). */
76  OF1X_MATCH_IP_ECN, /* IP ECN (2 bits in ToS field). */
77  OF1X_MATCH_IP_PROTO, /* IP protocol. */ //required
78  OF1X_MATCH_IPV4_SRC, /* IPv4 source address. */ //required
79  OF1X_MATCH_IPV4_DST, /* IPv4 destination address. */ //required
80 
81  /* ipv6 */
82  OF1X_MATCH_IPV6_SRC, /* IPv6 source address. */ //required
83  OF1X_MATCH_IPV6_DST, /* IPv6 destination address. */ //required
84  OF1X_MATCH_IPV6_FLABEL, /* IPv6 Flow Label */
85  OF1X_MATCH_ICMPV6_TYPE, /* ICMPv6 type. */
86  OF1X_MATCH_ICMPV6_CODE, /* ICMPv6 code. */
87  OF1X_MATCH_IPV6_ND_TARGET, /* Target address for ND. */
88  OF1X_MATCH_IPV6_ND_SLL, /* Source link-layer for ND. */
89  OF1X_MATCH_IPV6_ND_TLL, /* Target link-layer for ND. */
90  OF1X_MATCH_IPV6_EXTHDR, /* Extension header */
91 
92  /* transport */
93  OF1X_MATCH_TP_SRC, /* TCP/UDP source port. OF10 ONLY */ //required
94  OF1X_MATCH_TP_DST, /* TCP/UDP dest port. OF10 ONLY */ //required
95  OF1X_MATCH_TCP_SRC, /* TCP source port. */ //required
96  OF1X_MATCH_TCP_DST, /* TCP destination port. */ //required
97  OF1X_MATCH_UDP_SRC, /* UDP source port. */ //required
98  OF1X_MATCH_UDP_DST, /* UDP destination port. */ //required
99  OF1X_MATCH_SCTP_SRC, /* SCTP source port. */
100  OF1X_MATCH_SCTP_DST, /* SCTP destination port. */
101  OF1X_MATCH_ICMPV4_TYPE, /* ICMP type. */
102  OF1X_MATCH_ICMPV4_CODE, /* ICMP code. */
103 
104  /* other */
105  OF1X_MATCH_PBB_ISID,
106  OF1X_MATCH_TUNNEL_ID,
107 
108  /********************************/
109  /**** Extensions out of spec ****/
110  /********************************/
111 
112  /* PPP/PPPoE related extensions */
113  OF1X_MATCH_PPPOE_CODE, /* PPPoE code */
114  OF1X_MATCH_PPPOE_TYPE, /* PPPoE type */
115  OF1X_MATCH_PPPOE_SID, /* PPPoE session id */
116  OF1X_MATCH_PPP_PROT, /* PPP protocol */
117 
118  /* GTP related extensions */
119  OF1X_MATCH_GTP_MSG_TYPE, /* GTP message type */
120  OF1X_MATCH_GTP_TEID, /* GTP teid */
121 
122  /* CAPWAP related extensions */
123  OF1X_MATCH_CAPWAP_WBID, /* CAPWAP WBID */
124  OF1X_MATCH_CAPWAP_RID, /* CAPWAP RID */
125  OF1X_MATCH_CAPWAP_FLAGS, /* CAPWAP FLAGS */
126 
127  /* WLAN related extensions */
128  OF1X_MATCH_WLAN_FC, /* WLAN fc */
129  OF1X_MATCH_WLAN_TYPE, /* WLAN type */
130  OF1X_MATCH_WLAN_SUBTYPE, /* WLAN subtype */
131  OF1X_MATCH_WLAN_DIRECTION, /* WLAN direction */
132  OF1X_MATCH_WLAN_ADDRESS_1, /* WLAN address 1 */
133  OF1X_MATCH_WLAN_ADDRESS_2, /* WLAN address 2 */
134  OF1X_MATCH_WLAN_ADDRESS_3, /* WLAN address 3 */
135 
136  /* GRE related extensions */
137  OF1X_MATCH_GRE_VERSION, /* GRE version */
138  OF1X_MATCH_GRE_PROT_TYPE, /* GRE protocol types */
139  OF1X_MATCH_GRE_KEY, /* GRE key */
140 
141  /* max value */
142  OF1X_MATCH_MAX,
143 }of1x_match_type_t;
144 
145 //Specific flags for vlans
146 enum of1x_vlan_present{
147  OF1X_MATCH_VLAN_NONE=0,
148  OF1X_MATCH_VLAN_ANY=1,
149  OF1X_MATCH_VLAN_SPECIFIC=2,
150 };
151 
152 typedef struct of1x_match{
153 
154  //Type
155  of1x_match_type_t type;
156 
157  //Ternary value
158  utern_t* __tern;
159 
160  //Previous entry
161  struct of1x_match* prev;
162 
163  //Next entry
164  struct of1x_match* next;
165 
166  /* Fast validation flags */
167  //Bitmap of required OF versions
168  of1x_ver_req_t ver_req;
169 
170  //VLAN only (blame OF spec)
171  enum of1x_vlan_present vlan_present;
172 
173  //OF1.0 only
174  bool has_wildcard;
175 }of1x_match_t;
176 
177 
178 /* Match group, using a double-linked-list */
179 typedef struct of1x_match_group{
180  //Double linked list
181  of1x_match_t* head;
182  of1x_match_t* tail;
183 
184  //Num of matches
185  unsigned int num_elements;
186 
187  /* Fast validation flags */
188  //Required OF versions
189  of1x_ver_req_t ver_req;
190 
191  //bitmaps of matches and wilcards
192  bitmap128_t match_bm;
193  bitmap128_t wildcard_bm;
194  bitmap128_t of10_wildcard_bm; //OF1.0 only
196 
197 
198 /*
199 *
200 * Initializers per match
201 *
202 */
203 
204 //C++ extern C
205 ROFL_BEGIN_DECLS
206 
207 //Phy
213 of1x_match_t* of1x_init_port_in_match(uint32_t value);
220 
221 
222 //METADATA
228 of1x_match_t* of1x_init_metadata_match(uint64_t value, uint64_t mask);
229 
230 //ETHERNET
236 of1x_match_t* of1x_init_eth_dst_match(uint64_t value, uint64_t mask);
242 of1x_match_t* of1x_init_eth_src_match(uint64_t value, uint64_t mask);
248 of1x_match_t* of1x_init_eth_type_match(uint16_t value);
249 
250 //8021.q
256 of1x_match_t* of1x_init_vlan_vid_match(uint16_t value, uint16_t mask, enum of1x_vlan_present vlan_present);
257 
263 of1x_match_t* of1x_init_vlan_pcp_match(uint8_t value);
264 
265 //MPLS
277 of1x_match_t* of1x_init_mpls_tc_match(uint8_t value);
283 of1x_match_t* of1x_init_mpls_bos_match(uint8_t value);
284 
285 //ARP
297 of1x_match_t* of1x_init_arp_tha_match(uint64_t value, uint64_t mask);
303 of1x_match_t* of1x_init_arp_sha_match(uint64_t value, uint64_t mask);
309 of1x_match_t* of1x_init_arp_tpa_match(uint32_t value, uint32_t mask);
315 of1x_match_t* of1x_init_arp_spa_match(uint32_t value, uint32_t mask);
316 
317 //PPPoE
336 
337 //PPP
343 of1x_match_t* of1x_init_ppp_prot_match(uint16_t value);
344 
345 //GTP
357 of1x_match_t* of1x_init_gtp_teid_match(uint32_t value, uint32_t mask);
358 
359 //CAPWAP
365 of1x_match_t* of1x_init_capwap_wbid_match(uint8_t value, uint8_t mask);
371 of1x_match_t* of1x_init_capwap_rid_match(uint8_t value, uint8_t mask);
377 of1x_match_t* of1x_init_capwap_flags_match(uint16_t value, uint16_t mask);
378 
379 //WLAN
385 of1x_match_t* of1x_init_wlan_fc_match(uint16_t value, uint16_t mask);
391 of1x_match_t* of1x_init_wlan_type_match(uint8_t value, uint8_t mask);
397 of1x_match_t* of1x_init_wlan_subtype_match(uint8_t value, uint8_t mask);
403 of1x_match_t* of1x_init_wlan_direction_match(uint8_t value, uint8_t mask);
409 of1x_match_t* of1x_init_wlan_address_1_match(uint64_t value, uint64_t mask);
415 of1x_match_t* of1x_init_wlan_address_2_match(uint64_t value, uint64_t mask);
421 of1x_match_t* of1x_init_wlan_address_3_match(uint64_t value, uint64_t mask);
422 
423 //NW
429 of1x_match_t* of1x_init_nw_proto_match(uint8_t value);
435 of1x_match_t* of1x_init_nw_src_match(uint32_t value, uint32_t mask);
441 of1x_match_t* of1x_init_nw_dst_match(uint32_t value, uint32_t mask);
442 
443 //GRE
461 of1x_match_t* of1x_init_gre_key_match(uint32_t value);
462 
463 //IP
469 of1x_match_t* of1x_init_ip_proto_match(uint8_t value);
475 of1x_match_t* of1x_init_ip_ecn_match(uint8_t value);
481 of1x_match_t* of1x_init_ip_dscp_match(uint8_t value);
482 
483 //IPv4
489 of1x_match_t* of1x_init_ip4_src_match(uint32_t value, uint32_t mask);
495 of1x_match_t* of1x_init_ip4_dst_match(uint32_t value, uint32_t mask);
496 
497 //TCP
503 of1x_match_t* of1x_init_tcp_src_match(uint16_t value);
509 of1x_match_t* of1x_init_tcp_dst_match(uint16_t value);
510 
511 //UDP
517 of1x_match_t* of1x_init_udp_src_match(uint16_t value);
523 of1x_match_t* of1x_init_udp_dst_match(uint16_t value);
524 
525 //SCTP
531 of1x_match_t* of1x_init_sctp_src_match(uint16_t value);
537 of1x_match_t* of1x_init_sctp_dst_match(uint16_t value);
538 
539 //TP
545 of1x_match_t* of1x_init_tp_src_match(uint16_t value);
551 of1x_match_t* of1x_init_tp_dst_match(uint16_t value);
552 
553 
554 //ICMPv4
567 
568 //IPv6
586 of1x_match_t* of1x_init_ip6_flabel_match(uint32_t value, uint32_t mask);
610 of1x_match_t* of1x_init_ip6_exthdr_match(uint16_t value, uint16_t mask);
611 
612 //ICMPv6
625 
626 /*
627  * @brief Create an PBB_ISD match
628  * @ingroup core_of1x
629  */
630 of1x_match_t* of1x_init_pbb_isid_match(uint32_t value, uint32_t mask);
631 
637 of1x_match_t* of1x_init_tunnel_id_match(uint64_t value, uint64_t mask);
638 
639 //TODO
640 //Add more here...
641 
646 void of1x_destroy_match(of1x_match_t* match);
647 
648 //
649 //Getters for values
650 //
651 
652 //8 bit
653 static inline
654 uint8_t __of1x_get_match_val8(const of1x_match_t* match, bool get_mask, bool raw_nbo){
655 
656  wrap_uint_t* wrap;
657 
658  if(get_mask)
659  wrap = &match->__tern->mask;
660  else
661  wrap = &match->__tern->value;
662 
663  if(raw_nbo)
664  return wrap->u8;
665 
666  switch(match->type){
667  case OF1X_MATCH_VLAN_PCP:
668  return OF1X_VLAN_PCP_VALUE(wrap->u8);
669  case OF1X_MATCH_MPLS_TC:
670  return OF1X_MPLS_TC_VALUE(wrap->u8);
671  case OF1X_MATCH_MPLS_BOS:
672  case OF1X_MATCH_NW_PROTO:
673  case OF1X_MATCH_IP_PROTO:
674  case OF1X_MATCH_IP_ECN:
675  case OF1X_MATCH_ICMPV4_TYPE:
676  case OF1X_MATCH_ICMPV4_CODE:
677  case OF1X_MATCH_ICMPV6_TYPE:
678  case OF1X_MATCH_ICMPV6_CODE:
679  case OF1X_MATCH_PPPOE_TYPE:
680  case OF1X_MATCH_PPPOE_CODE:
681  case OF1X_MATCH_GTP_MSG_TYPE:
682  return wrap->u8;
683  case OF1X_MATCH_IP_DSCP:
684  return OF1X_IP_DSCP_VALUE(wrap->u8);
685  default:{
686  //ROFL_PIPELINE_ERR("%s: Match type %u not found\n",__func__,match->type);
687  assert(0);
688  return 0x0;
689  }
690  }
691 }
692 
699 static inline
700 uint8_t of1x_get_match_value8(const of1x_match_t* match){
701  return __of1x_get_match_val8(match, false, false);
702 }
703 
704 
705 //16 bit
706 static inline
707 uint16_t __of1x_get_match_val16(const of1x_match_t* match, bool get_mask, bool raw_nbo){
708 
709  wrap_uint_t* wrap;
710 
711  if(get_mask)
712  wrap = &match->__tern->mask;
713  else
714  wrap = &match->__tern->value;
715 
716 
717  if(raw_nbo)
718  return wrap->u16;
719 
720  switch(match->type){
721  case OF1X_MATCH_ETH_TYPE:
722  case OF1X_MATCH_VLAN_VID:
723  case OF1X_MATCH_ARP_OP:
724  case OF1X_MATCH_TCP_SRC:
725  case OF1X_MATCH_TCP_DST:
726  case OF1X_MATCH_UDP_SRC:
727  case OF1X_MATCH_UDP_DST:
728  case OF1X_MATCH_SCTP_SRC:
729  case OF1X_MATCH_SCTP_DST:
730  case OF1X_MATCH_TP_SRC:
731  case OF1X_MATCH_TP_DST:
732  case OF1X_MATCH_PPPOE_SID:
733  case OF1X_MATCH_PPP_PROT:
734  case OF1X_MATCH_IPV6_EXTHDR:
735  case OF1X_MATCH_GRE_VERSION:
736  case OF1X_MATCH_GRE_PROT_TYPE:
737  return NTOHB16(wrap->u16);
738  default:{
739  //ROFL_PIPELINE_ERR("%s: Match type %u not found\n",__func__,match->type);
740  assert(0);
741  return 0x0;
742  }
743  }
744 }
751 static inline
752 uint16_t of1x_get_match_value16(const of1x_match_t* match){
753  return __of1x_get_match_val16(match, false, false);
754 }
755 
756 //32 bit
757 static inline
758 uint32_t __of1x_get_match_val32(const of1x_match_t* match, bool get_mask, bool raw_nbo){
759 
760  wrap_uint_t* wrap;
761 
762  if(get_mask)
763  wrap = &match->__tern->mask;
764  else
765  wrap = &match->__tern->value;
766 
767 
768  if(raw_nbo)
769  return wrap->u32;
770 
771  switch(match->type){
772  case OF1X_MATCH_IN_PORT:
773  case OF1X_MATCH_IN_PHY_PORT:
774  return wrap->u32;
775  case OF1X_MATCH_MPLS_LABEL:
776  return OF1X_MPLS_LABEL_VALUE(NTOHB32(wrap->u32));
777  case OF1X_MATCH_ARP_TPA:
778  case OF1X_MATCH_ARP_SPA:
779  case OF1X_MATCH_NW_SRC:
780  case OF1X_MATCH_NW_DST:
781  case OF1X_MATCH_IPV4_SRC:
782  case OF1X_MATCH_IPV4_DST:
783  case OF1X_MATCH_GTP_TEID:
784  case OF1X_MATCH_PBB_ISID:
785  case OF1X_MATCH_GRE_KEY:
786  return NTOHB32(wrap->u32);
787  case OF1X_MATCH_IPV6_FLABEL:
788  return OF1X_IP6_FLABEL_VALUE(NTOHB32(wrap->u32));
789  default:{
790  //ROFL_PIPELINE_ERR("%s: Match type %u not found\n",__func__,match->type);
791  assert(0);
792  return 0x0;
793  }
794  }
795 
796 }
804 static inline
805 uint32_t of1x_get_match_value32(const of1x_match_t* match){
806  return __of1x_get_match_val32(match, false, false);
807 }
808 
809 //64 bit
810 static inline
811 uint64_t __of1x_get_match_val64(const of1x_match_t* match, bool get_mask, bool raw_nbo){
812 
813  wrap_uint_t* wrap;
814 
815  if(get_mask)
816  wrap = &match->__tern->mask;
817  else
818  wrap = &match->__tern->value;
819 
820 
821  if(raw_nbo)
822  return wrap->u64;
823 
824  switch(match->type){
825  case OF1X_MATCH_METADATA:
826  case OF1X_MATCH_TUNNEL_ID:
827  return wrap->u64;
828  break;
829  case OF1X_MATCH_ETH_DST:
830  case OF1X_MATCH_ETH_SRC:
831  case OF1X_MATCH_ARP_THA:
832  case OF1X_MATCH_ARP_SHA:
833  case OF1X_MATCH_IPV6_ND_SLL:
834  case OF1X_MATCH_IPV6_ND_TLL:
835  return OF1X_MAC_VALUE(NTOHB64(wrap->u64));
836  break;
837  default:{
838  //ROFL_PIPELINE_ERR("%s: Match type %u not found\n",__func__,match->type);
839  assert(0);
840  return 0x0;
841  }
842  }
843 }
850 static inline
851 uint64_t of1x_get_match_value64(const of1x_match_t* match){
852  return __of1x_get_match_val64(match, false, false);
853 }
854 
855 //128 bit
856 static inline
857 uint128__t __of1x_get_match_val128(const of1x_match_t* match, bool get_mask, bool raw_nbo){
858  uint128__t tmp;
859  wrap_uint_t* wrap;
860 
861  if(get_mask)
862  wrap = &match->__tern->mask;
863  else
864  wrap = &match->__tern->value;
865 
866  if(raw_nbo)
867  return wrap->u128;
868 
869  switch(match->type){
870  case OF1X_MATCH_IPV6_SRC:
871  case OF1X_MATCH_IPV6_DST:
872  case OF1X_MATCH_IPV6_ND_TARGET:
873  tmp = wrap->u128;
874  NTOHB128(tmp);
875  return tmp;
876  default:{
877  //ROFL_PIPELINE_ERR("%s: Match type %u not found\n",__func__,match->type);
878  assert(0);
879  return tmp;
880  }
881  }
882 }
883 
890 static inline
892  return __of1x_get_match_val128(match, false, false);
893 }
894 
895 //
896 //Getters for masks
897 //
898 
905 static inline
906 uint8_t of1x_get_match_mask8(const of1x_match_t* match){
907  return __of1x_get_match_val8(match, true, false);
908 }
909 
916 static inline
917 uint16_t of1x_get_match_mask16(const of1x_match_t* match){
918  return __of1x_get_match_val16(match, true, false);
919 }
920 
927 static inline
928 uint32_t of1x_get_match_mask32(const of1x_match_t* match){
929  return __of1x_get_match_val32(match, true, false);
930 }
931 
938 static inline
939 uint64_t of1x_get_match_mask64(const of1x_match_t* match){
940  return __of1x_get_match_val64(match, true, false);
941 }
942 
949 static inline
951  return __of1x_get_match_val128(match, true, false);
952 }
953 
954 //
955 // End of getters
956 //
957 
958 /* match group */
959 void __of1x_init_match_group(of1x_match_group_t* group);
960 void __of1x_destroy_match_group(of1x_match_group_t* group);
961 void __of1x_match_group_push_back(of1x_match_group_t* group, of1x_match_t* match);
962 
963 /* Push match at the end of the match */
964 rofl_result_t __of1x_add_match(of1x_match_t* root_match, of1x_match_t* add_match);
965 
966 /*
967 * Whole (linked list) Match copy
968 */
969 of1x_match_t* __of1x_copy_matches(of1x_match_t* matches);
970 
971 
972 /*
973 * Get alike match
974 */
975 of1x_match_t* __of1x_get_alike_match(of1x_match_t* match1, of1x_match_t* match2);
976 
977 /*
978 * Matching
979 */
980 bool __of1x_equal_matches(of1x_match_t* match1, of1x_match_t* match2);
981 bool __of1x_is_submatch(of1x_match_t* sub_match, of1x_match_t* match);
982 
983 
984 /*
985 * OF1.0 specific behaviour for wildcard
986 */
987 static inline bool __of10_is_wildcard(of1x_match_group_t* matches){
988  return !bitmap128_is_empty(&matches->of10_wildcard_bm);
989 }
990 
991 /*
992 * Dumping
993 */
994 void __of1x_dump_matches(of1x_match_t* matches, bool raw_nbo);
995 
996 //C++ extern C
997 ROFL_END_DECLS
998 
999 #endif //OF1X_MATCH
of1x_match_t * of1x_init_ip6_flabel_match(uint32_t value, uint32_t mask)
Create an IP6_FLABEL match.
Definition: of1x_match.c:648
of1x_match_t * of1x_init_tunnel_id_match(uint64_t value, uint64_t mask)
Create an TUNNEL_ID match.
Definition: of1x_match.c:1055
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.
Definition: of1x_match.h:917
of1x_match_t * of1x_init_tp_dst_match(uint16_t value)
Create an TP_DST match (TCP/UDP), OF1.0 ONLY!
Definition: of1x_match.c:966
of1x_match_t * of1x_init_arp_sha_match(uint64_t value, uint64_t mask)
Create an ARP_SHA match.
Definition: of1x_match.c:326
of1x_match_t * of1x_init_capwap_wbid_match(uint8_t value, uint8_t mask)
Create a CAPWAP_WBID match.
Definition: of1x_match.c:1213
of1x_match_t * of1x_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)
Definition: of1x_match.c:159
of1x_match_t * of1x_init_pppoe_code_match(uint8_t value)
Create an PPPOE_CODE match.
Definition: of1x_match.c:1085
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.
Definition: of1x_match.h:939
of1x_match_t * of1x_init_mpls_label_match(uint32_t value)
Create an MPLS_LABEL match.
Definition: of1x_match.c:212
of1x_match_t * of1x_init_ip4_dst_match(uint32_t value, uint32_t mask)
Create an IP4_DST match.
Definition: of1x_match.c:505
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.
Definition: of1x_match.h:928
of1x_match_t * of1x_init_gre_version_match(uint16_t value)
Create a GRE_VERSION match.
Definition: of1x_match.c:1455
of1x_match_t * of1x_init_wlan_address_2_match(uint64_t value, uint64_t mask)
Create an WLAN_ADDRESS_2 match.
Definition: of1x_match.c:1402
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.
Definition: of1x_match.h:805
of1x_match_t * of1x_init_capwap_rid_match(uint8_t value, uint8_t mask)
Create a CAPWAP_RID match.
Definition: of1x_match.c:1235
of1x_match_t * of1x_init_port_in_phy_match(uint32_t value)
Create an PHY_PORT_IN match.
Definition: of1x_match.c:38
of1x_match_t * of1x_init_ip6_src_match(uint128__t value, uint128__t mask)
Create an IP6_SRC match.
Definition: of1x_match.c:594
of1x_match_t * of1x_init_eth_type_match(uint16_t value)
Create an ETH_TYPE match.
Definition: of1x_match.c:136
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.
Definition: of1x_match.h:752
of1x_match_t * of1x_init_eth_dst_match(uint64_t value, uint64_t mask)
Create an ETH_DST match.
Definition: of1x_match.c:83
of1x_match_t * of1x_init_gtp_msg_type_match(uint8_t value)
Create an PPP_PROTO match.
Definition: of1x_match.c:1168
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.
Definition: of1x_match.h:906
of1x_match_t * of1x_init_gtp_teid_match(uint32_t value, uint32_t mask)
Create an PPP_PROTO match.
Definition: of1x_match.c:1187
of1x_match_t * of1x_init_mpls_tc_match(uint8_t value)
Create an MPLS_TC match.
Definition: of1x_match.c:234
of1x_match_t * of1x_init_wlan_subtype_match(uint8_t value, uint8_t mask)
Create a WLAN_SUBTYPE match.
Definition: of1x_match.c:1332
of1x_match_t * of1x_init_wlan_fc_match(uint16_t value, uint16_t mask)
Create a WLAN_FC match.
Definition: of1x_match.c:1284
of1x_match_t * of1x_init_icmpv4_type_match(uint8_t value)
Create an ICMPv4_TYPE match.
Definition: of1x_match.c:989
of1x_match_t * of1x_init_vlan_pcp_match(uint8_t value)
Create an VLAN_PCP match.
Definition: of1x_match.c:188
of1x_match_t * of1x_init_icmpv6_code_match(uint8_t value)
Create an ICMPV6_CODE match.
Definition: of1x_match.c:784
of1x_match_t * of1x_init_mpls_bos_match(uint8_t value)
Create an MPLS_BOS match.
Definition: of1x_match.c:256
void of1x_destroy_match(of1x_match_t *match)
Destroys whichever match previously created using of1x_init_match_*()
Definition: of1x_match.c:1687
of1x_match_t * of1x_init_capwap_flags_match(uint16_t value, uint16_t mask)
Create a CAPWAP_FLAGS match.
Definition: of1x_match.c:1257
of1x_match_t * of1x_init_arp_tpa_match(uint32_t value, uint32_t mask)
Create an ARP_TPA match.
Definition: of1x_match.c:352
of1x_match_t * of1x_init_ip_ecn_match(uint8_t value)
Create an IPC_ECN match.
Definition: of1x_match.c:573
of1x_match_t * of1x_init_nw_dst_match(uint32_t value, uint32_t mask)
Create an NW_DST match (IP/ARP), OF1.0 ONLY!
Definition: of1x_match.c:451
ROFL_BEGIN_DECLS of1x_match_t * of1x_init_port_in_match(uint32_t value)
Create an PORT_IN match.
Definition: of1x_match.c:18
of1x_match_t * of1x_init_arp_spa_match(uint32_t value, uint32_t mask)
Create an ARP_SPA match.
Definition: of1x_match.c:378
static bool bitmap128_is_empty(bitmap128_t *bitmap)
Is bitmap empty.
Definition: bitmap.h:75
of1x_match_t * of1x_init_ip_dscp_match(uint8_t value)
Create an IP_DSCP match.
Definition: of1x_match.c:550
of1x_match_t * of1x_init_gre_prot_type_match(uint16_t value)
Create a GRE_PROT_TYPE match.
Definition: of1x_match.c:1476
of1x_match_t * of1x_init_arp_tha_match(uint64_t value, uint64_t mask)
Create an ARP_THA match.
Definition: of1x_match.c:299
of1x_match_t * of1x_init_gre_key_match(uint32_t value)
Create a GRE_KEY match.
Definition: of1x_match.c:1497
of1x_match_t * of1x_init_wlan_direction_match(uint8_t value, uint8_t mask)
Create a WLAN_DIRECTION match.
Definition: of1x_match.c:1354
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.
Definition: of1x_match.h:950
of1x_match_t * of1x_init_nw_proto_match(uint8_t value)
Create an NW_PROTO match, OF1.0 ONLY!
Definition: of1x_match.c:406
of1x_match_t * of1x_init_wlan_address_3_match(uint64_t value, uint64_t mask)
Create an WLAN_ADDRESS_3 match.
Definition: of1x_match.c:1428
of1x_match_t * of1x_init_wlan_address_1_match(uint64_t value, uint64_t mask)
Create an WLAN_ADDRESS_1 match.
Definition: of1x_match.c:1376
of1x_match_t * of1x_init_arp_opcode_match(uint16_t value)
Create an ARP_OPCODE match.
Definition: of1x_match.c:277
of1x_match_t * of1x_init_sctp_src_match(uint16_t value)
Create an SCTP_SRC match.
Definition: of1x_match.c:897
of1x_match_t * of1x_init_ip4_src_match(uint32_t value, uint32_t mask)
Create an IP4_SRC match.
Definition: of1x_match.c:479
of1x_match_t * of1x_init_ip6_dst_match(uint128__t value, uint128__t mask)
Create an IP6_DST match.
Definition: of1x_match.c:621
of1x_match_t * of1x_init_ip6_nd_tll_match(uint64_t value)
Create an IP6_ND_TLL match.
Definition: of1x_match.c:717
of1x_match_t * of1x_init_icmpv4_code_match(uint8_t value)
Create an ICMPv4_CODE match.
Definition: of1x_match.c:1008
of1x_match_t * of1x_init_tp_src_match(uint16_t value)
Create an TP_SRC match (TCP/UDP), OF1.0 ONLY!
Definition: of1x_match.c:944
of1x_match_t * of1x_init_ip6_exthdr_match(uint16_t value, uint16_t mask)
Create an IP6_EXTHDR match.
Definition: of1x_match.c:739
of1x_match_t * of1x_init_tcp_dst_match(uint16_t value)
Create an TCP_DST match.
Definition: of1x_match.c:828
of1x_match_t * of1x_init_pppoe_type_match(uint8_t value)
Create an PPPOE_TYPE match.
Definition: of1x_match.c:1104
of1x_match_t * of1x_init_ip6_nd_target_match(uint128__t value)
Create an IP6_ND_TARGET match.
Definition: of1x_match.c:671
of1x_match_t * of1x_init_sctp_dst_match(uint16_t value)
Create an SCTP_DST match.
Definition: of1x_match.c:920
of1x_match_t * of1x_init_metadata_match(uint64_t value, uint64_t mask)
Create an METADATA match.
Definition: of1x_match.c:59
of1x_match_t * of1x_init_udp_src_match(uint16_t value)
Create an UDP_SRC match.
Definition: of1x_match.c:851
of1x_match_t * of1x_init_wlan_type_match(uint8_t value, uint8_t mask)
Create a WLAN_TYPE match.
Definition: of1x_match.c:1310
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.
Definition: of1x_match.h:851
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.
Definition: of1x_match.h:700
of1x_match_t * of1x_init_udp_dst_match(uint16_t value)
Create an UDP_DST match.
Definition: of1x_match.c:873
of1x_match_t * of1x_init_ip6_nd_sll_match(uint64_t value)
Create an IP6_ND_SLL match.
Definition: of1x_match.c:695
of1x_match_t * of1x_init_pppoe_session_match(uint16_t value)
Create an PPPOE_SESSION match.
Definition: of1x_match.c:1123
of1x_match_t * of1x_init_nw_src_match(uint32_t value, uint32_t mask)
Create an NW_SRC match (IP/ARP), OF1.0 ONLY!
Definition: of1x_match.c:425
of1x_match_t * of1x_init_ip_proto_match(uint8_t value)
Create an IP_PROTO match.
Definition: of1x_match.c:531
of1x_match_t * of1x_init_ppp_prot_match(uint16_t value)
Create an PPP_PROTO match.
Definition: of1x_match.c:1145
of1x_match_t * of1x_init_icmpv6_type_match(uint8_t value)
Create an ICMPV6_TYPE match.
Definition: of1x_match.c:765
of1x_match_t * of1x_init_tcp_src_match(uint16_t value)
Create an TCP_SRC match.
Definition: of1x_match.c:805
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.
Definition: of1x_match.h:891
of1x_match_t * of1x_init_eth_src_match(uint64_t value, uint64_t mask)
Create an ETH_SRC match.
Definition: of1x_match.c:110