]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
add decode & write
authorAlan T. DeKok <aland@freeradius.org>
Tue, 17 Oct 2017 19:58:57 +0000 (15:58 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Tue, 17 Oct 2017 19:58:57 +0000 (15:58 -0400)
which bounces through to proto_detail_work, which does the
actual work.

We should probably have a way to pass the fr_listen_t to proto_detail,
so it can use it's app_io, instead of the one in the proto_detail
instance

src/modules/proto_detail/proto_detail_file.c

index 728270d48451349ec0398d47b5f9cb128097a39f..e07c0722fe14e4e4ada6d5bad3d340a75d7bb4ed 100644 (file)
@@ -61,6 +61,24 @@ static const CONF_PARSER file_listen_config[] = {
 };
 
 
+/*
+ *     All of the decoding is done by proto_detail and proto_detail_work
+ */
+static int mod_decode(void const *instance, REQUEST *request, uint8_t *const data, size_t data_len)
+{
+       proto_detail_file_t const       *inst = talloc_get_type_abort_const(instance, proto_detail_file_t);
+
+       return inst->parent->work_io->decode(inst->parent->work_io_instance, request, data, data_len);
+}
+
+static ssize_t mod_write(void *instance, void *packet_ctx,
+                        fr_time_t request_time, uint8_t *buffer, size_t buffer_len)
+{
+       proto_detail_file_t const       *inst = talloc_get_type_abort_const(instance, proto_detail_file_t);
+
+       return inst->parent->work_io->write(inst->parent->work_io_instance, packet_ctx, request_time, buffer, buffer_len);
+}
+
 static void mod_vnode_extend(void *instance, UNUSED uint32_t fflags)
 {
        proto_detail_file_t *inst = talloc_get_type_abort(instance, proto_detail_file_t);
@@ -248,6 +266,8 @@ fr_app_io_t proto_detail_file = {
 
        .open                   = mod_open,
        .vnode                  = mod_vnode_extend,
+       .decode                 = mod_decode,
+       .write                  = mod_write,
        .fd                     = mod_fd,
        .event_list_set         = mod_event_list_set,
 };