2390N/A - Copyright (C) 2000, 2001 Internet Software Consortium. 2390N/A - Permission to use, copy, modify, and distribute this software for any 2390N/A - purpose with or without fee is hereby granted, provided that the above 2390N/A - copyright notice and this permission notice appear in all copies. 2390N/A - THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM 6983N/A - DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL 6983N/A - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL 2390N/A - INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, 2390N/A - INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING 2390N/A - FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, 2390N/A - NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 6983N/A - WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 2390N/ACONTENT="Modular DocBook HTML Stylesheet Version 1.61 2390N/A>lwres_context_create, lwres_context_destroy, lwres_context_nextserial, lwres_context_initserial, lwres_context_freemem, lwres_context_allocmem, lwres_context_sendrecv -- lightweight resolver context management</
DIV 2390N/A>(lwres_context_t **contextp, void *arg, lwres_malloc_t malloc_function, lwres_free_t free_function);</
CODE 2390N/A>(lwres_context_t **contextp);</
CODE 2390N/Alwres_context_initserial</
CODE 2390N/A>(lwres_context_t *ctx, lwres_uint32_t serial);</
CODE 2390N/Alwres_context_nextserial</
CODE 2390N/A>(lwres_context_t *ctx);</
CODE 2390N/A>(lwres_context_t *ctx, void *mem, size_t len);</
CODE 2390N/Alwres_context_allocmem</
CODE 2390N/A>(lwres_context_t *ctx, size_t len);</
CODE 2390N/Alwres_context_sendrecv</
CODE 2390N/A>(lwres_context_t *ctx, void *sendbase, int sendlen, void *recvbase, int recvlen, int *recvd_len);</
CODE 2390N/Astructure for use in lightweight resolver operations.
2899N/AIt holds a socket and other data needed for communicating
2390N/Apointer must initially be NULL, and is modified
2390N/Ato point to the newly created
2390N/A>When the lightweight resolver needs to perform dynamic memory
2390N/Aare NULL, memory is allocated using
2390N/AIt is not permitted to have a NULL
2390N/Ais passed as the first parameter to the memory
2390N/Ais unused and should be passed as NULL.</
P 2390N/A>Once memory for the structure has been allocated,
2390N/A>lwres_context_destroy()</
TT 2390N/Ais a pointer to a pointer to the context that is to be destroyed.
4303N/AThe pointer will be set to NULL when the context has been destroyed.</
P 2390N/A>The context holds a serial number that is used to identify resolver
2390N/Arequest packets and associate responses with the corresponding requests.
2390N/AThis serial number is controlled using
2390N/A>lwres_context_initserial()</
TT 2390N/A>lwres_context_nextserial()</
TT 2390N/A>lwres_context_initserial()</
TT 2390N/Asets the serial number for context
2390N/A>lwres_context_nextserial()</
TT 2390N/Aincrements the serial number and returns the previous value.</
P 2390N/A>Memory for a lightweight resolver context is allocated and freed using
2390N/A>lwres_context_allocmem()</
TT 2390N/A>lwres_context_freemem()</
TT 2390N/AThese use whatever allocations were defined when the context was
2390N/A>lwres_context_allocmem()</
TT 2390N/Abytes of memory and if successful returns a pointer to the allocated
2390N/A>lwres_context_allocmem()</
TT 2390N/A>lwres_context_freemem()</
TT 2390N/Abytes of space starting at location
2390N/A>lwres_context_sendrecv()</
TT 2390N/Aperforms I/O for the context
2390N/AData are read and written from the context's socket.
2390N/A— typically a lightweight resolver query packet —
2390N/Aand waits for a reply which is copied to the receive buffer at
2390N/AThe number of bytes that were written to this receive buffer is
2390N/A>Successful calls to the memory allocator
2390N/A>lwres_context_allocmem()</
TT 2390N/Areturn a pointer to the start of the allocated space.
2390N/AIt returns NULL if memory could not be allocated.</
P 2390N/A>lwres_context_sendrecv()</
TT 2390N/Ais returned if an I/O error occurs and
2390N/A>lwres_context_sendrecv()</
TT 2390N/Atimes out waiting for a response.</
P