ppd/include/mod.h
2023-01-17 21:22:43 +01:00

49 lines
1.4 KiB
C

#pragma once
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h>
#include <stdio.h>
typedef int (*ppd_global_init_cb)(int argc, char** argk, char** argv, void **ctx);
typedef int (*ppd_thread_create_cb)(int core, void * global_ctx, void **ctx);
typedef int (*ppd_conn_create_cb)(void * global_ctx, void * thread_ctx, void **ctx);
typedef void (*ppd_conn_destroy_cb)(void * global_ctx, void * thread_ctx, void *conn_ctx);
typedef int (*ppd_conn_recv_cb)(const char * data, size_t sz, void * global_ctx, void * thread_ctx, void * conn_ctx);
typedef int (*ppd_conn_send_cb)(const char * out, size_t sz, size_t * out_sz, void * global_ctx, void * thread_ctx, void * conn_ctx);
struct ppd_mod_info {
const char * name;
ppd_global_init_cb global_init_cb;
ppd_thread_create_cb thread_create_cb;
ppd_conn_create_cb conn_create_cb;
ppd_conn_destroy_cb conn_destroy_cb;
ppd_conn_send_cb conn_send_cb;
ppd_conn_recv_cb conn_recv_cb;
};
// struct dismemebr_mod_info {
// const char * name;
// ppd_global_init_cb global_init_cb;
// ppd_thread_create_cb thread_create_cb;
// ppd_conn_create_cb conn_create_cb;
// ppd_conn_destroy_cb conn_destroy_cb;
// ppd_conn_send_cb conn_send_cb;
// ppd_conn_recv_cb conn_recv_cb;
// };
typedef struct ppd_mod_info * (*ppd_get_mod_info_fn)(void);
#define PPD_GET_MOD_INFO_ID ppd_getmod_info
#define PPD_GET_MOD_INFO_FN ("##PPD_GET_MOD_INFO_ID")
#ifdef __cplusplus
}
#endif