Ejemplo n.º 1
0
bool
flow_entry_matches(struct flow_entry *entry, struct ofl_msg_flow_mod *mod, bool strict) {
    if (strict) {
        return (entry->stats->priority == mod->priority) &&
               match_std_strict((struct ofl_match_standard *)entry->stats->match,
                                (struct ofl_match_standard *)mod->match);
    } else {
        return match_std_nonstrict((struct ofl_match_standard *)entry->stats->match,
                                   (struct ofl_match_standard *)mod->match);
    }
}
Ejemplo n.º 2
0
bool
flow_entry_matches(struct flow_entry *entry, struct ofl_msg_flow_mod *mod, bool strict, bool check_cookie) {
	if (check_cookie && ((entry->stats->cookie & mod->cookie_mask) != (mod->cookie & mod->cookie_mask))) {
		return false;
	}
    
    if (strict) {
        return ( (entry->stats->priority == mod->priority) &&
                 match_std_strict((struct ofl_match *)mod->match,
                                (struct ofl_match *)entry->stats->match));
    } else {
        return match_std_nonstrict((struct ofl_match *)mod->match,
                                   (struct ofl_match *)entry->stats->match);
    }
}
void
flow_table_aggregate_stats(struct flow_table *table, struct ofl_msg_stats_request_flow *msg,
                           uint64_t *packet_count, uint64_t *byte_count, uint32_t *flow_count) {
    struct flow_entry *entry;

    LIST_FOR_EACH(entry, struct flow_entry, match_node, &table->match_entries) {
        if ((msg->out_port == OFPP_ANY || flow_entry_has_out_port(entry, msg->out_port)) &&
            (msg->out_group == OFPG_ANY || flow_entry_has_out_group(entry, msg->out_group)) &&
            match_std_nonstrict((struct ofl_match_standard *)msg->match,
                                (struct ofl_match_standard *)entry->stats->match)) {

            (*packet_count) += entry->stats->packet_count;
            (*byte_count)   += entry->stats->byte_count;
            (*flow_count)++;
        }
    }

}
Ejemplo n.º 4
0
void
flow_table_stats(struct flow_table *table, struct ofl_msg_stats_request_flow *msg,
                 struct ofl_flow_stats ***stats, size_t *stats_size, size_t *stats_num) {
    struct flow_entry *entry;

    LIST_FOR_EACH(entry, struct flow_entry, match_node, &table->match_entries) {
        if ((msg->out_port == OFPP_ANY || flow_entry_has_out_port(entry, msg->out_port)) &&
            (msg->out_group == OFPG_ANY || flow_entry_has_out_group(entry, msg->out_group)) &&
            match_std_nonstrict((struct ofl_match *)msg->match,
                                (struct ofl_match *)entry->stats->match)) {

            flow_entry_update(entry);
            if ((*stats_size) == (*stats_num)) {
                (*stats) = xrealloc(*stats, (sizeof(struct ofl_flow_stats *)) * (*stats_size) * 2);
                *stats_size *= 2;
            }
            (*stats)[(*stats_num)] = entry->stats;
            (*stats_num)++;
        }
    }
}
Ejemplo n.º 5
0
/* Two matches overlap, if there exists a packet,
   which both match structures match on. */
bool
match_std_overlap(struct ofl_match *a, struct ofl_match *b) {
    return (match_std_nonstrict(a, b) || match_std_nonstrict(b, a));
}
Ejemplo n.º 6
0
/* Two matches overlap, if there exists a packet,
   which both match structures match on. */
bool
match_std_overlap(struct ofl_match_standard *a, struct ofl_match_standard *b) {
	return match_std_nonstrict(a, b) || match_std_nonstrict(b, a);
}