static void
ofl_msg_print_flow_mod(struct ofl_msg_flow_mod *msg, FILE *stream, struct ofl_exp *exp) {
    size_t i;

    fprintf(stream, "{table=\"");
    ofl_table_print(stream, msg->table_id);
    fprintf(stream, "\", cmd=\"");
    ofl_flow_mod_command_print(stream, msg->command);
    fprintf(stream, "\", cookie=\"0x%"PRIx64"\", mask=\"0x%"PRIx64"\", "
                          "idle=\"%u\", hard=\"%u\", prio=\"%u\", buf=\"",
                  msg->cookie, msg->cookie_mask,
                  msg->idle_timeout, msg->hard_timeout, msg->priority);
    ofl_buffer_print(stream, msg->buffer_id);
    fprintf(stream, "\", port=\"");
    ofl_port_print(stream, msg->out_port);
    fprintf(stream, "\", group=\"");
    ofl_group_print(stream, msg->out_group);
    fprintf(stream, "\", flags=\"0x%"PRIx16"\", match=",msg->flags);
    ofl_structs_match_print(stream, msg->match, exp);
    fprintf(stream, ", insts=[");
    for(i=0; i<msg->instructions_num; i++) {
        ofl_structs_instruction_print(stream, msg->instructions[i], exp);
        if (i < msg->instructions_num - 1) { fprintf(stream, ", "); }
    }
    fprintf(stream, "]}");
}
Ejemplo n.º 2
0
void
ofl_structs_table_stats_print(FILE *stream, struct ofl_table_stats *s) {
    fprintf(stream, "{table=\"");
    ofl_table_print(stream, s->table_id);
    fprintf(stream, "\", active=\"%u\", "
                          "lookup=\"%"PRIu64"\", match=\"%"PRIu64"\"",
                  s->active_count,
                  s->lookup_count, s->matched_count);
}
Ejemplo n.º 3
0
char *
ofl_table_to_string(uint8_t table) {
    char *str;
    size_t str_size;
    FILE *stream = open_memstream(&str, &str_size);

    ofl_table_print(stream, table);
    fclose(stream);
    return str;
}
static void
ofl_msg_print_packet_in(struct ofl_msg_packet_in *msg, FILE *stream) {
    fprintf(stream, "{buffer=\"");
    ofl_buffer_print(stream, msg->buffer_id);
    fprintf(stream, "\", tlen=\"%u\", reas=\"", msg->total_len);
    ofl_packet_in_reason_print(stream, msg->reason);
    fprintf(stream, "\", table=\"");
    ofl_table_print(stream, msg->table_id);
    fprintf(stream, "\", dlen=\"%zu\"}", msg->data_length);
}
static void
ofl_msg_print_stats_request_flow(struct ofl_msg_multipart_request_flow *msg, FILE *stream, struct ofl_exp *exp) {
    fprintf(stream, ", table=\"");
    ofl_table_print(stream, msg->table_id);
    fprintf(stream, "\", oport=\"");
    ofl_port_print(stream, msg->out_port);
    fprintf(stream, "\", ogrp=\"");
    ofl_group_print(stream, msg->out_group);
    fprintf(stream, "\", cookie=0x%"PRIx64"\", mask=0x%"PRIx64"\", match=",
                  msg->cookie, msg->cookie_mask);
    ofl_structs_match_print(stream, msg->match, exp);
}
Ejemplo n.º 6
0
void
ofl_structs_table_features_print(FILE *stream, struct ofl_table_features *s){
    int i;
    fprintf(stream, "{table=\"");
    ofl_table_print(stream, s->table_id);  
    fprintf(stream, "\", name=\"%s\", "
                          "metadata_match=\"%"PRIx64"\", metadata_write=\"%"PRIx64"\", config=\"%"PRIu32"\"," 
                          "max_entries=\"%"PRIu32"\"",
                  s->name, s->metadata_match, s->metadata_write, s->config, s->max_entries);      
    for(i =0; i < s->properties_num; i++){
        ofl_structs_table_properties_print(stream, s->properties[i]);    
    }    
}
Ejemplo n.º 7
0
void
ofl_structs_flow_stats_print(FILE *stream, struct ofl_flow_stats *s, struct ofl_exp *exp) {
    size_t i;

    fprintf(stream, "{table=\"");
    ofl_table_print(stream, s->table_id);
    fprintf(stream, "\", match=\"");
    ofl_structs_match_print(stream, s->match, exp);
    fprintf(stream, "\", dur_s=\"%u\", dur_ns=\"%u\", prio=\"%u\", "
                          "idle_to=\"%u\", hard_to=\"%u\", cookie=\"0x%"PRIx64"\", "
                          "pkt_cnt=\"%"PRIu64"\", byte_cnt=\"%"PRIu64"\", insts=[",
                  s->duration_sec, s->duration_nsec, s->priority,
                  s->idle_timeout, s->hard_timeout, s->cookie,
                  s->packet_count, s->byte_count);

    for (i=0; i<s->instructions_num; i++) {
        ofl_structs_instruction_print(stream, s->instructions[i], exp);
        if (i < s->instructions_num - 1) { fprintf(stream, ", "); };
    }

    fprintf(stream, "]}");
}
static void
ofl_msg_print_table_mod(struct ofl_msg_table_mod *msg, FILE *stream) {
    fprintf(stream, "{id=\"");
    ofl_table_print(stream, msg->table_id);
    fprintf(stream, "\", config=\"0x%08"PRIx32"\"}", msg->config);
}