1 /* Copyright (c) 2008 The Board of Trustees of The Leland Stanford
4 * We are making the OpenFlow specification and associated documentation
5 * (Software) available for public use and benefit with the expectation
6 * that others will use, modify and enhance the Software and contribute
7 * those enhancements back to the community. However, since we would
8 * like to make the Software available for broadest use, with as few
9 * restrictions as possible permission is hereby granted, free of
10 * charge, to any person obtaining a copy of this Software to deal in
11 * the Software under the copyrights without restriction, including
12 * without limitation the rights to use, copy, modify, merge, publish,
13 * distribute, sublicense, and/or sell copies of the Software, and to
14 * permit persons to whom the Software is furnished to do so, subject to
15 * the following conditions:
17 * The above copyright notice and this permission notice shall be
18 * included in all copies or substantial portions of the Software.
20 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
24 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
25 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
26 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
29 * The name and trademarks of copyright holder(s) may NOT be used in
30 * advertising or publicity pertaining to the Software or any
31 * derivatives without specific, written prior permission.
45 /* Behavior when the connection to the controller fails. */
47 FAIL_OPEN, /* Act as learning switch. */
48 FAIL_CLOSED /* Drop all packets. */
51 /* Maximum number of management connection listeners. */
54 /* Settings that may be configured by the user. */
56 /* Overall mode of operation. */
57 bool discovery; /* Discover the controller automatically? */
58 bool in_band; /* Connect to controller in-band? */
60 /* Related vconns and network devices. */
61 const char *dp_name; /* Local datapath. */
62 const char *controller_name; /* Controller (if not discovery mode). */
63 const char *listener_names[MAX_MGMT]; /* Listen for mgmt connections. */
64 size_t n_listeners; /* Number of mgmt connection listeners. */
65 const char *monitor_name; /* Listen for traffic monitor connections. */
67 /* Failure behavior. */
68 enum fail_mode fail_mode; /* Act as learning switch if no controller? */
69 int max_idle; /* Idle time for flows in fail-open mode. */
70 int probe_interval; /* # seconds idle before sending echo request. */
71 int max_backoff; /* Max # seconds between connection attempts. */
73 /* Packet-in rate-limiting. */
74 int rate_limit; /* Tokens added to bucket per second. */
75 int burst_limit; /* Maximum number token bucket size. */
77 /* Discovery behavior. */
78 regex_t accept_controller_regex; /* Controller vconns to accept. */
79 const char *accept_controller_re; /* String version of regex. */
80 bool update_resolv_conf; /* Update /etc/resolv.conf? */
82 /* Spanning tree protocol. */
89 int n_txq; /* No. of packets queued for tx on 'rconn'. */
97 struct half halves[2];
103 bool (*local_packet_cb)(struct relay *, void *aux);
104 bool (*remote_packet_cb)(struct relay *, void *aux);
105 void (*periodic_cb)(void *aux);
106 void (*wait_cb)(void *aux);
107 void (*closing_cb)(struct relay *, void *aux);
110 void add_hook(struct secchan *, const struct hook_class *, void *);
112 struct ofp_packet_in *get_ofp_packet_in(struct relay *);
113 bool get_ofp_packet_eth_header(struct relay *, struct ofp_packet_in **,
114 struct eth_header **);
115 void get_ofp_packet_payload(struct ofp_packet_in *, struct ofpbuf *);
118 #endif /* secchan.h */