-----------------------------------------
+-------------------------------------------------------------------------------------
-- script-name: e2ap.lua
-----------------------------------------
+-- This script is a plugin to dissect packets that are exchanged over E2AP interface
+-------------------------------------------------------------------------------------
----------------------------------------
-- creates a Proto object, but doesn't register it yet
[1] = "successfulOutcome",
[2] = "unsuccessfulOutcome" }
-local ProcedureCodeE2 = {
+local E2ProcedureCode = {
[1] = "ProcedureCodeE2_id_E2setup",
[2] = "ProcedureCodeE2_id_ErrorIndicationE2",
[3] = "ProcedureCodeE2_id_Reset",
[8] = "ProcedureCodeE2_id_RICsubscription",
[9] = "ProcedureCodeE2_id_RICsubscriptionDelete" }
-local CriticalityE2 ={
+local E2Criticality ={
[0] = "CriticalityE2_reject",
[1] = "CriticalityE2_ignore",
[2] = "CriticalityE2_notify" }
-local InitiatingMessageE2ValuePrEnum = {
+local E2InitiatingMessagePresenceEnum = {
[0] = "InitiatingMessageE2__value_PR_NOTHING",
[1] = "InitiatingMessageE2__value_PR_RICsubscriptionRequest",
[2] = "InitiatingMessageE2__value_PR_RICsubscriptionDeleteRequest",
local RIC_indication = "Ric Indication Message"
local Initiating_Message_Type_Value = {
- value = "value"--, nil,InitiatingMessageE2ValuePrEnum, 0xFF)
+ value = "value"--, nil,E2InitiatingMessagePresenceEnum, 0xFF)
}
local InitiatingMessageE2 = {
local InitiatingMessageE2__value_u = {
RICsubscriptionRequest = "RIC subscription Request",
-RICsubscriptionDeleteRequest = "RIC subscription Delete Request",
-RICserviceUpdate = "RIC service Update",
-RICcontrolRequest = "RIC control Request",
-E2setupRequest = "E2 setup Request",
-ResetRequest = "Reset Request",
-RICindication = "RIC indication",
-RICserviceQuery = "RIC service Query",
-ErrorIndicationE2 = "Error Indication E2"
+RICsubscriptionDeleteRequest = "RIC subscription Delete Request",
+RICserviceUpdate = "RIC service Update",
+RICcontrolRequest = "RIC control Request",
+E2setupRequest = "E2 setup Request",
+ResetRequest = "Reset Request",
+RICindication = "RIC indication",
+RICserviceQuery = "RIC service Query",
+ErrorIndicationE2 = "Error Indication E2"
}
local successfulOutcomeE2 = {
procedureCode = "procedureCode: ",
criticality = "criticality: ",
valueLen = "Value Length: ",
- value = "Value"
+ value = "value"
}
local e2SetupResponse = "E2SetupResponse"
local result = bit.bor(fbyte1, sbyte)
return result
end
-function addE2apInitiatingMessageToTree(tvbuf, tree, offset, endianness)
+function addE2apInitiatingMessageToTree(tvbuf, pktinfo, tree, offset, endianness)
local info = tvbuf:range(offset, 1)
local initiatingMessageE2Tree = tree:add(info, InitiatingMessageE2.Initiating_Message_E2)
local procId = tvbuf:range(offset,1):le_uint()
- strId = tostring(ProcedureCodeE2[procId]) .. " (" .. tostring(procId) ..")"
+ strId = tostring(E2ProcedureCode[procId]) .. " (" .. tostring(procId) ..")"
tree:add(tvbuf:range(offset,1), InitiatingMessageE2.procedureCode .. strId)
offset = offset + 1
local criticalityId = tvbuf:range(offset,1):le_uint()
- strId = tostring(CriticalityE2[criticalityId]) .. " (" .. tostring(criticalityId) ..")"
+ strId = tostring(E2Criticality[criticalityId]) .. " (" .. tostring(criticalityId) ..")"
tree:add(tvbuf:range(offset,1), InitiatingMessageE2.criticality .. strId)
offset = offset + 1
function addGobalRICIdToTree(tvbuf, valueTree, offset, valueLen, endianness)
end
-function addE2SetupResponseToTree(tvbuf, valueTree, offset, pktlen, endianness)
+function addE2SetupResponseToTree(tvbuf, pktinfo, valueTree, offset, pktlen, endianness)
+ pktinfo.cols.info:set("E2 Setup Response")
+
local e2SetupResponseTree = valueTree:add(tvbuf:range(offset, pktlen), e2SetupResponse)
- local extBit = tvbuf:range(offset,1):le_uint()
- if(extBit == 0) then
- e2SetupResponseTree:add(tvbuf:range(offset,1), "<" .. extBit .. "... .... Extension Bit: FALSE>")
- else
- e2SetupResponseTree:add(tvbuf:range(offset,1), "<" .. extBit .. "... .... Extension Bit: TRUE>")
- end
- offset = offset + 1
+-- local extBit = tvbuf:range(offset,1):le_uint()
+-- if(extBit == 0) then
+-- e2SetupResponseTree:add(tvbuf:range(offset,1), "<" .. extBit .. "... .... Extension Bit: FALSE>")
+-- else
+-- e2SetupResponseTree:add(tvbuf:range(offset,1), "<" .. extBit .. "... .... Extension Bit: TRUE>")
+-- end
+ offset = offset + 1
- local seqLen = fetch2Bytes(tvbuf, offset)
- e2SetupResponseTree:add(tvbuf:range(offset, 2), "<Sequence-Of Length: " .. seqLen .. ">")
- local protoIeTree = e2SetupResponseTree:add(tvbuf:range(offset, 2), protocolIE .. seqLen .. " items")
- offset = offset + 2
+ local seqLen = fetch2Bytes(tvbuf, offset)
+-- e2SetupResponseTree:add(tvbuf:range(offset, 2), "<Sequence-Of Length: " .. seqLen .. ">")
+ local protoIeTree = e2SetupResponseTree:add(tvbuf:range(offset, 2), protocolIE .. seqLen .. " items")
+ offset = offset + 2
- for ie=0, seqLen-1, 1
- do
- local protocolIEId = fetch2Bytes(tvbuf, offset)
- strId = tostring(E2PotocolIEs[protocolIEId])
- local itemTree = protoIeTree:add(protocolItem .. ie .. ": " .. strId)
+ for ie=0, seqLen-1, 1
+ do
+ local protocolIEId = fetch2Bytes(tvbuf, offset)
+ strId = tostring(E2PotocolIEs[protocolIEId])
+ local itemTree = protoIeTree:add(protocolItem .. ie .. ": " .. strId)
+
+ strId = strId .. " (" .. tostring(protocolIEId) ..")"
+ local protocolFieldTree = itemTree:add(tvbuf:range(offset,2), protocolIEField.protocolIEFieldMsg)
+ protocolFieldTree:add(protocolIEField.id .. strId)
+ offset = offset + 2
- strId = strId .. " (" .. tostring(protocolIEId) ..")"
- local protocolFieldTree = itemTree:add(tvbuf:range(offset,2), protocolIEField.protocolIEFieldMsg)
- protocolFieldTree:add(protocolIEField.id .. strId)
- offset = offset + 2
-
- local criticalityId = tvbuf:range(offset,1):le_uint()
- protocolFieldTree:add(tvbuf:range(offset,1), "<Enumerated Index: " .. criticalityId ..">")
- strId = tostring(CriticalityE2[criticalityId]) .. " (" .. tostring(criticalityId) ..")"
- protocolFieldTree:add(tvbuf:range(offset,1), protocolIEField.criticality .. strId)
- offset = offset + 1
-
- local valueLen = tvbuf:range(offset,1):le_uint()
- protocolFieldTree:add(tvbuf:range(offset,1), "<" .. protocolIEField.valueLen .. valueLen ..">")
- offset = offset + 1
-
- local valueTree = protocolFieldTree:add(tvbuf:range(offset, valueLen), protocolIEField.value)
-
- if(protocolIEId == 4) then
- addGobalRICIdToTree(tvbuf, valueTree, offset, valueLen, endianness)
- end
- end
-end
-
-function addE2apSuccessfulOutcomeToTree(tvbuf, tree, offset, pktlen, endianness)
- local successfulOutcomeTree = tree:add(tvbuf:range(offset, (pktlen-offset)), successfulOutcomeE2.successOutcomeMsg)
- local procId = tvbuf:range(offset,1):le_uint()
- strId = tostring(ProcedureCodeE2[procId]) .. " (" .. tostring(procId) ..")"
- successfulOutcomeTree:add(tvbuf:range(offset,1), successfulOutcomeE2.procedureCode .. strId)
- offset = offset + 1
-
local criticalityId = tvbuf:range(offset,1):le_uint()
- successfulOutcomeTree:add(tvbuf:range(offset,1), "<Enumerated Index: " .. criticalityId ..">")
- strId = tostring(CriticalityE2[criticalityId]) .. " (" .. tostring(criticalityId) ..")"
- successfulOutcomeTree:add(tvbuf:range(offset,1), successfulOutcomeE2.criticality .. strId)
- offset = offset + 1
+-- protocolFieldTree:add(tvbuf:range(offset,1), "<Enumerated Index: " .. criticalityId ..">")
+ strId = tostring(E2Criticality[criticalityId]) .. " (" .. tostring(criticalityId) ..")"
+ protocolFieldTree:add(tvbuf:range(offset,1), protocolIEField.criticality .. strId)
+ offset = offset + 1
local valueLen = tvbuf:range(offset,1):le_uint()
- successfulOutcomeTree:add(tvbuf:range(offset,1), "<" .. successfulOutcomeE2.valueLen .. valueLen ..">")
+-- protocolFieldTree:add(tvbuf:range(offset,1), "<" .. protocolIEField.valueLen .. valueLen ..">")
offset = offset + 1
- local valueTree = successfulOutcomeTree:add(tvbuf:range(offset, valueLen), successfulOutcomeE2.value)
+ local valueTree = protocolFieldTree:add(tvbuf:range(offset, valueLen), protocolIEField.value)
- if(procId == 1) then
- addE2SetupResponseToTree(tvbuf, valueTree, offset, valueLen, endianness)
+ if(protocolIEId == 4) then
+ addGobalRICIdToTree(tvbuf, valueTree, offset, valueLen, endianness)
end
+ end
+end
+
+function addE2apSuccessfulOutcomeToTree(tvbuf, pktinfo, tree, offset, pktlen, endianness)
+ local successfulOutcomeTree = tree:add(tvbuf:range(offset, (pktlen-offset)), successfulOutcomeE2.successOutcomeMsg)
+ local procId = tvbuf:range(offset,1):le_uint()
+ strId = tostring(E2ProcedureCode[procId]) .. " (" .. tostring(procId) ..")"
+ successfulOutcomeTree:add(tvbuf:range(offset,1), successfulOutcomeE2.procedureCode .. strId)
+ offset = offset + 1
+
+ local criticalityId = tvbuf:range(offset,1):le_uint()
+-- successfulOutcomeTree:add(tvbuf:range(offset,1), "<Enumerated Index: " .. criticalityId ..">")
+ strId = tostring(E2Criticality[criticalityId]) .. " (" .. tostring(criticalityId) ..")"
+ successfulOutcomeTree:add(tvbuf:range(offset,1), successfulOutcomeE2.criticality .. strId)
+ offset = offset + 1
+
+ local valueLen = tvbuf:range(offset,1):le_uint()
+-- successfulOutcomeTree:add(tvbuf:range(offset,1), "<" .. successfulOutcomeE2.valueLen .. valueLen ..">")
+ offset = offset + 1
+
+ local valueTree = successfulOutcomeTree:add(tvbuf:range(offset, valueLen), successfulOutcomeE2.value)
+
+ if(procId == 1) then
+ addE2SetupResponseToTree(tvbuf, pktinfo, valueTree, offset, valueLen, endianness)
+ end
end
----------------------------------------
-- The following creates the callback function for the dissector.
-- Now let's add our protocol header fields under the protocol tree we just created.
local fByte = tvbuf:range(offset,1):le_uint()
- local apiId = bit.rshift(fByte, 5)
- tree:add(tvbuf:range(offset,1), "<Choice Index: " .. apiId ..">")
+ local apiId = bit.rshift(fByte, 5)
+-- tree:add(tvbuf:range(offset,1), "<Choice Index: " .. apiId ..">")
strId = tostring(E2apPduEnum[apiId]) .. " (" .. tostring(apiId) ..")"
- tree:add(tvbuf:range(offset,1), "E2AP-PDU: " .. strId)
+ local e2apTree = tree:add(tvbuf:range(offset,1), "E2AP-PDU: " .. strId)
offset = offset + 1
-- Now let's add our protocol fields under the protocol tree we just created.
if (apiId == 0) then
- addE2apInitiatingMessageToTree(tvbuf, tree, offset, endianness)
+ addE2apInitiatingMessageToTree(tvbuf, pktinfo, e2apTree, offset, endianness)
end
if(apiId == 1) then
- addE2apSuccessfulOutcomeToTree(tvbuf, tree, offset, pktlen, endianness)
+ addE2apSuccessfulOutcomeToTree(tvbuf, pktinfo, e2apTree, offset, pktlen, endianness)
end
end -- end of dissector funciton