+ uint32_t format = ntohl(nspf->format);
+
+ ds_put_cstr(string, " format=");
+ if (ofputil_packet_in_format_is_valid(format)) {
+ ds_put_cstr(string, ofputil_packet_in_format_to_string(format));
+ } else {
+ ds_put_format(string, "%"PRIu32, format);
+ }
+}
+
+static const char *
+ofp_port_reason_to_string(enum ofp_port_reason reason)
+{
+ static char s[32];
+
+ switch (reason) {
+ case OFPPR_ADD:
+ return "add";
+
+ case OFPPR_DELETE:
+ return "delete";
+
+ case OFPPR_MODIFY:
+ return "modify";
+
+ default:
+ sprintf(s, "%d", (int) reason);
+ return s;
+ }
+}
+
+static void
+ofp_print_nxt_set_async_config(struct ds *string,
+ const struct nx_async_config *nac)
+{
+ int i;
+
+ for (i = 0; i < 2; i++) {
+ int j;
+
+ ds_put_format(string, "\n %s:\n", i == 0 ? "master" : "slave");
+
+ ds_put_cstr(string, " PACKET_IN:");
+ for (j = 0; j < 32; j++) {
+ if (nac->packet_in_mask[i] & htonl(1u << j)) {
+ ds_put_format(string, " %s",
+ ofputil_packet_in_reason_to_string(j));
+ }
+ }
+ if (!nac->packet_in_mask[i]) {
+ ds_put_cstr(string, " (off)");
+ }
+ ds_put_char(string, '\n');
+
+ ds_put_cstr(string, " PORT_STATUS:");
+ for (j = 0; j < 32; j++) {
+ if (nac->port_status_mask[i] & htonl(1u << j)) {
+ ds_put_format(string, " %s", ofp_port_reason_to_string(j));
+ }
+ }
+ if (!nac->port_status_mask[i]) {
+ ds_put_cstr(string, " (off)");
+ }
+ ds_put_char(string, '\n');
+
+ ds_put_cstr(string, " FLOW_REMOVED:");
+ for (j = 0; j < 32; j++) {
+ if (nac->flow_removed_mask[i] & htonl(1u << j)) {
+ ds_put_format(string, " %s",
+ ofp_flow_removed_reason_to_string(j));
+ }
+ }
+ if (!nac->flow_removed_mask[i]) {
+ ds_put_cstr(string, " (off)");
+ }
+ ds_put_char(string, '\n');
+ }
+}
+
+static void
+ofp_print_nxt_set_controller_id(struct ds *string,
+ const struct nx_controller_id *nci)
+{
+ ds_put_format(string, " id=%"PRIu16, ntohs(nci->controller_id));
+}
+
+static void
+ofp_print_nxt_flow_monitor_cancel(struct ds *string,
+ const struct ofp_header *oh)
+{
+ ds_put_format(string, " id=%"PRIu32,
+ ofputil_decode_flow_monitor_cancel(oh));
+}
+
+static const char *
+nx_flow_monitor_flags_to_name(uint32_t bit)
+{
+ enum nx_flow_monitor_flags fmf = bit;
+
+ switch (fmf) {
+ case NXFMF_INITIAL: return "initial";
+ case NXFMF_ADD: return "add";
+ case NXFMF_DELETE: return "delete";
+ case NXFMF_MODIFY: return "modify";
+ case NXFMF_ACTIONS: return "actions";
+ case NXFMF_OWN: return "own";
+ }
+
+ return NULL;
+}
+
+static void
+ofp_print_nxst_flow_monitor_request(struct ds *string,
+ const struct ofp_header *oh)
+{
+ struct ofpbuf b;
+
+ ofpbuf_use_const(&b, oh, ntohs(oh->length));
+ for (;;) {
+ struct ofputil_flow_monitor_request request;
+ int retval;
+
+ retval = ofputil_decode_flow_monitor_request(&request, &b);
+ if (retval) {
+ if (retval != EOF) {
+ ofp_print_error(string, retval);
+ }
+ return;
+ }
+
+ ds_put_format(string, "\n id=%"PRIu32" flags=", request.id);
+ ofp_print_bit_names(string, request.flags,
+ nx_flow_monitor_flags_to_name, ',');