summaryrefslogtreecommitdiffstats
path: root/src/task.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/task.c')
-rw-r--r--src/task.c72
1 files changed, 36 insertions, 36 deletions
diff --git a/src/task.c b/src/task.c
index ad84a49..82948e6 100644
--- a/src/task.c
+++ b/src/task.c
@@ -27,13 +27,13 @@
#include "task.h"
-fastd_task* fastd_task_get(fastd_context *ctx) {
- return container_of(fastd_queue_get(ctx, &ctx->task_queue), fastd_task, entry);
+fastd_task_t* fastd_task_get(fastd_context_t *ctx) {
+ return container_of(fastd_queue_get(ctx, &ctx->task_queue), fastd_task_t, entry);
}
-static bool is_handshake(fastd_queue_entry *data, void *extra) {
- fastd_task *task = container_of(data, fastd_task, entry);
- fastd_peer *peer = extra;
+static bool is_handshake(fastd_queue_entry_t *data, void *extra) {
+ fastd_task_t *task = container_of(data, fastd_task_t, entry);
+ fastd_peer_t *peer = extra;
if (task->peer != peer)
return false;
@@ -41,13 +41,13 @@ static bool is_handshake(fastd_queue_entry *data, void *extra) {
return (task->type == TASK_HANDSHAKE);
}
-void fastd_task_schedule_handshake(fastd_context *ctx, fastd_peer *peer, int timeout) {
+void fastd_task_schedule_handshake(fastd_context_t *ctx, fastd_peer_t *peer, int timeout) {
if (fastd_queue_has_entry(ctx, &ctx->task_queue, is_handshake, peer)) {
pr_debug(ctx, "not sending a handshake to %P, there still is one queued", peer);
return;
}
- fastd_task *task = malloc(sizeof(fastd_task));
+ fastd_task_t *task = malloc(sizeof(fastd_task_t));
task->type = TASK_HANDSHAKE;
task->peer = peer;
@@ -55,9 +55,9 @@ void fastd_task_schedule_handshake(fastd_context *ctx, fastd_peer *peer, int tim
fastd_queue_put(ctx, &ctx->task_queue, &task->entry, timeout);
}
-static bool is_keepalive(fastd_queue_entry *data, void *extra) {
- fastd_task *task = container_of(data, fastd_task, entry);
- fastd_peer *peer = extra;
+static bool is_keepalive(fastd_queue_entry_t *data, void *extra) {
+ fastd_task_t *task = container_of(data, fastd_task_t, entry);
+ fastd_peer_t *peer = extra;
if (task->peer != peer)
return false;
@@ -65,13 +65,13 @@ static bool is_keepalive(fastd_queue_entry *data, void *extra) {
return (task->type == TASK_KEEPALIVE);
}
-void fastd_task_schedule_keepalive(fastd_context *ctx, fastd_peer *peer, int timeout) {
+void fastd_task_schedule_keepalive(fastd_context_t *ctx, fastd_peer_t *peer, int timeout) {
if (fastd_queue_has_entry(ctx, &ctx->task_queue, is_keepalive, peer)) {
pr_debug(ctx, "not sending a keepalive to %P, there still is one queued", peer);
return;
}
- fastd_task *task = malloc(sizeof(fastd_task));
+ fastd_task_t *task = malloc(sizeof(fastd_task_t));
task->type = TASK_KEEPALIVE;
task->peer = peer;
@@ -79,17 +79,17 @@ void fastd_task_schedule_keepalive(fastd_context *ctx, fastd_peer *peer, int tim
fastd_queue_put(ctx, &ctx->task_queue, &task->entry, timeout);
}
-typedef struct _replace_peer_extra {
- fastd_peer *old_peer;
- fastd_peer *new_peer;
-} replace_peer_extra;
+typedef struct replace_peer_extra {
+ fastd_peer_t *old_peer;
+ fastd_peer_t *new_peer;
+} replace_peer_extra_t;
-static bool replace_peer(fastd_queue_entry *data, void *extra) {
- replace_peer_extra *e = extra;
- fastd_task *task = container_of(data, fastd_task, entry);
- fastd_peer *old_peer = e->old_peer;
- fastd_peer *new_peer = e->new_peer;
+static bool replace_peer(fastd_queue_entry_t *data, void *extra) {
+ replace_peer_extra_t *e = extra;
+ fastd_task_t *task = container_of(data, fastd_task_t, entry);
+ fastd_peer_t *old_peer = e->old_peer;
+ fastd_peer_t *new_peer = e->new_peer;
if (task->peer == old_peer)
task->peer = new_peer;
@@ -97,21 +97,21 @@ static bool replace_peer(fastd_queue_entry *data, void *extra) {
return true;
}
-void fastd_task_replace_peer(fastd_context *ctx, fastd_peer *old_peer, fastd_peer *new_peer) {
- replace_peer_extra extra = {old_peer, new_peer};
+void fastd_task_replace_peer(fastd_context_t *ctx, fastd_peer_t *old_peer, fastd_peer_t *new_peer) {
+ replace_peer_extra_t extra = {old_peer, new_peer};
fastd_queue_filter(ctx, &ctx->task_queue, replace_peer, &extra);
}
-typedef struct _delete_task_extra {
- fastd_peer *peer;
+typedef struct delete_task_extra {
+ fastd_peer_t *peer;
bool handshake_only;
bool keepalive_only;
-} delete_task_extra;
+} delete_task_extra_t;
-static bool delete_task(fastd_queue_entry *data, void *extra) {
- delete_task_extra *e = extra;
- fastd_task *task = container_of(data, fastd_task, entry);
- fastd_peer *peer = e->peer;
+static bool delete_task(fastd_queue_entry_t *data, void *extra) {
+ delete_task_extra_t *e = extra;
+ fastd_task_t *task = container_of(data, fastd_task_t, entry);
+ fastd_peer_t *peer = e->peer;
if (task->peer != peer)
return true;
@@ -127,17 +127,17 @@ static bool delete_task(fastd_queue_entry *data, void *extra) {
return false;
}
-void fastd_task_delete_peer(fastd_context *ctx, fastd_peer *peer) {
- delete_task_extra extra = {peer, false, false};
+void fastd_task_delete_peer(fastd_context_t *ctx, fastd_peer_t *peer) {
+ delete_task_extra_t extra = {peer, false, false};
fastd_queue_filter(ctx, &ctx->task_queue, delete_task, &extra);
}
-void fastd_task_delete_peer_handshakes(fastd_context *ctx, fastd_peer *peer) {
- delete_task_extra extra = {peer, true, false};
+void fastd_task_delete_peer_handshakes(fastd_context_t *ctx, fastd_peer_t *peer) {
+ delete_task_extra_t extra = {peer, true, false};
fastd_queue_filter(ctx, &ctx->task_queue, delete_task, &extra);
}
-void fastd_task_delete_peer_keepalives(fastd_context *ctx, fastd_peer *peer) {
- delete_task_extra extra = {peer, false, true};
+void fastd_task_delete_peer_keepalives(fastd_context_t *ctx, fastd_peer_t *peer) {
+ delete_task_extra_t extra = {peer, false, true};
fastd_queue_filter(ctx, &ctx->task_queue, delete_task, &extra);
}