query.c File Reference
`#include "config.h"`
`#include "daemon/dnshandler.h"`
`#include "daemon/engine.h"`
`#include "file.h"`
`#include "util.h"`
`#include "wire/axfr.h"`
`#include "wire/query.h"`

Go to the source code of this file.

## Functions

query_type * | query_create (void)
void | query_reset (query_type *q, size_t maxlen, int is_tcp)
void | query_prepare (query_type *q)
query_state | query_process (query_type *q, engine_type *engine)
void | query_add_optional (query_type *q, engine_type *engine)
int | query_add_rr (query_type *q, ldns_rr *rr)
void | query_cleanup (query_type *q)

## Variables

const char * | query_str = "query"

## Function Documentation

## query_add_optional()

void query_add_optional | ( | query_type * | q,
|  | engine_type * | engine
| ) |  |

Add optional RRs to query.

First EDNS

Then TSIG

Definition at line 956 of file query.c.

References query_struct::buffer, buffer_pkt_arcount(), buffer_pkt_set_arcount(), buffer_position(), buffer_write(), edns_rr_struct::dnssec_ok, engine_struct::edns, EDNS_ERROR, EDNS_NOT_PRESENT, EDNS_OK, query_struct::edns_rr, edns_data_struct::error, tsig_rr_struct::error_code, edns_data_struct::ok, OPT_LEN, OPT_RDATA, query_str, edns_data_struct::rdata_none, edns_rr_struct::status, tsig_rr_struct::status, TSIG_ERROR, TSIG_NOT_PRESENT, TSIG_OK, query_struct::tsig_prepare_it, query_struct::tsig_rr, tsig_rr_append(), tsig_rr_error(), tsig_rr_prepare(), tsig_rr_sign(), tsig_rr_update(), query_struct::tsig_sign_it, and query_struct::tsig_update_it.

## query_add_rr()

int query_add_rr | ( | query_type * | q,
|  | ldns_rr * | rr
| ) |  |

Add RR to query.

Definition at line 1035 of file query.c.

References query_struct::buffer, buffer_available(), buffer_position(), buffer_skip(), buffer_write_rdf(), buffer_write_u16(), and buffer_write_u32().

## query_cleanup()

void query_cleanup | ( | query_type * | q | ) |

Cleanup query.

Definition at line 1092 of file query.c.

References query_struct::axfr_fd, query_struct::buffer, buffer_cleanup(), query_struct::edns_rr, edns_rr_cleanup(), query_struct::tsig_rr, and tsig_rr_cleanup().

Referenced by dnshandler_cleanup(), and query_create().

## query_create()

query_type* query_create | ( | void |  | ) |

Create query.

Definition at line 48 of file query.c.

References query_struct::axfr_fd, query_struct::buffer, buffer_create(), query_struct::edns_rr, edns_rr_create(), PACKET_BUFFER_SIZE, query_cleanup(), query_reset(), query_struct::tsig_rr, tsig_rr_create(), and UDP_MAX_MESSAGE_LEN.

## query_prepare()

void query_prepare | ( | query_type * | q | ) |

Prepare response.

Definition at line 612 of file query.c.

References query_struct::buffer, buffer_capacity(), buffer_clear(), buffer_limit(), buffer_pkt_flags(), buffer_pkt_set_flags(), buffer_set_limit(), buffer_set_position(), query_struct::edns_rr, edns_rr_reserved_space(), query_struct::reserved_space, query_struct::tsig_rr, and tsig_rr_reserved_space().

## query_process()

query_state query_process | ( | query_type * | q,
|  | engine_type * | engine
| ) |  |

Process query.

Definition at line 842 of file query.c.

References query_struct::buffer, buffer_current(), buffer_limit(), BUFFER_PKT_HEADER_SIZE, buffer_pkt_qr(), buffer_remaining(), QUERY_DISCARDED, and query_str.

## query_reset()

void query_reset | ( | query_type * | q,
|  | size_t | maxlen,
|  | int | is_tcp
| ) |  |

Reset query.

Definition at line 80 of file query.c.

References query_struct::addr, query_struct::addrlen, query_struct::axfr_fd, query_struct::axfr_is_done, query_struct::buffer, buffer_clear(), query_struct::edns_rr, edns_rr_reset(), query_struct::maxlen, query_struct::reserved_space, query_struct::serial, query_struct::startpos, query_struct::tcp, query_struct::tsig_prepare_it, query_struct::tsig_rr, tsig_rr_reset(), query_struct::tsig_sign_it, query_struct::tsig_update_it, and query_struct::zone.

Referenced by query_create().

## Variable Documentation

## query_str

const char* query_str = "query"

Query.

Definition at line 40 of file query.c.

Referenced by query_add_optional(), and query_process().