1 .\" $NetBSD: lwres_packet.3,v 1.5 2014/12/10 04:38:02 christos Exp $
3 .\" Copyright (C) 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC")
4 .\" Copyright (C) 2000, 2001 Internet Software Consortium.
6 .\" Permission to use, copy, modify, and/or distribute this software for any
7 .\" purpose with or without fee is hereby granted, provided that the above
8 .\" copyright notice and this permission notice appear in all copies.
10 .\" THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
11 .\" REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
12 .\" AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
13 .\" INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
14 .\" LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
15 .\" OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16 .\" PERFORMANCE OF THIS SOFTWARE.
22 .\" Title: lwres_packet
24 .\" Generator: DocBook XSL Stylesheets v1.71.1 <http://docbook.sf.net/>
25 .\" Date: June 18, 2007
29 .TH "LWRES_PACKET" "3" "June 18, 2007" "BIND9" "BIND9"
30 .\" disable hyphenation
32 .\" disable justification (adjust text to left margin only)
35 lwres_lwpacket_renderheader, lwres_lwpacket_parseheader \- lightweight resolver packet handling functions
38 #include <lwres/lwpacket.h>
41 .BI "lwres_result_t lwres_lwpacket_renderheader(lwres_buffer_t\ *" "b" ", lwres_lwpacket_t\ *" "pkt" ");"
43 .BI "lwres_result_t lwres_lwpacket_parseheader(lwres_buffer_t\ *" "b" ", lwres_lwpacket_t\ *" "pkt" ");"
46 These functions rely on a
47 \fBstruct lwres_lwpacket\fR
49 \fIlwres/lwpacket.h\fR.
53 typedef struct lwres_lwpacket lwres_lwpacket_t;
60 struct lwres_lwpacket {
61 lwres_uint32_t length;
62 lwres_uint16_t version;
63 lwres_uint16_t pktflags;
64 lwres_uint32_t serial;
65 lwres_uint32_t opcode;
66 lwres_uint32_t result;
67 lwres_uint32_t recvlength;
68 lwres_uint16_t authtype;
69 lwres_uint16_t authlength;
75 The elements of this structure are:
79 the overall packet length, including the entire packet header. This field is filled in by the lwres_gabn_*() and lwres_gnba_*() calls.
84 the header format. There is currently only one format,
85 \fBLWRES_LWPACKETVERSION_0\fR. This field is filled in by the lwres_gabn_*() and lwres_gnba_*() calls.
90 library\-defined flags for this packet: for instance whether the packet is a request or a reply. Flag values can be set, but not defined by the caller. This field is filled in by the application wit the exception of the LWRES_LWPACKETFLAG_RESPONSE bit, which is set by the library in the lwres_gabn_*() and lwres_gnba_*() calls.
95 is set by the requestor and is returned in all replies. If two or more packets from the same source have the same serial number and are from the same source, they are assumed to be duplicates and the latter ones may be dropped. This field must be set by the application.
100 indicates the operation. Opcodes between 0x00000000 and 0x03ffffff are reserved for use by the lightweight resolver library. Opcodes between 0x04000000 and 0xffffffff are application defined. This field is filled in by the lwres_gabn_*() and lwres_gnba_*() calls.
105 is only valid for replies. Results between 0x04000000 and 0xffffffff are application defined. Results between 0x00000000 and 0x03ffffff are reserved for library use. This field is filled in by the lwres_gabn_*() and lwres_gnba_*() calls.
110 is the maximum buffer size that the receiver can handle on requests and the size of the buffer needed to satisfy a request when the buffer is too large for replies. This field is supplied by the application.
115 defines the packet level authentication that is used. Authorisation types between 0x1000 and 0xffff are application defined and types between 0x0000 and 0x0fff are reserved for library use. Currently these are not used and must be zero.
120 gives the length of the authentication data. Since packet authentication is currently not used, this must be zero.
123 The following opcodes are currently defined:
127 Success is always returned and the packet contents are echoed. The lwres_noop_*() functions should be used for this type.
132 returns all known addresses for a given name. The lwres_gabn_*() functions should be used for this type.
137 return the hostname for the given address. The lwres_gnba_*() functions should be used for this type.
140 \fBlwres_lwpacket_renderheader()\fR
141 transfers the contents of lightweight resolver packet structure
142 \fBlwres_lwpacket_t\fR
144 in network byte order to the lightweight resolver buffer,
147 \fBlwres_lwpacket_parseheader()\fR
148 performs the converse operation. It transfers data in network byte order from buffer
151 \fI*pkt\fR. The contents of the buffer
153 should correspond to a
154 \fBlwres_lwpacket_t\fR.
158 \fBlwres_lwpacket_renderheader()\fR
160 \fBlwres_lwpacket_parseheader()\fR
162 \fBLWRES_R_SUCCESS\fR. If there is insufficient space to copy data between the buffer
164 and lightweight resolver packet
166 both functions return
167 \fBLWRES_R_UNEXPECTEDEND\fR.
169 Copyright \(co 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC")
171 Copyright \(co 2000, 2001 Internet Software Consortium.