Change the secchan "hook" mechanism to be easier to add new callbacks.
[sliver-openvswitch.git] / secchan / secchan.h
index 0345fa3..0a398ad 100644 (file)
@@ -40,6 +40,8 @@
 #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. */
@@ -97,18 +99,16 @@ struct relay {
     bool is_mgmt_conn;
 };
 
-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 **);