summaryrefslogtreecommitdiffstats
path: root/src/map.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/map.c')
-rw-r--r--src/map.c39
1 files changed, 22 insertions, 17 deletions
diff --git a/src/map.c b/src/map.c
index 24686b0..3faaaf9 100644
--- a/src/map.c
+++ b/src/map.c
@@ -64,9 +64,10 @@ struct {
/* The name of the backend entry for this
* entry. */
char *id;
- /* Key and value. */
- char *key;
- unsigned int key_len;
+ /* Keys and value. */
+ int n_keys;
+ char **key;
+ unsigned int *key_len;
char *value;
unsigned int value_len;
} *entries;
@@ -209,10 +210,11 @@ map_data_foreach_entry(struct plugin_state *state,
bool_t secure,
const char *key, unsigned int key_len,
const char *value, unsigned int value_len,
- const char *id, void *cbdata),
+ const char *id, int key_index,
+ void *cbdata),
void *cbdata)
{
- int i, j;
+ int i, j, k;
struct domain *domain;
struct map *map;
struct map_entry *entry;
@@ -226,14 +228,18 @@ map_data_foreach_entry(struct plugin_state *state,
if (all ||
((id != NULL) &&
(strcmp(id, entry->id) == 0))) {
- if (!(*fn)(domain->name, map->name,
- map->secure,
- entry->key,
- entry->key_len,
- entry->value,
- entry->value_len,
- entry->id, cbdata)) {
- return FALSE;
+ for (k = 0; k < entry->n_keys; k++) {
+ if (!(*fn)(domain->name,
+ map->name,
+ map->secure,
+ entry->key[k],
+ entry->key_len[k],
+ entry->value,
+ entry->value_len,
+ entry->id, k,
+ cbdata)) {
+ return FALSE;
+ }
}
}
}
@@ -251,7 +257,8 @@ map_data_foreach_entry_id(struct plugin_state *state, const char *id,
unsigned int key_len,
const char *value,
unsigned int value_len,
- const char *id, void *cbdata),
+ const char *id, int key_index,
+ void *cbdata),
void *cbdata)
{
return map_data_foreach_entry(state, FALSE, id, fn, cbdata);
@@ -452,8 +459,7 @@ map_next(struct plugin_state *state,
const char *domain_name, const char *map_name, bool_t *secure,
unsigned int prev_len, const char *prev,
unsigned int *next_key_len, char **next_key,
- unsigned int *next_value_len, char **next_value,
- const char **next_id)
+ unsigned int *next_value_len, char **next_value)
{
struct map *map;
struct map_entry *entry;
@@ -470,7 +476,6 @@ map_next(struct plugin_state *state,
*next_key = entry->next->key;
*next_value_len = entry->next->value_len;
*next_value = entry->next->value;
- *next_id = entry->next->id;
return TRUE;
}
bool_t