meta-flow: New library for working with fields by id.
[sliver-openvswitch.git] / lib / nx-match.def
1 /*                                                                -*- c -*-
2  * Copyright (c) 2008, 2009, 2010, 2011 Nicira Networks.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at:
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 #define DEFINE_FIELD_M(HEADER, MFF_ID, WRITABLE)  \
18     DEFINE_FIELD(HEADER,     MFF_ID, WRITABLE)        \
19     DEFINE_FIELD(HEADER##_W, MFF_ID, false)
20
21 /*             NXM_ suffix    MFF_ field ID    rw? */
22 /*             ------------   ------------   ----- */
23 DEFINE_FIELD_M(NX_TUN_ID,     MFF_TUN_ID,     true)
24 DEFINE_FIELD  (OF_IN_PORT,    MFF_IN_PORT,   false)
25 DEFINE_FIELD_M(OF_ETH_DST,    MFF_ETH_DST,    true)
26 DEFINE_FIELD  (OF_ETH_SRC,    MFF_ETH_SRC,    true)
27 DEFINE_FIELD  (OF_ETH_TYPE,   MFF_ETH_TYPE,  false)
28 DEFINE_FIELD_M(OF_VLAN_TCI,   MFF_VLAN_TCI,   true)
29 DEFINE_FIELD  (OF_IP_TOS,     MFF_IP_TOS,     true)
30 DEFINE_FIELD  (OF_IP_PROTO,   MFF_IP_PROTO,  false)
31 DEFINE_FIELD_M(OF_IP_SRC,     MFF_IPV4_SRC,   true)
32 DEFINE_FIELD_M(OF_IP_DST,     MFF_IPV4_DST,   true)
33 DEFINE_FIELD  (OF_TCP_SRC,    MFF_TCP_SRC,    true)
34 DEFINE_FIELD  (OF_TCP_DST,    MFF_TCP_DST,    true)
35 DEFINE_FIELD  (OF_UDP_SRC,    MFF_UDP_SRC,    true)
36 DEFINE_FIELD  (OF_UDP_DST,    MFF_UDP_DST,    true)
37 DEFINE_FIELD  (OF_ICMP_TYPE,  MFF_ICMP_TYPE, false)
38 DEFINE_FIELD  (OF_ICMP_CODE,  MFF_ICMP_CODE, false)
39 DEFINE_FIELD  (OF_ARP_OP,     MFF_ARP_OP,    false)
40 DEFINE_FIELD_M(OF_ARP_SPA,    MFF_ARP_SPA,   false)
41 DEFINE_FIELD_M(OF_ARP_TPA,    MFF_ARP_TPA,   false)
42 DEFINE_FIELD  (NX_ARP_SHA,    MFF_ARP_SHA,   false)
43 DEFINE_FIELD  (NX_ARP_THA,    MFF_ARP_THA,   false)
44 DEFINE_FIELD_M(NX_IPV6_SRC,   MFF_IPV6_SRC,  false)
45 DEFINE_FIELD_M(NX_IPV6_DST,   MFF_IPV6_DST,  false)
46 /* XXX should we have MFF_ICMPV4_TYPE and MFF_ICMPV6_TYPE? */
47 DEFINE_FIELD  (NX_ICMPV6_TYPE,MFF_ICMP_TYPE, false)
48 DEFINE_FIELD  (NX_ICMPV6_CODE,MFF_ICMP_CODE, false)
49 DEFINE_FIELD  (NX_ND_TARGET,  MFF_ND_TARGET, false)
50 DEFINE_FIELD  (NX_ND_SLL,     MFF_ND_SLL,    false)
51 DEFINE_FIELD  (NX_ND_TLL,     MFF_ND_TLL,    false)
52
53 DEFINE_FIELD_M(NX_REG0,       MFF_REG0,       true)
54 #if FLOW_N_REGS >= 2
55 DEFINE_FIELD_M(NX_REG1,       MFF_REG1,       true)
56 #endif
57 #if FLOW_N_REGS >= 3
58 DEFINE_FIELD_M(NX_REG2,       MFF_REG2,       true)
59 #endif
60 #if FLOW_N_REGS >= 4
61 DEFINE_FIELD_M(NX_REG3,       MFF_REG3,       true)
62 #endif
63 #if FLOW_N_REGS > 4
64 #error
65 #endif
66
67 #undef DEFINE_FIELD