Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

misc.h

00001 #ifndef PUTTY_MISC_H
00002 #define PUTTY_MISC_H
00003 
00004 #include "puttymem.h"
00005 
00006 #ifndef FALSE
00007 #define FALSE 0
00008 #endif
00009 #ifndef TRUE
00010 #define TRUE 1
00011 #endif
00012 
00013 char *dupstr(char *s);
00014 char *dupcat(char *s1, ...);
00015 
00016 void base64_encode_atom(unsigned char *data, int n, char *out);
00017 
00018 struct bufchain_granule;
00019 typedef struct bufchain_tag {
00020     struct bufchain_granule *head, *tail;
00021     int buffersize;                    /* current amount of buffered data */
00022 } bufchain;
00023 
00024 void bufchain_init(bufchain *ch);
00025 void bufchain_clear(bufchain *ch);
00026 int bufchain_size(bufchain *ch);
00027 void bufchain_add(bufchain *ch, void *data, int len);
00028 void bufchain_prefix(bufchain *ch, void **data, int *len);
00029 void bufchain_consume(bufchain *ch, int len);
00030 void bufchain_fetch(bufchain *ch, void *data, int len);
00031 
00032 /*
00033  * Debugging functions.
00034  *
00035  * Output goes to debug.log
00036  *
00037  * debug(()) (note the double brackets) is like printf().
00038  *
00039  * dmemdump() and dmemdumpl() both do memory dumps.  The difference
00040  * is that dmemdumpl() is more suited for when where the memory is is
00041  * important (say because you'll be recording pointer values later
00042  * on).  dmemdump() is more concise.
00043  */
00044 
00045 #ifdef DEBUG
00046 void dprintf(char *fmt, ...);
00047 void debug_memdump(void *buf, int len, int L);
00048 #define debug(x) (dprintf x)
00049 #define dmemdump(buf,len) debug_memdump (buf, len, 0);
00050 #define dmemdumpl(buf,len) debug_memdump (buf, len, 1);
00051 #else
00052 #define debug(x)
00053 #define dmemdump(buf,len)
00054 #define dmemdumpl(buf,len)
00055 #endif
00056 
00057 
00058 #ifndef lenof
00059 #define lenof(x) ( (sizeof((x))) / (sizeof(*(x))))
00060 #endif
00061 
00062 
00063 #endif

Generated on Sun Feb 9 13:01:28 2003 for PuTTY by doxygen1.2.18