diff options
author | Andreas Schneider <asn@cryptomilk.org> | 2013-07-14 13:31:24 +0200 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2013-07-14 13:31:24 +0200 |
commit | c64ec43eef8ec5a8b8a8f4c4c3216043aea8e08a (patch) | |
tree | 33131e402f35d800cf923f837ae4c72166703b27 /src/packet.c | |
parent | 0d3deeec101b0d6568d7c04eda833bde47c7329c (diff) | |
download | libssh-c64ec43eef8ec5a8b8a8f4c4c3216043aea8e08a.tar.gz libssh-c64ec43eef8ec5a8b8a8f4c4c3216043aea8e08a.tar.xz libssh-c64ec43eef8ec5a8b8a8f4c4c3216043aea8e08a.zip |
src: Remove enter_function() and leave_function().
Diffstat (limited to 'src/packet.c')
-rw-r--r-- | src/packet.c | 30 |
1 files changed, 9 insertions, 21 deletions
diff --git a/src/packet.c b/src/packet.c index a47efbd7..c4b4a9a1 100644 --- a/src/packet.c +++ b/src/packet.c @@ -159,14 +159,12 @@ int ssh_packet_socket_callback(const void *data, size_t receivedlen, void *user) goto error; } - enter_function(); if (session->session_state == SSH_SESSION_STATE_ERROR) goto error; switch(session->packet_state) { case PACKET_STATE_INIT: if(receivedlen < blocksize){ /* We didn't receive enough data to read at least one block size, give up */ - leave_function(); return 0; } memset(&session->in_packet, 0, sizeof(PACKET)); @@ -296,7 +294,7 @@ int ssh_packet_socket_callback(const void *data, size_t receivedlen, void *user) receivedlen - processed,user); processed += rc; } - leave_function(); + return processed; case PACKET_STATE_PROCESSING: SSH_LOG(SSH_LOG_RARE, "Nested packet processing. Delaying."); @@ -309,7 +307,7 @@ int ssh_packet_socket_callback(const void *data, size_t receivedlen, void *user) error: session->session_state= SSH_SESSION_STATE_ERROR; - leave_function(); + return processed; } @@ -359,11 +357,12 @@ void ssh_packet_process(ssh_session session, uint8_t type){ struct ssh_iterator *i; int r=SSH_PACKET_NOT_USED; ssh_packet_callbacks cb; - enter_function(); + SSH_LOG(SSH_LOG_PACKET, "Dispatching handler for packet type %d",type); if(session->packet_callbacks == NULL){ SSH_LOG(SSH_LOG_RARE,"Packet callback is not initialized !"); - goto error; + + return; } i=ssh_list_get_iterator(session->packet_callbacks); while(i != NULL){ @@ -385,8 +384,6 @@ void ssh_packet_process(ssh_session session, uint8_t type){ SSH_LOG(SSH_LOG_RARE,"Couldn't do anything with packet type %d",type); ssh_packet_send_unimplemented(session, session->recv_seq-1); } -error: - leave_function(); } /** @internal @@ -397,7 +394,7 @@ error: */ int ssh_packet_send_unimplemented(ssh_session session, uint32_t seqnum){ int r; - enter_function(); + r = buffer_add_u8(session->out_buffer, SSH2_MSG_UNIMPLEMENTED); if (r < 0) { return SSH_ERROR; @@ -407,7 +404,7 @@ int ssh_packet_send_unimplemented(ssh_session session, uint32_t seqnum){ return SSH_ERROR; } r = packet_send(session); - leave_function(); + return r; } @@ -430,23 +427,18 @@ SSH_PACKET_CALLBACK(ssh_packet_unimplemented){ * @parse the "Type" header field of a packet and updates the session */ int ssh_packet_parse_type(ssh_session session) { - enter_function(); - memset(&session->in_packet, 0, sizeof(PACKET)); if(session->in_buffer == NULL) { - leave_function(); return SSH_ERROR; } if(buffer_get_u8(session->in_buffer, &session->in_packet.type) == 0) { ssh_set_error(session, SSH_FATAL, "Packet too short to read type"); - leave_function(); return SSH_ERROR; } session->in_packet.valid = 1; - leave_function(); return SSH_OK; } @@ -457,12 +449,10 @@ int ssh_packet_parse_type(ssh_session session) { static int ssh_packet_write(ssh_session session) { int rc = SSH_ERROR; - enter_function(); - rc=ssh_socket_write(session->socket, buffer_get_rest(session->out_buffer), buffer_get_rest_len(session->out_buffer)); - leave_function(); + return rc; } @@ -476,8 +466,6 @@ static int packet_send2(ssh_session session) { uint32_t finallen,payloadsize,compsize; uint8_t padding; - enter_function(); - payloadsize = currentlen; #ifdef WITH_ZLIB if (session->current_crypto @@ -537,7 +525,7 @@ static int packet_send2(ssh_session session) { rc = SSH_ERROR; } error: - leave_function(); + return rc; /* SSH_OK, AGAIN or ERROR */ } |