1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- #ifndef SP_SVC_H
- #define SP_SVC_H
- #pragma once
- #ifdef __cplusplus
- extern "C" {
- #endif
- #include "sp_iom.h"
- #include "sp_tmr.h"
- #include "sp_rsn.h"
- #include "threadpool.h"
- typedef struct sp_svc_t sp_svc_t;
- typedef int (*sp_svc_on_pkt)(sp_svc_t *,int epid, int svc_id, int pkt_type, int pkt_id, iobuffer_t **p_pkt, void *user_data);
- typedef void (*sp_svc_on_sys)(sp_svc_t *,int epid, int state, void *user_data);
- SPBASE_API int sp_svc_create(sp_iom_t *iom, int multithread, int svc_id, int devel_id, sp_svc_t **p_svc);
- SPBASE_API void sp_svc_destroy(sp_svc_t *svc);
- int sp_svc_add_pkt_handler(sp_svc_t *svc, int key, int pkt_type, sp_svc_on_pkt on_pkt, void *user_data);
- int sp_svc_add_sys_handler(sp_svc_t *svc, int key, sp_svc_on_sys on_sys, void *user_data);
- int sp_svc_remove_pkt_handler(sp_svc_t *svc, int key, int pkt_type);
- int sp_svc_remove_sys_handler(sp_svc_t *svc, int key);
- SPBASE_API int sp_svc_start(sp_svc_t *svc);
- SPBASE_API int sp_svc_stop(sp_svc_t *svc);
- int sp_svc_send(sp_svc_t *svc, int epid, int svc_id, int pkt_type, int pkt_id, iobuffer_t **p_pkt);
- int sp_svc_post(sp_svc_t *svc, int epid, int svc_id, int pkt_type, int pkt_id, iobuffer_t **p_pkt);
- int sp_svc_get_state(sp_svc_t *svc, int epid, int *state);
- sp_tmr_mgr_t* sp_svc_get_tmr_mgr(sp_svc_t *svc);
- sp_iom_t *sp_svc_get_iom(sp_svc_t *svc);
- threadpool_t *sp_svc_get_threadpool(sp_svc_t *svc);
- int sp_svc_get_id(sp_svc_t *svc);
- sp_uid_t sp_svc_new_runserial(sp_svc_t *svc);
- void sp_svc_push_runserial_context(sp_svc_t *svc, sp_rsn_context_t *rsn);
- void sp_svc_pop_runserial_context(sp_svc_t *svc);
- sp_rsn_context_t *sp_svc_get_runserial_context(sp_svc_t *svc);
- #ifdef __cplusplus
- } // extern "C" {
- #endif
- #endif // SP_SVC_H
|