static krb5_error_code parse_reg_values(krb5_context context, HKEY key, krb5_config_section ** parent) { DWORD index; LONG rcode; for (index = 0; ; index ++) { char name[16385]; DWORD cch = sizeof(name)/sizeof(name[0]); DWORD type; DWORD cbdata = 0; krb5_error_code code; rcode = RegEnumValue(key, index, name, &cch, NULL, &type, NULL, &cbdata); if (rcode != ERROR_SUCCESS) break; if (cbdata == 0) continue; code = parse_reg_value(context, key, name, type, cbdata, parent); if (code != 0) return code; } return 0; }
/* Convert 'string' (as described in the Flow Syntax section of the ovs-ofctl * man page) into 'pf'. If 'actions' is specified, an action must be in * 'string' and may be expanded or reallocated. */ void parse_ofp_str(struct flow_mod *fm, uint8_t *table_idx, struct ofpbuf *actions, char *string) { char *save_ptr = NULL; char *name; if (table_idx) { *table_idx = 0xff; } cls_rule_init_catchall(&fm->cr, OFP_DEFAULT_PRIORITY); fm->cookie = htonll(0); fm->command = UINT16_MAX; fm->idle_timeout = OFP_FLOW_PERMANENT; fm->hard_timeout = OFP_FLOW_PERMANENT; fm->buffer_id = UINT32_MAX; fm->out_port = OFPP_NONE; fm->flags = 0; if (actions) { char *act_str = strstr(string, "action"); if (!act_str) { ovs_fatal(0, "must specify an action"); } *act_str = '\0'; act_str = strchr(act_str + 1, '='); if (!act_str) { ovs_fatal(0, "must specify an action"); } act_str++; str_to_action(act_str, actions); fm->actions = actions->data; fm->n_actions = actions->size / sizeof(union ofp_action); } else { fm->actions = NULL; fm->n_actions = 0; } for (name = strtok_r(string, "=, \t\r\n", &save_ptr); name; name = strtok_r(NULL, "=, \t\r\n", &save_ptr)) { const struct protocol *p; if (parse_protocol(name, &p)) { cls_rule_set_dl_type(&fm->cr, htons(p->dl_type)); if (p->nw_proto) { cls_rule_set_nw_proto(&fm->cr, p->nw_proto); } } else { const struct field *f; char *value; value = strtok_r(NULL, ", \t\r\n", &save_ptr); if (!value) { ovs_fatal(0, "field %s missing value", name); } if (table_idx && !strcmp(name, "table")) { *table_idx = atoi(value); } else if (!strcmp(name, "out_port")) { fm->out_port = atoi(value); } else if (!strcmp(name, "priority")) { fm->cr.priority = atoi(value); } else if (!strcmp(name, "idle_timeout")) { fm->idle_timeout = atoi(value); } else if (!strcmp(name, "hard_timeout")) { fm->hard_timeout = atoi(value); } else if (!strcmp(name, "cookie")) { fm->cookie = htonll(str_to_u64(value)); } else if (parse_field_name(name, &f)) { if (!strcmp(value, "*") || !strcmp(value, "ANY")) { if (f->wildcard) { fm->cr.wc.wildcards |= f->wildcard; cls_rule_zero_wildcarded_fields(&fm->cr); } else if (f->index == F_NW_SRC) { cls_rule_set_nw_src_masked(&fm->cr, 0, 0); } else if (f->index == F_NW_DST) { cls_rule_set_nw_dst_masked(&fm->cr, 0, 0); } else if (f->index == F_IPV6_SRC) { cls_rule_set_ipv6_src_masked(&fm->cr, &in6addr_any, &in6addr_any); } else if (f->index == F_IPV6_DST) { cls_rule_set_ipv6_dst_masked(&fm->cr, &in6addr_any, &in6addr_any); } else if (f->index == F_DL_VLAN) { cls_rule_set_any_vid(&fm->cr); } else if (f->index == F_DL_VLAN_PCP) { cls_rule_set_any_pcp(&fm->cr); } else { NOT_REACHED(); } } else { parse_field_value(&fm->cr, f->index, value); } } else if (!strncmp(name, "reg", 3) && isdigit((unsigned char) name[3])) { unsigned int reg_idx = atoi(name + 3); if (reg_idx >= FLOW_N_REGS) { ovs_fatal(0, "only %d registers supported", FLOW_N_REGS); } parse_reg_value(&fm->cr, reg_idx, value); } else { ovs_fatal(0, "unknown keyword %s", name); } } } }