|
Electroneum
|
Go to the source code of this file.
Functions | |
| int | reply_info_answer_encode (struct query_info *qinf, struct reply_info *rep, uint16_t id, uint16_t qflags, struct sldns_buffer *dest, time_t timenow, int cached, struct regional *region, uint16_t udpsize, struct edns_data *edns, int dnssec, int secure) |
| int | reply_info_encode (struct query_info *qinfo, struct reply_info *rep, uint16_t id, uint16_t flags, struct sldns_buffer *buffer, time_t timenow, struct regional *region, uint16_t udpsize, int dnssec) |
| void | qinfo_query_encode (struct sldns_buffer *pkt, struct query_info *qinfo) |
| uint16_t | calc_edns_field_size (struct edns_data *edns) |
| void | attach_edns_record (struct sldns_buffer *pkt, struct edns_data *edns) |
| void | error_encode (struct sldns_buffer *pkt, int r, struct query_info *qinfo, uint16_t qid, uint16_t qflags, struct edns_data *edns) |
This file contains temporary data structures and routines to create compressed DNS messages.
Definition in file msgencode.h.
| void attach_edns_record | ( | struct sldns_buffer * | pkt, |
| struct edns_data * | edns | ||
| ) |
Attach EDNS record to buffer. Buffer has complete packet. There must be enough room left for the EDNS record.
| pkt | packet added to. |
| edns | if NULL or present=0, nothing is added to the packet. |
Estimate size of EDNS record in packet. EDNS record will be no larger.
| edns | edns data or NULL. |
| void error_encode | ( | struct sldns_buffer * | pkt, |
| int | r, | ||
| struct query_info * | qinfo, | ||
| uint16_t | qid, | ||
| uint16_t | qflags, | ||
| struct edns_data * | edns | ||
| ) |
Encode an error. With QR and RA set.
| pkt | where to store the packet. |
| r | RCODE value to encode. |
| qinfo | if not NULL, the query is included. |
| qid | query ID to set in packet. network order. |
| qflags | original query flags (to copy RD and CD bits). host order. |
| edns | if not NULL, this is the query edns info, and an edns reply is attached. Only attached if EDNS record fits reply. |
| void qinfo_query_encode | ( | struct sldns_buffer * | pkt, |
| struct query_info * | qinfo | ||
| ) |
Encode query packet. Assumes the buffer is large enough.
| pkt | where to store the packet. |
| qinfo | query info. |
| int reply_info_answer_encode | ( | struct query_info * | qinf, |
| struct reply_info * | rep, | ||
| uint16_t | id, | ||
| uint16_t | qflags, | ||
| struct sldns_buffer * | dest, | ||
| time_t | timenow, | ||
| int | cached, | ||
| struct regional * | region, | ||
| uint16_t | udpsize, | ||
| struct edns_data * | edns, | ||
| int | dnssec, | ||
| int | secure | ||
| ) |
Generate answer from reply_info.
| qinf | query information that provides query section in packet. |
| rep | reply to fill in. |
| id | id word from the query. |
| qflags | flags word from the query. |
| dest | buffer to put message into; will truncate if it does not fit. |
| timenow | time to subtract. |
| cached | set true if a cached reply (so no AA bit). set false for the first reply. |
| region | where to allocate temp variables (for compression). |
| udpsize | size of the answer, 512, from EDNS, or 64k for TCP. |
| edns | EDNS data included in the answer, NULL for none. or if edns_present = 0, it is not included. |
| dnssec | if 0 DNSSEC records are omitted from the answer. |
| secure | if 1, the AD bit is set in the reply. |
| int reply_info_encode | ( | struct query_info * | qinfo, |
| struct reply_info * | rep, | ||
| uint16_t | id, | ||
| uint16_t | flags, | ||
| struct sldns_buffer * | buffer, | ||
| time_t | timenow, | ||
| struct regional * | region, | ||
| uint16_t | udpsize, | ||
| int | dnssec | ||
| ) |
Regenerate the wireformat from the stored msg reply. If the buffer is too small then the message is truncated at a whole rrset and the TC bit set, or whole rrsets are left out of the additional and the TC bit is not set.
| qinfo | query info to store. |
| rep | reply to store. |
| id | id value to store, network order. |
| flags | flags value to store, host order. |
| buffer | buffer to store the packet into. |
| timenow | time now, to adjust ttl values. |
| region | to store temporary data in. |
| udpsize | size of the answer, 512, from EDNS, or 64k for TCP. |
| dnssec | if 0 DNSSEC records are omitted from the answer. |