Utility functions for the python module that perform stores and loads and conversions. More...
#include "config.h"
#include "pythonmod/pythonmod_utils.h"
#include "util/module.h"
#include "util/netevent.h"
#include "util/net_help.h"
#include "services/cache/dns.h"
#include "services/cache/rrset.h"
#include "util/data/msgparse.h"
#include "util/data/msgreply.h"
#include "util/storage/slabhash.h"
#include "util/regional.h"
#include "iterator/iter_delegpt.h"
#include "sldns/sbuffer.h"
#include <Python.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). More... | |
void | invalidateQueryInCache (struct module_qstate *qstate, struct query_info *qinfo) |
Invalidate the message associated with query_info stored in message cache. More... | |
int | createResponse (struct module_qstate *qstate, sldns_buffer *pkt) |
Create response according to the ldns packet content. More... | |
void | reply_addr2str (struct comm_reply *reply, char *dest, int maxlen) |
Convert reply->addr to string. More... | |
void | delegpt_addr_addr2str (struct delegpt_addr *target, char *dest, int maxlen) |
Convert target->addr to string. More... | |
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, module_qstate::prefetch_leeway, module_qstate::qstarttime, and module_qstate::query_flags.
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, module_qstate::query_flags, 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(), reply_info::ttl, and packed_rrset_data::ttl.
int createResponse | ( | struct module_qstate * | qstate, |
struct sldns_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 sldns_buffer which contains sldns_packet data |
References module_qstate::env, log_err(), parse_packet(), regional_alloc(), module_env::scratch, and sldns_buffer_set_position().
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::client_addr.
void delegpt_addr_addr2str | ( | struct delegpt_addr * | target, |
char * | dest, | ||
int | maxlen | ||
) |
Convert target->addr to string.
target | delegpt_addr with address in it. |
dest | destination string. |
maxlen | length of string buffer. |
References delegpt_addr::addr.