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

    ofl_group_mod_command_print(stream, command);
    fclose(stream);
    return str;
}
static void
ofl_msg_print_group_mod(struct ofl_msg_group_mod *msg, FILE *stream, struct ofl_exp *exp) {
    size_t i;

    fprintf(stream,"{group=\"");
    ofl_group_print(stream, msg->group_id);
    fprintf(stream,"\", cmd=\"");
    ofl_group_mod_command_print(stream, msg->command);
    fprintf(stream, "\", type=\"");
    ofl_group_type_print(stream, msg->type);
    fprintf(stream,"\", buckets=[");

    for (i=0; i<msg->buckets_num; i++) {
        ofl_structs_bucket_print(stream, msg->buckets[i], exp);

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

    fprintf(stream, "]}");
}