server: Added an API entry for the message callback.
Signed-off-by: Andreas Schneider <asn@cynapses.org>
Этот коммит содержится в:
родитель
e533c3f33b
Коммит
24b524040b
@ -83,7 +83,6 @@ SSH_PACKET_CALLBACK(ssh_packet_userauth_request);
|
||||
|
||||
int ssh_message_handle_channel_request(ssh_session session, ssh_channel channel, ssh_buffer packet,
|
||||
const char *request, uint8_t want_reply);
|
||||
int ssh_execute_message_callbacks(ssh_session session);
|
||||
void ssh_message_queue(ssh_session session, ssh_message message);
|
||||
ssh_message ssh_message_pop_head(ssh_session session);
|
||||
|
||||
|
@ -159,7 +159,9 @@ LIBSSH_API int ssh_message_service_reply_success(ssh_message msg);
|
||||
LIBSSH_API char *ssh_message_service_service(ssh_message msg);
|
||||
|
||||
LIBSSH_API void ssh_set_message_callback(ssh_session session,
|
||||
int(*ssh_message_callback)(ssh_session session, ssh_message msg));
|
||||
int(*ssh_message_callback)(ssh_session session, ssh_message msg, void *data),
|
||||
void *data);
|
||||
LIBSSH_API int ssh_execute_message_callbacks(ssh_session session);
|
||||
|
||||
LIBSSH_API char *ssh_message_channel_request_open_originator(ssh_message msg);
|
||||
LIBSSH_API int ssh_message_channel_request_open_originator_port(ssh_message msg);
|
||||
|
@ -115,7 +115,8 @@ struct ssh_session_struct {
|
||||
int auth_methods;
|
||||
int hostkeys; /* contains type of host key wanted by client, in server impl */
|
||||
struct ssh_list *ssh_message_list; /* list of delayed SSH messages */
|
||||
int (*ssh_message_callback)( struct ssh_session_struct *session, ssh_message msg);
|
||||
int (*ssh_message_callback)( struct ssh_session_struct *session, ssh_message msg, void *userdata);
|
||||
void *ssh_message_callback_data;
|
||||
int log_verbosity; /*cached copy of the option structure */
|
||||
int log_indent; /* indentation level in enter_function logs */
|
||||
|
||||
|
@ -1132,19 +1132,21 @@ char *ssh_message_channel_request_subsystem(ssh_message msg){
|
||||
* must take care of the response).
|
||||
*/
|
||||
void ssh_set_message_callback(ssh_session session,
|
||||
int(*ssh_message_callback_)(ssh_session session, ssh_message msg)){
|
||||
int(*ssh_message_callback_)(ssh_session session, ssh_message msg, void *data), void *data){
|
||||
session->ssh_message_callback=ssh_message_callback_;
|
||||
session->ssh_message_callback_data=data;
|
||||
}
|
||||
|
||||
int ssh_execute_message_callbacks(ssh_session session){
|
||||
ssh_message msg=NULL;
|
||||
int ret;
|
||||
ssh_handle_packets(session, 0);
|
||||
if(!session->ssh_message_list)
|
||||
return SSH_OK;
|
||||
if(session->ssh_message_callback){
|
||||
while(ssh_list_pop_head(ssh_message , session->ssh_message_list) != NULL){
|
||||
msg=ssh_message_pop_head(session);
|
||||
ret=session->ssh_message_callback(session,msg);
|
||||
while((msg=ssh_message_pop_head(session)) != NULL) {
|
||||
ret=session->ssh_message_callback(session,msg,
|
||||
session->ssh_message_callback_data);
|
||||
if(ret==1){
|
||||
ret = ssh_message_reply_default(msg);
|
||||
ssh_message_free(msg);
|
||||
@ -1155,8 +1157,7 @@ int ssh_execute_message_callbacks(ssh_session session){
|
||||
}
|
||||
}
|
||||
} else {
|
||||
while(ssh_list_pop_head(ssh_message , session->ssh_message_list) != NULL){
|
||||
msg=ssh_message_pop_head(session);
|
||||
while((msg=ssh_message_pop_head(session)) != NULL) {
|
||||
ret = ssh_message_reply_default(msg);
|
||||
ssh_message_free(msg);
|
||||
if(ret != SSH_OK)
|
||||
|
Загрузка…
Ссылка в новой задаче
Block a user