diff options
author | Holger Hans Peter Freyther <zecke@selfish.org> | 2011-08-28 14:42:21 +0200 |
---|---|---|
committer | Holger Hans Peter Freyther <zecke@selfish.org> | 2011-08-30 15:04:15 +0200 |
commit | 91eb1fa1829119f14ebb50928fed562ee11161a1 (patch) | |
tree | 8e999c289d170c248d7dee73208ba57de669e727 /openbsc | |
parent | 3b9a067e9d5e88a2a46bcd310c8057a976266fb9 (diff) |
gprs: Add lua script to count size of packets
Diffstat (limited to 'openbsc')
-rw-r--r-- | openbsc/contrib/gprs/gprs-size-count.lua | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/openbsc/contrib/gprs/gprs-size-count.lua b/openbsc/contrib/gprs/gprs-size-count.lua new file mode 100644 index 000000000..c07571fbf --- /dev/null +++ b/openbsc/contrib/gprs/gprs-size-count.lua @@ -0,0 +1,42 @@ +-- I count the buffer space needed for LLC PDUs in the worse case and print it + +do + local function init_listener() + -- handle the port as NS over IP + local udp_port_table = DissectorTable.get("udp.port") + local gprs_ns_dis = Dissector.get("gprs_ns") + udp_port_table:add(23000,gprs_ns_dis) + + -- bssgp filters + local bssgp_pdu_get = Field.new("bssgp.pdu_type") + local udp_get = Field.new("ip.len") + local racap_get = Field.new("gsm_a_gm.elem_id") + local packets = 0 + local org_bytes = 0 + + local tap = Listener.new("ip", "udp.port == 23000") + function tap.packet(pinfo,tvb,ip) + local pdu = bssgp_pdu_get() + local racap = racap_get() + org_bytes = org_bytes + tonumber(tostring(udp_get())) + packets = packets + 1 + end + + function tap.draw() + -- well... this will not be called... +-- for ip,bssgp_histo in pairs(dumpers) do +-- print("IP " .. ip) +-- end + print("Packets: " .. packets .. + " bytes: " .. org_bytes / 1024.0 .. + " cap: " .. (org_bytes - (2580*18)) / 1024.0) + print("END") + end + + function tap.reset() + -- well... this will not be called... + end + end + + init_listener() +end |