Add state to the on_session_message parameter.
* When state is closed, it implies that packet is null and the session will be destroyed
This commit is contained in:
@@ -151,15 +151,15 @@ struct session_manager;
|
||||
struct session_manager *stellar_module_get_session_manager(struct stellar_module_manager *mod_mgr);
|
||||
int session_manager_new_session_exdata_index(struct session_manager *sess_mgr, const char *name, exdata_free *func, void *arg);
|
||||
|
||||
typedef void on_session_free_callback(struct session *sess, void *args);
|
||||
typedef void on_session_packet_callback(struct session *sess, struct packet *pkt, void *args);
|
||||
typedef void on_tcp_stream_callback(struct session *sess, const char *tcp_payload, uint32_t tcp_payload_len, void *args);
|
||||
// When the state is SESSION_STATE_CLOSED, the packet is NULL, and the session will be destroyed.
|
||||
typedef void on_session_message_callback(struct session *sess, enum session_state state, struct packet *pkt, void *args);
|
||||
// When the state is SESSION_STATE_CLOSED, the tcp_payload is NULL, and the session will be destroyed.
|
||||
typedef void on_tcp_payload_callback(struct session *sess, enum session_state state, const char *tcp_payload, uint32_t tcp_payload_len, void *args);
|
||||
|
||||
int session_manager_subscribe_free(struct session_manager *sess_mgr, on_session_free_callback *cb, void *args);
|
||||
int session_manager_subscribe_tcp(struct session_manager *sess_mgr, on_session_packet_callback *cb, void *args);
|
||||
int session_manager_subscribe_udp(struct session_manager *sess_mgr, on_session_packet_callback *cb, void *args);
|
||||
int session_manager_subscribe_control_packet(struct session_manager *sess_mgr, on_session_packet_callback *cb, void *args);
|
||||
int session_manager_subscribe_tcp_stream(struct session_manager *sess_mgr, on_tcp_stream_callback *cb, void *args);
|
||||
int session_manager_subscribe_tcp(struct session_manager *sess_mgr, on_session_message_callback *cb, void *args);
|
||||
int session_manager_subscribe_udp(struct session_manager *sess_mgr, on_session_message_callback *cb, void *args);
|
||||
int session_manager_subscribe_control_packet(struct session_manager *sess_mgr, on_session_message_callback *cb, void *args);
|
||||
int session_manager_subscribe_tcp_stream(struct session_manager *sess_mgr, on_tcp_payload_callback *cb, void *args);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user