1#ifndef foollmnrquerierbar
2#define foollmnrquerierbar
3
4typedef struct AvahiLLMNRQuery AvahiLLMNRQuery;
5
6#include <sys/types.h>
7
8#include <avahi-common/address.h>
9#include <avahi-common/defs.h>
10
11#include "core.h"
12#include "publish.h"
13#include "rrlist.h"
14#include "internal.h"
15
16typedef void (*AvahiLLMNRQueryCallback)(
17    AvahiIfIndex idx,
18    AvahiProtocol protocol,
19    AvahiRecord *r,
20    void *userdata);
21
22typedef enum {
23    AVAHI_LLMNR_SIMPLE_QUERY,
24    AVAHI_LLMNR_CONFLICT_QUERY,
25    AVAHI_LLMNR_UNIQUENESS_VERIFICATION_QUERY
26} AvahiLLMNRQueryType;
27
28
29struct AvahiLLMNRQuery{
30    int dead;
31
32    /* 'e = interface->monitor->server->llmnr->llmnr_lookup_engine'
33    maintains the hashmap for all queries by id. */
34    uint32_t id;
35
36    AvahiKey *key;
37    AvahiInterface *interface;
38    AvahiLLMNRQueryCallback callback;
39    AvahiLLMNRQueryType type;
40
41    AvahiRecordList *c_bit_set, *c_bit_clear;
42
43    /* 'AvahiLLMNRQueryScheduler' next_id */
44    unsigned post_id;
45    int post_id_valid;
46
47    void *userdata;
48};
49
50/* Issue an LLMNR Query on the specified interface and key*/
51AvahiLLMNRQuery* avahi_llmnr_query_add(AvahiInterface *i, AvahiKey *key, AvahiLLMNRQueryType type, AvahiLLMNRQueryCallback callback, void *userdata);
52
53/* Remove a scheduled LLMNR query for the specified key and interface*/
54void avahi_llmnr_query_remove(AvahiInterface *i, AvahiKey *key);
55
56/* Issue LLMNR queries for the specied key on all interfaces that match
57idx and protocol. In this case callback function will be 'callback' for
58all those queries. and it issues AVAHI_LLMNR_SIMPLE_QUERY type of query*/
59void avahi_llmnr_query_add_for_all(AvahiServer *s, AvahiIfIndex idx, AvahiProtocol protocol, AvahiKey *key, AvahiLLMNRQueryCallback callback, void *userdata);
60
61/* Remove LLMNR queries for the specified key on all interface that match*/
62void avahi_llmnr_query_remove_for_all(AvahiServer *s, AvahiIfIndex idx, AvahiProtocol protocol, AvahiKey *key);
63
64/* Remove specified query */
65void avahi_llmnr_query_free(AvahiLLMNRQuery *lq);
66void avahi_llmnr_query_destroy(AvahiLLMNRQuery *lq);
67
68/** Remove all queries from specified interface **/
69void avahi_llmnr_queries_free(AvahiInterface *i);
70
71#endif /* foollmnrquerierbar */
72