static void ofl_msg_print_stats_reply_group_features(struct ofl_msg_multipart_reply_group_features *msg, FILE *stream){ size_t i; enum ofp_action_type j; fprintf(stream, ", types=\"%d\", capabilities=\"%d [", msg->types, msg->capabilities); for(i = 0; i < 4; i++){ ofl_group_type_print(stream, i); fprintf(stream, ": max_groups=%d, actions= ", msg->max_groups[i]); if(msg->actions[i] & 1){ ofl_action_type_print(stream, OFPAT_OUTPUT); fprintf(stream, "/"); } if(msg->actions[i] & OFPAT_COPY_TTL_OUT){ ofl_action_type_print(stream, OFPAT_COPY_TTL_OUT); fprintf(stream, "/"); } if(msg->actions[i] & OFPAT_COPY_TTL_IN){ ofl_action_type_print(stream, OFPAT_COPY_TTL_IN); fprintf(stream, "/"); } for(j = OFPAT_SET_MPLS_TTL; j < OFPAT_POP_PBB; j++){ if (msg->actions[i] & j){ ofl_action_type_print(stream, j); fprintf(stream, "/"); } } if (i < 3) fprintf(stream, ", "); } }
char * ofl_group_type_to_string(uint8_t type) { char *str; size_t str_size; FILE *stream = open_memstream(&str, &str_size); ofl_group_type_print(stream, type); fclose(stream); return str; }
void ofl_structs_group_desc_stats_print(FILE *stream, struct ofl_group_desc_stats *s, struct ofl_exp *exp) { size_t i; fprintf(stream, "{type=\""); ofl_group_type_print(stream, s->type); fprintf(stream, "\", group=\""); ofl_group_print(stream, s->group_id); fprintf(stream, "\", buckets=["); for (i=0; i<s->buckets_num; i++) { ofl_structs_bucket_print(stream, s->buckets[i], exp); if (i < s->buckets_num - 1) { fprintf(stream, ", "); }; } fprintf(stream, "]}"); }
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, "]}"); }