- import of strongswan-2.7.0
- applied patch for charon
This commit is contained in:
@@ -0,0 +1,408 @@
|
||||
<!--
|
||||
- Copyright (C) 2000, 2001 Internet Software Consortium.
|
||||
-
|
||||
- Permission to use, copy, modify, and distribute this software for any
|
||||
- purpose with or without fee is hereby granted, provided that the above
|
||||
- copyright notice and this permission notice appear in all copies.
|
||||
-
|
||||
- THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
|
||||
- DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
|
||||
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
|
||||
- INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
|
||||
- FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
|
||||
- NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
|
||||
- WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
-->
|
||||
<HTML
|
||||
><HEAD
|
||||
><TITLE
|
||||
>lwres_gnba</TITLE
|
||||
><META
|
||||
NAME="GENERATOR"
|
||||
CONTENT="Modular DocBook HTML Stylesheet Version 1.61
|
||||
"></HEAD
|
||||
><BODY
|
||||
CLASS="REFENTRY"
|
||||
BGCOLOR="#FFFFFF"
|
||||
TEXT="#000000"
|
||||
LINK="#0000FF"
|
||||
VLINK="#840084"
|
||||
ALINK="#0000FF"
|
||||
><H1
|
||||
><A
|
||||
NAME="AEN1"
|
||||
>lwres_gnba</A
|
||||
></H1
|
||||
><DIV
|
||||
CLASS="REFNAMEDIV"
|
||||
><A
|
||||
NAME="AEN8"
|
||||
></A
|
||||
><H2
|
||||
>Name</H2
|
||||
>lwres_gnbarequest_render, lwres_gnbaresponse_render, lwres_gnbarequest_parse, lwres_gnbaresponse_parse, lwres_gnbaresponse_free, lwres_gnbarequest_free -- lightweight resolver getnamebyaddress message handling</DIV
|
||||
><DIV
|
||||
CLASS="REFSYNOPSISDIV"
|
||||
><A
|
||||
NAME="AEN16"
|
||||
></A
|
||||
><H2
|
||||
>Synopsis</H2
|
||||
><DIV
|
||||
CLASS="FUNCSYNOPSIS"
|
||||
><A
|
||||
NAME="AEN17"
|
||||
></A
|
||||
><P
|
||||
></P
|
||||
><PRE
|
||||
CLASS="FUNCSYNOPSISINFO"
|
||||
>#include <lwres/lwres.h></PRE
|
||||
><P
|
||||
><CODE
|
||||
><CODE
|
||||
CLASS="FUNCDEF"
|
||||
>lwres_result_t
|
||||
lwres_gnbarequest_render</CODE
|
||||
>(lwres_context_t *ctx, lwres_gnbarequest_t *req, lwres_lwpacket_t *pkt, lwres_buffer_t *b);</CODE
|
||||
></P
|
||||
><P
|
||||
><CODE
|
||||
><CODE
|
||||
CLASS="FUNCDEF"
|
||||
>lwres_result_t
|
||||
lwres_gnbaresponse_render</CODE
|
||||
>(lwres_context_t *ctx, lwres_gnbaresponse_t *req, lwres_lwpacket_t *pkt, lwres_buffer_t *b);</CODE
|
||||
></P
|
||||
><P
|
||||
><CODE
|
||||
><CODE
|
||||
CLASS="FUNCDEF"
|
||||
>lwres_result_t
|
||||
lwres_gnbarequest_parse</CODE
|
||||
>(lwres_context_t *ctx, lwres_buffer_t *b, lwres_lwpacket_t *pkt, lwres_gnbarequest_t **structp);</CODE
|
||||
></P
|
||||
><P
|
||||
><CODE
|
||||
><CODE
|
||||
CLASS="FUNCDEF"
|
||||
>lwres_result_t
|
||||
lwres_gnbaresponse_parse</CODE
|
||||
>(lwres_context_t *ctx, lwres_buffer_t *b, lwres_lwpacket_t *pkt, lwres_gnbaresponse_t **structp);</CODE
|
||||
></P
|
||||
><P
|
||||
><CODE
|
||||
><CODE
|
||||
CLASS="FUNCDEF"
|
||||
>void
|
||||
lwres_gnbaresponse_free</CODE
|
||||
>(lwres_context_t *ctx, lwres_gnbaresponse_t **structp);</CODE
|
||||
></P
|
||||
><P
|
||||
><CODE
|
||||
><CODE
|
||||
CLASS="FUNCDEF"
|
||||
>void
|
||||
lwres_gnbarequest_free</CODE
|
||||
>(lwres_context_t *ctx, lwres_gnbarequest_t **structp);</CODE
|
||||
></P
|
||||
><P
|
||||
></P
|
||||
></DIV
|
||||
></DIV
|
||||
><DIV
|
||||
CLASS="REFSECT1"
|
||||
><A
|
||||
NAME="AEN61"
|
||||
></A
|
||||
><H2
|
||||
>DESCRIPTION</H2
|
||||
><P
|
||||
>These are low-level routines for creating and parsing
|
||||
lightweight resolver address-to-name lookup request and
|
||||
response messages.</P
|
||||
><P
|
||||
>There are four main functions for the getnamebyaddr opcode.
|
||||
One render function converts a getnamebyaddr request structure —
|
||||
<SPAN
|
||||
CLASS="TYPE"
|
||||
>lwres_gnbarequest_t</SPAN
|
||||
> —
|
||||
to the lightweight resolver's canonical format.
|
||||
It is complemented by a parse function that converts a packet in this
|
||||
canonical format to a getnamebyaddr request structure.
|
||||
Another render function converts the getnamebyaddr response structure —
|
||||
<SPAN
|
||||
CLASS="TYPE"
|
||||
>lwres_gnbaresponse_t</SPAN
|
||||
>
|
||||
to the canonical format.
|
||||
This is complemented by a parse function which converts a packet in
|
||||
canonical format to a getnamebyaddr response structure.</P
|
||||
><P
|
||||
>These structures are defined in
|
||||
<TT
|
||||
CLASS="FILENAME"
|
||||
>lwres/lwres.h</TT
|
||||
>.
|
||||
They are shown below.
|
||||
<PRE
|
||||
CLASS="PROGRAMLISTING"
|
||||
>#define LWRES_OPCODE_GETNAMEBYADDR 0x00010002U
|
||||
|
||||
typedef struct {
|
||||
lwres_uint32_t flags;
|
||||
lwres_addr_t addr;
|
||||
} lwres_gnbarequest_t;
|
||||
|
||||
typedef struct {
|
||||
lwres_uint32_t flags;
|
||||
lwres_uint16_t naliases;
|
||||
char *realname;
|
||||
char **aliases;
|
||||
lwres_uint16_t realnamelen;
|
||||
lwres_uint16_t *aliaslen;
|
||||
void *base;
|
||||
size_t baselen;
|
||||
} lwres_gnbaresponse_t;</PRE
|
||||
></P
|
||||
><P
|
||||
><TT
|
||||
CLASS="FUNCTION"
|
||||
>lwres_gnbarequest_render()</TT
|
||||
>
|
||||
uses resolver context
|
||||
<TT
|
||||
CLASS="VARNAME"
|
||||
>ctx</TT
|
||||
>
|
||||
to convert getnamebyaddr request structure
|
||||
<TT
|
||||
CLASS="VARNAME"
|
||||
>req</TT
|
||||
>
|
||||
to canonical format.
|
||||
The packet header structure
|
||||
<TT
|
||||
CLASS="VARNAME"
|
||||
>pkt</TT
|
||||
>
|
||||
is initialised and transferred to
|
||||
buffer
|
||||
<TT
|
||||
CLASS="VARNAME"
|
||||
>b</TT
|
||||
>.
|
||||
The contents of
|
||||
<TT
|
||||
CLASS="VARNAME"
|
||||
>*req</TT
|
||||
>
|
||||
are then appended to the buffer in canonical format.
|
||||
<TT
|
||||
CLASS="FUNCTION"
|
||||
>lwres_gnbaresponse_render()</TT
|
||||
>
|
||||
performs the same task, except it converts a getnamebyaddr response structure
|
||||
<SPAN
|
||||
CLASS="TYPE"
|
||||
>lwres_gnbaresponse_t</SPAN
|
||||
>
|
||||
to the lightweight resolver's canonical format.</P
|
||||
><P
|
||||
><TT
|
||||
CLASS="FUNCTION"
|
||||
>lwres_gnbarequest_parse()</TT
|
||||
>
|
||||
uses context
|
||||
<TT
|
||||
CLASS="VARNAME"
|
||||
>ctx</TT
|
||||
>
|
||||
to convert the contents of packet
|
||||
<TT
|
||||
CLASS="VARNAME"
|
||||
>pkt</TT
|
||||
>
|
||||
to a
|
||||
<SPAN
|
||||
CLASS="TYPE"
|
||||
>lwres_gnbarequest_t</SPAN
|
||||
>
|
||||
structure.
|
||||
Buffer
|
||||
<TT
|
||||
CLASS="VARNAME"
|
||||
>b</TT
|
||||
>
|
||||
provides space to be used for storing this structure.
|
||||
When the function succeeds, the resulting
|
||||
<SPAN
|
||||
CLASS="TYPE"
|
||||
>lwres_gnbarequest_t</SPAN
|
||||
>
|
||||
is made available through
|
||||
<TT
|
||||
CLASS="VARNAME"
|
||||
>*structp</TT
|
||||
>.
|
||||
<TT
|
||||
CLASS="FUNCTION"
|
||||
>lwres_gnbaresponse_parse()</TT
|
||||
>
|
||||
offers the same semantics as
|
||||
<TT
|
||||
CLASS="FUNCTION"
|
||||
>lwres_gnbarequest_parse()</TT
|
||||
>
|
||||
except it yields a
|
||||
<SPAN
|
||||
CLASS="TYPE"
|
||||
>lwres_gnbaresponse_t</SPAN
|
||||
>
|
||||
structure.</P
|
||||
><P
|
||||
><TT
|
||||
CLASS="FUNCTION"
|
||||
>lwres_gnbaresponse_free()</TT
|
||||
>
|
||||
and
|
||||
<TT
|
||||
CLASS="FUNCTION"
|
||||
>lwres_gnbarequest_free()</TT
|
||||
>
|
||||
release the memory in resolver context
|
||||
<TT
|
||||
CLASS="VARNAME"
|
||||
>ctx</TT
|
||||
>
|
||||
that was allocated to the
|
||||
<SPAN
|
||||
CLASS="TYPE"
|
||||
>lwres_gnbaresponse_t</SPAN
|
||||
>
|
||||
or
|
||||
<SPAN
|
||||
CLASS="TYPE"
|
||||
>lwres_gnbarequest_t</SPAN
|
||||
>
|
||||
structures referenced via
|
||||
<TT
|
||||
CLASS="VARNAME"
|
||||
>structp</TT
|
||||
>.
|
||||
Any memory associated with ancillary buffers and strings for those
|
||||
structures is also discarded.</P
|
||||
></DIV
|
||||
><DIV
|
||||
CLASS="REFSECT1"
|
||||
><A
|
||||
NAME="AEN97"
|
||||
></A
|
||||
><H2
|
||||
>RETURN VALUES</H2
|
||||
><P
|
||||
>The getnamebyaddr opcode functions
|
||||
<TT
|
||||
CLASS="FUNCTION"
|
||||
>lwres_gnbarequest_render()</TT
|
||||
>,
|
||||
<TT
|
||||
CLASS="FUNCTION"
|
||||
>lwres_gnbaresponse_render()</TT
|
||||
>
|
||||
<TT
|
||||
CLASS="FUNCTION"
|
||||
>lwres_gnbarequest_parse()</TT
|
||||
>
|
||||
and
|
||||
<TT
|
||||
CLASS="FUNCTION"
|
||||
>lwres_gnbaresponse_parse()</TT
|
||||
>
|
||||
all return
|
||||
<SPAN
|
||||
CLASS="ERRORCODE"
|
||||
>LWRES_R_SUCCESS</SPAN
|
||||
>
|
||||
on success.
|
||||
They return
|
||||
<SPAN
|
||||
CLASS="ERRORCODE"
|
||||
>LWRES_R_NOMEMORY</SPAN
|
||||
>
|
||||
if memory allocation fails.
|
||||
<SPAN
|
||||
CLASS="ERRORCODE"
|
||||
>LWRES_R_UNEXPECTEDEND</SPAN
|
||||
>
|
||||
is returned if the available space in the buffer
|
||||
<TT
|
||||
CLASS="VARNAME"
|
||||
>b</TT
|
||||
>
|
||||
is too small to accommodate the packet header or the
|
||||
<SPAN
|
||||
CLASS="TYPE"
|
||||
>lwres_gnbarequest_t</SPAN
|
||||
>
|
||||
and
|
||||
<SPAN
|
||||
CLASS="TYPE"
|
||||
>lwres_gnbaresponse_t</SPAN
|
||||
>
|
||||
structures.
|
||||
<TT
|
||||
CLASS="FUNCTION"
|
||||
>lwres_gnbarequest_parse()</TT
|
||||
>
|
||||
and
|
||||
<TT
|
||||
CLASS="FUNCTION"
|
||||
>lwres_gnbaresponse_parse()</TT
|
||||
>
|
||||
will return
|
||||
<SPAN
|
||||
CLASS="ERRORCODE"
|
||||
>LWRES_R_UNEXPECTEDEND</SPAN
|
||||
>
|
||||
if the buffer is not empty after decoding the received packet.
|
||||
These functions will return
|
||||
<SPAN
|
||||
CLASS="ERRORCODE"
|
||||
>LWRES_R_FAILURE</SPAN
|
||||
>
|
||||
if
|
||||
<TT
|
||||
CLASS="STRUCTFIELD"
|
||||
><I
|
||||
>pktflags</I
|
||||
></TT
|
||||
>
|
||||
in the packet header structure
|
||||
<SPAN
|
||||
CLASS="TYPE"
|
||||
>lwres_lwpacket_t</SPAN
|
||||
>
|
||||
indicate that the packet is not a response to an earlier query.</P
|
||||
></DIV
|
||||
><DIV
|
||||
CLASS="REFSECT1"
|
||||
><A
|
||||
NAME="AEN116"
|
||||
></A
|
||||
><H2
|
||||
>SEE ALSO</H2
|
||||
><P
|
||||
><SPAN
|
||||
CLASS="CITEREFENTRY"
|
||||
><SPAN
|
||||
CLASS="REFENTRYTITLE"
|
||||
>lwres_packet</SPAN
|
||||
>(3)</SPAN
|
||||
>.</P
|
||||
></DIV
|
||||
></BODY
|
||||
></HTML
|
||||
>
|
||||
Reference in New Issue
Block a user