1 /* Copyright (C) 2008 Board of Trustees, Leland Stanford Jr. University.
3 * Permission is hereby granted, free of charge, to any person obtaining a copy
4 * of this software and associated documentation files (the "Software"), to
5 * deal in the Software without restriction, including without limitation the
6 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
7 * sell copies of the Software, and to permit persons to whom the Software is
8 * furnished to do so, subject to the following conditions:
10 * The above copyright notice and this permission notice shall be included in
11 * all copies or substantial portions of the Software.
13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
18 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
22 /* Interface exported by OpenFlow module. */
29 #include "switch-flow.h"
33 #define NL_FLOWS_PER_MESSAGE 100
35 /* Capabilities supported by this implementation. */
36 #define OFP_SUPPORTED_CAPABILITIES (OFPC_MULTI_PHY_TX)
38 /* Actions supported by this implementation. */
39 #define OFP_SUPPORTED_ACTIONS ( (1 << OFPAT_OUTPUT) \
40 | (1 << OFPAT_SET_DL_VLAN) \
41 | (1 << OFPAT_SET_DL_SRC) \
42 | (1 << OFPAT_SET_DL_DST) \
43 | (1 << OFPAT_SET_NW_SRC) \
44 | (1 << OFPAT_SET_NW_DST) \
45 | (1 << OFPAT_SET_TP_SRC) \
46 | (1 << OFPAT_SET_TP_DST) )
51 struct netdev *netdev;
52 struct list node; /* Element in datapath.ports. */
56 struct controller_connection *cc;
60 /* Unique identifier for this datapath */
63 struct sw_chain *chain; /* Forwarding rules. */
65 /* Flags from the control hello message */
68 /* Maximum number of bytes that should be sent for flow misses */
69 uint16_t miss_send_len;
72 struct sw_port ports[OFPP_MAX];
73 struct list port_list; /* List of ports, for flooding. */
76 int dp_new(struct datapath **, uint64_t dpid, struct controller_connection *);
77 int dp_add_port(struct datapath *, const char *netdev);
78 void dp_run(struct datapath *);
79 void dp_wait(struct datapath *);
81 void dp_output_port(struct datapath *, struct buffer *,
82 int in_port, int out_port);
83 void dp_output_control(struct datapath *, struct buffer *, int in_port,
84 uint32_t buffer_id, size_t max_len, int reason);
85 void dp_send_hello(struct datapath *);
86 void dp_send_flow_expired(struct datapath *, struct sw_flow *);
87 void dp_update_port_flags(struct datapath *dp, const struct ofp_phy_port *opp);
89 #endif /* datapath.h */