diff --git a/src/include/utils/os.h b/src/include/utils/os.h
index 38d53b2a8bb1281aa13987403ea60f96b3375a6d..42fdea3dad5e99872dc0eac03bc68cf3caa8a4e4 100644 (file)
--- a/src/include/utils/os.h
+++ b/src/include/utils/os.h
#define SDB_UTILS_OS_H 1
#include <sys/types.h>
+#include <netdb.h>
#ifdef __cplusplus
extern "C" {
#endif
+/*
+ * sdb_get_homedir:
+ * Returns the home directory of the current user. The buffer to hold the
+ * return value is allocated dynamically and has to be freed by the caller.
+ *
+ * Returns:
+ * - the current user's home directory on success
+ * - NULL else
+ */
+char *
+sdb_get_homedir(void);
+
+/*
+ * sdb_realpath:
+ * Returns the canonicalized absolute pathname for the specified path. The
+ * function expands all symbolic links and resolves references to '.', '..',
+ * and extra slash characters (/).
+ *
+ * '~/' at the start of the string will be replaced by the current user's home
+ * directory.
+ *
+ * Returns:
+ * - the canonicalized absolute pathname on success
+ * - NULL else
+ */
+char *
+sdb_realpath(const char *path);
+
/*
* sysdb_mkdir_all:
* Recursively create the directory 'pathname' (similar to 'mkdir -p' on the
ssize_t
sdb_write(int fd, size_t msg_len, const void *msg);
+enum {
+ SDB_NET_TCP = 1 << 0,
+ SDB_NET_UDP = 1 << 1,
+ SDB_NET_IP = SDB_NET_TCP | SDB_NET_UDP,
+
+ SDB_NET_V4 = 1 << 2,
+ SDB_NET_V6 = 1 << 3,
+};
+
+/*
+ * sdb_resolve:
+ * Resolve the specified address on the specified network which may be a
+ * bitwise OR of the SDB_NET constants. The network addresses are returned in
+ * the list pointed to by 'res'. The list is allocated dynamically and has to
+ * be freed using freeaddrinfo().
+ *
+ * Returns:
+ * - zero on success
+ * - an error code else; use gai_strerror() to translate the error into a
+ * human readable string
+ */
+int
+sdb_resolve(int network, const char *address, struct addrinfo **res);
+
#ifdef __cplusplus
} /* extern "C" */
#endif