Utility functions for the python module that perform stores and loads and conversions. More...
#include "util/module.h"
Functions | |
int | storeQueryInCache (struct module_qstate *qstate, struct query_info *qinfo, struct reply_info *msgrep, int is_referral) |
Store the reply_info and query_info pair in message cache (qstate->msg_cache). | |
void | invalidateQueryInCache (struct module_qstate *qstate, struct query_info *qinfo) |
Invalidate the message associated with query_info stored in message cache. | |
int | createResponse (struct module_qstate *qstate, ldns_buffer *pkt) |
Create response according to the ldns packet content. | |
void | reply_addr2str (struct comm_reply *reply, char *dest, int maxlen) |
Convert reply->addr to string. |
Utility functions for the python module that perform stores and loads and conversions.
int storeQueryInCache | ( | struct module_qstate * | qstate, | |
struct query_info * | qinfo, | |||
struct reply_info * | msgrep, | |||
int | is_referral | |||
) |
Store the reply_info and query_info pair in message cache (qstate->msg_cache).
qstate,: | module environment | |
qinfo,: | query info, the query for which answer is stored. | |
msgrep,: | reply in dns_msg | |
is_referral,: | If true, then the given message to be stored is a referral. The cache implementation may use this as a hint. It will store only the RRsets, not the message. |
References reply_info::authoritative, dns_cache_store(), module_qstate::env, and module_qstate::prefetch_leeway.
void invalidateQueryInCache | ( | struct module_qstate * | qstate, | |
struct query_info * | qinfo | |||
) |
Invalidate the message associated with query_info stored in message cache.
This function invalidates the record in message cache associated with the given query only if such a record exists.
qstate,: | module environment | |
qinfo,: | query info, the query for which answer is stored. |
References packed_rrset_data::count, lruhash_entry::data, ub_packed_rrset_key::entry, module_qstate::env, rrset_ref::key, lruhash_entry::lock, log_info(), module_env::msg_cache, module_env::now, query_info_hash(), reply_info::ref, packed_rrset_data::rr_ttl, rrset_array_lock(), rrset_array_unlock(), reply_info::rrset_count, packed_rrset_data::rrsig_count, slabhash_lookup(), packed_rrset_data::ttl, and reply_info::ttl.
int createResponse | ( | struct module_qstate * | qstate, | |
ldns_buffer * | pkt | |||
) |
Create response according to the ldns packet content.
This function fills qstate.return_msg up with data of a given packet
qstate,: | module environment | |
pkt,: | a ldns_buffer which contains ldns_packet data |
References BIT_CD, module_qstate::env, log_dns_msg(), log_err(), parse_create_msg(), parse_extract_edns(), parse_packet(), dns_msg::qinfo, module_qstate::region, regional_alloc(), dns_msg::rep, module_qstate::return_msg, module_env::scratch, VERB_ALGO, verbose(), and verbosity.
void reply_addr2str | ( | struct comm_reply * | reply, | |
char * | dest, | |||
int | maxlen | |||
) |
Convert reply->addr to string.
reply,: | comm reply with address in it. | |
dest,: | destination string. | |
maxlen,: | length of string buffer. |
References comm_reply::addr.