+
+static void
+copy_to_monitor(struct rconn *rc, const struct ofpbuf *b)
+{
+ struct ofpbuf *clone = NULL;
+ int retval;
+ size_t i;
+
+ for (i = 0; i < rc->n_monitors; ) {
+ struct vconn *vconn = rc->monitors[i];
+
+ if (!clone) {
+ clone = ofpbuf_clone(b);
+ }
+ retval = vconn_send(vconn, clone);
+ if (!retval) {
+ clone = NULL;
+ } else if (retval != EAGAIN) {
+ VLOG_DBG("%s: closing monitor connection to %s: %s",
+ rconn_get_name(rc), vconn_get_name(vconn),
+ strerror(retval));
+ rc->monitors[i] = rc->monitors[--rc->n_monitors];
+ continue;
+ }
+ i++;
+ }
+ ofpbuf_delete(clone);
+}
+
+static bool
+is_connected_state(enum state state)
+{
+ return (state & (S_ACTIVE | S_IDLE)) != 0;
+}
+
+static bool
+is_admitted_msg(const struct ofpbuf *b)
+{
+ struct ofp_header *oh = b->data;
+ uint8_t type = oh->type;
+ return !(type < 32
+ && (1u << type) & ((1u << OFPT_HELLO) |
+ (1u << OFPT_ERROR) |
+ (1u << OFPT_ECHO_REQUEST) |
+ (1u << OFPT_ECHO_REPLY) |
+ (1u << OFPT_VENDOR) |
+ (1u << OFPT_FEATURES_REQUEST) |
+ (1u << OFPT_FEATURES_REPLY) |
+ (1u << OFPT_GET_CONFIG_REQUEST) |
+ (1u << OFPT_GET_CONFIG_REPLY) |
+ (1u << OFPT_SET_CONFIG)));
+}