1:255.16-alt1
[systemd_ALT.git] / src / resolve / resolved-dnssd.h
blobe978a0d5fc6ec4e16522bf05f7831a23144ade8f
1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
3 #pragma once
5 #include "list.h"
7 typedef struct DnssdService DnssdService;
8 typedef struct DnssdTxtData DnssdTxtData;
10 typedef struct Manager Manager;
11 typedef struct DnsResourceRecord DnsResourceRecord;
12 typedef struct DnsTxtItem DnsTxtItem;
14 enum {
15 DNS_TXT_ITEM_TEXT,
16 DNS_TXT_ITEM_DATA,
19 struct DnssdTxtData {
20 DnsResourceRecord *rr;
22 LIST_HEAD(DnsTxtItem, txts);
24 LIST_FIELDS(DnssdTxtData, items);
27 struct DnssdService {
28 char *filename;
29 char *name;
30 char *name_template;
31 char *type;
32 uint16_t port;
33 uint16_t priority;
34 uint16_t weight;
36 DnsResourceRecord *ptr_rr;
37 DnsResourceRecord *srv_rr;
39 /* Section 6.8 of RFC 6763 allows having service
40 * instances with multiple TXT resource records. */
41 LIST_HEAD(DnssdTxtData, txt_data_items);
43 Manager *manager;
45 bool withdrawn:1;
46 uid_t originator;
49 DnssdService *dnssd_service_free(DnssdService *service);
50 DnssdTxtData *dnssd_txtdata_free(DnssdTxtData *txt_data);
51 DnssdTxtData *dnssd_txtdata_free_all(DnssdTxtData *txt_data);
53 DEFINE_TRIVIAL_CLEANUP_FUNC(DnssdService*, dnssd_service_free);
54 DEFINE_TRIVIAL_CLEANUP_FUNC(DnssdTxtData*, dnssd_txtdata_free);
56 int dnssd_render_instance_name(Manager *m, DnssdService *s, char **ret);
57 int dnssd_load(Manager *manager);
58 int dnssd_txt_item_new_from_string(const char *key, const char *value, DnsTxtItem **ret_item);
59 int dnssd_txt_item_new_from_data(const char *key, const void *value, const size_t size, DnsTxtItem **ret_item);
60 int dnssd_update_rrs(DnssdService *s);
61 int dnssd_signal_conflict(Manager *manager, const char *name);