|
libssh
0.7.2
|
00001 /* 00002 * This file is part of the SSH Library 00003 * 00004 * Copyright (c) 2009 by Aris Adamantiadis 00005 * 00006 * This library is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU Lesser General Public 00008 * License as published by the Free Software Foundation; either 00009 * version 2.1 of the License, or (at your option) any later version. 00010 * 00011 * This library is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 * Lesser General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU Lesser General Public 00017 * License along with this library; if not, write to the Free Software 00018 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00019 */ 00020 00021 #ifndef PACKET_H_ 00022 #define PACKET_H_ 00023 00024 #include "libssh/wrapper.h" 00025 00026 struct ssh_socket_struct; 00027 00028 /* this structure should go someday */ 00029 typedef struct packet_struct { 00030 int valid; 00031 uint32_t len; 00032 uint8_t type; 00033 } PACKET; 00034 00036 enum ssh_packet_state_e { 00038 PACKET_STATE_INIT, 00040 PACKET_STATE_SIZEREAD, 00043 PACKET_STATE_PROCESSING 00044 }; 00045 00046 int packet_send(ssh_session session); 00047 00048 #ifdef WITH_SSH1 00049 int packet_send1(ssh_session session) ; 00050 void ssh_packet_set_default_callbacks1(ssh_session session); 00051 00052 SSH_PACKET_CALLBACK(ssh_packet_disconnect1); 00053 SSH_PACKET_CALLBACK(ssh_packet_smsg_success1); 00054 SSH_PACKET_CALLBACK(ssh_packet_smsg_failure1); 00055 int ssh_packet_socket_callback1(const void *data, size_t receivedlen, void *user); 00056 00057 #endif 00058 00059 SSH_PACKET_CALLBACK(ssh_packet_unimplemented); 00060 SSH_PACKET_CALLBACK(ssh_packet_disconnect_callback); 00061 SSH_PACKET_CALLBACK(ssh_packet_ignore_callback); 00062 SSH_PACKET_CALLBACK(ssh_packet_dh_reply); 00063 SSH_PACKET_CALLBACK(ssh_packet_newkeys); 00064 SSH_PACKET_CALLBACK(ssh_packet_service_accept); 00065 00066 #ifdef WITH_SERVER 00067 SSH_PACKET_CALLBACK(ssh_packet_kexdh_init); 00068 #endif 00069 00070 int ssh_packet_send_unimplemented(ssh_session session, uint32_t seqnum); 00071 int ssh_packet_parse_type(ssh_session session); 00072 //int packet_flush(ssh_session session, int enforce_blocking); 00073 00074 int ssh_packet_socket_callback(const void *data, size_t len, void *user); 00075 void ssh_packet_register_socket_callback(ssh_session session, struct ssh_socket_struct *s); 00076 void ssh_packet_set_callbacks(ssh_session session, ssh_packet_callbacks callbacks); 00077 void ssh_packet_set_default_callbacks(ssh_session session); 00078 void ssh_packet_process(ssh_session session, uint8_t type); 00079 00080 /* PACKET CRYPT */ 00081 uint32_t packet_decrypt_len(ssh_session session, char *crypted); 00082 int packet_decrypt(ssh_session session, void *packet, unsigned int len); 00083 unsigned char *packet_encrypt(ssh_session session, 00084 void *packet, 00085 unsigned int len); 00086 int packet_hmac_verify(ssh_session session,ssh_buffer buffer, 00087 unsigned char *mac, enum ssh_hmac_e type); 00088 00089 #endif /* PACKET_H_ */
1.7.5.1