|
The struct rfc1035_udp_query_responses collects multiple UDP responses
to concurrent UDP queries.
rfc1035_udp_query_response_alloc() allocates it.
rfc1035_udp_query_response_free() deletes it.
Nobody else cares about rfc1035_recv_udp, make it static. The existing
rfc1035_recv_udp code gets renamed as rfc1035_recv_one_udp_response,
and receives a rfc1035_udp_query_responses pointer, and instead of
returning a response, and its buflen, it reads a response, and finds
an unanswered query, in rfc1035_udp_query_responses, for which this
response is receives, and saves it there: loop over each query, and
if it doesn't have its response yet, and the response's serial number
matches the query's, store the query there, else throw it away.
The replacement rfc1035_recv_udp wrapper rfc1035_udp_query_response_alloc-s,
rfc1035_recv_one_udp_response, and fetches the received response out of it.
then rfc1035_udp_query_response_free()s.
|