aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAris Adamantiadis <aris@0xbadc0de.be>2008-06-16 23:02:49 +0000
committerAris Adamantiadis <aris@0xbadc0de.be>2008-06-16 23:02:49 +0000
commit77603dbc5a5c55ecfa8d583c133db844673fb690 (patch)
tree96c4ad653c74e1d53791f4a73c49d43cdcb58359 /include
parent5367581ce1d52518343bb8ede60738f4035e033a (diff)
downloadlibssh-77603dbc5a5c55ecfa8d583c133db844673fb690.tar.gz
libssh-77603dbc5a5c55ecfa8d583c133db844673fb690.tar.xz
libssh-77603dbc5a5c55ecfa8d583c133db844673fb690.zip
Big changes :
refactoring of the socket class. Now the buffering happens in the socket class. enhanced the logging system. Cleaned up some debugging messages. Verified the working with ssh-1. If this cleanup introduced bugs (it did but corrected the found ones) at least, they will be easier to find also added the (c) and fixed dates for updated files git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/libssh/trunk@169 7dcaeef0-15fb-0310-b436-a5af3365683c
Diffstat (limited to 'include')
-rw-r--r--include/libssh/libssh.h34
-rw-r--r--include/libssh/priv.h21
2 files changed, 39 insertions, 16 deletions
diff --git a/include/libssh/libssh.h b/include/libssh/libssh.h
index c7f0d5c0..36fd0925 100644
--- a/include/libssh/libssh.h
+++ b/include/libssh/libssh.h
@@ -1,5 +1,5 @@
/*
-Copyright 2003,04 Aris Adamantiadis
+Copyright (c) 2003-2008 Aris Adamantiadis
This file is part of the SSH Library
@@ -122,15 +122,37 @@ char *ssh_get_error(void *error);
int ssh_get_error_code(void *error);
void ssh_say(int priority,char *format,...);
void ssh_set_verbosity(int num);
-
- /* There is a verbosity level */
-
-#define SSH_LOG_NOLOG 0 // no log
+/** \addtogroup ssh_log
+ * @{
+ */
+ /** \brief Verbosity level for logging and help to debugging
+ */
+
+enum {
+ /** No logging at all
+ */
+ SSH_LOG_NOLOG=0,
+ /** Only rare and noteworthy events
+ */
+ SSH_LOG_RARE,
+ /** High level protocol informations
+ */
+ SSH_LOG_PROTOCOL,
+ /** Lower level protocol infomations, packet level
+ */
+ SSH_LOG_PACKET,
+ /** Every function path
+ */
+ SSH_LOG_FUNCTIONS
+};
+/** @}
+ */
+/*#define SSH_LOG_NOLOG 0 // no log
#define SSH_LOG_RARE 1 // rare conditions
#define SSH_LOG_ENTRY 2 // user-accessible entrypoints
#define SSH_LOG_PACKET 3 // packet id and size
#define SSH_LOG_FUNCTIONS 4 // every function in and return
-
+*/
/* log.c */
void ssh_log(SSH_SESSION *session, int prioriry, char *format, ...);
diff --git a/include/libssh/priv.h b/include/libssh/priv.h
index d5aeda82..db8fe955 100644
--- a/include/libssh/priv.h
+++ b/include/libssh/priv.h
@@ -1,5 +1,5 @@
/*
-Copyright 2003,04 Aris Adamantiadis
+Copyright (c) 2003-2008 Aris Adamantiadis
This file is part of the SSH Library
@@ -322,10 +322,7 @@ struct ssh_session {
BUFFER *in_buffer;
PACKET in_packet;
BUFFER *out_buffer;
-
- BUFFER *out_socket_buffer;
- BUFFER *in_socket_buffer;
-
+
/* the states are used by the nonblocking stuff to remember */
/* where it was before being interrupted */
int packet_state;
@@ -426,11 +423,11 @@ struct ssh_message {
struct ssh_channel_request channel_request;
};
-/* socketc.c */
+/* socket.c */
struct socket;
void ssh_socket_init();
-struct socket *ssh_socket_new();
+struct socket *ssh_socket_new(SSH_SESSION *session);
void ssh_socket_free(struct socket *s);
void ssh_socket_set_fd(struct socket *s, socket_t fd);
socket_t ssh_socket_get_fd(struct socket *s);
@@ -441,6 +438,10 @@ int ssh_socket_is_open(struct socket *s);
int ssh_socket_fd_isset(struct socket *s, fd_set *set);
void ssh_socket_fd_set(struct socket *s, fd_set *set, int *fd_max);
int ssh_socket_completeread(struct socket *s, void *buffer, int len);
+int ssh_socket_wait_for_data(struct socket *s, SSH_SESSION *session,int len);
+int ssh_socket_nonblocking_flush(struct socket *s);
+int ssh_socket_blocking_flush(struct socket *s);
+int ssh_socket_poll(struct socket *s, int *write, int *except);
/* session.c */
@@ -486,7 +487,7 @@ unsigned char *packet_encrypt(SSH_SESSION *session,void *packet,unsigned int len
int packet_hmac_verify(SSH_SESSION *session,BUFFER *buffer,unsigned char *mac);
/* in packet.c */
-void packet_clear_out(SSH_SESSION *session);
+
void packet_parse(SSH_SESSION *session);
int packet_send(SSH_SESSION *session);
@@ -546,8 +547,8 @@ void buffer_add_ssh_string(BUFFER *buffer,STRING *string);
void buffer_add_u8(BUFFER *buffer, u8 data);
void buffer_add_u32(BUFFER *buffer, u32 data);
void buffer_add_u64(BUFFER *buffer,u64 data);
-void buffer_add_data(BUFFER *buffer, void *data, int len);
-void buffer_add_data_begin(BUFFER *buffer,void *data,int len);
+void buffer_add_data(BUFFER *buffer,const void *data, int len);
+void buffer_add_data_begin(BUFFER *buffer,const void *data,int len);
void buffer_add_buffer(BUFFER *buffer, BUFFER *source);
void buffer_reinit(BUFFER *buffer);