summaryrefslogtreecommitdiff
path: root/include/openflow/openflow-1.5.h
blob: c146052afa6421751d1918209b766ded75909dc1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
/* Copyright (c) 2008, 2014 The Board of Trustees of The Leland Stanford
* Junior University
* Copyright (c) 2011, 2014 Open Networking Foundation
*
* We are making the OpenFlow specification and associated documentation
* (Software) available for public use and benefit with the expectation
* that others will use, modify and enhance the Software and contribute
* those enhancements back to the community. However, since we would
* like to make the Software available for broadest use, with as few
* restrictions as possible permission is hereby granted, free of
* charge, to any person obtaining a copy of this Software to deal in
* the Software under the copyrights without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT.  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
* The name and trademarks of copyright holder(s) may NOT be used in
* advertising or publicity pertaining to the Software or any
* derivatives without specific, written prior permission.
*/

/* OpenFlow: protocol between controller and datapath. */

#ifndef OPENFLOW_15_H
#define OPENFLOW_15_H 1

#include <openflow/openflow-common.h>

/* Body for ofp15_multipart_request of type OFPMP_PORT_DESC. */
struct ofp15_port_desc_request {
    ovs_be32 port_no;         /* All ports if OFPP_ANY. */
    uint8_t pad[4];            /* Align to 64 bits. */
};
OFP_ASSERT(sizeof(struct ofp15_port_desc_request) == 8);

/* Group commands */
enum ofp15_group_mod_command {
    /* Present since OpenFlow 1.1 - 1.4 */
    OFPGC15_ADD    = 0,       /* New group. */
    OFPGC15_MODIFY = 1,       /* Modify all matching groups. */
    OFPGC15_DELETE = 2,       /* Delete all matching groups. */

    /* New in OpenFlow 1.5 */
    OFPGC15_INSERT_BUCKET = 3,/* Insert action buckets to the already available
                                 list of action buckets in a matching group */
    /* OFPGCXX_YYY = 4, */    /* Reserved for future use. */
    OFPGC15_REMOVE_BUCKET = 5,/* Remove all action buckets or any specific
                                 action bucket from matching group */
    OFPGC15_ADD_OR_MOD = 0x8000, /* Create new or modify existing group. */
};

/* Group bucket property types.  */
enum ofp15_group_bucket_prop_type {
    OFPGBPT15_WEIGHT                 = 0,  /* Select groups only. */
    OFPGBPT15_WATCH_PORT             = 1,  /* Fast failover groups only. */
    OFPGBPT15_WATCH_GROUP            = 2,  /* Fast failover groups only. */
    OFPGBPT15_EXPERIMENTER      = 0xFFFF,  /* Experimenter defined. */
};

/* Bucket for use in groups. */
struct ofp15_bucket {
    ovs_be16 len;                   /* Length the bucket in bytes, including
                                       this header and any padding to make it
                                       64-bit aligned. */
    ovs_be16 action_array_len;      /* Length of all actions in bytes. */
    ovs_be32 bucket_id;             /* Bucket Id used to identify bucket*/
    /* Followed by:
     *   - Exactly 'action_array_len' bytes containing an array of
     *     struct ofp_action_*.
     *   - Zero or more bytes of group bucket properties to fill out the
     *     overall length in 'len'. */
};
OFP_ASSERT(sizeof(struct ofp15_bucket) == 8);

/* Bucket Id can be any value between 0 and OFPG_BUCKET_MAX */
enum ofp15_group_bucket {
    OFPG15_BUCKET_MAX   = 0xffffff00, /* Last usable bucket ID */
    OFPG15_BUCKET_FIRST = 0xfffffffd, /* First bucket ID in the list of action
                                         buckets of a group. This is applicable
                                         for OFPGC15_INSERT_BUCKET and
                                         OFPGC15_REMOVE_BUCKET commands */
    OFPG15_BUCKET_LAST  = 0xfffffffe, /* Last bucket ID in the list of action
                                         buckets of a group. This is applicable
                                         for OFPGC15_INSERT_BUCKET and
                                         OFPGC15_REMOVE_BUCKET commands */
    OFPG15_BUCKET_ALL   = 0xffffffff  /* All action buckets in a group,
                                         This is applicable for
                                         only OFPGC15_REMOVE_BUCKET command */
};

/* Group property types.  */
enum ofp_group_prop_type {
    OFPGPT15_EXPERIMENTER      = 0xFFFF,  /* Experimenter defined. */
};

