X-Git-Url: https://git.teslayout.com/public/public/public/?a=blobdiff_plain;f=example%2Fdiameter%2Flauncher%2Fresources%2Fadvanced%2FclientSocketManager.sh;fp=example%2Fdiameter%2Flauncher%2Fresources%2Fadvanced%2FclientSocketManager.sh;h=4c801b29d6a089dd6ab0d2b535702e26ad980b13;hb=2ddc4abd3627f5f5b4df32de199f364aa3844491;hp=0000000000000000000000000000000000000000;hpb=b5a7dd9cd05eb652f63e10a77dc26af49b9a6ff2;p=anna.git diff --git a/example/diameter/launcher/resources/advanced/clientSocketManager.sh b/example/diameter/launcher/resources/advanced/clientSocketManager.sh new file mode 100755 index 0000000..4c801b2 --- /dev/null +++ b/example/diameter/launcher/resources/advanced/clientSocketManager.sh @@ -0,0 +1,70 @@ +#!/bin/bash +> curl_log.txt +TRACE="--trace-ascii curl_log.txt" +SERVER=`cat .httpServer` +ENTITY=`cat .entity 2>/dev/null` +# If missing following, 1 is assigned (ENTITY_SS_1 is ENTITY_SS - 1) +ENTITY_SS=`cat .entityServerSessions 2>/dev/null` +[[ "$ENTITY_SS" = "" ]] && ENTITY_SS=1 +TARGET=$2 + +use () { + echo + echo + echo "Use: $0 \"[
:]|[socket id]\"" + echo + echo "Hides/shows/query hidden state/query shown state, the socket/s provided." + echo "If missing server (first parameter) all applications sockets will be affected by action." + echo "If missing socket (second parameter) for specific server, all its sockets will be affected by action." + echo + exit +} + +states () { + echo + echo "Select option to switch (0 = quit):" + echo + option=1 + for i in `echo $ENTITY | sed 's/,/ /g'` + do + for j in `seq 0 $ENTITY_SS_1` + do + TARGET="${i}|${j}" + RES=$(curl -m 1 --data "shown|$TARGET" ${SERVER} 2>&1 | tail -1 | grep "true$") + res=hidden + [[ "$RES" != "" ]] && res=shown + echo "${option}. $TARGET ($res)" + action=show + [[ "$RES" != "" ]] && action=hide + echo "curl -m 1 --data \"$action|$TARGET\" ${SERVER}" > .switch_${option} + chmod a+x .switch_${option} + option=$((option+1)) + done + done + echo +} + +if test "$ENTITY" != "" +then + ENTITY_SS_1=$((ENTITY_SS-1)) + while true + do + states + read option + [[ "$option" = "0" ]] && break + .switch_${option} + done + echo + echo "Exiting" + rm .switch_* + exit +else + [[ "$1" = "" ]] && use +fi + +echo +echo +operation="$1|$TARGET" +[[ "$TARGET" = "" ]] && operation="$1" +curl -m 1 --data "$operation" $TRACE ${SERVER} +