aboutsummaryrefslogtreecommitdiff
path: root/libssh
diff options
context:
space:
mode:
authorMilo Jhoran <milo.jhoran@gmail.com>2010-08-08 02:27:51 +0200
committerAndreas Schneider <asn@cynapses.org>2010-08-13 11:17:18 +0200
commit24b524040be4af9204f9d509ef6b8153aa6dc2cc (patch)
tree9c31a1b58fb0e3182a7dd45e9dea4284e7508247 /libssh
parente533c3f33b83a7a7fd820bf1fee91c53b11228c1 (diff)
downloadlibssh-24b524040be4af9204f9d509ef6b8153aa6dc2cc.tar.gz
libssh-24b524040be4af9204f9d509ef6b8153aa6dc2cc.tar.xz
libssh-24b524040be4af9204f9d509ef6b8153aa6dc2cc.zip
server: Added an API entry for the message callback.
Signed-off-by: Andreas Schneider <asn@cynapses.org>
Diffstat (limited to 'libssh')
-rw-r--r--libssh/server.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/libssh/server.c b/libssh/server.c
index 3e73ab9..7f6ecf0 100644
--- a/libssh/server.c
+++ b/libssh/server.c
@@ -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)