1 /** \file send.h sender-related defines and structures */
2 /** the sender subcommands */
3 enum {SENDER_ADD
, SENDER_DELETE
, SENDER_ALLOW
, SENDER_DENY
, SENDER_ON
, SENDER_OFF
};
5 /** the number of sender subcommands */
6 #define NUM_SENDER_CMDS (SENDER_OFF + 1)
9 * describes one supported sender of para_server
11 * \sa http_send.c ortp_send.c
14 /** the name of the sender */
17 * the init function of this sender
19 * It must fill in all function pointers of \a s as well as the \a client_cmds
20 * array, see below. It should also do all necessary preparations to init
21 * this sending facility, for example it could open a tcp port.
23 void (*init
)(struct sender
*s
);
24 /** \p SENDER_ON or \p SENDER_OFF */
27 * return the help text of this sender
29 * The result must be dynamically allocated and is freed by the caller.
33 * return current status info about this sender
35 * The result must be dynamically allocated and is freed by the caller.
41 * It gets called whenever para_server is playing and the current
42 * audio format handler indicates that another chunk of data should
43 * be sent now. The two parameters \a current_chunk and \a chunks_sent
44 * only differ if the stream was repositioned by the \a ff or \a jmp
45 * command. Of course, \a buf is a pointer to the chunk of data which
46 * should be sent, and \a len is the length of this buffer.
48 void (*send
)(long unsigned current_chunk
, long unsigned chunks_sent
,
49 const char *buf
, size_t len
);
50 /** add file descriptors to fd_sets
52 * The pre_select function of each supported sender is called just before
53 * para_server enters its main select loop. Each sender may add its own
54 * file descriptors to the \a rfds or the \a wfds set.
56 * If a file descriptor was added, \a max_fileno must be increased by
57 * this function, if necessary.
61 void (*pre_select
)(int *max_fileno
, fd_set
*rfds
, fd_set
*wfds
);
63 * handle the file descriptors which are ready for I/O
65 * If the pre_select hook added one ore more file descriptors to the read or write
66 * set, this is the hook to check the result and do any I/O on those descriptors
67 * which are ready for reading/writing.
69 void (*post_select
)(fd_set
*rfds
, fd_set
*wfds
);
71 * terminate all connected clients
73 * This is called e.g. if the stop command was executed. It should make the clients
74 * aware of the end-of-file condition.
76 void (*shutdown_clients
)(void);
78 * array of function pointers for the sender subcommands
80 * Each sender may implement any subset of the sender commands by filling in
81 * the appropriate function pointer in the array. A \p NULL pointer means this
82 * command is not implemented by this sender.
84 int (*client_cmds
[NUM_SENDER_CMDS
])(struct sender_command_data
*);