lwres_context.docbook revision d4ef65050feac78554addf6e16a06c6e2e0bd331
d4ef65050feac78554addf6e16a06c6e2e0bd331Brian Wellington<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook V4.1//EN">
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews - Copyright (C) 2001 Internet Software Consortium.
ec5347e2c775f027573ce5648b910361aa926c01Automatic Updater - Permission to use, copy, modify, and distribute this software for any
d4ef65050feac78554addf6e16a06c6e2e0bd331Brian Wellington - purpose with or without fee is hereby granted, provided that the above
d4ef65050feac78554addf6e16a06c6e2e0bd331Brian Wellington - copyright notice and this permission notice appear in all copies.
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews - THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews - DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews - INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews - INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews - FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews - NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
d4ef65050feac78554addf6e16a06c6e2e0bd331Brian Wellington - WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt<!-- $Id: lwres_context.docbook,v 1.2 2001/04/10 21:51:25 bwelling Exp $ -->
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt<refentryinfo>
94bd918b63001277f1b28ae4581645f8a835688fBob Halley</refentryinfo>
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein<refpurpose>lightweight resolver context management</refpurpose>
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein</refnamediv>
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein<refsynopsisdiv>
c1a883f2e04d94e99c433b1f6cfd0c0338f4ed85Mark Andrews<funcsynopsis>
cfa2326b5c96a3a4c720262e077b2baf9fc27970Tinderbox User<funcsynopsisinfo>#include <lwres/lwres.h></funcsynopsisinfo>
938440694b33cd752e9e4b71a526368b4811c177Tinderbox User<funcprototype>
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austeinlwres_result_t
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein<function>lwres_context_create</function></funcdef>
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein<paramdef>lwres_malloc_t malloc_function</paramdef>
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein</funcprototype>
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein<funcprototype>
94bd918b63001277f1b28ae4581645f8a835688fBob Halleylwres_result_t
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt<function>lwres_context_destroy</function></funcdef>
94bd918b63001277f1b28ae4581645f8a835688fBob Halley</funcprototype>
94bd918b63001277f1b28ae4581645f8a835688fBob Halley<funcprototype>
30eec077db2bdcb6f2a0dc388a3cdde2ede75ec1Mark Andrews<function>lwres_context_initserial</function></funcdef>
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein</funcprototype>
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein<funcprototype>
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austeinlwres_uint32_t
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein<function>lwres_context_nextserial</function></funcdef>
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein</funcprototype>
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein<funcprototype>
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein<function>lwres_context_freemem</function></funcdef>
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein</funcprototype>
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein<funcprototype>
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein<function>lwres_context_allocmem</function></funcdef>
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein</funcprototype>
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein<funcprototype>
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein<function>lwres_context_sendrecv</function></funcdef>
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein</funcprototype>
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein</funcsynopsis>
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein</refsynopsisdiv>
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austeinstructure for use in lightweight resolver operations.
268a4475065fe6a8cd7cc707820982cf5e98f430Rob AusteinIt holds a socket and other data needed for communicating
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austeinwith a resolver daemon.
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austeinis returned throught
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austeina pointer to a
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austeinpointer. This
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austeinpointer must initially be NULL, and is modified
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austeinto point to the newly created
268a4475065fe6a8cd7cc707820982cf5e98f430Rob AusteinWhen the lightweight resolver needs to perform dynamic memory
4eb998928b9aef0ceda42d7529980d658138698aEvan Huntallocation, it will call
4eb998928b9aef0ceda42d7529980d658138698aEvan Huntto allocate memory and
4eb998928b9aef0ceda42d7529980d658138698aEvan Huntto free it. If
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austeinare NULL, memory is allocated using
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein<citerefentry>
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein<refentrytitle>free</refentrytitle><manvolnum>3</manvolnum>
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein</citerefentry>.
268a4475065fe6a8cd7cc707820982cf5e98f430Rob AusteinIt is not permitted to have a NULL
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austeinand a non-NULL
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Huntor vice versa.
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Huntis passed as the first parameter to the memory
30eec077db2bdcb6f2a0dc388a3cdde2ede75ec1Mark Andrewsallocation functions.
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austeinis unused and should be passed as NULL.
94bd918b63001277f1b28ae4581645f8a835688fBob HalleyOnce memory for the structure has been allocated,
94bd918b63001277f1b28ae4581645f8a835688fBob Halleyit is initialized using
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein<citerefentry>
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein<refentrytitle>lwres_conf_init</refentrytitle><manvolnum>3</manvolnum>
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein</citerefentry>
7389e8330d62a059b8923fb8ca6f933caeb559d9Mark Andrewsand returned via
94bd918b63001277f1b28ae4581645f8a835688fBob Halleyclosing its socket.
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austeinis a pointer to a pointer to the context that is to be destroyed.
268a4475065fe6a8cd7cc707820982cf5e98f430Rob AusteinThe pointer will be set to NULL when the context has been destroyed.
7389e8330d62a059b8923fb8ca6f933caeb559d9Mark AndrewsThe context holds a serial number that is used to identify resolver
561a29af8c54a216e7d30b5b4f6e0d21661654ecMark Andrewsrequest packets and associate responses with the corresponding requests.
94bd918b63001277f1b28ae4581645f8a835688fBob HalleyThis serial number is controlled using
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austeinsets the serial number for context
4eb998928b9aef0ceda42d7529980d658138698aEvan Huntincrements the serial number and returns the previous value.
268a4475065fe6a8cd7cc707820982cf5e98f430Rob AusteinMemory for a lightweight resolver context is allocated and freed using
268a4475065fe6a8cd7cc707820982cf5e98f430Rob AusteinThese use whatever allocations were defined when the context was
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austeinbytes of memory and if successful returns a pointer to the allocated
94bd918b63001277f1b28ae4581645f8a835688fBob Halleymust be greater than 0.
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austeinbytes of space starting at location
94bd918b63001277f1b28ae4581645f8a835688fBob Halleyperforms I/O for the context
268a4475065fe6a8cd7cc707820982cf5e98f430Rob AusteinData are read and written from the context's socket.
268a4475065fe6a8cd7cc707820982cf5e98f430Rob AusteinIt writes data from
94bd918b63001277f1b28ae4581645f8a835688fBob Halley— typically a lightweight resolver query packet —
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Huntand waits for a reply which is copied to the receive buffer at
30eec077db2bdcb6f2a0dc388a3cdde2ede75ec1Mark AndrewsThe number of bytes that were written to this receive buffer is
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Huntif memory for the
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Huntcould not be allocated,