-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmanyclient_tbff
executable file
·218 lines (206 loc) · 6.6 KB
/
manyclient_tbff
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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
#!/bin/bash
BASE_DIR=/root/alien-ofelia-conet-ccnx
RANGE_S=3
SERVER[0]=192.168.64.1
SERVER[1]=192.168.64.2
SERVER[2]=192.168.64.3
PORT=9699
RANGE=20
NID[0]=ccn:/example1/mb1_0
NID[1]=ccn:/example1/mb1_1
NID[2]=ccn:/example1/mb1_2
NID[3]=ccn:/example1/mb1_3
NID[4]=ccn:/example1/mb1_4
NID[5]=ccn:/example1/mb1_5
NID[6]=ccn:/example1/mb1_6
NID[7]=ccn:/example1/mb1_7
NID[8]=ccn:/example1/mb1_8
NID[9]=ccn:/example1/mb1_9
NID[10]=ccn:/example1/mb1_10
NID[11]=ccn:/example1/mb1_11
NID[12]=ccn:/example1/mb1_12
NID[13]=ccn:/example1/mb1_13
NID[14]=ccn:/example1/mb1_14
NID[15]=ccn:/example1/mb1_15
NID[16]=ccn:/example1/mb1_16
NID[17]=ccn:/example1/mb1_17
NID[18]=ccn:/example1/mb1_18
NID[19]=ccn:/example1/mb1_19
NID[20]=ccn:/example2/mb2_0
NID[21]=ccn:/example2/mb2_1
NID[22]=ccn:/example2/mb2_2
NID[23]=ccn:/example2/mb2_3
NID[24]=ccn:/example2/mb2_4
NID[25]=ccn:/example2/mb2_5
NID[26]=ccn:/example2/mb2_6
NID[27]=ccn:/example2/mb2_7
NID[28]=ccn:/example2/mb2_8
NID[29]=ccn:/example2/mb2_9
NID[30]=ccn:/example2/mb2_10
NID[31]=ccn:/example2/mb2_11
NID[32]=ccn:/example2/mb2_12
NID[33]=ccn:/example2/mb2_13
NID[34]=ccn:/example2/mb2_14
NID[35]=ccn:/example2/mb2_15
NID[36]=ccn:/example2/mb2_16
NID[37]=ccn:/example2/mb2_17
NID[38]=ccn:/example2/mb2_18
NID[39]=ccn:/example2/mb2_19
NID[40]=ccn:/example3/mb3_0
NID[41]=ccn:/example3/mb3_1
NID[42]=ccn:/example3/mb3_2
NID[43]=ccn:/example3/mb3_3
NID[44]=ccn:/example3/mb3_4
NID[45]=ccn:/example3/mb3_5
NID[46]=ccn:/example3/mb3_6
NID[47]=ccn:/example3/mb3_7
NID[48]=ccn:/example3/mb3_8
NID[49]=ccn:/example3/mb3_9
NID[50]=ccn:/example3/mb3_10
NID[51]=ccn:/example3/mb3_11
NID[52]=ccn:/example3/mb3_12
NID[53]=ccn:/example3/mb3_13
NID[54]=ccn:/example3/mb3_14
NID[55]=ccn:/example3/mb3_15
NID[56]=ccn:/example3/mb3_16
NID[57]=ccn:/example3/mb3_17
NID[58]=ccn:/example3/mb3_18
NID[59]=ccn:/example3/mb3_19
NID_CCNX[0]=ccn:/example1
NID_CCNX[1]=ccn:/example2
NID_CCNX[2]=ccn:/example3
TIME=10
while [ $# -gt 0 ]; do
if [ "$1" = "-s" ]; then
if [ $# -lt 2 ]; then
usage
fi
SERVER=$2
shift 2
elif [ "$1" = "-nx" ]; then
if [ $# -lt 2 ]; then
usage
fi
NID_CCNX=$2
shift 2
elif [ "$1" = "-p" ]; then
if [ $# -lt 2 ]; then
usage
fi
PORT=$2
shift 2
elif [ "$1" = "-t" ]; then
if [ $# -lt 2 ]; then
usage
fi
TIME=$2
shift 2
elif [ "$1" = "-n" ]; then
if [ $# -lt 2 ]; then
usage
fi
NID=$2
shift 2
else
break
fi
done
kill $(pidof ccnd) > /dev/null 2>&1
i="0"
j="0"
#while [ "$i" -lt "15" ]; do
while [ 1 ]; do
if [ "$(pidof ccnd)" ];then
echo "Old CCND pid: $(pidof ccnd)"
# sudo kill $(pidof ccnd)
# fi
else #
$BASE_DIR/csrc/ccnd/ccnd 1 1 0 0 0 > /dev/null 2>&1 &
echo "Attendo avvio di ccnd "
sleep $TIME
echo "New CCND pid: $(pidof ccnd)"
fi #
# number=$RANDOM
# let "number %= $RANGE"
# if [ "$i" -eq "15" ];then
# j=$[$j+1]
# fi
echo ${SERVER[($j % $RANGE_S)]}
echo ${NID_CCNX[($j % $RANGE_S)]}
echo "$BASE_DIR/csrc/libexec/ccndc add ${NID_CCNX[($j % $RANGE_S)]} udp ${SERVER[($j % $RANGE_S)]} $PORT"
echo "$BASE_DIR/csrc/libexec/ccndc add ccnx:/ udp ${SERVER[($j % $RANGE_S)]}"
echo "$j"
$BASE_DIR/csrc/libexec/ccndc add ${NID_CCNX[($j % $RANGE_S)]} udp ${SERVER[($j % $RANGE_S)]} $PORT
$BASE_DIR/csrc/libexec/ccndc add ccnx:/ udp ${SERVER[($j % $RANGE_S)]}
# $BASE_DIR/csrc/cmd/ccncatchunks2 -d -p 20 -s ${NID[$number]} &
echo ${NID[($i % $RANGE)]}
echo "$BASE_DIR/csrc/cmd/ccncatchunks2 -d -p 20 -s ${NID[($i % $RANGE)]} &"
$BASE_DIR/csrc/cmd/ccncatchunks2 -d -p 20 -s ${NID[($i % $RANGE)]} &
sleep $TIME
if [ "$(pidof ccncatchunks2)" ];then
kill $(pidof ccnd) > /dev/null 2>&1
kill $(pidof ccncatchunks2) > /dev/null 2>&1
echo "((((((((((((((((( sveglia!!! )))))))))))))))))))"
fi
echo "@@@@ risveglio @@@@"
j=$[$j+1]
if [ "$(pidof ccnd)" ];then
echo "Old CCND pid: $(pidof ccnd)"
# sudo kill $(pidof ccnd)
# fi
else #
$BASE_DIR/csrc/ccnd/ccnd 1 1 0 0 0 > /dev/null 2>&1 &
echo "Attendo avvio di ccnd "
sleep $TIME
echo "New CCND pid: $(pidof ccnd)"
fi #
echo ${SERVER[($j % $RANGE_S)]}
echo ${NID_CCNX[($j % $RANGE_S)]}
echo "$BASE_DIR/csrc/libexec/ccndc add ${NID_CCNX[($j % $RANGE_S)]} udp ${SERVER[($j % $RANGE_S)]} $PORT"
echo "$BASE_DIR/csrc/libexec/ccndc add ccnx:/ udp ${SERVER[($j % $RANGE_S)]}"
echo "$j"
$BASE_DIR/csrc/libexec/ccndc add ${NID_CCNX[($j % $RANGE_S)]} udp ${SERVER[($j % $RANGE_S)]} $PORT
$BASE_DIR/csrc/libexec/ccndc add ccnx:/ udp ${SERVER[($j % $RANGE_S)]}
# $BASE_DIR/csrc/cmd/ccncatchunks2 -d -p 20 -s ${NID[$number]} &
echo ${NID[(($i % $RANGE)+20)]}
echo "$BASE_DIR/csrc/cmd/ccncatchunks2 -d -p 20 -s ${NID[(($i % $RANGE)+20)]} &"
$BASE_DIR/csrc/cmd/ccncatchunks2 -d -p 20 -s ${NID[(($i % $RANGE)+20)]} &
sleep $TIME
if [ "$(pidof ccncatchunks2)" ];then
kill $(pidof ccnd) > /dev/null 2>&1
kill $(pidof ccncatchunks2) > /dev/null 2>&1
echo "((((((((((((((((( sveglia!!! )))))))))))))))))))"
fi
echo "@@@@ risveglio @@@@"
j=$[$j+1]
if [ "$(pidof ccnd)" ];then
echo "Old CCND pid: $(pidof ccnd)"
# sudo kill $(pidof ccnd)
# fi
else #
$BASE_DIR/csrc/ccnd/ccnd 1 1 0 0 0 > /dev/null 2>&1 &
echo "Attendo avvio di ccnd "
sleep $TIME
echo "New CCND pid: $(pidof ccnd)"
fi #
echo ${SERVER[($j % $RANGE_S)]}
echo ${NID_CCNX[($j % $RANGE_S)]}
echo "$BASE_DIR/csrc/libexec/ccndc add ${NID_CCNX[($j % $RANGE_S)]} udp ${SERVER[($j % $RANGE_S)]} $PORT"
echo "$BASE_DIR/csrc/libexec/ccndc add ccnx:/ udp ${SERVER[($j % $RANGE_S)]}"
echo "$j"
$BASE_DIR/csrc/libexec/ccndc add ${NID_CCNX[($j % $RANGE_S)]} udp ${SERVER[($j % $RANGE_S)]} $PORT
$BASE_DIR/csrc/libexec/ccndc add ccnx:/ udp ${SERVER[($j % $RANGE_S)]}
# $BASE_DIR/csrc/cmd/ccncatchunks2 -d -p 20 -s ${NID[$number]} &
echo ${NID[(($i % $RANGE)+40)]}
echo "$BASE_DIR/csrc/cmd/ccncatchunks2 -d -p 20 -s ${NID[(($i % $RANGE)+40)]} &"
$BASE_DIR/csrc/cmd/ccncatchunks2 -d -p 20 -s ${NID[(($i % $RANGE)+40)]} &
sleep $TIME
if [ "$(pidof ccncatchunks2)" ];then
kill $(pidof ccnd) > /dev/null 2>&1
kill $(pidof ccncatchunks2) > /dev/null 2>&1
echo "((((((((((((((((( sveglia!!! )))))))))))))))))))"
fi
echo "@@@@ risveglio @@@@"
i=$[$i+1]
j=$[$j+1]
done