#include "list.h"
#include "packets.h"
+struct secchan;
+
/* Behavior when the connection to the controller fails. */
enum fail_mode {
FAIL_OPEN, /* Act as learning switch. */
/* Spanning tree protocol. */
bool enable_stp;
+
+ /* Remote command execution. */
+ char *command_acl; /* Command white/blacklist, as shell globs. */
+ char *command_dir; /* Directory that contains commands. */
};
struct half {
#define HALF_REMOTE 1
struct half halves[2];
- bool is_mgmt_conn;
+ /* The secchan has a primary connection (relay) to an OpenFlow controller.
+ * This primary connection actually makes two connections to the datapath:
+ * one for OpenFlow requests and responses, and one that is only used for
+ * receiving asynchronous events such as 'ofp_packet_in' events. This
+ * design keeps replies to OpenFlow requests from being dropped by the
+ * kernel due to a flooded network device.
+ *
+ * The secchan may also have any number of secondary "management"
+ * connections (relays). These connections do not receive asychronous
+ * events and thus have a null 'async_rconn'. */
+ bool is_mgmt_conn; /* Is this a management connection? */
+ struct rconn *async_rconn; /* For receiving asynchronous events. */
};
-struct hook {
- bool (*packet_cb[2])(struct relay *, void *aux);
+struct hook_class {
+ bool (*local_packet_cb)(struct relay *, void *aux);
+ bool (*remote_packet_cb)(struct relay *, void *aux);
void (*periodic_cb)(void *aux);
void (*wait_cb)(void *aux);
- void *aux;
+ void (*closing_cb)(struct relay *, void *aux);
};
-struct hook make_hook(bool (*local_packet_cb)(struct relay *, void *),
- bool (*remote_packet_cb)(struct relay *, void *),
- void (*periodic_cb)(void *),
- void (*wait_cb)(void *),
- void *aux);
+void add_hook(struct secchan *, const struct hook_class *, void *);
+
struct ofp_packet_in *get_ofp_packet_in(struct relay *);
bool get_ofp_packet_eth_header(struct relay *, struct ofp_packet_in **,
struct eth_header **);