comparison dbutil.h @ 641:2b1bb792cd4d dropbear-tfm

- Update tfm changes to current default tip
author Matt Johnston <matt@ucc.asn.au>
date Mon, 21 Nov 2011 19:52:28 +0800
parents 76097ec1a29a 00eca37e47e8
children
comparison
equal deleted inserted replaced
640:76097ec1a29a 641:2b1bb792cd4d
31 31
32 #ifndef DISABLE_SYSLOG 32 #ifndef DISABLE_SYSLOG
33 void startsyslog(); 33 void startsyslog();
34 #endif 34 #endif
35 35
36 extern void (*_dropbear_exit)(int exitcode, const char* format, va_list param); 36 #ifdef __GNUC__
37 #define ATTRIB_PRINTF(fmt,args) __attribute__((format(printf, fmt, args)))
38 #else
39 #define ATTRIB_PRINTF(fmt,args)
40 #endif
41
42 #ifdef __GNUC__
43 #define ATTRIB_NORETURN __attribute__((noreturn))
44 #else
45 #define ATTRIB_NORETURN
46 #endif
47
48 extern void (*_dropbear_exit)(int exitcode, const char* format, va_list param) ATTRIB_NORETURN;
37 extern void (*_dropbear_log)(int priority, const char* format, va_list param); 49 extern void (*_dropbear_log)(int priority, const char* format, va_list param);
38 50
39 void dropbear_exit(const char* format, ...); 51 void dropbear_exit(const char* format, ...) ATTRIB_PRINTF(1,2) ATTRIB_NORETURN;
40 void dropbear_close(const char* format, ...); 52
41 void dropbear_log(int priority, const char* format, ...); 53 void dropbear_close(const char* format, ...) ATTRIB_PRINTF(1,2) ;
42 void fail_assert(const char* expr, const char* file, int line); 54 void dropbear_log(int priority, const char* format, ...) ATTRIB_PRINTF(2,3) ;
55
56 void fail_assert(const char* expr, const char* file, int line) ATTRIB_NORETURN;
57
43 #ifdef DEBUG_TRACE 58 #ifdef DEBUG_TRACE
44 void dropbear_trace(const char* format, ...); 59 void dropbear_trace(const char* format, ...) ATTRIB_PRINTF(1,2);
45 void printhex(const char * label, const unsigned char * buf, int len); 60 void printhex(const char * label, const unsigned char * buf, int len);
46 extern int debug_trace; 61 extern int debug_trace;
47 #endif 62 #endif
63
48 char * stripcontrol(const char * text); 64 char * stripcontrol(const char * text);
49 unsigned char * getaddrstring(struct sockaddr_storage* addr, int withport); 65 void get_socket_address(int fd, char **local_host, char **local_port,
66 char **remote_host, char **remote_port, int host_lookup);
67 void getaddrstring(struct sockaddr_storage* addr,
68 char **ret_host, char **ret_port, int host_lookup);
50 int dropbear_listen(const char* address, const char* port, 69 int dropbear_listen(const char* address, const char* port,
51 int *socks, unsigned int sockcount, char **errstring, int *maxfd); 70 int *socks, unsigned int sockcount, char **errstring, int *maxfd);
52 int spawn_command(void(*exec_fn)(void *user_data), void *exec_data, 71 int spawn_command(void(*exec_fn)(void *user_data), void *exec_data,
53 int *writefd, int *readfd, int *errfd, pid_t *pid); 72 int *writefd, int *readfd, int *errfd, pid_t *pid);
54 void run_shell_command(const char* cmd, unsigned int maxfd, char* usershell); 73 void run_shell_command(const char* cmd, unsigned int maxfd, char* usershell);
74 #ifdef ENABLE_CONNECT_UNIX
75 int connect_unix(const char* addr);
76 #endif
55 int connect_remote(const char* remotehost, const char* remoteport, 77 int connect_remote(const char* remotehost, const char* remoteport,
56 int nonblocking, char ** errstring); 78 int nonblocking, char ** errstring);
57 char* getaddrhostname(struct sockaddr_storage * addr);
58 int buf_readfile(buffer* buf, const char* filename); 79 int buf_readfile(buffer* buf, const char* filename);
59 int buf_getline(buffer * line, FILE * authfile); 80 int buf_getline(buffer * line, FILE * authfile);
60 81
61 void m_close(int fd); 82 void m_close(int fd);
62 void * m_malloc(size_t size); 83 void * m_malloc(size_t size);