]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
daemon/worker.h: move internal stuff to the end
authorVladimír Čunát <vladimir.cunat@nic.cz>
Thu, 25 Aug 2016 14:27:08 +0000 (16:27 +0200)
committerVladimír Čunát <vladimir.cunat@nic.cz>
Thu, 25 Aug 2016 16:10:12 +0000 (18:10 +0200)
Also break overlong lines.

daemon/worker.h

index a02d46e2ca591fb22249e285a24395ae22e2df66..5a5c773e2fe8fbd7bf68c8317ef4ff95934d3b32 100644 (file)
 #include "lib/generic/array.h"
 #include "lib/generic/map.h"
 
-/** @internal Number of request within timeout window. */
-#define MAX_PENDING KR_NSREP_MAXADDR
 
-/** @cond internal Freelist of available mempools. */
-typedef array_t(void *) mp_freelist_t;
+/** Worker state (opaque). */
+struct worker_ctx;
+/** Worker callback */
+typedef void (*worker_cb_t)(struct worker_ctx *worker, struct kr_request *req, void *baton);
+
+/**
+ * Process incoming packet (query or answer to subrequest).
+ * @return 0 or an error code
+ */
+int worker_submit(struct worker_ctx *worker, uv_handle_t *handle, knot_pkt_t *query,
+               const struct sockaddr* addr);
+
+/**
+ * Process incoming DNS/TCP message fragment(s).
+ * If the fragment contains only a partial message, it is buffered.
+ * If the fragment contains a complete query or completes current fragment, execute it.
+ * @return 0 or an error code
+ */
+int worker_process_tcp(struct worker_ctx *worker, uv_stream_t *handle,
+               const uint8_t *msg, ssize_t len);
+
+/**
+ * End current DNS/TCP session, this disassociates pending tasks from this session
+ * which may be freely closed afterwards.
+ */
+int worker_end_tcp(struct worker_ctx *worker, uv_handle_t *handle);
 
 /**
- * Query resolution worker.
+ * Schedule query for resolution.
+ * @return 0 or an error code
  */
+int worker_resolve(struct worker_ctx *worker, knot_pkt_t *query, unsigned options,
+               worker_cb_t on_complete, void *baton);
+
+/** Reserve worker buffers */
+int worker_reserve(struct worker_ctx *worker, size_t ring_maxlen);
+
+/** Collect worker mempools */
+void worker_reclaim(struct worker_ctx *worker);
+
+struct qr_task;
+typedef int (*qr_task_send_cb)(struct qr_task *task, uv_handle_t *handle, int status);
+
+
+/** @cond internal */
+
+/** Number of request within timeout window. */
+#define MAX_PENDING KR_NSREP_MAXADDR
+
+/** Freelist of available mempools. */
+typedef array_t(void *) mp_freelist_t;
+
+/** \details Worker state is meant to persist during the whole life of daemon. */
 struct worker_ctx {
        struct engine *engine;
        uv_loop_t *loop;
@@ -57,10 +102,7 @@ struct worker_ctx {
        knot_mm_t pkt_pool;
 };
 
-/* Worker callback */
-typedef void (*worker_cb_t)(struct worker_ctx *worker, struct kr_request *req, void *baton);
-
-/** @internal Query resolution task. */
+/** Query resolution task. */
 struct qr_task
 {
        struct kr_request req;
@@ -94,40 +136,6 @@ struct qr_task
        bool finished : 1;
        bool leading  : 1;
 };
-/* @endcond */
-
-/**
- * Process incoming packet (query or answer to subrequest).
- * @return 0 or an error code
- */
-int worker_submit(struct worker_ctx *worker, uv_handle_t *handle, knot_pkt_t *query, const struct sockaddr* addr);
-
-/**
- * Process incoming DNS/TCP message fragment(s).
- * If the fragment contains only a partial message, it is buffered.
- * If the fragment contains a complete query or completes current fragment, execute it.
- * @return 0 or an error code
- */
-int worker_process_tcp(struct worker_ctx *worker, uv_stream_t *handle, const uint8_t *msg, ssize_t len);
-
-/**
- * End current DNS/TCP session, this disassociates pending tasks from this session
- * which may be freely closed afterwards.
- */
-int worker_end_tcp(struct worker_ctx *worker, uv_handle_t *handle);
-
-
-/**
- * Schedule query for resolution.
- * @return 0 or an error code
- */
-int worker_resolve(struct worker_ctx *worker, knot_pkt_t *query, unsigned options, worker_cb_t on_complete, void *baton);
 
-/** Reserve worker buffers */
-int worker_reserve(struct worker_ctx *worker, size_t ring_maxlen);
+/** @endcond */
 
-/** Collect worker mempools */
-void worker_reclaim(struct worker_ctx *worker);
-
-struct qr_task;
-typedef int (*qr_task_send_cb)(struct qr_task *task, uv_handle_t *handle, int status);