ds_put_format(string, " cookie=0x%"PRIx64, ntohll(pin.cookie));
}
- ds_put_format(string, " total_len=%zu in_port=", pin.total_len);
+ ds_put_format(string, " total_len=%"PRIuSIZE" in_port=", pin.total_len);
ofputil_format_port(pin.fmd.in_port, string);
if (pin.fmd.tun_id != htonll(0)) {
ofputil_packet_in_reason_to_string(pin.reason, reasonbuf,
sizeof reasonbuf));
- ds_put_format(string, " data_len=%zu", pin.packet_len);
+ ds_put_format(string, " data_len=%"PRIuSIZE, pin.packet_len);
if (pin.buffer_id == UINT32_MAX) {
ds_put_format(string, " (unbuffered)");
if (pin.total_len != pin.packet_len) {
ofpacts_format(po.ofpacts, po.ofpacts_len, string);
if (po.buffer_id == UINT32_MAX) {
- ds_put_format(string, " data_len=%zu", po.packet_len);
+ ds_put_format(string, " data_len=%"PRIuSIZE, po.packet_len);
if (verbosity > 0 && po.packet_len > 0) {
char *packet = ofp_packet_to_string(po.packet, po.packet_len);
ds_put_char(string, '\n');
protocol = ofputil_protocol_set_tid(protocol, true);
ofpbuf_init(&ofpacts, 64);
- error = ofputil_decode_flow_mod(&fm, oh, protocol, &ofpacts);
+ error = ofputil_decode_flow_mod(&fm, oh, protocol, &ofpacts,
+ OFPP_MAX, 255);
if (error) {
ofpbuf_uninit(&ofpacts);
ofp_print_error(s, error);
{
struct ofpbuf b;
- ds_put_format(string, " %zu ports\n", ofputil_count_port_stats(oh));
+ ds_put_format(string, " %"PRIuSIZE" ports\n", ofputil_count_port_stats(oh));
if (verbosity < 1) {
return;
}
ofpraw_pull_assert(&b);
n = b.size / sizeof *ts;
- ds_put_format(string, " %zu tables\n", n);
+ ds_put_format(string, " %"PRIuSIZE" tables\n", n);
if (verbosity < 1) {
return;
}
ofpraw_pull_assert(&b);
n = b.size / sizeof *ts;
- ds_put_format(string, " %zu tables\n", n);
+ ds_put_format(string, " %"PRIuSIZE" tables\n", n);
if (verbosity < 1) {
return;
}
ofpraw_pull_assert(&b);
n = b.size / sizeof *ts;
- ds_put_format(string, " %zu tables\n", n);
+ ds_put_format(string, " %"PRIuSIZE" tables\n", n);
if (verbosity < 1) {
return;
}
ofpraw_pull_assert(&b);
n = b.size / sizeof *ts;
- ds_put_format(string, " %zu tables\n", n);
+ ds_put_format(string, " %"PRIuSIZE" tables\n", n);
if (verbosity < 1) {
return;
}
{
struct ofpbuf b;
- ds_put_format(string, " %zu queues\n", ofputil_count_queue_stats(oh));
+ ds_put_format(string, " %"PRIuSIZE" queues\n", ofputil_count_queue_stats(oh));
if (verbosity < 1) {
return;
}
{
size_t len = ntohs(oh->length);
- ds_put_format(string, " %zu bytes of payload\n", len - sizeof *oh);
+ ds_put_format(string, " %"PRIuSIZE" bytes of payload\n", len - sizeof *oh);
if (verbosity > 1) {
ds_put_hex_dump(string, oh + 1, len - sizeof *oh, 0, true);
}
}
static void
-ofp_print_role_message(struct ds *string, const struct ofp_header *oh)
+ofp_print_role_generic(struct ds *string, enum ofp12_controller_role role,
+ uint64_t generation_id)
{
- struct ofputil_role_request rr;
- enum ofperr error;
-
- error = ofputil_decode_role_message(oh, &rr);
- if (error) {
- ofp_print_error(string, error);
- return;
- }
-
ds_put_cstr(string, " role=");
- switch (rr.role) {
+ switch (role) {
case OFPCR12_ROLE_NOCHANGE:
ds_put_cstr(string, "nochange");
break;
NOT_REACHED();
}
- if (rr.have_generation_id) {
- ds_put_format(string, " generation_id=%"PRIu64, rr.generation_id);
+ if (generation_id != UINT64_MAX) {
+ ds_put_format(string, " generation_id=%"PRIu64, generation_id);
+ }
+}
+
+static void
+ofp_print_role_message(struct ds *string, const struct ofp_header *oh)
+{
+ struct ofputil_role_request rr;
+ enum ofperr error;
+
+ error = ofputil_decode_role_message(oh, &rr);
+ if (error) {
+ ofp_print_error(string, error);
+ return;
+ }
+
+ ofp_print_role_generic(string, rr.role, rr.have_generation_id ? rr.generation_id : UINT64_MAX);
+}
+
+static void
+ofp_print_role_status_message(struct ds *string, const struct ofp_header *oh)
+{
+ struct ofputil_role_status rs;
+ enum ofperr error;
+
+ error = ofputil_decode_role_status(oh, &rs);
+ if (error) {
+ ofp_print_error(string, error);
+ return;
+ }
+
+ ofp_print_role_generic(string, rs.role, rs.generation_id);
+
+ ds_put_cstr(string, " reason=");
+
+ switch (rs.reason) {
+ case OFPCRR_MASTER_REQUEST:
+ ds_put_cstr(string, "master_request");
+ break;
+ case OFPCRR_CONFIG:
+ ds_put_cstr(string, "configuration_changed");
+ break;
+ case OFPCRR_EXPERIMENTER:
+ ds_put_cstr(string, "experimenter_data_changed");
+ break;
+ default:
+ NOT_REACHED();
}
}
case OFPTYPE_ROLE_REPLY:
ofp_print_role_message(string, oh);
break;
+ case OFPTYPE_ROLE_STATUS:
+ ofp_print_role_status_message(string, oh);
+ break;
case OFPTYPE_METER_STATS_REQUEST:
case OFPTYPE_METER_CONFIG_STATS_REQUEST:
if (!len) {
ds_put_cstr(&string, "OpenFlow message is empty\n");
} else if (len < sizeof(struct ofp_header)) {
- ds_put_format(&string, "OpenFlow packet too short (only %zu bytes):\n",
+ ds_put_format(&string, "OpenFlow packet too short (only %"PRIuSIZE" bytes):\n",
len);
} else if (ntohs(oh->length) > len) {
enum ofperr error;
}
ds_put_format(&string,
- "(***truncated to %zu bytes from %"PRIu16"***)\n",
+ "(***truncated to %"PRIuSIZE" bytes from %"PRIu16"***)\n",
len, ntohs(oh->length));
} else if (ntohs(oh->length) < len) {
ds_put_format(&string,
- "(***only uses %"PRIu16" bytes out of %zu***)\n",
+ "(***only uses %"PRIu16" bytes out of %"PRIuSIZE"***)\n",
ntohs(oh->length), len);
} else {
enum ofperr error;