lwres_noop.c revision c05e003dce672b2f8555a3e56857f29ce89c1677
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff/*
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff * Copyright (C) 2000 Internet Software Consortium.
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff *
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff * Permission to use, copy, modify, and distribute this software for any
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff * purpose with or without fee is hereby granted, provided that the above
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff * copyright notice and this permission notice appear in all copies.
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff *
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff * SOFTWARE.
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff */
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff#include <config.h>
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff#include <assert.h>
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff#include <errno.h>
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff#include <stdlib.h>
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff#include <string.h>
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff#include <lwres/lwbuffer.h>
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff#include <lwres/lwpacket.h>
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff#include <lwres/lwres.h>
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff#include "context_p.h"
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff#include "assert_p.h"
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graffint
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Grafflwres_nooprequest_render(lwres_context_t *ctx, lwres_nooprequest_t *req,
658db10162f779c8a5ed4e40c77111a7e18492beMichael Graff lwres_lwpacket_t *pkt, lwres_buffer_t *b)
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff{
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff unsigned char *buf;
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff size_t buflen;
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff int ret;
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff size_t payload_length;
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff REQUIRE(ctx != NULL);
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff REQUIRE(req != NULL);
c05e003dce672b2f8555a3e56857f29ce89c1677Michael Graff REQUIRE(pkt != NULL);
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff REQUIRE(b != NULL);
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff payload_length = sizeof(isc_uint16_t) + req->datalength;
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff
c05e003dce672b2f8555a3e56857f29ce89c1677Michael Graff buflen = LWRES_LWPACKET_LENGTH + payload_length;
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff buf = CTXMALLOC(buflen);
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff if (buf == NULL) {
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff errno = ENOMEM;
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff return (-1);
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff }
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff lwres_buffer_init(b, buf, buflen);
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff
658db10162f779c8a5ed4e40c77111a7e18492beMichael Graff pkt->length = buflen;
658db10162f779c8a5ed4e40c77111a7e18492beMichael Graff pkt->version = LWRES_LWPACKETVERSION_0;
c05e003dce672b2f8555a3e56857f29ce89c1677Michael Graff pkt->flags &= ~LWRES_LWPACKETFLAG_RESPONSE;
658db10162f779c8a5ed4e40c77111a7e18492beMichael Graff pkt->opcode = LWRES_OPCODE_NOOP;
658db10162f779c8a5ed4e40c77111a7e18492beMichael Graff pkt->result = 0;
658db10162f779c8a5ed4e40c77111a7e18492beMichael Graff pkt->authtype = 0;
658db10162f779c8a5ed4e40c77111a7e18492beMichael Graff pkt->authlength = 0;
658db10162f779c8a5ed4e40c77111a7e18492beMichael Graff
658db10162f779c8a5ed4e40c77111a7e18492beMichael Graff ret = lwres_lwpacket_renderheader(b, pkt);
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff if (ret != 0) {
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff lwres_buffer_invalidate(b);
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff CTXFREE(buf, buflen);
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff return (ret);
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff }
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff INSIST(SPACE_OK(b, payload_length));
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff /*
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff * Put the length and the data. We know this will fit because we
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff * just checked for it.
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff */
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff lwres_buffer_putuint16(b, req->datalength);
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff lwres_buffer_putmem(b, req->data, req->datalength);
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff INSIST(LWRES_BUFFER_AVAILABLECOUNT(b) == 0);
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff return (0);
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff}
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graffint
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Grafflwres_noopresponse_render(lwres_context_t *ctx, lwres_noopresponse_t *req,
658db10162f779c8a5ed4e40c77111a7e18492beMichael Graff lwres_lwpacket_t *pkt, lwres_buffer_t *b)
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff{
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff unsigned char *buf;
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff size_t buflen;
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff int ret;
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff size_t payload_length;
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff REQUIRE(ctx != NULL);
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff REQUIRE(req != NULL);
c05e003dce672b2f8555a3e56857f29ce89c1677Michael Graff REQUIRE(pkt != NULL);
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff REQUIRE(b != NULL);
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff payload_length = sizeof(isc_uint16_t) + req->datalength;
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff
c05e003dce672b2f8555a3e56857f29ce89c1677Michael Graff buflen = LWRES_LWPACKET_LENGTH + payload_length;
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff buf = CTXMALLOC(buflen);
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff if (buf == NULL) {
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff errno = ENOMEM;
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff return (-1);
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff }
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff lwres_buffer_init(b, buf, buflen);
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff
658db10162f779c8a5ed4e40c77111a7e18492beMichael Graff pkt->length = buflen;
658db10162f779c8a5ed4e40c77111a7e18492beMichael Graff pkt->version = LWRES_LWPACKETVERSION_0;
658db10162f779c8a5ed4e40c77111a7e18492beMichael Graff pkt->flags |= LWRES_LWPACKETFLAG_RESPONSE;
658db10162f779c8a5ed4e40c77111a7e18492beMichael Graff pkt->opcode = LWRES_OPCODE_NOOP;
658db10162f779c8a5ed4e40c77111a7e18492beMichael Graff pkt->authtype = 0;
658db10162f779c8a5ed4e40c77111a7e18492beMichael Graff pkt->authlength = 0;
658db10162f779c8a5ed4e40c77111a7e18492beMichael Graff
658db10162f779c8a5ed4e40c77111a7e18492beMichael Graff ret = lwres_lwpacket_renderheader(b, pkt);
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff if (ret != 0) {
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff lwres_buffer_invalidate(b);
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff CTXFREE(buf, buflen);
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff return (ret);
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff }
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff INSIST(SPACE_OK(b, payload_length));
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff /*
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff * Put the length and the data. We know this will fit because we
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff * just checked for it.
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff */
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff lwres_buffer_putuint16(b, req->datalength);
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff lwres_buffer_putmem(b, req->data, req->datalength);
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff INSIST(LWRES_BUFFER_AVAILABLECOUNT(b) == 0);
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff return (0);
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff}
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graffint
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Grafflwres_nooprequest_parse(lwres_context_t *ctx, lwres_buffer_t *b,
658db10162f779c8a5ed4e40c77111a7e18492beMichael Graff lwres_lwpacket_t *pkt, lwres_nooprequest_t **structp)
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff{
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff int ret;
658db10162f779c8a5ed4e40c77111a7e18492beMichael Graff lwres_nooprequest_t *req;
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff REQUIRE(ctx != NULL);
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff REQUIRE(b != NULL);
658db10162f779c8a5ed4e40c77111a7e18492beMichael Graff REQUIRE(pkt != NULL);
658db10162f779c8a5ed4e40c77111a7e18492beMichael Graff REQUIRE(structp != NULL && *structp == NULL);
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff
658db10162f779c8a5ed4e40c77111a7e18492beMichael Graff if ((pkt->flags & LWRES_LWPACKETFLAG_RESPONSE) != 0)
658db10162f779c8a5ed4e40c77111a7e18492beMichael Graff return (-1);
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff
658db10162f779c8a5ed4e40c77111a7e18492beMichael Graff req = CTXMALLOC(sizeof(lwres_nooprequest_t));
658db10162f779c8a5ed4e40c77111a7e18492beMichael Graff if (req == NULL)
658db10162f779c8a5ed4e40c77111a7e18492beMichael Graff return (-1);
658db10162f779c8a5ed4e40c77111a7e18492beMichael Graff
658db10162f779c8a5ed4e40c77111a7e18492beMichael Graff if (!SPACE_REMAINING(b, sizeof(isc_uint16_t))) {
658db10162f779c8a5ed4e40c77111a7e18492beMichael Graff ret = -1;
658db10162f779c8a5ed4e40c77111a7e18492beMichael Graff goto out;
658db10162f779c8a5ed4e40c77111a7e18492beMichael Graff }
658db10162f779c8a5ed4e40c77111a7e18492beMichael Graff req->datalength = lwres_buffer_getuint16(b);
658db10162f779c8a5ed4e40c77111a7e18492beMichael Graff
658db10162f779c8a5ed4e40c77111a7e18492beMichael Graff if (!SPACE_REMAINING(b, req->datalength)) {
658db10162f779c8a5ed4e40c77111a7e18492beMichael Graff ret = -1;
658db10162f779c8a5ed4e40c77111a7e18492beMichael Graff goto out;
658db10162f779c8a5ed4e40c77111a7e18492beMichael Graff }
658db10162f779c8a5ed4e40c77111a7e18492beMichael Graff req->data = b->base + b->current;
658db10162f779c8a5ed4e40c77111a7e18492beMichael Graff
658db10162f779c8a5ed4e40c77111a7e18492beMichael Graff /* success! */
658db10162f779c8a5ed4e40c77111a7e18492beMichael Graff *structp = req;
658db10162f779c8a5ed4e40c77111a7e18492beMichael Graff return (0);
658db10162f779c8a5ed4e40c77111a7e18492beMichael Graff
658db10162f779c8a5ed4e40c77111a7e18492beMichael Graff /* Error return */
658db10162f779c8a5ed4e40c77111a7e18492beMichael Graff out:
658db10162f779c8a5ed4e40c77111a7e18492beMichael Graff CTXFREE(req, sizeof(lwres_nooprequest_t));
658db10162f779c8a5ed4e40c77111a7e18492beMichael Graff return (ret);
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff}
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graffint
658db10162f779c8a5ed4e40c77111a7e18492beMichael Grafflwres_noopresponse_parse(lwres_context_t *ctx, lwres_buffer_t *b,
658db10162f779c8a5ed4e40c77111a7e18492beMichael Graff lwres_lwpacket_t *pkt, lwres_noopresponse_t **structp)
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff{
658db10162f779c8a5ed4e40c77111a7e18492beMichael Graff int ret;
658db10162f779c8a5ed4e40c77111a7e18492beMichael Graff lwres_noopresponse_t *req;
658db10162f779c8a5ed4e40c77111a7e18492beMichael Graff
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff REQUIRE(ctx != NULL);
658db10162f779c8a5ed4e40c77111a7e18492beMichael Graff REQUIRE(b != NULL);
658db10162f779c8a5ed4e40c77111a7e18492beMichael Graff REQUIRE(pkt != NULL);
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff REQUIRE(structp != NULL && *structp == NULL);
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff
658db10162f779c8a5ed4e40c77111a7e18492beMichael Graff if ((pkt->flags & LWRES_LWPACKETFLAG_RESPONSE) == 0)
658db10162f779c8a5ed4e40c77111a7e18492beMichael Graff return (-1);
658db10162f779c8a5ed4e40c77111a7e18492beMichael Graff
658db10162f779c8a5ed4e40c77111a7e18492beMichael Graff req = CTXMALLOC(sizeof(lwres_noopresponse_t));
658db10162f779c8a5ed4e40c77111a7e18492beMichael Graff if (req == NULL)
658db10162f779c8a5ed4e40c77111a7e18492beMichael Graff return (-1);
658db10162f779c8a5ed4e40c77111a7e18492beMichael Graff
658db10162f779c8a5ed4e40c77111a7e18492beMichael Graff if (!SPACE_REMAINING(b, sizeof(isc_uint16_t))) {
658db10162f779c8a5ed4e40c77111a7e18492beMichael Graff ret = -1;
658db10162f779c8a5ed4e40c77111a7e18492beMichael Graff goto out;
658db10162f779c8a5ed4e40c77111a7e18492beMichael Graff }
658db10162f779c8a5ed4e40c77111a7e18492beMichael Graff req->datalength = lwres_buffer_getuint16(b);
658db10162f779c8a5ed4e40c77111a7e18492beMichael Graff
658db10162f779c8a5ed4e40c77111a7e18492beMichael Graff if (!SPACE_REMAINING(b, req->datalength)) {
658db10162f779c8a5ed4e40c77111a7e18492beMichael Graff ret = -1;
658db10162f779c8a5ed4e40c77111a7e18492beMichael Graff goto out;
658db10162f779c8a5ed4e40c77111a7e18492beMichael Graff }
658db10162f779c8a5ed4e40c77111a7e18492beMichael Graff req->data = b->base + b->current;
658db10162f779c8a5ed4e40c77111a7e18492beMichael Graff
658db10162f779c8a5ed4e40c77111a7e18492beMichael Graff /* success! */
658db10162f779c8a5ed4e40c77111a7e18492beMichael Graff *structp = req;
658db10162f779c8a5ed4e40c77111a7e18492beMichael Graff return (0);
658db10162f779c8a5ed4e40c77111a7e18492beMichael Graff
658db10162f779c8a5ed4e40c77111a7e18492beMichael Graff /* Error return */
658db10162f779c8a5ed4e40c77111a7e18492beMichael Graff out:
658db10162f779c8a5ed4e40c77111a7e18492beMichael Graff CTXFREE(req, sizeof(lwres_noopresponse_t));
658db10162f779c8a5ed4e40c77111a7e18492beMichael Graff return (ret);
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff}
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graffvoid
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Grafflwres_noopresponse_free(lwres_context_t *ctx, lwres_noopresponse_t **structp)
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff{
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff lwres_noopresponse_t *noop;
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff REQUIRE(ctx != NULL);
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff REQUIRE(structp != NULL && *structp != NULL);
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff noop = *structp;
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff *structp = NULL;
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff CTXFREE(noop, sizeof(lwres_noopresponse_t));
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff}
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graffvoid
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Grafflwres_nooprequest_free(lwres_context_t *ctx, lwres_nooprequest_t **structp)
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff{
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff lwres_nooprequest_t *noop;
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff REQUIRE(ctx != NULL);
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff REQUIRE(structp != NULL && *structp != NULL);
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff noop = *structp;
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff *structp = NULL;
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff CTXFREE(noop, sizeof(lwres_nooprequest_t));
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff}