- if (flow_wildcards_set_nw_src_mask(&rule->wc, mask)) {
- rule->flow.nw_src = ip & mask;
- return true;
- } else {
- return false;
- }
-}
-
-void
-cls_rule_set_nw_dst(struct cls_rule *rule, ovs_be32 nw_dst)
-{
- cls_rule_set_nw_dst_masked(rule, nw_dst, htonl(UINT32_MAX));
-}
-
-bool
-cls_rule_set_nw_dst_masked(struct cls_rule *rule, ovs_be32 ip, ovs_be32 mask)
-{
- if (flow_wildcards_set_nw_dst_mask(&rule->wc, mask)) {
- rule->flow.nw_dst = ip & mask;
- return true;
- } else {
- return false;
- }
-}
-
-void
-cls_rule_set_nw_tos(struct cls_rule *rule, uint8_t nw_tos)
-{
- rule->wc.wildcards &= ~OFPFW_NW_TOS;
- rule->flow.nw_tos = nw_tos & IP_DSCP_MASK;
-}
-
-void
-cls_rule_set_icmp_type(struct cls_rule *rule, uint8_t icmp_type)
-{
- rule->wc.wildcards &= ~OFPFW_ICMP_TYPE;
- rule->flow.icmp_type = htons(icmp_type);
-
-}
-
-void
-cls_rule_set_icmp_code(struct cls_rule *rule, uint8_t icmp_code)
-{
- rule->wc.wildcards &= ~OFPFW_ICMP_CODE;
- rule->flow.icmp_code = htons(icmp_code);
-}
-
-/* Converts 'rule' to a string and returns the string. The caller must free
- * the string (with free()). */
-char *
-cls_rule_to_string(const struct cls_rule *rule)
-{
- struct ds s = DS_EMPTY_INITIALIZER;
- ds_put_format(&s, "wildcards=%x priority=%u ",
- rule->wc.wildcards, rule->priority);
- flow_format(&s, &rule->flow);
- return ds_cstr(&s);
-}
-
-/* Prints cls_rule 'rule', for debugging.
- *
- * (The output could be improved and expanded, but this was good enough to
- * debug the classifier.) */
-void
-cls_rule_print(const struct cls_rule *rule)
-{
- printf("wildcards=%x priority=%u ", rule->wc.wildcards, rule->priority);
- flow_print(stdout, &rule->flow);
- putc('\n', stdout);