-
Notifications
You must be signed in to change notification settings - Fork 7
/
udpcast.h
135 lines (100 loc) · 3.33 KB
/
udpcast.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
#ifndef UDPCAST_H
#define UDPCAST_H
#ifdef __GNUC__
#define UNUSED __attribute__((unused))
#endif
#include "socklib.h"
#include <sys/time.h>
#include <stdio.h>
#define BITS_PER_INT (sizeof(int) * 8)
#define BITS_PER_CHAR 8
#define MAP_ZERO(l, map) (memset(map, 0, ((l) + BITS_PER_INT - 1)/ BIT_PER_INT))
#define BZERO(data) (memset((void *)&data, 0, sizeof(data)))
#define RDATABUFSIZE (2*(MAX_SLICE_SIZE + 1)* MAX_BLOCK_SIZE)
#define DATABUFSIZE (RDATABUFSIZE + 4096 - RDATABUFSIZE % 4096)
int udpc_writeSize(void);
int udpc_largeReadSize(void);
int udpc_smallReadSize(void);
int udpc_makeDataBuffer(int blocksize);
int udpc_parseCommand(char *pipeName, char **arg);
int udpc_printLongNum(unsigned long long x);
int udpc_waitForProcess(int pid, const char *message);
struct disk_config {
int origOutFile;
const char *fileName;
char *pipeName;
int flags;
struct timeval stats_last_printed;
};
#define MAX_GOVERNORS 10
struct net_config {
net_if_t *net_if; /* Network interface (eth0, isdn0, etc.) on which to
* multicast */
int portBase; /* Port base */
int blockSize;
int sliceSize;
struct sockaddr_in controlMcastAddr;
struct sockaddr_in dataMcastAddr;
const char *mcastRdv;
int ttl;
int nrGovernors;
struct rateGovernor_t *rateGovernor[MAX_GOVERNORS];
void *rateGovernorData[MAX_GOVERNORS];
/*int async;*/
/*int pointopoint;*/
struct timeval ref_tv;
enum discovery {
DSC_DOUBLING,
DSC_REDUCING
} discovery;
/* int autoRate; do queue watching using TIOCOUTQ, to avoid overruns */
int flags; /* non-capability command line flags */
int capabilities;
int min_slice_size;
int default_slice_size;
int max_slice_size;
unsigned int rcvbuf;
int rexmit_hello_interval; /* retransmission interval between hello's.
* If 0, hello message won't be retransmitted
*/
int autostart; /* autostart after that many retransmits */
int requestedBufSize; /* requested receiver buffer */
/* sender-specific parameters */
int min_receivers;
int max_receivers_wait;
int min_receivers_wait;
int retriesUntilDrop;
/* receiver-specif parameters */
int exitWait; /* How many milliseconds to wait on program exit */
int startTimeout; /* Timeout at start */
int receiveTimeout; /* Receive timeout */
/* FEC config */
#ifdef BB_FEATURE_UDPCAST_FEC
int fec_redundancy; /* how much fec blocks are added per group */
int fec_stripesize; /* size of FEC group */
int fec_stripes; /* number of FEC stripes per slice */
#endif
int rehelloOffset; /* how far before end will rehello packet will
be retransmitted */
};
struct stat_config {
FILE *log; /* Log file for statistics */
long bwPeriod; /* How often are bandwidth estimations logged? */
int statPeriod;
int printUncompressedPos;
int noProgress;
};
void *rgInitGovernor(struct net_config *cfg, struct rateGovernor_t *gov);
void rgParseRateGovernor(struct net_config *net_config, char *rg);
void rgWaitAll(struct net_config *cfg, int sock, in_addr_t ip, int size);
void rgShutdownAll(struct net_config *cfg);
/**
* Answers whether given fd is seekable
*/
int udpc_shouldPrintUncompressedPos(int deflt, int fd, int pipe);
#define MAX_SLICE_SIZE 1024
#define DEFLT_STAT_PERIOD 500000
#ifndef DEBUG
# define DEBUG 0
#endif
#endif