]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - send.h
send.h: Simplify sender command enum.
[paraslash.git] / send.h
diff --git a/send.h b/send.h
index 76a35123c8b5b414b45eec935a525e8d906ae22a..b0da1652b2251668cbce5222396c33b4e9e5c76c 100644 (file)
--- a/send.h
+++ b/send.h
@@ -1,9 +1,13 @@
-/** \file send.h sender-related defines and structures */
-/** the sender subcommands */
-enum {SENDER_ADD, SENDER_DELETE, SENDER_ALLOW, SENDER_DENY, SENDER_ON, SENDER_OFF};
+/*
+ * Copyright (C) 2005-2008 Andre Noll <maan@systemlinux.org>
+ *
+ * Licensed under the GPL v2. For licencing details see COPYING.
+ */
 
-/** the number of sender subcommands */
-#define NUM_SENDER_CMDS (SENDER_OFF + 1)
+/** \file send.h Sender-related defines and structures. */
+
+/** The sender subcommands. */
+enum {SENDER_ADD, SENDER_DELETE, SENDER_ALLOW, SENDER_DENY, SENDER_ON, SENDER_OFF, NUM_SENDER_CMDS};
 
 /**
  * describes one supported sender of para_server
@@ -17,7 +21,7 @@ struct sender {
  * the init function of this sender
  *
  * It must fill in all function pointers of \a s as well as the \a client_cmds
- * array, see below. It should also do all neccessary preparations to init
+ * array, see below. It should also do all necessary preparations to init
  * this sending facility, for example it could open a tcp port.
  */
        void (*init)(struct sender *s);
@@ -54,7 +58,7 @@ struct sender {
  * file descriptors to the \a rfds or the \a wfds set.
  *
  * If a file descriptor was added, \a max_fileno must be increased by
- * this function, if neccessary.
+ * this function, if necessary.
  *
  * \sa select(2)
 */
@@ -78,33 +82,9 @@ struct sender {
  * array of function pointers for the sender subcommands
  *
  * Each sender may implement any subset of the sender commands by filling in
- * the aprropriate function pointer in the array. A \p NULL pointer means this
+ * the appropriate function pointer in the array. A \p NULL pointer means this
  * command is not implemented by this sender.
  */
        int (*client_cmds[NUM_SENDER_CMDS])(struct sender_command_data*);
 };
 
-/**
- * check a file descriptor for writability
- *
- * \param fd the file desctiptor
- *
- * \return positive if fd is ready for writing, zero if it isn't, negative if
- * an error occured.
- */
-
-static inline int write_ok(int fd)
-{
-       struct timeval tv = {0, 0};
-       fd_set wfds;
-       int ret;
-again:
-       FD_ZERO(&wfds);
-       FD_SET(fd, &wfds);
-       tv.tv_sec = 0;
-       tv.tv_usec = 0;
-       ret = select(fd + 1, NULL, &wfds, NULL, &tv);
-       if (ret < 0 && errno == EINTR)
-               goto again;
-       return ret;
-}