1DNSServiceQueryRecordD(N3SDNSSe_rSvDi)ce Discovery LibraryDNFSuSnecrtviiocnesQueryRecord(3DNS_SD)
2
3
4

NAME

6       DNSServiceQueryRecord - query records from DNS
7

SYNOPSIS

9       cc [ flag ... ] file ... -ldns_sd [ library ... ]
10       #include <dns_sd.h>
11
12       DNSServiceErrorType DNSServiceQueryRecord(DNSServiceRef *sdRef,
13            DNSServiceFlags flags, uint32_t interfaceIndex, const char *fullname,
14            uint16_t rrtype, uint16_t rrclass,
15            DNSServiceServiceQueryRecordReply callBack, void *context);
16
17
18       typedef void(*DNSServiceQueryRecordReply)(DNSServiceRef DNSServiceRef,
19            DNSServiceFlags flags, uint32_t interfaceIndex,
20            DNSServiceErrorType errorCode, const char *fullname,
21            uint16_t rrtype, uint16_t rrclass, uint16_t rdlen,
22            const void *rdata, uint32_t ttl, void *context);
23
24

DESCRIPTION

26       The  DNSServiceQueryRecord()  function  is used to query the daemon for
27       any DNS resource record type.  The  callback  argument  to  DNSService‐
28       QueryRecord() points to a function of type DNSServiceQueryRecordReply()
29       listed above. The sdRef parameter in DNSServiceQueryRecord() points  to
30       an  uninitialized  DNSServiceRef.  The DNSServiceQueryRecord() function
31       returns kDNSServiceErr_NoError and initializes sdRef  on  success.  The
32       query runs indefinitely until the client terminates by passing the ini‐
33       tialized sdRef from the query call to DNSServiceRefDeallocate().
34
35
36       The flag kDNSServiceFlagsLongLivedQuery should be passed in  the  flags
37       argument  of  DNSServiceQueryRecord()  to create a "long-lived" unicast
38       query in a non-local domain. This flag has no effect on link local mul‐
39       ticast queries. Without this flag, unicast queries will be one-shot and
40       only the results that are available at the time of the  query  will  be
41       returned. With long-lived queries, add or remove events that are avail‐
42       able after the first call generate callbacks. The interfaceIndex  argu‐
43       ment specifies the interface on which to issue the query. Most applica‐
44       tions will pass a 0 as the interfaceIndex to  make  the  query  on  all
45       interfaces.  See  the  section  "Constants  for specifying an interface
46       index" in <dns_sd.h>. The fullname argument indicates the  full  domain
47       name  of  the  resource record to be queried. The rrtype argument indi‐
48       cates the resource record type: kDNSServiceType_PTR, for  example.  The
49       rrclass  argument  holds the class of the resource record to be queried
50       (kDNSServiceClass_IN). The context argument can be NULL and points to a
51       value passed to the callback function.
52
53
54       The  sdRef  argument  passed to the callback function is initialized by
55       the call to DNSServiceQueryRecord().  Possible  values  for  the  flags
56       parameter  to  the callback function are kDNSServiceFlagsMoreComing and
57       kDNSServiceFlagsAdd. The kDNSServiceFlagsMoreComing  value  is  set  to
58       indicate   that  additional  results  are  immediately  available.  The
59       kDNSServiceFlagsAdd value indicates that the results  returned  to  the
60       callback function are for a valid DNS record. If kDNSServiceFlagsAdd is
61       not set, the results returned are for a  delete  event.  The  errorCode
62       passed to the callback is kDNSServiceErr_NoError on success. Otherwise,
63       failure is indicated and other  parameter  values  are  undefined.  The
64       fullname  parameter  indicates  the  full  domain  name of the resource
65       record . The rrtype indicates the resource  record  type.  The  rrclass
66       indicates  the  class  of  the DNS resource record. The rdlen parameter
67       indicates the length of the resource record rdata in bytes.  The  rdata
68       parameter points to raw rdata of the resource record. The ttl parameter
69       indicates the time to live of the resource record in seconds. The  con‐
70       text  parameter  points  to the value passed  by the application in the
71       context argument to the DNSServiceQueryRecord() call.
72

RETURN VALUES

74       The DNSServiceQueryRecord function  returns  kDNSServiceErr_NoError  on
75       success.  Otherwise, an error code defined in <dns_sd.h> is returned to
76       indicate the specific failure that occurred.
77

ATTRIBUTES

79       See attributes(5) for description of the following attributes:
80
81
82
83
84       ┌─────────────────────────────┬─────────────────────────────┐
85       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
86       ├─────────────────────────────┼─────────────────────────────┤
87       │Interface Stability          │Committed                    │
88       ├─────────────────────────────┼─────────────────────────────┤
89       │MT-Level                     │Safe                         │
90       └─────────────────────────────┴─────────────────────────────┘
91

SEE ALSO

93       DNSServiceBrowse(3DNS_SD),  DNSServiceRegister(3DNS_SD),  DNSServiceRe‐
94       solve(3DNS_SD), attributes(5)
95
96
97
98SunOS 5.11                        20 Aug 2007   DNSServiceQueryRecord(3DNS_SD)
Impressum