26 lines
1.1 KiB
C
26 lines
1.1 KiB
C
#pragma once
|
|
#include "algo_skel.h"
|
|
#include <glib-2.0/glib.h>
|
|
#include <glib-2.0/gmodule.h>
|
|
#include <glib-2.0/glib-object.h>
|
|
|
|
struct algo_ctx {
|
|
int ref_count;
|
|
struct buffer_packet bps[10];
|
|
GQueue* free_buffer; // Available buffers
|
|
GHashTable* used_buffer; // Buffers used for reading or writing
|
|
GQueue* read_waiting; // Who wait to be notified for a read
|
|
GHashTable* write_waiting; // Structure to track packets waiting to be written
|
|
};
|
|
|
|
void mv_buffer_rtow(struct algo_ctx* app_ctx,
|
|
struct evt_core_fdinfo* from,
|
|
struct evt_core_fdinfo* to,
|
|
struct buffer_packet* bp);
|
|
void mv_buffer_wtor(struct algo_ctx* app_ctx, struct evt_core_fdinfo* fdinfo, struct buffer_packet* bp);
|
|
struct buffer_packet* get_write_buffer(struct algo_ctx *app_ctx, struct evt_core_fdinfo *fdinfo);
|
|
struct buffer_packet* get_read_buffer(struct algo_ctx *app_ctx, struct evt_core_fdinfo *fdinfo);
|
|
void free_naive(void* app_ctx);
|
|
void free_nothing(void* app_ctx);
|
|
void notify_read(struct evt_core_ctx* ctx, struct algo_ctx* app_ctx);
|
|
void naive_free_simple(void* v);
|