Clean and tiddy-up files.
[tomato.git] / release / src / router / udpxy / uopt.h
blob1175f94bf5f4c99836a089ec86b11f96c5604cb0
1 /* @(#) option definitions and associated structures for udpxy
3 * Copyright 2008-2011 Pavel V. Cherenkov (pcherenkov@gmail.com)
5 * This file is part of udpxy.
7 * udpxy is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
12 * udpxy is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with udpxy. If not, see <http://www.gnu.org/licenses/>.
21 #ifndef UOPT_H_0215082300
22 #define UOPT_H_0215082300
24 #include <sys/types.h>
25 #include <stdio.h>
26 #include <time.h>
27 #include <unistd.h>
29 #include "udpxy.h"
31 static const int MIN_CLIENT_COUNT = 1;
32 static const int MAX_CLIENT_COUNT = 5000;
33 static const int DEFAULT_CLIENT_COUNT = 3;
35 static const ssize_t MIN_MCACHE_LEN = 4 * 1024;
36 static const ssize_t MAX_MCACHE_LEN = 2048 * 1024;
37 static const ssize_t DEFAULT_CACHE_LEN = 2 * 1024;
38 static const u_short DEFAULT_MCAST_REFRESH = 0;
40 static const ssize_t MIN_SOCKBUF_LEN = (1024 * 64);
43 /* udpxy options
45 struct udpxy_opt {
46 flag_t is_verbose; /* verbose output on/off */
47 flag_t cl_tpstat; /* client reports throughput stats */
48 int nice_incr; /* value to increment nice by */
49 ssize_t rbuf_len; /* size of read buffer */
50 int rbuf_msgs; /* max msgs in read buffer (-1 = all) */
51 int max_clients; /* max clients to accept */
52 u_short mcast_refresh; /* refresh rate (sec) for multicast
53 subscription */
55 time_t rcv_tmout; /* receive (mcast) socket timeout */
56 time_t dhold_tmout; /* timeout to hold buffered data (milisec) */
58 time_t sr_tmout, /* server READ/RCV timeout (sec) */
59 sw_tmout; /* server WRITE/SND timeout (sec) */
60 long ssel_tmout; /* server select/poll timeout (sec) */
61 int lq_backlog; /* accept queue length for listening socket */
62 int ss_rlwmark; /* receive low watermark on listening socket */
64 flag_t nosync_sbuf, /* do not alter source-socket's buffer size */
65 nosync_dbuf; /* do not alter dest-socket's buffer size */
67 char* srcfile; /* file to read (video stream) from */
68 char* dstfile; /* file to save (video stream) to */
70 char h200_ftr[2048]; /* text to add to HTTP 200 response */
74 #ifdef UDPXREC_MOD
75 /* udpxrec options
77 struct udpxrec_opt {
78 flag_t is_verbose; /* verbose output on/off */
79 int nice_incr; /* value to increment nice by */
81 time_t bg_time; /* time to start recording */
82 time_t end_time; /* time to end recording */
83 int64_t max_fsize; /* max size of dest file (in bytes) */
84 ssize_t bufsize; /* size of receiving socket buffer */
85 int rbuf_msgs; /* max number of messages to save
86 in buffer (-1 = as many as would fit) */
88 /* address of the multicast interface */
89 char mcast_addr[ IPADDR_STR_SIZE ];
90 char rec_channel[ IPADDR_STR_SIZE ];
91 int rec_port;
92 int waitupd_sec; /* update every N seconds while waiting
93 to start recording */
95 time_t rcv_tmout; /* receive (mcast) socket timeout */
96 time_t sr_tmout, /* server READ/RCV timeout (sec) */
97 sw_tmout; /* server WRITE/SND timeout (sec) */
99 flag_t nosync_sbuf, /* do not alter source-socket's buffer size */
100 nosync_dbuf; /* do not alter dest-socket's buffer size */
103 char* pidfile; /* file to store app's PID */
104 char* dstfile; /* file to save (video stream) to */
106 #endif /* UDPXREC_MOD */
108 #ifdef __cplusplus
109 extern "C" {
110 #endif
112 /* populate udpxy options with default/initial values
115 init_uopt( struct udpxy_opt* uo );
118 /* release udpxy resources allocated for udpxy options
120 void
121 free_uopt( struct udpxy_opt* uo );
124 #ifdef UDPXREC_MOD
125 /* populate udpxrec options with default/initial values
128 init_recopt( struct udpxrec_opt* ro );
131 /* release resources allocated for udpxy options
133 void
134 free_recopt( struct udpxrec_opt* ro );
136 /* print udpxrec options to stream
138 void
139 fprint_recopt( FILE* stream, struct udpxrec_opt* ro );
141 #endif /* UDPXREC_MOD */
143 /* set verbose output on
145 void
146 set_verbose( flag_t* verbose );
149 #ifdef __cplusplus
150 } /* extern "C" */
151 #endif
153 #endif /* UOPT_H_0215082300 */
155 /* __EOF__ */