/*
- * Copyright (C) 2005-2012 Andre Noll <maan@systemlinux.org>
+ * Copyright (C) 2005-2013 Andre Noll <maan@systemlinux.org>
*
* Licensed under the GPL v2. For licencing details see COPYING.
*/
struct list_head sockopts;
};
+/**
+ * Allocate and initialize a flowopt queue.
+ *
+ * \return A new structure to be passed to \ref flowopt_add(). It is
+ * automatically deallocated in \ref makesock().
+ */
struct flowopts *flowopt_new(void)
{
struct flowopts *new = para_malloc(sizeof(*new));
list_add_tail(&new->node, &fo->sockopts);
}
-void flowopt_add_bool(struct flowopts *fo, int lev, int opt,
- const char *optname, bool on_or_off)
-{
- int on = on_or_off; /* kernel takes 'int' */
-
- flowopt_add(fo, lev, opt, optname, &on, sizeof(on));
-}
-
/** Set the entire bunch of pre-connection options at once. */
static void flowopt_setopts(int sockfd, struct flowopts *fo)
{
return ia;
}
-/**
- * Send a \p NULL-terminated buffer.
- *
- * \param fd The file descriptor.
- * \param buf The null-terminated buffer to be send.
- *
- * This is equivalent to write_all(fd, buf, strlen(buf)).
- *
- * \return Standard.
- */
-int send_buffer(int fd, const char *buf)
-{
- return write_all(fd, buf, strlen(buf));
-}
-
-/**
- * Send a buffer given by a format string.
- *
- * \param fd The file descriptor.
- * \param fmt A format string.
- *
- * \return Standard.
- */
-__printf_2_3 int send_va_buffer(int fd, const char *fmt, ...)
-{
- char *msg;
- int ret;
-
- PARA_VSPRINTF(fmt, msg);
- ret = send_buffer(fd, msg);
- free(msg);
- return ret;
-}
-
/**
* Receive data from a file descriptor.
*
#ifndef HAVE_UCRED
ssize_t send_cred_buffer(int sock, char *buf)
{
- return send_buffer(sock, buf);
+ return write_buffer(sock, buf);
}
int recv_cred_buffer(int fd, char *buf, size_t size)
{