Revision 3797b8e7

b/src/libstrongswan/settings.c
325 325
}
326 326

  
327 327
/**
328
 * Enumerate key and values, not kv_t entries
329
 */
330
static bool kv_filter(void *null, kv_t **in, char **key,
331
					  void *none, char **value)
332
{
333
	*key = (*in)->key;
334
	*value = (*in)->value;
335
	return TRUE;
336
}
337

  
338
/**
339
 * Implementation of settings_t.create_key_value_enumerator
340
 */
341
static enumerator_t* create_key_value_enumerator(private_settings_t *this,
342
												 char *key, ...)
343
{
344
	section_t *section;
345
	va_list args;
346

  
347
	va_start(args, key);
348
	section = find_section(this->top, key, args);
349
	va_end(args);
350

  
351
	if (!section)
352
	{
353
		return enumerator_create_empty();
354
	}
355
	return enumerator_create_filter(
356
					section->kv->create_enumerator(section->kv),
357
					(void*)kv_filter, NULL, NULL);
358
}
359

  
360
/**
328 361
 * destroy a section
329 362
 */
330 363
static void section_destroy(section_t *this)
......
495 528
	this->public.get_time = (u_int32_t(*)(settings_t*, char *key, u_int32_t def, ...))get_time;
496 529
	this->public.get_bool = (bool(*)(settings_t*, char *key, bool def, ...))get_bool;
497 530
	this->public.create_section_enumerator = (enumerator_t*(*)(settings_t*,char *section, ...))create_section_enumerator;
531
	this->public.create_key_value_enumerator = (enumerator_t*(*)(settings_t*, char *key, ...))create_key_value_enumerator;
498 532
	this->public.destroy = (void(*)(settings_t*))destroy;
499 533

  
500 534
	this->top = NULL;
b/src/libstrongswan/settings.h
103 103
	 */
104 104
	enumerator_t* (*create_section_enumerator)(settings_t *this,
105 105
											   char *section, ...);
106

  
107
	/**
108
	 * Create an enumerator over key/value pairs in a section.
109
	 *
110
	 * @param section	section name to list key/value pairs of, printf style
111
	 * @param ...		argmuent list for section
112
	 * @return			enumerator over (char *key, char *value)
113
	 */
114
	enumerator_t* (*create_key_value_enumerator)(settings_t *this,
115
												 char *section, ...);
116

  
106 117
	/**
107 118
	 * Destroy a settings instance.
108 119
	 */

Also available in: Unified diff