44 lines
1 KiB
C
44 lines
1 KiB
C
#pragma once
|
|
#include <stdlib.h>
|
|
#include <stdio.h>
|
|
#include <errno.h>
|
|
#include <string.h>
|
|
#include "packet.h"
|
|
#include "evt_core.h"
|
|
#include "utils.h"
|
|
#include "url.h"
|
|
|
|
struct algo_params {
|
|
uint8_t is_waiting_bootstrap;
|
|
uint8_t is_healing;
|
|
};
|
|
|
|
struct algo_skel {
|
|
struct evt_core_cat on_udp_read;
|
|
struct evt_core_cat on_tcp_read;
|
|
struct evt_core_cat on_udp_write;
|
|
struct evt_core_cat on_tcp_write;
|
|
struct evt_core_cat on_tcp_co;
|
|
};
|
|
|
|
typedef void (*algo_init)(struct evt_core_ctx* ctx, struct algo_skel* as, struct algo_params* ap);
|
|
|
|
void init_algo(struct evt_core_ctx* ctx, struct algo_skel* as, char* name, struct algo_params* ap);
|
|
void algo_naive(struct evt_core_ctx* ctx, struct algo_skel* as, struct algo_params* ap);
|
|
void algo_rr(struct evt_core_ctx* ctx, struct algo_skel* as, struct algo_params* ap);
|
|
|
|
struct algo_desc {
|
|
algo_init init;
|
|
char* name;
|
|
};
|
|
|
|
static struct algo_desc available_algo[] = {
|
|
{
|
|
.init = algo_naive,
|
|
.name = "naive"
|
|
},
|
|
{
|
|
.init = algo_rr,
|
|
.name = "rr"
|
|
}
|
|
};
|