transmission support almost ready
[p2p-testing-infrastructure.git] / ControlScripts / client_script_mappings
1 #!/bin/bash
2
3 #
4 # Configuration file for mapping client (string) identifiers to
5 # start/stop/detect scripts
6 #
7
8 DEBUG()
9 {
10         test ${_DEBUG} = "on" && $@
11 }
12
13 start_client()
14 {
15         local client_type=$1
16         local download_limit=$2
17         local upload_limit=$3
18         local connection_limit=$4
19
20         download_limit=$(($download_limit * 1024 / 8))
21         upload_limit=$(($upload_limit * 1024 / 8))
22
23         DEBUG echo "starting client ..."
24         case "${client_type}" in
25                 "hrktorrent_seeder")
26                         clients/hrk/start_hrk_seeder.sh &
27                         return $!
28                         ;;
29                 "hrktorrent_leecher")
30                         clients/hrk/start_hrk_leecher.sh &
31                         return $!
32                         ;;
33                 "hrktorrent_seeder_limit")
34                         clients/hrk/start_hrk_seeder_limit.sh ${download_limit} ${upload_limit} ${connection_limit} &
35                         return $!
36                         ;;
37                 "hrktorrent_leecher_limit")
38                         clients/hrk/start_hrk_leecher_limit.sh ${download_limit} ${upload_limit} ${connection_limit} &
39                         return $!
40                         ;;
41                 "transmission_seeder")
42                         clients/transmission/start_transmission_seeder.sh &
43                         return $!
44                         ;;
45                 "transmission_leecher")
46                         clients/transmission/start_transmission_leecher.sh &
47                         return $!
48                         ;;
49                 "tribler_seeder")
50                         clients/tribler/start_tribler_seeder.sh &
51                         return $!
52                         ;;
53                 "tribler_leecher")
54                         clients/tribler/start_tribler_leecher.sh &
55                         return $!
56                         ;;
57                 "tribler_doe")
58                         clients/tribler/start_tribler_doe.sh &
59                         return $!
60                         ;;
61                 "tribler_proxy_01")
62                         clients/tribler/start_tribler_proxy.sh 01 &
63                         return $!
64                         ;;
65                 "tribler_proxy_02")
66                         clients/tribler/start_tribler_proxy.sh 02 &
67                         return $!
68                         ;;
69                 "tribler_proxy_03")
70                         clients/tribler/start_tribler_proxy.sh 03 &
71                         return $!
72                         ;;
73                 "tribler_proxy_04")
74                         clients/tribler/start_tribler_proxy.sh 04 &
75                         return $!
76                         ;;
77                 "swift_seeder")
78                         clients/swift/start_swift_seeder.sh &
79                         return $!
80                         ;;
81                 "swift_leecher")
82                         clients/swift/start_swift_leecher.sh &
83                         return $!
84                         ;;
85                 "xbtut")
86                         clients/xbt-unified-tracker/start_xbtut.sh &
87                         return $!
88                         ;;
89         esac
90 }
91
92 stop_client()
93 {
94         local client_type=$1
95
96         DEBUG echo "stopping client ..."
97         case "${CLIENT_TYPE}" in
98                 "hrktorrent_seeder" | "hrktorrent_leecher" | "hrktorrent_seeder_limit" | "hrktorrent_leecher_limit")
99                         clients/hrk/stop_hrk.sh
100                         ;;
101                 "transmission_seeder" | "transmission_leecher")
102                         clients/transmission/stop_transmission.sh 
103                         ;;
104                 "tribler_seeder")
105                         clients/tribler/stop_tribler.sh
106                         ;;
107                 "tribler_leecher")
108                         clients/tribler/stop_tribler.sh
109                         ;;
110                 "tribler_doe")
111                         clients/tribler/stop_tribler.sh
112                         ;;
113                 "tribler_proxy_01")
114                         clients/tribler/stop_tribler.sh
115                         ;;
116                 "tribler_proxy_02")
117                         clients/tribler/stop_tribler.sh
118                         ;;
119                 "tribler_proxy_03")
120                         clients/tribler/stop_tribler.sh
121                         ;;
122                 "tribler_proxy_04")
123                         clients/tribler/stop_tribler.sh
124                         ;;
125                 "swift_seeder" | "swift_leecher")
126                         clients/swift/stop_swift.sh 
127                         ;;
128                 "xbtut")
129                         clients/xbt-unified-tracker/stop_xbtut.sh
130                         ;;
131         esac
132 }
133
134 detect_complete_client()
135 {
136         local client_type=$1
137         local log_file=$2
138
139         DEBUG echo "stopping client ..."
140         case "${client_type}" in
141                 "hrktorrent_seeder" | "hrktorrent_leecher" | "hrktorrent_seeder_limit" | "hrktorrent_leecher_limit")
142                         clients/hrk/detect_complete_hrk.sh ${log_file}
143                         ;;
144                 "transmission_seeder" | "transmission_leecher")
145                         clients/transmission/detect_complete_transmission.sh ${log_file}
146                         ;;
147                 "tribler_seeder")
148                         clients/tribler/detect_complete_tribler_seeder.sh ${log_file}
149                         ;;
150                 "tribler_leecher")
151                         clients/tribler/detect_complete_tribler_leecher.sh ${log_file}
152                         ;;
153                 "tribler_doe")
154                         clients/tribler/detect_complete_tribler_doe.sh ${log_file}
155                         ;;
156                 "tribler_proxy_01")
157                         clients/tribler/detect_complete_tribler_proxy.sh ${log_file}
158                         ;;
159                 "tribler_proxy_02")
160                         clients/tribler/detect_complete_tribler_proxy.sh ${log_file}
161                         ;;
162                 "tribler_proxy_03")
163                         clients/tribler/detect_complete_tribler_proxy.sh ${log_file}
164                         ;;
165                 "tribler_proxy_04")
166                         clients/tribler/detect_complete_tribler_proxy.sh ${log_file}
167                         ;;
168                 "swift_seeder" | "swift_leecher")
169                         clients/swift/detect_complete_swift.sh ${log_file}
170                         ;;
171         esac
172 }
173
174 parse_client_log()
175 {
176         local client_type=$1
177         local log_folder=$2
178         local log_file=$3
179
180         DEBUG echo "parsing client ${client_type} (${log_folder}/${log_file})..."
181         case "${client_type}" in
182                 "hrktorrent_seeder" | "hrktorrent_leecher" | "hrktorrent_seeder_limit" | "hrktorrent_leecher_limit")
183                         DEBUG echo "hello hrktorrent_seeder"
184                         clients/hrk/parse_hrk.sh ${log_folder} ${log_file}
185                         ;;
186                 "transmission_seeder" | "transmission_leecher")
187                         clients/swift/parse_swift.sh ${log_folder} ${log_file}
188                         ;;
189                 "tribler_seeder")
190                         clients/tribler/parse_tribler.sh ${log_folder} ${log_file}
191                         ;;
192                 "tribler_leecher")
193                         clients/tribler/parse_tribler.sh ${log_folder} ${log_file}
194                         ;;
195                 "tribler_doe")
196                         clients/tribler/parse_tribler.sh ${log_folder} ${log_file}
197                         ;;
198                 "tribler_proxy_01")
199                         clients/tribler/parse_tribler.sh ${log_folder} ${log_file}
200                         ;;
201                 "tribler_proxy_02")
202                         clients/tribler/parse_tribler.sh ${log_folder} ${log_file}
203                         ;;
204                 "tribler_proxy_03")
205                         clients/tribler/parse_tribler.sh ${log_folder} ${log_file}
206                         ;;
207                 "tribler_proxy_04")
208                         clients/tribler/parse_tribler.sh ${log_folder} ${log_file}
209                         ;;
210                 "swift_seeder" | "swift_leecher")
211                         clients/swift/parse_swift.sh ${log_folder} ${log_file}
212                         ;;
213         esac
214 }