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>
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);
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
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 rcv_lwmark
; /* 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 */
71 flag_t tcp_nodelay
; /* apply TCP_NODELAY option to
72 newly-accepted sockets */
73 char cnt_type
[80]; /* custom HTTP 200 content type */
81 flag_t is_verbose
; /* verbose output on/off */
82 int nice_incr
; /* value to increment nice by */
84 time_t bg_time
; /* time to start recording */
85 time_t end_time
; /* time to end recording */
86 int64_t max_fsize
; /* max size of dest file (in bytes) */
87 ssize_t bufsize
; /* size of receiving socket buffer */
88 int rbuf_msgs
; /* max number of messages to save
89 in buffer (-1 = as many as would fit) */
91 /* address of the multicast interface */
92 char mcast_addr
[ IPADDR_STR_SIZE
];
93 char rec_channel
[ IPADDR_STR_SIZE
];
95 int waitupd_sec
; /* update every N seconds while waiting
98 time_t rcv_tmout
; /* receive (mcast) socket timeout */
99 time_t sr_tmout
, /* server READ/RCV timeout (sec) */
100 sw_tmout
; /* server WRITE/SND timeout (sec) */
102 flag_t nosync_sbuf
, /* do not alter source-socket's buffer size */
103 nosync_dbuf
; /* do not alter dest-socket's buffer size */
106 char* pidfile
; /* file to store app's PID */
107 char* dstfile
; /* file to save (video stream) to */
109 #endif /* UDPXREC_MOD */
115 /* populate udpxy options with default/initial values
118 init_uopt( struct udpxy_opt
* uo
);
121 /* release udpxy resources allocated for udpxy options
124 free_uopt( struct udpxy_opt
* uo
);
128 /* populate udpxrec options with default/initial values
131 init_recopt( struct udpxrec_opt
* ro
);
134 /* release resources allocated for udpxy options
137 free_recopt( struct udpxrec_opt
* ro
);
139 /* print udpxrec options to stream
142 fprint_recopt( FILE* stream
, struct udpxrec_opt
* ro
);
144 #endif /* UDPXREC_MOD */
146 /* set verbose output on
149 set_verbose( flag_t
* verbose
);
156 #endif /* UOPT_H_0215082300 */