Commit 89c6290c authored by Marek Vavruša's avatar Marek Vavruša

axfr: cleanup

parent 1fe138db
......@@ -188,10 +188,10 @@ int xfr_process_list(knot_pkt_t *pkt, xfr_put_cb process_item,
#define AXFROUT_LOG(severity, msg...) \
QUERY_LOG(severity, qdata, "Outgoing AXFR", msg)
int axfr_process_query(knot_pkt_t *pkt, struct query_data *qdata)
int axfr_query_process(knot_pkt_t *pkt, struct query_data *qdata)
{
if (pkt == NULL || qdata == NULL) {
return KNOT_EINVAL;
return NS_PROC_FAIL;
}
int ret = KNOT_EOK;
......@@ -216,7 +216,7 @@ int axfr_process_query(knot_pkt_t *pkt, struct query_data *qdata)
if (ret != KNOT_EOK) {
AXFROUT_LOG(LOG_ERR, "Failed to start (%s).",
knot_strerror(ret));
return ret;
return NS_PROC_FAIL;
} else {
AXFROUT_LOG(LOG_INFO, "Started (serial %u).",
zone_contents_serial(qdata->zone->contents));
......@@ -244,7 +244,7 @@ int axfr_process_query(knot_pkt_t *pkt, struct query_data *qdata)
return NS_PROC_FAIL;
}
}
#undef AXFR_QLOG
#undef AXFROUT_LOG
static void axfr_answer_cleanup(struct answer_data *data)
{
......@@ -333,7 +333,7 @@ static int axfr_answer_finalize(struct answer_data *data)
return KNOT_EOK;
}
static int process_axfr_packet(knot_pkt_t *pkt, struct xfr_proc *proc)
static int axfr_answer_packet(knot_pkt_t *pkt, struct xfr_proc *proc)
{
assert(pkt != NULL);
assert(proc != NULL);
......@@ -360,7 +360,7 @@ static int process_axfr_packet(knot_pkt_t *pkt, struct xfr_proc *proc)
return NS_PROC_MORE;
}
int axfr_process_answer(knot_pkt_t *pkt, struct answer_data *data)
int axfr_answer_process(knot_pkt_t *pkt, struct answer_data *data)
{
if (pkt == NULL || data == NULL) {
return NS_PROC_FAIL;
......@@ -385,7 +385,7 @@ int axfr_process_answer(knot_pkt_t *pkt, struct answer_data *data)
}
/* Process answer packet. */
int ret = process_axfr_packet(pkt, (struct xfr_proc *)data->ext);
int ret = axfr_answer_packet(pkt, (struct xfr_proc *)data->ext);
if (ret == NS_PROC_DONE) {
NS_NEED_TSIG_SIGNED(&data->param->tsig_ctx, 0);
/* This was the last packet, finalize zone and publish it. */
......@@ -402,4 +402,4 @@ int axfr_process_answer(knot_pkt_t *pkt, struct answer_data *data)
return ret;
}
#undef AXFR_QRLOG
#undef AXFRIN_LOG
......@@ -43,6 +43,7 @@ struct xfr_proc {
};
/*! \brief Generic transfer processing (reused for IXFR).
* \return KNOT_EOK or an error
*/
typedef int (*xfr_put_cb)(knot_pkt_t *pkt, const void *item, struct xfr_proc *xfer);
......@@ -52,22 +53,20 @@ typedef int (*xfr_put_cb)(knot_pkt_t *pkt, const void *item, struct xfr_proc *xf
int xfr_process_list(knot_pkt_t *pkt, xfr_put_cb put, struct query_data *qdata);
/*!
* \brief AXFR query processing module.
* \brief Process an AXFR query message.
*
* \retval FULL if it has an answer, but not yet finished.
* \retval FAIL if it encountered an error.
* \retval DONE if finished.
* \return NS_PROC_* processing states
*/
int axfr_process_query(knot_pkt_t *pkt, struct query_data *qdata);
int axfr_query_process(knot_pkt_t *pkt, struct query_data *qdata);
/*!
* \brief Processes an AXFR query response.
* \brief Processes an AXFR respons message.
*
* \param pkt Processed packet.
* \param xfr Persistent transfer-specific data.
*
* \return NS_PROC_* processing states
*/
int axfr_process_answer(knot_pkt_t *pkt, struct answer_data *data);
int axfr_answer_process(knot_pkt_t *pkt, struct answer_data *data);
#endif /* _KNOT_AXFR_H_ */
......
......@@ -591,7 +591,7 @@ int ixfr_query(knot_pkt_t *pkt, struct query_data *qdata)
case KNOT_ENOENT:
IXFROUT_LOG(LOG_INFO, "Incomplete history, fallback to AXFR.");
qdata->packet_type = KNOT_QUERY_AXFR; /* Solve as AXFR. */
return axfr_process_query(pkt, qdata);
return axfr_query_process(pkt, qdata);
default: /* Server errors. */
IXFROUT_LOG(LOG_ERR, "Failed to start (%s).", knot_strerror(ret));
return NS_PROC_FAIL;
......
......@@ -129,7 +129,7 @@ static int process_answer(knot_pkt_t *pkt, knot_process_t *ctx)
next_state = internet_process_answer(pkt, data);
break;
case KNOT_RESPONSE_AXFR:
next_state = axfr_process_answer(pkt, data);
next_state = axfr_answer_process(pkt, data);
break;
case KNOT_RESPONSE_IXFR:
next_state = ixfr_process_answer(pkt, data);
......
......@@ -390,7 +390,7 @@ static int query_internet(knot_pkt_t *pkt, knot_process_t *ctx)
next_state = notify_query(pkt, data);
break;
case KNOT_QUERY_AXFR:
next_state = axfr_process_query(pkt, data);
next_state = axfr_query_process(pkt, data);
break;
case KNOT_QUERY_IXFR:
next_state = ixfr_query(pkt, data);
......
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