PARA_INFO_LOG("--> %s\n", buf);
if (!FD_ISSET(ct->scc.fd, &s->wfds))
return;
- ret = send_buffer(ct->scc.fd, buf);
+ ret = write_buffer(ct->scc.fd, buf);
if (ret < 0)
goto out;
ct->status = CL_SENT_AUTH;
if (ret < 0)
goto net_err;
/* send Welcome message */
- ret = send_va_buffer(fd, "This is para_server, version "
+ ret = write_va_buffer(fd, "This is para_server, version "
PACKAGE_VERSION ".\n" );
if (ret < 0)
goto net_err;
return len;
}
+/**
+ * Send a buffer given by a format string.
+ *
+ * \param fd The file descriptor.
+ * \param fmt A format string.
+ *
+ * \return Standard.
+ */
+__printf_2_3 int write_va_buffer(int fd, const char *fmt, ...)
+{
+ char *msg;
+ int ret;
+
+ PARA_VSPRINTF(fmt, msg);
+ ret = write_buffer(fd, msg);
+ free(msg);
+ return ret;
+}
+
/**
* Write a buffer to a non-blocking file descriptor.
*
/** \file fd.h exported symbols from fd.c */
int write_all(int fd, const char *buf, size_t len);
+__printf_2_3 int write_va_buffer(int fd, const char *fmt, ...);
int file_exists(const char *);
int para_select(int n, fd_set *readfds, fd_set *writefds,
struct timeval *timeout_tv);
int write_nonblock(int fd, const char *buf, size_t len);
int for_each_file_in_dir(const char *dirname,
int (*func)(const char *, void *), void *private_data);
+/**
+ * Write 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.
+ */
+_static_inline_ int write_buffer(int fd, const char *buf)
+{
+ return write_all(fd, buf, strlen(buf));
+}
return;
rq = make_request_msg();
PARA_INFO_LOG("sending http request\n");
- ret = send_va_buffer(rn->fd, "%s", rq);
+ ret = write_va_buffer(rn->fd, "%s", rq);
free(rq);
if (ret < 0)
goto out;
static int http_send_msg(struct sender_client *sc, const char *msg)
{
- int ret = send_buffer(sc->fd, msg);
+ int ret = write_buffer(sc->fd, msg);
if (ret < 0)
shutdown_client(sc, hss);
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)
{
*/
extern int generic_max_transport_msg_size(int sockfd);
-int send_buffer(int, const char *);
-__printf_2_3 int send_va_buffer(int fd, const char *fmt, ...);
-
int recv_bin_buffer(int fd, char *buf, size_t size);
int recv_buffer(int fd, char *buf, size_t size);
recv_afs_result(vsst, &s->rfds);
else if (FD_ISSET(vsst->afs_socket, &s->wfds)) {
PARA_NOTICE_LOG("requesting new fd from afs\n");
- ret = send_buffer(vsst->afs_socket, "new");
+ ret = write_buffer(vsst->afs_socket, "new");
if (ret < 0)
PARA_CRIT_LOG("%s\n", para_strerror(-ret));
else