3 [ -z "$1" ] && { echo "Usage: <hex file from 'tsharkDecoder.sh'>" ; exit 1 ; }
4 [ ! -f "$1" ] && { echo "Cannot find '$1' !" ; exit 1 ; }
6 ENDPOINT=$(cat ../.httpServer 2>/dev/null)
7 [ -z "${ENDPOINT}" ] && ENDPOINT=localhost:8000
13 "diameterHex":"$(cat $1)"
16 responseField=$(curl -X POST -H 'Accept: application/json' -H 'Content-Type: application/json' -d@${tmpfile} http://${ENDPOINT}/decode 2>/dev/null | jq '.response')
18 [ -z "${responseField}" ] && { echo "Unexpected error. Check that ADML is started and the corresponding diameter dictionary is loaded." ; exit 1 ; }
20 # Remove surrounding quotes:
21 base64=$(echo ${responseField} | tr -d '"')
23 # Decode response (base64), which is xml:
24 echo ${base64} | base64 -d > ${1}.xml
25 echo "Created '${1}.xml'"
27 # Also create the json version:
28 diameterJsonHelper/xml2json.py ${1}.xml > ${1}.xml.json
29 echo "Created '${1}.xml.json'"