ds_put_hex_dump(&string, oh, len, 0, true);
return ds_steal_cstr(&string);
}
-
-/* Returns the name for the specified OpenFlow message type as a string,
- * e.g. "OFPT_FEATURES_REPLY". If no name is known, the string returned is a
- * hex number, e.g. "0x55".
- *
- * The caller must free the returned string when it is no longer needed. */
-char *
-ofp_message_type_to_string(uint8_t type)
-{
- const char *name;
-
- switch (type) {
- case OFPT_HELLO:
- name = "HELLO";
- break;
- case OFPT_ERROR:
- name = "ERROR";
- break;
- case OFPT_ECHO_REQUEST:
- name = "ECHO_REQUEST";
- break;
- case OFPT_ECHO_REPLY:
- name = "ECHO_REPLY";
- break;
- case OFPT_VENDOR:
- name = "VENDOR";
- break;
- case OFPT_FEATURES_REQUEST:
- name = "FEATURES_REQUEST";
- break;
- case OFPT_FEATURES_REPLY:
- name = "FEATURES_REPLY";
- break;
- case OFPT_GET_CONFIG_REQUEST:
- name = "GET_CONFIG_REQUEST";
- break;
- case OFPT_GET_CONFIG_REPLY:
- name = "GET_CONFIG_REPLY";
- break;
- case OFPT_SET_CONFIG:
- name = "SET_CONFIG";
- break;
- case OFPT_PACKET_IN:
- name = "PACKET_IN";
- break;
- case OFPT_FLOW_REMOVED:
- name = "FLOW_REMOVED";
- break;
- case OFPT_PORT_STATUS:
- name = "PORT_STATUS";
- break;
- case OFPT_PACKET_OUT:
- name = "PACKET_OUT";
- break;
- case OFPT_FLOW_MOD:
- name = "FLOW_MOD";
- break;
- case OFPT_PORT_MOD:
- name = "PORT_MOD";
- break;
- case OFPT_STATS_REQUEST:
- name = "STATS_REQUEST";
- break;
- case OFPT_STATS_REPLY:
- name = "STATS_REPLY";
- break;
- case OFPT_BARRIER_REQUEST:
- name = "BARRIER_REQUEST";
- break;
- case OFPT_BARRIER_REPLY:
- name = "BARRIER_REPLY";
- break;
- case OFPT_QUEUE_GET_CONFIG_REQUEST:
- name = "QUEUE_GET_CONFIG_REQUEST";
- break;
- case OFPT_QUEUE_GET_CONFIG_REPLY:
- name = "QUEUE_GET_CONFIG_REPLY";
- break;
- default:
- name = NULL;
- break;
- }
-
- return name ? xasprintf("OFPT_%s", name) : xasprintf("0x%02"PRIx8, type);
-}
\f
static void
print_and_free(FILE *stream, char *string)
/*
- * Copyright (c) 2008, 2009, 2011 Nicira Networks.
+ * Copyright (c) 2008, 2009, 2011, 2012 Nicira Networks.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
char *ofp_to_string(const void *, size_t, int verbosity);
char *ofp_match_to_string(const struct ofp_match *, int verbosity);
char *ofp_packet_to_string(const void *data, size_t len);
-char *ofp_message_type_to_string(uint8_t type);
-
#ifdef __cplusplus
}