Commit e6b0b29d authored by Lubos Slovak's avatar Lubos Slovak

ns_process_axfrin() implemented + new xfrin API.

- ns_process_axfrin() just calls xfrin_process_axfr_packet()

refs #875 @15m
parent 4f5cee2a
......@@ -2599,8 +2599,17 @@ int ns_process_axfrin(ns_nameserver_t *nameserver, ns_xfr_t *xfr)
* - incoming packet size is in xfr->wire_size
* - signalize caller, that transfer is finished/error (ret. code?)
*/
debug_net("ns_process_axfrin: incoming packet\n");
return KNOT_EOK;
debug_ns("ns_process_axfrin: incoming packet\n");
int ret = xfrin_process_axfr_packet(xfr->wire, xfr->wire_size,
(dnslib_zone_t **)(&xfr->data));
if (ret > 0) { // transfer finished
xfr->zone = (dnslib_zone_t *)xfr->data;
return KNOT_EOK;
} else {
return ret;
}
}
/*----------------------------------------------------------------------------*/
......@@ -2613,7 +2622,7 @@ int ns_process_ixfrin(ns_nameserver_t *nameserver, ns_xfr_t *xfr)
* - incoming packet size is in xfr->wire_size
* - signalize caller, that transfer is finished/error (ret. code?)
*/
debug_net("ns_process_axfrin: incoming packet\n");
debug_ns("ns_process_axfrin: incoming packet\n");
return KNOT_EOK;
}
......
......@@ -180,3 +180,21 @@ int xfrin_zone_transferred(ns_nameserver_t *nameserver, dnslib_zone_t *zone)
{
return KNOT_ENOTSUP;
}
/*----------------------------------------------------------------------------*/
int xfrin_process_axfr_packet(const uint8_t *pkt, size_t size,
dnslib_zone_t **zone)
{
if (pkt == NULL || zone == NULL) {
return KNOT_EINVAL;
}
return KNOT_EOK;
// if (*zone == NULL) {
// // create new zone
// /*! \todo Ensure that the packet is the first one. */
// }
}
......@@ -89,6 +89,21 @@ int xfrin_create_ixfr_query(const dnslib_dname_t *zone_name, uint8_t *buffer,
*/
int xfrin_zone_transferred(ns_nameserver_t *nameserver, dnslib_zone_t *zone);
/*!
* \brief Processes one incoming packet of AXFR transfer by updating the given
* zone.
*
* \param pkt Incoming packet in wire format.
* \param size Size of the packet in bytes.
* \param zone Zone being built. If there is no such zone (i.e. this is the
* first packet, \a *zone may be set to NULL, in which case a new
* zone structure is created).
*
* \retval KNOT_EOK
*/
int xfrin_process_axfr_packet(const uint8_t *pkt, size_t size,
dnslib_zone_t **zone);
#endif /* _KNOT_XFR_IN_H_ */
/*! @} */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment