char *
ofl_structs_port_to_string(struct ofl_port *port) {
        char *str;
    size_t str_size;
    FILE *stream = open_memstream(&str, &str_size);
    ofl_structs_port_print(stream, port);
    fclose(stream);
    return str;
}
static void
ofl_msg_print_port_status(struct ofl_msg_port_status *msg, FILE *stream) {

    fprintf(stream, "{reas=");
    ofl_port_status_reason_print(stream, msg->reason);
    fprintf(stream, ", desc=");
    ofl_structs_port_print(stream, msg->desc);
    fprintf(stream, "}");
}
static void
ofl_msg_print_port_desc_reply(struct ofl_msg_multipart_reply_port_desc *msg, FILE *stream) {
    size_t i;
    
    for(i = 0; i < msg->stats_num; i++){
        ofl_structs_port_print(stream, msg->stats[i]);
        if (i < msg->stats_num - 1) { fprintf(stream, ", "); };
    }
    fprintf(stream, "}");
}
示例#4
0
static void
ofl_msg_print_features_reply(struct ofl_msg_features_reply *msg, FILE *stream) {
    size_t i;

    fprintf(stream, "{dpid=\"0x%016"PRIx64"\", buffs=\"%u\", tabs=\"%u\", "
                          "caps=\"0x%"PRIx32"\", ports=[",
                  msg->datapath_id, msg->n_buffers, msg->n_tables,
                  msg->capabilities);

    for (i=0; i < msg->ports_num; i++) {
        ofl_structs_port_print(stream, msg->ports[i]);
        if (i < msg->ports_num - 1) { fprintf(stream, ", "); }
    }
    fprintf(stream, "]}");
}