1
1

packets: allow removal of callbacks

Signed-off-by: Aris Adamantiadis <aris@0xbadc0de.be>
Reviewed-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
Этот коммит содержится в:
Aris Adamantiadis 2015-07-24 16:09:48 +02:00 коммит произвёл Andreas Schneider
родитель 0197e5e1e5
Коммит f4339df577
2 изменённых файлов: 12 добавлений и 0 удалений

Просмотреть файл

@ -70,6 +70,7 @@ int ssh_packet_parse_type(ssh_session session);
int ssh_packet_socket_callback(const void *data, size_t len, void *user); int ssh_packet_socket_callback(const void *data, size_t len, void *user);
void ssh_packet_register_socket_callback(ssh_session session, struct ssh_socket_struct *s); void ssh_packet_register_socket_callback(ssh_session session, struct ssh_socket_struct *s);
void ssh_packet_set_callbacks(ssh_session session, ssh_packet_callbacks callbacks); void ssh_packet_set_callbacks(ssh_session session, ssh_packet_callbacks callbacks);
void ssh_packet_remove_callbacks(ssh_session session, ssh_packet_callbacks callbacks);
void ssh_packet_set_default_callbacks(ssh_session session); void ssh_packet_set_default_callbacks(ssh_session session);
void ssh_packet_process(ssh_session session, uint8_t type); void ssh_packet_process(ssh_session session, uint8_t type);

Просмотреть файл

@ -1241,6 +1241,17 @@ void ssh_packet_set_callbacks(ssh_session session, ssh_packet_callbacks callback
} }
} }
/** @internal
* @brief remove the callbacks from the packet layer
*/
void ssh_packet_remove_callbacks(ssh_session session, ssh_packet_callbacks callbacks){
struct ssh_iterator *it = NULL;
it = ssh_list_find(session->packet_callbacks, callbacks);
if (it != NULL) {
ssh_list_remove(session->packet_callbacks, it);
}
}
/** @internal /** @internal
* @brief sets the default packet handlers * @brief sets the default packet handlers
*/ */