aboutsummaryrefslogtreecommitdiff
path: root/include/libssh/misc.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/libssh/misc.h')
-rw-r--r--include/libssh/misc.h36
1 files changed, 33 insertions, 3 deletions
diff --git a/include/libssh/misc.h b/include/libssh/misc.h
index 5044817a..fc8596f7 100644
--- a/include/libssh/misc.h
+++ b/include/libssh/misc.h
@@ -21,6 +21,25 @@
#ifndef MISC_H_
#define MISC_H_
+#ifdef _WIN32
+
+# ifdef _MSC_VER
+# ifndef _SSIZE_T_DEFINED
+# undef ssize_t
+# include <BaseTsd.h>
+ typedef _W64 SSIZE_T ssize_t;
+# define _SSIZE_T_DEFINED
+# endif /* _SSIZE_T_DEFINED */
+# endif /* _MSC_VER */
+
+#else
+# include <sys/types.h>
+#endif /* _WIN32 */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/* in misc.c */
/* gets the user home dir. */
char *ssh_get_user_home_dir(void);
@@ -75,13 +94,13 @@ const void *_ssh_list_pop_head(struct ssh_list *list);
/** @brief fetch the head element of a list and remove it from list
* @param type type of the element to return
- * @param list the ssh_list to use
+ * @param ssh_list the ssh_list to use
* @return the first element of the list, or NULL if the list is empty
*/
#define ssh_list_pop_head(type, ssh_list)\
((type)_ssh_list_pop_head(ssh_list))
-int ssh_make_milliseconds(long sec, long usec);
+int ssh_make_milliseconds(unsigned long sec, unsigned long usec);
void ssh_timestamp_init(struct ssh_timestamp *ts);
int ssh_timeout_elapsed(struct ssh_timestamp *ts, int timeout);
int ssh_timeout_update(struct ssh_timestamp *ts, int timeout);
@@ -96,7 +115,18 @@ int ssh_mkdirs(const char *pathname, mode_t mode);
int ssh_quote_file_name(const char *file_name, char *buf, size_t buf_len);
int ssh_newline_vis(const char *string, char *buf, size_t buf_len);
-int ssh_tmpname(char *template);
+int ssh_tmpname(char *name);
char *ssh_strreplace(const char *src, const char *pattern, const char *repl);
+
+ssize_t ssh_readn(int fd, void *buf, size_t nbytes);
+ssize_t ssh_writen(int fd, const void *buf, size_t nbytes);
+
+int ssh_check_hostname_syntax(const char *hostname);
+int ssh_check_username_syntax(const char *username);
+
+#ifdef __cplusplus
+}
+#endif
+
#endif /* MISC_H_ */