comparison dbutil.h @ 1024:aac0095dc3b4 fastopen

work in progress for async connect
author Matt Johnston <matt@ucc.asn.au>
date Wed, 18 Feb 2015 00:05:27 +0800
parents a00303a7d247
children 02baa0b334e8
comparison
equal deleted inserted replaced
1023:a00303a7d247 1024:aac0095dc3b4
74 void getaddrstring(struct sockaddr_storage* addr, 74 void getaddrstring(struct sockaddr_storage* addr,
75 char **ret_host, char **ret_port, int host_lookup); 75 char **ret_host, char **ret_port, int host_lookup);
76 void set_sock_nodelay(int sock); 76 void set_sock_nodelay(int sock);
77 void set_sock_priority(int sock, enum dropbear_prio prio); 77 void set_sock_priority(int sock, enum dropbear_prio prio);
78 78
79 #ifdef __linux__ 79 #if defined(__linux__) && HAVE_SENDMSG
80 #define DROPBEAR_TCP_FAST_OPEN 80 #define DROPBEAR_TCP_FAST_OPEN
81 void set_listen_fast_open(int sock); 81 void set_listen_fast_open(int sock);
82 #endif 82 #endif
83 83
84 int dropbear_listen(const char* address, const char* port, 84 int dropbear_listen(const char* address, const char* port,
87 int *writefd, int *readfd, int *errfd, pid_t *pid); 87 int *writefd, int *readfd, int *errfd, pid_t *pid);
88 void run_shell_command(const char* cmd, unsigned int maxfd, char* usershell); 88 void run_shell_command(const char* cmd, unsigned int maxfd, char* usershell);
89 #ifdef ENABLE_CONNECT_UNIX 89 #ifdef ENABLE_CONNECT_UNIX
90 int connect_unix(const char* addr); 90 int connect_unix(const char* addr);
91 #endif 91 #endif
92 int connect_remote(const char* remotehost, const char* remoteport, char ** errstring);
93 int buf_readfile(buffer* buf, const char* filename); 92 int buf_readfile(buffer* buf, const char* filename);
94 int buf_getline(buffer * line, FILE * authfile); 93 int buf_getline(buffer * line, FILE * authfile);
95 94
96 void m_close(int fd); 95 void m_close(int fd);
97 void * m_malloc(size_t size); 96 void * m_malloc(size_t size);
116 a real-world clock */ 115 a real-world clock */
117 time_t monotonic_now(); 116 time_t monotonic_now();
118 117
119 char * expand_tilde(const char *inpath); 118 char * expand_tilde(const char *inpath);
120 119
120 struct dropbear_progress_connection;
121
122 /* result is DROPBEAR_SUCCESS or DROPBEAR_FAILURE.
123 errstring is only set on DROPBEAR_FAILURE, returns failure message for the last attempted socket */
124 typedef void(*connect_callback)(int result, int sock, void* data, const char* errstring);
125
126 struct dropbear_progress_connection * connect_remote (const char* remotehost, const char* remoteport,
127 connect_callback cb, void *cb_data);
128
129 void set_connect_fds(fd_set *writefd);
130 void handle_connect_fds(fd_set *writefd);
131
121 #endif /* _DBUTIL_H_ */ 132 #endif /* _DBUTIL_H_ */