/** * @internal * * @brief Add a message to the current queue of messages to be parsed and/or call * the various callback functions. * * @param[in] session The SSH session to add the message. * * @param[in] message The message to add to the queue. */ void ssh_message_queue(ssh_session session, ssh_message message){ if (message != NULL) { #ifdef WITH_SERVER int ret; /* probably not the best place to execute server callbacks, but still better * than nothing. */ ret = ssh_execute_server_callbacks(session, message); if (ret == SSH_OK){ ssh_message_free(message); return; } #endif /* WITH_SERVER */ if(session->ssh_message_callback != NULL) { ssh_execute_message_callback(session, message); return; } if (session->server_callbacks != NULL){ /* if we have server callbacks, but nothing was executed, it means we are * in non-synchronous mode, and we just don't care about the message we * received. Just send a default response. Do not queue it. */ ssh_message_reply_default(message); ssh_message_free(message); return; } if(session->ssh_message_list == NULL) { session->ssh_message_list = ssh_list_new(); } if (session->ssh_message_list != NULL) { ssh_list_append(session->ssh_message_list, message); } } }
/** * @internal * * @brief Add a message to the current queue of messages to be parsed. * * @param[in] session The SSH session to add the message. * * @param[in] message The message to add to the queue. */ void ssh_message_queue(ssh_session session, ssh_message message){ if(message) { if(session->ssh_message_list == NULL) { if(session->ssh_message_callback != NULL) { ssh_execute_message_callback(session, message); return; } session->ssh_message_list = ssh_list_new(); } ssh_list_append(session->ssh_message_list, message); } }