#ifndef SP_IOM_H #define SP_IOM_H #pragma once #ifdef __cplusplus extern "C" { #endif /* IO management, provide network communication functions */ #include "bus.h" #include "timerqueue.h" typedef struct sp_iom_t sp_iom_t; typedef int (*sp_iom_on_pkt)(sp_iom_t *, int to_svc_id, int epid, int svc_id, int pkt_type, int pkt_id, iobuffer_t **p_pkt, void *user_data); typedef void (*sp_iom_on_sys)(sp_iom_t *,int epid, int state, void *user_data); typedef void (*sp_custom_poll)(void* user_data); SPBASE_API int sp_iom_create(const char *url, int epid, sp_iom_t **p_iom); SPBASE_API void sp_iom_destroy(sp_iom_t *iom); int sp_iom_add_pkt_handler(sp_iom_t *iom, int key, sp_iom_on_pkt on_pkt, void *user_data); int sp_iom_remove_pkt_handler(sp_iom_t *iom, int key); int sp_iom_add_sys_handler(sp_iom_t *iom, int key, sp_iom_on_sys on_sys, void *user_data); int sp_iom_remove_sys_handler(sp_iom_t *iom, int key); SPBASE_API int sp_iom_run(sp_iom_t *iom); SPBASE_API int sp_iom_stop(sp_iom_t *iom); SPBASE_API int sp_iom_send(sp_iom_t *iom, int this_svc_id, int epid, int svc_id, int pkt_type, int pkt_id, iobuffer_t **p_pkt); SPBASE_API int sp_iom_post(sp_iom_t *iom, int this_svc_id, int epid, int svc_id, int pkt_type, int pkt_id, iobuffer_t **p_pkt); int sp_iom_get_state(sp_iom_t *iom, int epid, int *state); int sp_iom_schedule_timer(sp_iom_t *iom, timer_entry *entry, unsigned int delay); int sp_iom_cancel_timer(sp_iom_t *iom, timer_entry *entry, int cancel); int sp_iom_get_epid(sp_iom_t *iom); const char *sp_iom_get_comm_url(sp_iom_t *iom); SPBASE_API int sp_iom_post_quit(sp_iom_t *iom); int sp_iom_get_poll_thread_id(sp_iom_t *iom); #ifdef __cplusplus } // extern "C" { #endif #endif // SP_IOM_H