Ejemplo n.º 1
0
 epr_t *epr_from_string(const char* str)
 {
 	char *p;
	char *uri;
	hash_t *selectors;
	hash_t *selectors_new;
	hnode_t        *hn;
	hscan_t         hs;
	selector_entry *entry;
	epr_t *epr;

	p = strchr(str, '?');
	uri = u_strndup(str, p - str);
	selectors = u_parse_query(p + 1);
	selectors_new = hash_create2(HASHCOUNT_T_MAX, 0, 0);

	hash_scan_begin(&hs, selectors);
	while ((hn = hash_scan_next(&hs))) {
		entry = u_malloc(sizeof(selector_entry));
		entry->type = 0;
		entry->entry.text = (char *)hnode_get(hn);
		hash_alloc_insert(selectors_new, hnode_getkey(hn), entry);
	}

	epr = epr_create(uri, selectors_new, NULL);
	hash_free(selectors_new);
	hash_free(selectors);
	u_free(uri);
	return epr;
 }
Ejemplo n.º 2
0
void set_config( void *self, dictionary *config )
{
  debug("reading configuration file options");
  if (config) {
    cim_namespace = iniparser_getstr (config, "cim:default_cim_namespace");
    char *namespaces = iniparser_getstr (config, "cim:vendor_namespaces");
    cim_host = iniparser_getstring(config, "cim:host", "localhost");
    cim_client_frontend = iniparser_getstring(config, "cim:cim_client_frontend", "XML");
    cim_port = iniparser_getstring(config, "cim:port", DEFAULT_HTTP_CIMOM_PORT);
    server_port = iniparser_getstring(config, "server:port", server_port);
    cim_ssl = iniparser_getboolean(config, "cim:ssl", 0);
    cim_trust_store = iniparser_getstring(config, "cim:trust_store", "/etc/ssl/certs");
    cim_verify = iniparser_getboolean(config, "cim:verify_cert", 0);
    omit_schema_optional = iniparser_getboolean(config, "cim:omit_schema_optional", 0);
    indication_profile_implementation_ns = iniparser_getstring(config, "cim:indication_profile_implementation_ns", "root/interop");
    debug("vendor namespaces: %s", namespaces);
    if (namespaces) {
      hash_t * t = u_parse_query(namespaces);
      if (t) {
        vendor_namespaces = t;
      }
      else
        vendor_namespaces = NULL;
    }
    debug("cim namespace: %s", cim_namespace);
  }
  return;
}
Ejemplo n.º 3
0
void
wsmc_add_selector_from_uri(WsXmlDocH doc,
		const char *resource_uri)
{
	u_uri_t        *uri;
	WsXmlNodeH      header = ws_xml_get_soap_header(doc);
	hash_t         *query;
	hnode_t        *hn;
	hscan_t         hs;

	if (resource_uri != NULL) {
		if (u_uri_parse((const char *) resource_uri, &uri) != 0)
			return;
		else if (!uri->query)
			goto cleanup;
	}

	query = u_parse_query(uri->query);
	hash_scan_begin(&hs, query);
	while ((hn = hash_scan_next(&hs))) {
		wsman_add_selector(header,
				(char *) hnode_getkey(hn),
				(char *) hnode_get(hn));
		debug("key=%s value=%s", (char *) hnode_getkey(hn),
				(char *) hnode_get(hn));
	}
	hash_free_nodes(query);
	hash_destroy(query);
cleanup:
	if (uri) {
		u_uri_free(uri);
	}
}
Ejemplo n.º 4
0
void
wsmc_add_selectors_from_str(client_opt_t * options,
		const char *query_string)
{
	if (query_string) {
		hash_t *query = u_parse_query(query_string);
		if (query) {
			options->selectors = query;
		}
	}
}
Ejemplo n.º 5
0
void
wsmc_add_prop_from_str(client_opt_t * options,
		const char *query_string)
{
	hash_t *query;
	if (!query_string)
		return;

        query = u_parse_query(query_string);
	if (query) {
		options->properties = query;
	}
}
Ejemplo n.º 6
0
static hash_t *
get_selectors_from_uri(const char *resource_uri)
{
	u_uri_t        *uri;
	hash_t *selectors = NULL;
	if (resource_uri != NULL) {
		if (u_uri_parse((const char *) resource_uri, &uri) != 0)
			return NULL;
	} else {
		return NULL;
	}
	if (uri->query != NULL) {
		 selectors = u_parse_query(uri->query);
	}
	if (uri) {
		u_uri_free(uri);
	}
	return selectors;
}