OLD | NEW |
(Empty) | |
| 1 #!/bin/sh |
| 2 # |
| 3 # usage: rtpw_test <rtpw_commands> |
| 4 # |
| 5 # tests the rtpw sender and receiver functions |
| 6 # |
| 7 # Copyright (c) 2001-2006, Cisco Systems, Inc. |
| 8 # All rights reserved. |
| 9 # |
| 10 # Redistribution and use in source and binary forms, with or without |
| 11 # modification, are permitted provided that the following conditions |
| 12 # are met: |
| 13 # |
| 14 # Redistributions of source code must retain the above copyright |
| 15 # notice, this list of conditions and the following disclaimer. |
| 16 # |
| 17 # Redistributions in binary form must reproduce the above |
| 18 # copyright notice, this list of conditions and the following |
| 19 # disclaimer in the documentation and/or other materials provided |
| 20 # with the distribution. |
| 21 # |
| 22 # Neither the name of the Cisco Systems, Inc. nor the names of its |
| 23 # contributors may be used to endorse or promote products derived |
| 24 # from this software without specific prior written permission. |
| 25 # |
| 26 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 27 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 28 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
| 29 # FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
| 30 # COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, |
| 31 # INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
| 32 # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
| 33 # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
| 34 # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, |
| 35 # STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
| 36 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 37 # OF THE POSSIBILITY OF SUCH DAMAGE. |
| 38 # |
| 39 |
| 40 RTPW=./rtpw |
| 41 DEST_PORT=9999 |
| 42 DURATION=3 |
| 43 |
| 44 # First, we run "killall" to get rid of all existing rtpw processes. |
| 45 # This step also enables this script to clean up after itself; if this |
| 46 # script is interrupted after the rtpw processes are started but before |
| 47 # they are killed, those processes will linger. Re-running the script |
| 48 # will get rid of them. |
| 49 |
| 50 killall rtpw 2>/dev/null |
| 51 |
| 52 if test -x $RTPW; then |
| 53 |
| 54 GCMARGS128="-k 01234567890123456789012345678901234567890123456789012345 -g -e 12
8" |
| 55 echo $0 ": starting GCM mode 128-bit rtpw receiver process... " |
| 56 |
| 57 exec $RTPW $* $GCMARGS128 -r 127.0.0.1 $DEST_PORT & |
| 58 |
| 59 receiver_pid=$! |
| 60 |
| 61 echo $0 ": receiver PID = $receiver_pid" |
| 62 |
| 63 sleep 1 |
| 64 |
| 65 # verify that the background job is running |
| 66 ps | grep -q $receiver_pid |
| 67 retval=$? |
| 68 echo $retval |
| 69 if [ $retval != 0 ]; then |
| 70 echo $0 ": error" |
| 71 exit 254 |
| 72 fi |
| 73 |
| 74 echo $0 ": starting GCM 128-bit rtpw sender process..." |
| 75 |
| 76 exec $RTPW $* $GCMARGS128 -s 127.0.0.1 $DEST_PORT & |
| 77 |
| 78 sender_pid=$! |
| 79 |
| 80 echo $0 ": sender PID = $sender_pid" |
| 81 |
| 82 # verify that the background job is running |
| 83 ps | grep -q $sender_pid |
| 84 retval=$? |
| 85 echo $retval |
| 86 if [ $retval != 0 ]; then |
| 87 echo $0 ": error" |
| 88 exit 255 |
| 89 fi |
| 90 |
| 91 sleep $DURATION |
| 92 |
| 93 kill $receiver_pid |
| 94 kill $sender_pid |
| 95 |
| 96 GCMARGS128="-k 01234567890123456789012345678901234567890123456789012345 -g -t 16
-e 128" |
| 97 echo $0 ": starting GCM mode 128-bit (16 byte tag) rtpw receiver process... " |
| 98 |
| 99 exec $RTPW $* $GCMARGS128 -r 127.0.0.1 $DEST_PORT & |
| 100 |
| 101 receiver_pid=$! |
| 102 |
| 103 echo $0 ": receiver PID = $receiver_pid" |
| 104 |
| 105 sleep 1 |
| 106 |
| 107 # verify that the background job is running |
| 108 ps | grep -q $receiver_pid |
| 109 retval=$? |
| 110 echo $retval |
| 111 if [ $retval != 0 ]; then |
| 112 echo $0 ": error" |
| 113 exit 254 |
| 114 fi |
| 115 |
| 116 echo $0 ": starting GCM 128-bit (16 byte tag) rtpw sender process..." |
| 117 |
| 118 exec $RTPW $* $GCMARGS128 -s 127.0.0.1 $DEST_PORT & |
| 119 |
| 120 sender_pid=$! |
| 121 |
| 122 echo $0 ": sender PID = $sender_pid" |
| 123 |
| 124 # verify that the background job is running |
| 125 ps | grep -q $sender_pid |
| 126 retval=$? |
| 127 echo $retval |
| 128 if [ $retval != 0 ]; then |
| 129 echo $0 ": error" |
| 130 exit 255 |
| 131 fi |
| 132 |
| 133 sleep $DURATION |
| 134 |
| 135 kill $receiver_pid |
| 136 kill $sender_pid |
| 137 |
| 138 |
| 139 |
| 140 GCMARGS256="-k 01234567890123456789012345678901234567890123456789012345678901234
56789012345678901234567 -g -e 256" |
| 141 echo $0 ": starting GCM mode 256-bit rtpw receiver process... " |
| 142 |
| 143 exec $RTPW $* $GCMARGS256 -r 127.0.0.1 $DEST_PORT & |
| 144 |
| 145 receiver_pid=$! |
| 146 |
| 147 echo $0 ": receiver PID = $receiver_pid" |
| 148 |
| 149 sleep 1 |
| 150 |
| 151 # verify that the background job is running |
| 152 ps | grep -q $receiver_pid |
| 153 retval=$? |
| 154 echo $retval |
| 155 if [ $retval != 0 ]; then |
| 156 echo $0 ": error" |
| 157 exit 254 |
| 158 fi |
| 159 |
| 160 echo $0 ": starting GCM 256-bit rtpw sender process..." |
| 161 |
| 162 exec $RTPW $* $GCMARGS256 -s 127.0.0.1 $DEST_PORT & |
| 163 |
| 164 sender_pid=$! |
| 165 |
| 166 echo $0 ": sender PID = $sender_pid" |
| 167 |
| 168 # verify that the background job is running |
| 169 ps | grep -q $sender_pid |
| 170 retval=$? |
| 171 echo $retval |
| 172 if [ $retval != 0 ]; then |
| 173 echo $0 ": error" |
| 174 exit 255 |
| 175 fi |
| 176 |
| 177 sleep $DURATION |
| 178 |
| 179 kill $receiver_pid |
| 180 kill $sender_pid |
| 181 |
| 182 |
| 183 GCMARGS256="-k a1234567890123456789012345678901234567890123456789012345678901234
56789012345678901234567 -g -t 16 -e 256" |
| 184 echo $0 ": starting GCM mode 256-bit (16 byte tag) rtpw receiver process... " |
| 185 |
| 186 exec $RTPW $* $GCMARGS256 -r 127.0.0.1 $DEST_PORT & |
| 187 |
| 188 receiver_pid=$! |
| 189 |
| 190 echo $0 ": receiver PID = $receiver_pid" |
| 191 |
| 192 sleep 1 |
| 193 |
| 194 # verify that the background job is running |
| 195 ps | grep -q $receiver_pid |
| 196 retval=$? |
| 197 echo $retval |
| 198 if [ $retval != 0 ]; then |
| 199 echo $0 ": error" |
| 200 exit 254 |
| 201 fi |
| 202 |
| 203 echo $0 ": starting GCM 256-bit (16 byte tag) rtpw sender process..." |
| 204 |
| 205 exec $RTPW $* $GCMARGS256 -s 127.0.0.1 $DEST_PORT & |
| 206 |
| 207 sender_pid=$! |
| 208 |
| 209 echo $0 ": sender PID = $sender_pid" |
| 210 |
| 211 # verify that the background job is running |
| 212 ps | grep -q $sender_pid |
| 213 retval=$? |
| 214 echo $retval |
| 215 if [ $retval != 0 ]; then |
| 216 echo $0 ": error" |
| 217 exit 255 |
| 218 fi |
| 219 |
| 220 sleep $DURATION |
| 221 |
| 222 kill $receiver_pid |
| 223 kill $sender_pid |
| 224 |
| 225 |
| 226 echo $0 ": done (test passed)" |
| 227 |
| 228 else |
| 229 |
| 230 echo "error: can't find executable" $RTPW |
| 231 exit 1 |
| 232 |
| 233 fi |
| 234 |
| 235 # EOF |
| 236 |
| 237 |
OLD | NEW |