2 * Copyright (C) 2005-2007 Andre Noll <maan@systemlinux.org>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
19 /** \file recv.h receiver-relates structures and exported symbols of recv_common.c */
22 * describes one instance of a receiver
24 struct receiver_node {
25 /** points to the corresponding receiver */
26 struct receiver *receiver;
27 /** the output buffer */
29 /** the amount of bytes in \a buf */
31 /** receiver-specific data */
33 /** set to 1 if end of file is reached */
35 /** pointer to the eof member of the consumer */
37 /** pointer to the configuration data for this instance */
39 /** the task associated with this instance */
44 * describes one supported paraslash receiver
46 * \sa http_recv.c, ortp_recv.c
52 * the name of the receiver
58 * the receiver init function
60 * It must fill in all other function pointers and is assumed to succeed.
62 * \sa http_recv_init ortp_recv_init
64 void (*init)(struct receiver *r);
68 * the command line parser of the receiver
70 * It should check whether the command line options given by \a argc and \a
71 * argv are valid. On success, it should return a pointer to the
72 * receiver-specific configuration data determined by \a argc and \a argv.
73 * Note that this might be called more than once with different values of
74 * \a argc and \a argv.
77 void * (*parse_config)(int argc, char **argv);
81 * open one instance of the receiver
83 * This should allocate the output buffer of \a rn. and may also perform any
84 * other work necessary for retrieving the stream according to the
85 * configuration stored in the \a conf member of \a rn which is guaranteed to
86 * point to valid configuration data (as previously obtained from the config
89 * \sa receiver_node::conf, receiver_node::buf
91 int (*open)(struct receiver_node *rn);
95 * close one instance of the receiver
97 * It should free all resources associated with given receiver node that were
98 * allocated during the corresponding open call.
102 void (*close)(struct receiver_node *rn);
106 * deactivate the receiver
108 * Clean up what init has allocated.
110 void (*shutdown)(void);
114 * add file descriptors to fd_sets and compute timeout for select(2)
116 * The pre_select function gets called from the driving application before
117 * entering its select loop. The receiver may use this hook to add any file
118 * descriptors to the sets of file descriptors given by \a s.
121 * \sa select(2), time.c struct task, struct sched
123 void (*pre_select)(struct sched *s, struct task *t);
127 * evaluate the result from select()
129 * This hook gets called after the call to select(). It should check all file
130 * descriptors which were added to any of the the fd sets during the previous
131 * call to pre_select. According to the result, it may then use any
132 * non-blocking I/O to establish a connection or to receive the audio data.
135 * \sa select(2), struct receiver
137 void (*post_select)(struct sched *s, struct task *t);
142 extern void http_recv_init(struct receiver *r);
143 #define HTTP_RECEIVER {.name = "http", .init = http_recv_init},
144 extern void dccp_recv_init(struct receiver *r);
145 #define DCCP_RECEIVER {.name = "dccp", .init = dccp_recv_init},
148 extern void ortp_recv_init(struct receiver *r);
149 #define ORTP_RECEIVER {.name = "ortp", .init = ortp_recv_init},
151 #define ORTP_RECEIVER
154 extern struct receiver receivers[];
155 extern void (*crypt_function_recv)(unsigned long len, const unsigned char *indata, unsigned char *outdata);
158 /** define an array of all available receivers */
159 #define DEFINE_RECEIVER_ARRAY struct receiver receivers[] = { \
165 void *check_receiver_arg(char *ra, int *receiver_num);
168 extern void (*crypt_function_send)(unsigned long len, const unsigned char *indata, unsigned char *outdata);