/* Group setup and teardown (controller -> datapath). */
struct ofp15_group_mod {
    ovs_be16 command;             /* One of OFPGC15_*. */
    uint8_t type;                 /* One of OFPGT11_*. */
    uint8_t pad;                  /* Pad to 64 bits. */
    ovs_be32 group_id;            /* Group identifier. */
    ovs_be16 bucket_array_len;    /* Length of action buckets data. */
    uint8_t pad1[2];              /* Pad to 64 bits. */
    ovs_be32 command_bucket_id;   /* Bucket Id used as part of
                                   * OFPGC15_INSERT_BUCKET and
                                   * OFPGC15_REMOVE_BUCKET commands
                                   * execution.*/
    /* Followed by:
     *   - Exactly 'bucket_array_len' bytes containing an array of
     *     struct ofp15_bucket.
     *   - Zero or more bytes of group properties to fill out the overall
     *     length in header.length. */
};
OFP_ASSERT(sizeof(struct ofp15_group_mod) == 16);

/* Body for ofp15_multipart_request of type OFPMP_GROUP_DESC. */
struct ofp15_group_desc_request {
    ovs_be32 group_id;         /* All groups if OFPG_ALL. */
    uint8_t pad[4];            /* Align to 64 bits. */
};
OFP_ASSERT(sizeof(struct ofp15_group_desc_request) == 8);

/* Body of reply to OFPMP_GROUP_DESC request. */
struct ofp15_group_desc_stats {
    ovs_be16 length;              /* Length of this entry. */
    uint8_t type;                 /* One of OFPGT11_*. */
    uint8_t pad;                  /* Pad to 64 bits. */
    ovs_be32 group_id;            /* Group identifier. */
    ovs_be16 bucket_list_len;     /* Length of action buckets data. */
    uint8_t pad2[6];              /* Pad to 64 bits. */
    /* Followed by:
     *   - Exactly 'bucket_list_len' bytes containing an array of
     *     struct ofp_bucket.
     *   - Zero or more bytes of group properties to fill out the overall
     *     length in header.length. */
};
OFP_ASSERT(sizeof(struct ofp15_group_desc_stats) == 16);

/* Send packet (controller -> datapath). */
struct ofp15_packet_out {
    ovs_be32 buffer_id;         /* ID assigned by datapath (-1 if none). */
    ovs_be16 actions_len;       /* Size of action array in bytes. */
    uint8_t pad[2];
    /* Followed by:
     *   - Match
     *   - List of actions
     *   - Packet data
     */
};
OFP_ASSERT(sizeof(struct ofp15_packet_out) == 8);

/* Body of reply to OFPMP_FLOW_DESC request. */
struct ofp15_flow_desc {
    ovs_be16 length;          /* Length of this entry. */
    uint8_t pad2[2];          /* Align to 64 bits. */
    uint8_t table_id;         /* ID of table flow came from. */
    uint8_t pad;
    ovs_be16 priority;        /* Priority of the entry. */
    ovs_be16 idle_timeout;    /* Number of seconds
                                 idle before expiration. */
    ovs_be16 hard_timeout;    /* Number of seconds
                                 before expiration. */
    ovs_be16 flags;           /* Bitmap of OFPFF_*. flags. */
    ovs_be16 importance;      /* Eviction precedence. */
    ovs_be64 cookie;          /* Opaque controller issued identifier. */
};

OFP_ASSERT(sizeof(struct ofp15_flow_desc) == 24);

/* Body of reply to OFPMP_FLOW_STATS request
 * and body for OFPIT_STAT_TRIGGER generated status. */
struct ofp15_flow_stats_reply {
    ovs_be16 length;            /* Length of this entry.  */
    uint8_t pad2[2];            /* Align to 64 bits.  */
    uint8_t table_id;           /* ID of table flow came from. */
    uint8_t reason;             /* One of OFPFSR_*.  */
    ovs_be16 priority;          /* Priority of the entry.  */
};

OFP_ASSERT(sizeof(struct ofp15_flow_stats_reply) == 8);

/* OXS flow stat field types for OpenFlow basic class. */
enum oxs_ofb_stat_fields {
    OFPXST_OFB_DURATION = 0,     /* Time flow entry has been alive.  */
    OFPXST_OFB_IDLE_TIME = 1,    /* Time flow entry has been idle.  */
    OFPXST_OFB_FLOW_COUNT = 3,   /* Number of aggregated flow entries. */
    OFPXST_OFB_PACKET_COUNT = 4, /* Number of packets in flow entry.  */
    OFPXST_OFB_BYTE_COUNT = 5,   /* Number of bytes in flow entry.  */
};

/* Flow removed (datapath -> controller). */
struct ofp15_flow_removed {
    uint8_t table_id;           /* ID of the table */
    uint8_t reason;             /* One of OFPRR_*. */
    ovs_be16 priority;          /* Priority level of flow entry. */
    ovs_be16 idle_timeout;      /* Idle timeout from original flow mod. */
    ovs_be16 hard_timeout;      /* Hard timeout from original flow mod. */
    ovs_be64 cookie;            /* Opaque controller issued identifier. */
};

OFP_ASSERT(sizeof (struct ofp15_flow_removed) == 16);

#endif /* openflow/openflow-1.5.h */