diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2012-10-08 02:45:07 +0200 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2012-10-08 02:45:07 +0200 |
commit | 26f5dc2ab09ed83380a374300b10a245f4c848f4 (patch) | |
tree | 7b03c6b85859cb8e470491a18aac135ebb4c226d /ffd/announce.c | |
parent | 46a05f96643b31ca6b4006c34cdee21c273bc2a4 (diff) | |
download | ffd-26f5dc2ab09ed83380a374300b10a245f4c848f4.tar ffd-26f5dc2ab09ed83380a374300b10a245f4c848f4.zip |
Answer requests for single announcements
Diffstat (limited to 'ffd/announce.c')
-rw-r--r-- | ffd/announce.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/ffd/announce.c b/ffd/announce.c index 151d1b3..ae0a406 100644 --- a/ffd/announce.c +++ b/ffd/announce.c @@ -138,3 +138,28 @@ ffd_announce_t* ffd_announce_new(void) { return a; } + +ffd_announce_t* ffd_announce_find(const ffd_node_id_t *node, uint16_t type, uint16_t key) { + ffd_announce_t *announce; + for (announce = announce_list; announce; announce = announce->next) { + if (ffd_are_node_ids_equal(&announce->node, node) + && announce->type == type + && announce->key == key) + return announce; + } + + return NULL; +} + +ffd_announce_t* ffd_announce_get(const ffd_node_id_t *node, uint16_t type, uint16_t key) { + ffd_announce_t *announce = ffd_announce_find(node, type, key); + + if (!announce) { + announce = ffd_announce_new(); + announce->node = *node; + announce->type = type; + announce->key = key; + } + + return announce; +} |