lwres_noop.c revision c05e003dce672b2f8555a3e56857f29ce89c1677
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff * Copyright (C) 2000 Internet Software Consortium.
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 * 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 Grafflwres_nooprequest_render(lwres_context_t *ctx, lwres_nooprequest_t *req,
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff unsigned char *buf;
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff payload_length = sizeof(isc_uint16_t) + req->datalength;
c05e003dce672b2f8555a3e56857f29ce89c1677Michael Graff buflen = LWRES_LWPACKET_LENGTH + payload_length;
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff * Put the length and the data. We know this will fit because we
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff * just checked for it.
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff lwres_buffer_putmem(b, req->data, req->datalength);
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Grafflwres_noopresponse_render(lwres_context_t *ctx, lwres_noopresponse_t *req,
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff unsigned char *buf;
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff payload_length = sizeof(isc_uint16_t) + req->datalength;
c05e003dce672b2f8555a3e56857f29ce89c1677Michael Graff buflen = LWRES_LWPACKET_LENGTH + payload_length;
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff * Put the length and the data. We know this will fit because we
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff * just checked for it.
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff lwres_buffer_putmem(b, req->data, req->datalength);
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Grafflwres_nooprequest_parse(lwres_context_t *ctx, lwres_buffer_t *b,
658db10162f779c8a5ed4e40c77111a7e18492beMichael Graff lwres_lwpacket_t *pkt, lwres_nooprequest_t **structp)
658db10162f779c8a5ed4e40c77111a7e18492beMichael Graff if ((pkt->flags & LWRES_LWPACKETFLAG_RESPONSE) != 0)
658db10162f779c8a5ed4e40c77111a7e18492beMichael Graff if (!SPACE_REMAINING(b, sizeof(isc_uint16_t))) {
658db10162f779c8a5ed4e40c77111a7e18492beMichael Graff /* success! */
658db10162f779c8a5ed4e40c77111a7e18492beMichael Graff /* Error return */
658db10162f779c8a5ed4e40c77111a7e18492beMichael Grafflwres_noopresponse_parse(lwres_context_t *ctx, lwres_buffer_t *b,
658db10162f779c8a5ed4e40c77111a7e18492beMichael Graff lwres_lwpacket_t *pkt, lwres_noopresponse_t **structp)
658db10162f779c8a5ed4e40c77111a7e18492beMichael Graff if ((pkt->flags & LWRES_LWPACKETFLAG_RESPONSE) == 0)
658db10162f779c8a5ed4e40c77111a7e18492beMichael Graff req = CTXMALLOC(sizeof(lwres_noopresponse_t));
658db10162f779c8a5ed4e40c77111a7e18492beMichael Graff if (!SPACE_REMAINING(b, sizeof(isc_uint16_t))) {
658db10162f779c8a5ed4e40c77111a7e18492beMichael Graff /* success! */
658db10162f779c8a5ed4e40c77111a7e18492beMichael Graff /* Error return */
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Grafflwres_noopresponse_free(lwres_context_t *ctx, lwres_noopresponse_t **structp)