---
name: "lwres_nooprequest_parse"
section: "3"
platform: "linux"
package: "libbind-dev"
version: "1:9.11.5.P4+dfsg-5.1+deb10u7"
release: "Debian 10 (Buster)"
platforms: ["linux"]
url: "https://new.carta.tech/lwres_nooprequest_parse"
---

# lwres\_nooprequest\_parse(3)

lightweight resolver no-op message handling

## NAME

lwres\_nooprequest\_render, lwres\_noopresponse\_render, lwres\_nooprequest\_parse, lwres\_noopresponse\_parse, lwres\_noopresponse\_free, lwres\_nooprequest\_free - lightweight resolver no-op message handling

## SYNOPSIS

```
#include <lwres/lwres.h>
```

**lwres\_result\_t lwres\_nooprequest\_render(lwres\_context\_t \****ctx***, lwres\_nooprequest\_t \****req***, lwres\_lwpacket\_t \****pkt***, lwres\_buffer\_t \****b***);**

**lwres\_result\_t lwres\_noopresponse\_render(lwres\_context\_t \****ctx***, lwres\_noopresponse\_t \****req***, lwres\_lwpacket\_t \****pkt***, lwres\_buffer\_t \****b***);**

**lwres\_result\_t lwres\_nooprequest\_parse(lwres\_context\_t \****ctx***, lwres\_buffer\_t \****b***, lwres\_lwpacket\_t \****pkt***, lwres\_nooprequest\_t \*\****structp***);**

**lwres\_result\_t lwres\_noopresponse\_parse(lwres\_context\_t \****ctx***, lwres\_buffer\_t \****b***, lwres\_lwpacket\_t \****pkt***, lwres\_noopresponse\_t \*\****structp***);**

**void lwres\_noopresponse\_free(lwres\_context\_t \****ctx***, lwres\_noopresponse\_t \*\****structp***);**

**void lwres\_nooprequest\_free(lwres\_context\_t \****ctx***, lwres\_nooprequest\_t \*\****structp***);**

## DESCRIPTION

These are low-level routines for creating and parsing lightweight resolver no-op request and response messages.

The no-op message is analogous to a **ping** packet: a packet is sent to the resolver daemon and is simply echoed back. The opcode is intended to allow a client to determine if the server is operational or not.

There are four main functions for the no-op opcode. One render function converts a no-op request structure — **lwres\_nooprequest\_t** — to the lightweight resolver's canonical format. It is complemented by a parse function that converts a packet in this canonical format to a no-op request structure. Another render function converts the no-op response structure — **lwres\_noopresponse\_t** to the canonical format. This is complemented by a parse function which converts a packet in canonical format to a no-op response structure.

These structures are defined in lwres/lwres.h. They are shown below.

```
#define LWRES_OPCODE_NOOP       0x00000000U
```

```
typedef struct {
        uint16_t  datalength;
        unsigned char   *data;
} lwres_nooprequest_t;
```

```
typedef struct {
        uint16_t  datalength;
        unsigned char   *data;
} lwres_noopresponse_t;
```

Although the structures have different types, they are identical. This is because the no-op opcode simply echos whatever data was sent: the response is therefore identical to the request.

**lwres\_nooprequest\_render()** uses resolver context *ctx* to convert no-op request structure *req* to canonical format. The packet header structure *pkt* is initialised and transferred to buffer *b*. The contents of *\*req* are then appended to the buffer in canonical format. **lwres\_noopresponse\_render()** performs the same task, except it converts a no-op response structure **lwres\_noopresponse\_t** to the lightweight resolver's canonical format.

**lwres\_nooprequest\_parse()** uses context *ctx* to convert the contents of packet *pkt* to a **lwres\_nooprequest\_t** structure. Buffer *b* provides space to be used for storing this structure. When the function succeeds, the resulting **lwres\_nooprequest\_t** is made available through *\*structp*. **lwres\_noopresponse\_parse()** offers the same semantics as **lwres\_nooprequest\_parse()** except it yields a **lwres\_noopresponse\_t** structure.

**lwres\_noopresponse\_free()** and **lwres\_nooprequest\_free()** release the memory in resolver context *ctx* that was allocated to the **lwres\_noopresponse\_t** or **lwres\_nooprequest\_t** structures referenced via *structp*.

## RETURN VALUES

The no-op opcode functions **lwres\_nooprequest\_render()**, **lwres\_noopresponse\_render()lwres\_nooprequest\_parse()** and **lwres\_noopresponse\_parse()** all return **LWRES\_R\_SUCCESS** on success. They return **LWRES\_R\_NOMEMORY** if memory allocation fails. **LWRES\_R\_UNEXPECTEDEND** is returned if the available space in the buffer *b* is too small to accommodate the packet header or the **lwres\_nooprequest\_t** and **lwres\_noopresponse\_t** structures. **lwres\_nooprequest\_parse()** and **lwres\_noopresponse\_parse()** will return **LWRES\_R\_UNEXPECTEDEND** if the buffer is not empty after decoding the received packet. These functions will return **LWRES\_R\_FAILURE** if **pktflags** in the packet header structure **lwres\_lwpacket\_t** indicate that the packet is not a response to an earlier query.

## SEE ALSO

[**lwres\_packet**(3)](/lwres_packet/3.md)

## AUTHOR

**Internet Systems Consortium, Inc.**

## COPYRIGHT

Copyright © 2000, 2001, 2004, 2005, 2007, 2014-2016, 2018, 2019 Internet Systems Consortium, Inc. ("ISC")\
