summaryrefslogtreecommitdiffstats
path: root/contrib/bind9/lib/lwres/lwpacket.c
diff options
context:
space:
mode:
authordougb <dougb@FreeBSD.org>2007-06-02 23:21:47 +0000
committerdougb <dougb@FreeBSD.org>2007-06-02 23:21:47 +0000
commit6df9693fc1899de774712d6421c2fc401db2eadd (patch)
tree6e65ba28d6d850f4d5c07cd37f26842e97b4aecf /contrib/bind9/lib/lwres/lwpacket.c
parentfb8cb3b3a3d2367752c01dc81b68c0b7390f7760 (diff)
downloadFreeBSD-src-6df9693fc1899de774712d6421c2fc401db2eadd.zip
FreeBSD-src-6df9693fc1899de774712d6421c2fc401db2eadd.tar.gz
Vendor import of BIND 9.4.1
Diffstat (limited to 'contrib/bind9/lib/lwres/lwpacket.c')
-rw-r--r--contrib/bind9/lib/lwres/lwpacket.c48
1 files changed, 46 insertions, 2 deletions
diff --git a/contrib/bind9/lib/lwres/lwpacket.c b/contrib/bind9/lib/lwres/lwpacket.c
index 6e28df0..964b465 100644
--- a/contrib/bind9/lib/lwres/lwpacket.c
+++ b/contrib/bind9/lib/lwres/lwpacket.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (C) 2004, 2005 Internet Systems Consortium, Inc. ("ISC")
* Copyright (C) 2000, 2001 Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
@@ -15,7 +15,46 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: lwpacket.c,v 1.13.206.1 2004/03/06 08:15:32 marka Exp $ */
+/* $Id: lwpacket.c,v 1.14.18.2 2005/04/29 00:17:19 marka Exp $ */
+
+/*! \file */
+
+/**
+ * These functions rely on a struct lwres_lwpacket which is defined in
+ * \link lwpacket.h lwres/lwpacket.h.\endlink
+ *
+ * The following opcodes are currently defined:
+ *
+ * \li #LWRES_OPCODE_NOOP
+ * Success is always returned and the packet contents are
+ * echoed. The \link lwres_noop.c lwres_noop_*()\endlink functions should be used for this
+ * type.
+ *
+ * \li #LWRES_OPCODE_GETADDRSBYNAME
+ * returns all known addresses for a given name. The
+ * \link lwres_gabn.c lwres_gabn_*()\endlink functions should be used for this type.
+ *
+ * \li #LWRES_OPCODE_GETNAMEBYADDR
+ * return the hostname for the given address. The
+ * \link lwres_gnba.c lwres_gnba_*() \endlink functions should be used for this type.
+ *
+ * lwres_lwpacket_renderheader() transfers the contents of lightweight
+ * resolver packet structure #lwres_lwpacket_t *pkt in network byte
+ * order to the lightweight resolver buffer, *b.
+ *
+ * lwres_lwpacket_parseheader() performs the converse operation. It
+ * transfers data in network byte order from buffer *b to resolver
+ * packet *pkt. The contents of the buffer b should correspond to a
+ * #lwres_lwpacket_t.
+ *
+ * \section lwpacket_return Return Values
+ *
+ * Successful calls to lwres_lwpacket_renderheader() and
+ * lwres_lwpacket_parseheader() return #LWRES_R_SUCCESS. If there is
+ * insufficient space to copy data between the buffer *b and
+ * lightweight resolver packet *pkt both functions return
+ * #LWRES_R_UNEXPECTEDEND.
+ */
#include <config.h>
@@ -29,9 +68,12 @@
#include "assert_p.h"
+/*% Length of Packet */
#define LWPACKET_LENGTH \
(sizeof(lwres_uint16_t) * 4 + sizeof(lwres_uint32_t) * 5)
+/*% transfers the contents of lightweight resolver packet structure lwres_lwpacket_t *pkt in network byte order to the lightweight resolver buffer, *b. */
+
lwres_result_t
lwres_lwpacket_renderheader(lwres_buffer_t *b, lwres_lwpacket_t *pkt) {
REQUIRE(b != NULL);
@@ -53,6 +95,8 @@ lwres_lwpacket_renderheader(lwres_buffer_t *b, lwres_lwpacket_t *pkt) {
return (LWRES_R_SUCCESS);
}
+/*% transfers data in network byte order from buffer *b to resolver packet *pkt. The contents of the buffer b should correspond to a lwres_lwpacket_t. */
+
lwres_result_t
lwres_lwpacket_parseheader(lwres_buffer_t *b, lwres_lwpacket_t *pkt) {
lwres_uint32_t space;
OpenPOWER on IntegriCloud