aboutsummaryrefslogtreecommitdiff
path: root/include/libssh/priv.h
diff options
context:
space:
mode:
authorAris Adamantiadis <aris@0xbadc0de.be>2008-06-12 20:14:17 +0000
committerAris Adamantiadis <aris@0xbadc0de.be>2008-06-12 20:14:17 +0000
commitfe51f9c7662b7391f80953bedc4fe61b89013913 (patch)
tree66e1390ec6f593ba32b7a881040a303fd2669653 /include/libssh/priv.h
parentb94422ef10bb083dde58e8c8349cc3e004888f9f (diff)
downloadlibssh-fe51f9c7662b7391f80953bedc4fe61b89013913.tar.gz
libssh-fe51f9c7662b7391f80953bedc4fe61b89013913.tar.xz
libssh-fe51f9c7662b7391f80953bedc4fe61b89013913.zip
big changes :
Some documentation, and a new logging system. some work must be done to get rid of the infamous ssh_say() git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/libssh/trunk@166 7dcaeef0-15fb-0310-b436-a5af3365683c
Diffstat (limited to 'include/libssh/priv.h')
-rw-r--r--include/libssh/priv.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/include/libssh/priv.h b/include/libssh/priv.h
index fa8ba3c2..d5aeda82 100644
--- a/include/libssh/priv.h
+++ b/include/libssh/priv.h
@@ -237,6 +237,8 @@ struct ssh_options_struct {
int ssh1allowed;
char *dsakey;
char *rsakey; /* host key for server implementation */
+ int log_verbosity;
+ void (*log_function)(const char *message, SSH_SESSION *session, int verbosity); //log callback
};
typedef struct ssh_crypto_struct {
@@ -355,6 +357,8 @@ struct ssh_session {
int auth_methods;
int hostkeys; /* contains type of host key wanted by client, in server impl */
struct ssh_message *ssh_message; /* ssh message */
+ int log_verbosity; /*cached copy of the option structure */
+ int log_indent; /* indentation level in enter_function logs */
};
struct ssh_kbdint {
@@ -612,6 +616,27 @@ int channel_write1(CHANNEL *channel, void *data, int len);
int ssh_handle_packets(SSH_SESSION *session);
+/* log.c */
+
+#define _enter_function(sess) \
+ do {\
+ if((sess)->log_verbosity >= SSH_LOG_FUNCTIONS){ \
+ ssh_log((sess),SSH_LOG_FUNCTIONS,"entering function %s line %d in " __FILE__ , __FUNCTION__,__LINE__);\
+ (sess)->log_indent++; \
+ } \
+ } while(0)
+
+#define _leave_function(sess) \
+ do { \
+ if((sess)->log_verbosity >= SSH_LOG_FUNCTIONS){ \
+ (sess)->log_indent--; \
+ ssh_log((sess),SSH_LOG_FUNCTIONS,"leaving function %s line %d in " __FILE__ , __FUNCTION__,__LINE__);\
+ }\
+ } while(0)
+
+#define enter_function() _enter_function(session)
+#define leave_function() _leave_function(session)
+
#ifdef HAVE_LIBGCRYPT
/* gcrypt_missing.c */
int my_gcry_dec2bn(bignum *bn, const char *data);