From 13306fc146b4839d511287f29df8572a80bf8914 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sun, 26 Feb 2012 23:13:08 +0100 Subject: Implement I/O for a fixed peer --- src/method_null.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'src/method_null.c') diff --git a/src/method_null.c b/src/method_null.c index fd41110..dea84d4 100644 --- a/src/method_null.c +++ b/src/method_null.c @@ -25,21 +25,31 @@ */ #include "fastd.h" +#include "task.h" -static void null_init(const fastd_context *ctx) { +static size_t null_max_packet_size(fastd_context *ctx) { + return fastd_max_packet_size(ctx); } -static void null_recv(const fastd_context *ctx, void *buffer, size_t len) { +static void null_init(fastd_context *ctx, const fastd_peer *peer) { + struct iovec buffer = { .iov_base = NULL, .iov_len = 0 }; + fastd_task_put_send(ctx, peer, buffer); } -static void null_send(const fastd_context *ctx, void *buffer, size_t len) { +static void null_handle_recv(fastd_context *ctx, const fastd_peer *peer, struct iovec buffer) { + fastd_task_put_handle_recv(ctx, peer, buffer); +} + +static void null_send(fastd_context *ctx, const fastd_peer *peer, struct iovec buffer) { + fastd_task_put_send(ctx, peer, buffer); } const fastd_method fastd_method_null = { .name = "null", + .method_max_packet_size = null_max_packet_size, .method_init = null_init, - .method_recv = null_recv, + .method_handle_recv = null_handle_recv, .method_send = null_send, }; -- cgit v1.2.3