Esempio n. 1
0
char *
ofl_meter_mod_command_to_string(uint16_t command) {
    char *str;
    size_t str_size;
    FILE *stream = open_memstream(&str, &str_size);

    ofl_meter_mod_command_print(stream, command);
    fclose(stream);
    return str;
}
static void
ofl_msg_print_meter_mod(struct ofl_msg_meter_mod *msg, FILE *stream) {
    size_t i;

    fprintf(stream,"{cmd=\"");
    ofl_meter_mod_command_print(stream, msg->command);
    fprintf(stream, "\", flags=\"0x%"PRIx16"\"",msg->flags);
    fprintf(stream, "\", meter_id=\"%"PRIx32"\"",msg->meter_id);
    fprintf(stream,"\", bands=[");

    for (i=0; i<msg->meter_bands_num; i++) {
        ofl_structs_meter_band_print(stream, msg->bands[i]);

        if (i < msg->meter_bands_num - 1) { fprintf(stream, ", "); }
    }

    fprintf(stream, "]}");
}