X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=send.h;h=3436bcea65371979152cb718bb8beb5d4cb9fda5;hp=75c13731bb1af9223a0a32fdc8c85792f04f3d50;hb=d4171bf0379c24a15df0281c5328c53087e446f4;hpb=c9f109a9e7f2d6116b7906a852afc339c858c275 diff --git a/send.h b/send.h index 75c13731..3436bcea 100644 --- 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 + * + * Licensed under the GPL v2. For licencing details see COPYING. + */ + +/** \file send.h Sender-related defines and structures. */ -/** the number of sender subcommands */ -#define NUM_SENDER_CMDS (SENDER_OFF + 1) +/** 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,12 +21,10 @@ 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); -/** \p SENDER_ON or \p SENDER_OFF */ - int status; /** * return the help text of this sender * @@ -45,8 +47,8 @@ struct sender { * command. Of course, \a buf is a pointer to the chunk of data which * should be sent, and \a len is the length of this buffer. */ - void (*send)(struct audio_format *af, long unsigned current_chunk, - long unsigned chunks_sent, const char *buf, size_t len); + void (*send)(long unsigned current_chunk, long unsigned chunks_sent, + const char *buf, size_t len); /** add file descriptors to fd_sets * * The pre_select function of each supported sender is called just before @@ -54,12 +56,11 @@ 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) */ - void (*pre_select)(struct audio_format *af, int *max_fileno, fd_set *rfds, - fd_set *wfds); + void (*pre_select)(int *max_fileno, fd_set *rfds, fd_set *wfds); /** * handle the file descriptors which are ready for I/O * @@ -67,7 +68,7 @@ struct sender { * set, this is the hook to check the result and do any I/O on those descriptors * which are ready for reading/writing. */ - void (*post_select)(struct audio_format *af, fd_set *rfds, fd_set *wfds); + void (*post_select)(fd_set *rfds, fd_set *wfds); /** * terminate all connected clients * @@ -79,27 +80,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*); }; - - -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); - ret = select(fd + 1, NULL, &wfds, NULL, &tv); - if (ret < 0 && errno == EINTR) - goto again; - if (ret < 0) - ret = 0; - return ret; -} -