Unleashed v1.4
[unleashed.git] / share / man / man3dns_sd / DNSServiceQueryRecord.3dns_sd
blob0e5b950095dc311251e8b844c5d7af0a81d763f6
1 '\" te
2 .\" Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved.
3 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
4 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
5 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
6 .TH DNSSERVICEQUERYRECORD 3DNS_SD "Aug 20, 2007"
7 .SH NAME
8 DNSServiceQueryRecord \- query records from DNS
9 .SH SYNOPSIS
10 .LP
11 .nf
12 \fBcc\fR [ \fIflag\fR ... ] \fIfile\fR ... \fB-ldns_sd\fR [ \fIlibrary\fR ... ]
13 #include <dns_sd.h>
15 \fBDNSServiceErrorType\fR \fIDNSServiceQueryRecord\fR(\fBDNSServiceRef\fR *\fIsdRef\fR,
16      \fBDNSServiceFlags\fR \fIflags\fR, \fBuint32_t\fR \fIinterfaceIndex\fR, \fBconst char\fR *\fIfullname\fR,
17      \fBuint16_t\fR \fIrrtype\fR, \fBuint16_t\fR \fIrrclass\fR,
18      \fBDNSServiceServiceQueryRecordReply\fR \fIcallBack\fR, \fBvoid\fR *\fIcontext\fR);
19 .fi
21 .LP
22 .nf
23 \fBtypedef\fR \fIvoid\fR(*\fBDNSServiceQueryRecordReply\fR)(\fBDNSServiceRef\fR \fIDNSServiceRef\fR,
24      \fBDNSServiceFlags\fR \fIflags\fR, \fBuint32_t\fR \fIinterfaceIndex\fR,
25      \fBDNSServiceErrorType\fR \fIerrorCode\fR, \fBconst char\fR *\fIfullname\fR,
26      \fBuint16_t\fR \fIrrtype\fR, \fBuint16_t\fR \fIrrclass\fR, \fBuint16_t\fR \fIrdlen\fR,
27      \fBconst void\fR *\fIrdata\fR, \fBuint32_t\fR \fIttl\fR, \fBvoid\fR *\fIcontext\fR);
28 .fi
30 .SH DESCRIPTION
31 .sp
32 .LP
33 The \fBDNSServiceQueryRecord()\fR function is used to query the daemon for any
34 \fBDNS\fR resource record type. The \fIcallback\fR argument to
35 \fBDNSServiceQueryRecord()\fR points to a function of type
36 \fBDNSServiceQueryRecordReply()\fR listed above. The \fIsdRef\fR parameter in
37 \fBDNSServiceQueryRecord()\fR points to an uninitialized \fIDNSServiceRef\fR.
38 The \fBDNSServiceQueryRecord()\fR function returns \fBkDNSServiceErr_NoError\fR
39 and initializes \fIsdRef\fR on success. The query runs indefinitely until the
40 client terminates by passing the initialized \fIsdRef\fR from the query call to
41 \fBDNSServiceRefDeallocate()\fR.
42 .sp
43 .LP
44 The flag \fBkDNSServiceFlagsLongLivedQuery\fR should be passed in the
45 \fIflags\fR argument of \fBDNSServiceQueryRecord()\fR to create a "long-lived"
46 unicast query in a non-local domain. This flag has no effect on link local
47 multicast queries. Without this flag, unicast queries will be one-shot and only
48 the results that are available at the time of the query will be returned. With
49 long-lived queries, add or remove events that are available after the first
50 call generate callbacks. The \fIinterfaceIndex\fR argument specifies the
51 interface on which to issue the query. Most applications will pass a \fB0\fR as
52 the \fIinterfaceIndex\fR to make the query on all interfaces. See the section
53 "Constants for specifying an interface index" in \fB<dns_sd.h>\fR\&. The
54 \fIfullname\fR argument indicates the full domain name of the resource record
55 to be queried. The \fIrrtype\fR argument indicates the resource record type:
56 \fBkDNSServiceType_PTR\fR, for example. The \fIrrclass\fR argument holds the
57 class of the resource record to be queried (\fBkDNSServiceClass_IN\fR). The
58 \fIcontext\fR argument can be \fINULL\fR and points to a value passed to the
59 callback function.
60 .sp
61 .LP
62 The \fIsdRef\fR argument passed to the callback function is initialized by the
63 call to \fBDNSServiceQueryRecord()\fR. Possible values for the \fIflags\fR
64 parameter to the callback function are \fBkDNSServiceFlagsMoreComing\fR and
65 \fBkDNSServiceFlagsAdd\fR. The \fBkDNSServiceFlagsMoreComing\fR value is set to
66 indicate that additional results are immediately available. The
67 \fBkDNSServiceFlagsAdd\fR value indicates that the results returned to the
68 callback function are for a valid \fBDNS\fR record. If
69 \fBkDNSServiceFlagsAdd\fR is not set, the results returned are for a delete
70 event. The \fIerrorCode\fR passed to the callback is
71 \fBkDNSServiceErr_NoError\fR on success. Otherwise, failure is indicated and
72 other parameter values are undefined. The \fIfullname\fR parameter indicates
73 the full domain name of the resource record . The \fIrrtype\fR indicates the
74 resource record type. The \fIrrclass\fR indicates the class of the \fBDNS\fR
75 resource record. The \fIrdlen\fR parameter indicates the length of the resource
76 record \fIrdata\fR in bytes. The \fIrdata\fR parameter points to raw rdata of
77 the resource record. The \fIttl\fR parameter indicates the time to live of the
78 resource record in seconds. The \fIcontext\fR parameter points to the value
79 passed  by the application in the \fBcontext\fR argument to the
80 \fBDNSServiceQueryRecord()\fR call.
81 .SH RETURN VALUES
82 .sp
83 .LP
84 The \fBDNSServiceQueryRecord\fR function returns \fBkDNSServiceErr_NoError\fR
85 on success. Otherwise, an error code defined in \fB<dns_sd.h>\fR is returned to
86 indicate the specific failure that occurred.
87 .SH ATTRIBUTES
88 .sp
89 .LP
90 See \fBattributes\fR(5) for description of the following attributes:
91 .sp
93 .sp
94 .TS
95 box;
96 c | c
97 l | l .
98 ATTRIBUTE TYPE  ATTRIBUTE VALUE
100 Interface Stability     Committed
102 MT-Level        Safe
105 .SH SEE ALSO
108 \fBDNSServiceBrowse\fR(3DNS_SD), \fBDNSServiceRegister\fR(3DNS_SD),
109 \fBDNSServiceResolve\fR(3DNS_SD), \fBattributes\fR(5)