2 * Copyright (c) 2015 Mohamed Aslan <maslan@sce.carleton.ca>
4 * Permission to use, copy, modify, and distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
23 #define OFPT10_HELLO 0
24 #define OFPT10_OFPT_ERROR 1
25 #define OFPT10_ECHO_REQUEST 2
26 #define OFPT10_ECHO_REPLY 3
27 #define OFPT10_VENDOR 4
28 #define OFPT10_FEATURES_REQUEST 5
29 #define OFPT10_FEATURES_REPLY 6
30 #define OFPT10_GET_CONFIG_REQUEST 7
31 #define OFPT10_GET_CONFIG_REPLY 8
32 #define OFPT10_SET_CONFIG 9
33 #define OFPT10_PACKET_IN 10
34 #define OFPT10_FLOW_REMOVED 11
35 #define OFPT10_PORT_STATUS 12
36 #define OFPT10_PACKET_OUT 13
37 #define OFPT10_FLOW_MOD 14
38 #define OFPT10_PORT_MOD 15
39 #define OFPT10_STATS_REQUEST 16
40 #define OFPT10_STATS_REPLY 17
41 #define OFPT10_BARRIER_REQUEST 18
42 #define OFPT10_BARRIER_REPLY 19
43 #define OFPT10_QUEUE_GET_CONFIG_REQUEST 20
44 #define OFPT10_QUEUE_GET_CONFIG_REPLY 21
46 #define OFP10_ETH_ALEN 6
47 #define OFP10_MAX_PORT_NAME_LEN 16
49 /* packet_in reason */
50 #define OFPR10_NO_MATCH 0
51 #define OFPR10_ACTION 1
54 #define OFPAT10_OUTPUT 0
55 #define OFPAT10_SET_VLAN_VID 1
56 #define OFPAT10_SET_VLAN_PCP 2
57 #define OFPAT10_STRIP_VLAN 3
58 #define OFPAT10_SET_DL_SRC 4
59 #define OFPAT10_SET_DL_DST 5
60 #define OFPAT10_SET_NW_SRC 6
61 #define OFPAT10_SET_NW_DST 7
62 #define OFPAT10_SET_NW_TOS 8
63 #define OFPAT10_SET_TP_SRC 9
64 #define OFPAT10_SET_TP_DST 10
65 #define OFPAT10_ENQUEUE 11
66 #define OFPAT10_VENDOR 0xffff
68 /* flow mod command */
70 #define OFPFC10_MODIFY 1
71 #define OFPFC10_MODIFY_STRICT 2
72 #define OFPFC10_DELETE 3
73 #define OFPFC10_DELETE_STRICT 4
76 #define OFPP10_IN_PORT 0xfff8
77 #define OFPP10_NORMAL 0xfffa
78 #define OFPP10_FLOOD 0xfffb
79 #define OFPP10_ALL 0xfffc
80 #define OFPP10_CONTROLLER 0xfffd
81 #define OFPP10_NONE 0xffff
84 #define OFPFW10_IN_PORT 1 << 0
85 #define OFPFW10_DL_VLAN 1 << 1
86 #define OFPFW10_DL_SRC 1 << 2
87 #define OFPFW10_DL_DST 1 << 3
88 #define OFPFW10_DL_TYPE 1 << 4
89 #define OFPFW10_NW_PROTO 1 << 5
90 #define OFPFW10_TP_SRC 1 << 6
91 #define OFPFW10_TP_DST 1 << 7
92 #define OFPFW10_ALL ((1 << 22) - 1)
95 #define OFPFF_SEND_FLOW_REM 1 << 0
96 #define OFPFF_CHECK_OVERLAP 1 << 1
97 #define OFPFF_EMERG 1 << 2
100 #define OFPST10_DESC 0
101 #define OFPST10_FLOW 1
102 #define OFPST10_AGGREGATE 2
103 #define OFPST10_TABLE 3
104 #define OFPST10_PORT 4
105 #define OFPST10_QUEUE 5
106 #define OFPST10_VENDOR 0xffff
112 uint8_t hw_addr
[OFP10_ETH_ALEN
];
113 char name
[OFP10_MAX_PORT_NAME_LEN
];
120 }__attribute__((packed
));
122 struct of10_switch_features
124 struct ofp_header hdr
;
125 uint64_t datapath_id
;
129 uint32_t capabilities
;
131 struct of10_phy_port ports
[0]; /* XXX: won't be considered by sizeof */
132 }__attribute__((packed
));
134 struct of10_packet_in
136 struct ofp_header hdr
;
142 uint8_t data
[0]; /* XXX: won't be considered by sizeof */
143 }__attribute__((packed
));
145 struct of10_action_header
150 }__attribute__((packed
));
152 struct of10_action_output
158 }__attribute__((packed
));
160 struct of10_action_dl_addr
164 uint8_t dl_addr
[OFP10_ETH_ALEN
];
166 }__attribute__((packed
));
168 struct of10_action_nw_addr
173 }__attribute__((packed
));
175 struct of10_packet_out
177 struct ofp_header hdr
;
180 uint16_t actions_len
;
181 struct of10_action_header actions
[0]; /* XXX: won't be considered by sizeof */
182 }__attribute__((packed
));
187 uint8_t dl_src
[OFP10_ETH_ALEN
];
188 uint8_t dl_dst
[OFP10_ETH_ALEN
];
200 }__attribute__((packed
));
204 struct ofp_header hdr
;
205 struct of10_match match
;
208 uint16_t idle_timeout
;
209 uint16_t hard_timeout
;
214 struct of10_action_header actions
[0]; /* XXX: won't be considered by sizeof */
215 }__attribute__((packed
));
218 struct of10_stats_request
{
219 struct ofp_header hdr
;
222 uint8_t body
[0]; /* XXX: won't be considered by sizeof */
223 }__attribute__((packed
));
225 struct of10_stats_reply
{
226 struct ofp_header hdr
;
229 uint8_t body
[0]; /* XXX: won't be considered by sizeof */
230 }__attribute__((packed
));
232 struct of10_flow_stats_request
234 struct of10_match match
;
238 }__attribute__((packed
));
240 struct of10_flow_stats
245 struct of10_match match
;
246 uint32_t duration_sec
;
247 uint32_t duration_nsec
;
249 uint16_t idle_timeout
;
250 uint16_t hard_timeout
;
253 uint64_t packet_count
;
255 struct of10_action_header actions
[0]; /* XXX: won't be considered by sizeof */
256 }__attribute__((packed
));
258 struct of10_port_stats_request
262 }__attribute__((packed
));
264 struct of10_port_stats
276 uint64_t rx_frame_err
;
277 uint64_t rx_over_err
;
280 }__attribute__((packed
));
282 const struct of_protocol
*of10_protocol();