include: Use #include <.*> in public headers.
[cascardo/ovs.git] / include / openflow / openflow-1.5.h
1 /* Copyright (c) 2008, 2014 The Board of Trustees of The Leland Stanford
2 * Junior University
3 * Copyright (c) 2011, 2014 Open Networking Foundation
4 *
5 * We are making the OpenFlow specification and associated documentation
6 * (Software) available for public use and benefit with the expectation
7 * that others will use, modify and enhance the Software and contribute
8 * those enhancements back to the community. However, since we would
9 * like to make the Software available for broadest use, with as few
10 * restrictions as possible permission is hereby granted, free of
11 * charge, to any person obtaining a copy of this Software to deal in
12 * the Software under the copyrights without restriction, including
13 * without limitation the rights to use, copy, modify, merge, publish,
14 * distribute, sublicense, and/or sell copies of the Software, and to
15 * permit persons to whom the Software is furnished to do so, subject to
16 * the following conditions:
17 *
18 * The above copyright notice and this permission notice shall be
19 * included in all copies or substantial portions of the Software.
20 *
21 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
23 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
24 * NONINFRINGEMENT.  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
25 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
26 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
27 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28 * SOFTWARE.
29 *
30 * The name and trademarks of copyright holder(s) may NOT be used in
31 * advertising or publicity pertaining to the Software or any
32 * derivatives without specific, written prior permission.
33 */
34
35 /* OpenFlow: protocol between controller and datapath. */
36
37 #ifndef OPENFLOW_15_H
38 #define OPENFLOW_15_H 1
39
40 #include <openflow/openflow-common.h>
41
42 /* Group commands */
43 enum ofp15_group_mod_command {
44     /* Present since OpenFlow 1.1 - 1.4 */
45     OFPGC15_ADD    = 0,       /* New group. */
46     OFPGC15_MODIFY = 1,       /* Modify all matching groups. */
47     OFPGC15_DELETE = 2,       /* Delete all matching groups. */
48
49     /* New in OpenFlow 1.5 */
50     OFPGC15_INSERT_BUCKET = 3,/* Insert action buckets to the already available
51                                  list of action buckets in a matching group */
52     OFPGC15_REMOVE_BUCKET = 5,/* Remove all action buckets or any specific
53                                  action bucket from matching group */
54 };
55
56 /* Group bucket property types.  */
57 enum ofp15_group_bucket_prop_type {
58     OFPGBPT15_WEIGHT                 = 0,  /* Select groups only. */
59     OFPGBPT15_WATCH_PORT             = 1,  /* Fast failover groups only. */
60     OFPGBPT15_WATCH_GROUP            = 2,  /* Fast failover groups only. */
61     OFPGBPT15_EXPERIMENTER      = 0xFFFF,  /* Experimenter defined. */
62 };
63
64 /* Group bucket weight property, for select groups only. */
65 struct ofp15_group_bucket_prop_weight {
66     ovs_be16         type;    /* OFPGBPT15_WEIGHT. */
67     ovs_be16         length;  /* 8. */
68     ovs_be16         weight;  /* Relative weight of bucket. */
69     uint8_t          pad[2];  /* Pad to 64 bits. */
70 };
71 OFP_ASSERT(sizeof(struct ofp15_group_bucket_prop_weight) == 8);
72
73 /* Group bucket watch port or watch group property, for fast failover groups
74  * only. */
75 struct ofp15_group_bucket_prop_watch {
76     ovs_be16         type;    /* OFPGBPT15_WATCH_PORT or OFPGBPT15_WATCH_GROUP. */
77     ovs_be16         length;  /* 8. */
78     ovs_be32         watch;   /* The port or the group.  */
79 };
80 OFP_ASSERT(sizeof(struct ofp15_group_bucket_prop_watch) == 8);
81
82 /* Bucket for use in groups. */
83 struct ofp15_bucket {
84     ovs_be16 len;                   /* Length the bucket in bytes, including
85                                        this header and any padding to make it
86                                        64-bit aligned. */
87     ovs_be16 actions_len;           /* Length of all actions in bytes. */
88     ovs_be32 bucket_id;             /* Bucket Id used to identify bucket*/
89     /* Followed by exactly len - 8 bytes of group bucket properties. */
90     /* Followed by:
91      *   - Exactly 'actions_len' bytes containing an array of
92      *     struct ofp_action_*.
93      *   - Zero or more bytes of group bucket properties to fill out the
94      *     overall length in header.length. */
95 };
96 OFP_ASSERT(sizeof(struct ofp15_bucket) == 8);
97
98 /* Bucket Id can be any value between 0 and OFPG_BUCKET_MAX */
99 enum ofp15_group_bucket {
100     OFPG15_BUCKET_MAX   = 0xffffff00, /* Last usable bucket ID */
101     OFPG15_BUCKET_FIRST = 0xfffffffd, /* First bucket ID in the list of action
102                                          buckets of a group. This is applicable
103                                          for OFPGC15_INSERT_BUCKET and
104                                          OFPGC15_REMOVE_BUCKET commands */
105     OFPG15_BUCKET_LAST  = 0xfffffffe, /* Last bucket ID in the list of action
106                                          buckets of a group. This is applicable
107                                          for OFPGC15_INSERT_BUCKET and
108                                          OFPGC15_REMOVE_BUCKET commands */
109     OFPG15_BUCKET_ALL   = 0xffffffff  /* All action buckets in a group,
110                                          This is applicable for
111                                          only OFPGC15_REMOVE_BUCKET command */
112 };
113
114 /* Group property types.  */
115 enum ofp_group_prop_type {
116     OFPGPT15_EXPERIMENTER      = 0xFFFF,  /* Experimenter defined. */
117 };
118
119 /* Group setup and teardown (controller -> datapath). */
120 struct ofp15_group_mod {
121     ovs_be16 command;             /* One of OFPGC15_*. */
122     uint8_t type;                 /* One of OFPGT11_*. */
123     uint8_t pad;                  /* Pad to 64 bits. */
124     ovs_be32 group_id;            /* Group identifier. */
125     ovs_be16 bucket_list_len;     /* Length of action buckets data. */
126     uint8_t pad1[2];              /* Pad to 64 bits. */
127     ovs_be32 command_bucket_id;   /* Bucket Id used as part of
128                                    * OFPGC15_INSERT_BUCKET and
129                                    * OFPGC15_REMOVE_BUCKET commands
130                                    * execution.*/
131     /* Followed by:
132      *   - Exactly 'bucket_list_len' bytes containing an array of
133      *     struct ofp15_bucket.
134      *   - Zero or more bytes of group properties to fill out the overall
135      *     length in header.length. */
136 };
137 OFP_ASSERT(sizeof(struct ofp15_group_mod) == 16);
138
139 /* Body of reply to OFPMP_GROUP_DESC request. */
140 struct ofp15_group_desc_stats {
141     ovs_be16 length;              /* Length of this entry. */
142     uint8_t type;                 /* One of OFPGT11_*. */
143     uint8_t pad;                  /* Pad to 64 bits. */
144     ovs_be32 group_id;            /* Group identifier. */
145     ovs_be16 bucket_list_len;     /* Length of action buckets data. */
146     uint8_t pad2[6];              /* Pad to 64 bits. */
147     /* Followed by:
148      *   - Exactly 'bucket_list_len' bytes containing an array of
149      *     struct ofp_bucket.
150      *   - Zero or more bytes of group properties to fill out the overall
151      *     length in header.length. */
152 };
153 OFP_ASSERT(sizeof(struct ofp15_group_desc_stats) == 16);
154
155 #endif /* openflow/openflow-1.5.h */