Skip to content
Snippets Groups Projects
Commit c746ac74 authored by Lubos Slovak's avatar Lubos Slovak
Browse files

Function for setting OPCODE to query.

parent 14a43391
No related branches found
No related tags found
No related merge requests found
......@@ -49,3 +49,18 @@ int dnslib_query_set_question(dnslib_packet_t *query,
return DNSLIB_EOK;
}
/*----------------------------------------------------------------------------*/
int dnslib_query_set_opcode(dnslib_packet_t *query, uint8_t opcode)
{
if (query == NULL) {
return DNSLIB_EBADARG;
}
// set the OPCODE in the structure
dnslib_wire_flags_set_opcode(query->header.flags1, opcode);
// set the OPCODE in the wire format
dnslib_wire_set_opcode(query->wireformat, opcode);
return DNSLIB_EOK;
}
......@@ -55,6 +55,8 @@ int dnslib_query_init(dnslib_packet_t *query);
int dnslib_query_set_question(dnslib_packet_t *query,
const dnslib_question_t *question);
int dnslib_query_set_opcode(dnslib_packet_t *query, uint8_t opcode);
#endif /* _KNOT_DNSLIB_QUERY_H_ */
/*! @} */
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment