telcoladder 0.2.0__tar.gz → 0.3.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (207) hide show
  1. {telcoladder-0.2.0/telcoladder.egg-info → telcoladder-0.3.0}/PKG-INFO +37 -7
  2. {telcoladder-0.2.0 → telcoladder-0.3.0}/README.md +36 -6
  3. {telcoladder-0.2.0 → telcoladder-0.3.0}/pyproject.toml +1 -1
  4. {telcoladder-0.2.0 → telcoladder-0.3.0}/telcoladder/__init__.py +1 -1
  5. telcoladder-0.3.0/telcoladder/activity.py +88 -0
  6. {telcoladder-0.2.0 → telcoladder-0.3.0}/telcoladder/adapters/__init__.py +67 -6
  7. {telcoladder-0.2.0 → telcoladder-0.3.0}/telcoladder/adapters/diameter.py +34 -1
  8. telcoladder-0.3.0/telcoladder/adapters/enum.py +112 -0
  9. {telcoladder-0.2.0 → telcoladder-0.3.0}/telcoladder/adapters/gtpv2.py +39 -6
  10. {telcoladder-0.2.0 → telcoladder-0.3.0}/telcoladder/adapters/nas5gs.py +19 -0
  11. {telcoladder-0.2.0 → telcoladder-0.3.0}/telcoladder/adapters/naseps.py +21 -4
  12. {telcoladder-0.2.0 → telcoladder-0.3.0}/telcoladder/adapters/s1ap.py +4 -1
  13. {telcoladder-0.2.0 → telcoladder-0.3.0}/telcoladder/adapters/sbi.py +348 -2
  14. telcoladder-0.3.0/telcoladder/adapters/sgsap.py +120 -0
  15. {telcoladder-0.2.0 → telcoladder-0.3.0}/telcoladder/adapters/sip.py +75 -17
  16. telcoladder-0.3.0/telcoladder/anonymize.py +2234 -0
  17. {telcoladder-0.2.0 → telcoladder-0.3.0}/telcoladder/callflow.py +38 -8
  18. telcoladder-0.3.0/telcoladder/calls.py +467 -0
  19. {telcoladder-0.2.0 → telcoladder-0.3.0}/telcoladder/cli.py +90 -0
  20. telcoladder-0.3.0/telcoladder/correlate.py +194 -0
  21. {telcoladder-0.2.0 → telcoladder-0.3.0}/telcoladder/coverage.py +216 -120
  22. {telcoladder-0.2.0 → telcoladder-0.3.0}/telcoladder/diameterflows.py +2 -0
  23. {telcoladder-0.2.0 → telcoladder-0.3.0}/telcoladder/extract.py +26 -1
  24. telcoladder-0.3.0/telcoladder/hpack_huffman.py +108 -0
  25. {telcoladder-0.2.0 → telcoladder-0.3.0}/telcoladder/identities.py +6 -5
  26. {telcoladder-0.2.0 → telcoladder-0.3.0}/telcoladder/identity.py +172 -0
  27. {telcoladder-0.2.0 → telcoladder-0.3.0}/telcoladder/interfaces.py +23 -1
  28. {telcoladder-0.2.0 → telcoladder-0.3.0}/telcoladder/ipsec.py +5 -2
  29. telcoladder-0.3.0/telcoladder/lanes.py +156 -0
  30. {telcoladder-0.2.0 → telcoladder-0.3.0}/telcoladder/lifecycle.py +94 -8
  31. {telcoladder-0.2.0 → telcoladder-0.3.0}/telcoladder/mcp.py +1 -1
  32. {telcoladder-0.2.0 → telcoladder-0.3.0}/telcoladder/model.py +120 -6
  33. {telcoladder-0.2.0 → telcoladder-0.3.0}/telcoladder/nf.py +150 -6
  34. {telcoladder-0.2.0 → telcoladder-0.3.0}/telcoladder/overview.py +48 -1
  35. {telcoladder-0.2.0 → telcoladder-0.3.0}/telcoladder/packets.py +3 -1
  36. {telcoladder-0.2.0 → telcoladder-0.3.0}/telcoladder/pipeline.py +207 -41
  37. {telcoladder-0.2.0 → telcoladder-0.3.0}/telcoladder/probe.py +201 -12
  38. {telcoladder-0.2.0 → telcoladder-0.3.0}/telcoladder/procedures.py +435 -50
  39. {telcoladder-0.2.0 → telcoladder-0.3.0}/telcoladder/session.py +43 -4
  40. telcoladder-0.3.0/telcoladder/static/app.css +1 -0
  41. telcoladder-0.3.0/telcoladder/static/app.js +282 -0
  42. {telcoladder-0.2.0 → telcoladder-0.3.0}/telcoladder/summary.py +50 -8
  43. {telcoladder-0.2.0 → telcoladder-0.3.0}/telcoladder/translations/zh_tw.py +124 -8
  44. {telcoladder-0.2.0 → telcoladder-0.3.0}/telcoladder/tshark.py +35 -0
  45. {telcoladder-0.2.0 → telcoladder-0.3.0}/telcoladder/viewer.py +117 -6
  46. {telcoladder-0.2.0 → telcoladder-0.3.0}/telcoladder/web.py +75 -20
  47. {telcoladder-0.2.0 → telcoladder-0.3.0}/telcoladder/wireview.py +7 -1
  48. {telcoladder-0.2.0 → telcoladder-0.3.0}/telcoladder/xdr.py +49 -9
  49. {telcoladder-0.2.0 → telcoladder-0.3.0/telcoladder.egg-info}/PKG-INFO +37 -7
  50. {telcoladder-0.2.0 → telcoladder-0.3.0}/telcoladder.egg-info/SOURCES.txt +29 -0
  51. telcoladder-0.3.0/tests/test_4g_nas_completeness.py +124 -0
  52. telcoladder-0.3.0/tests/test_4g_s_tmsi_and_transactions.py +192 -0
  53. telcoladder-0.3.0/tests/test_4g_scenarios.py +141 -0
  54. {telcoladder-0.2.0 → telcoladder-0.3.0}/tests/test_adapter_diameter.py +105 -21
  55. telcoladder-0.3.0/tests/test_adapter_sgsap.py +124 -0
  56. {telcoladder-0.2.0 → telcoladder-0.3.0}/tests/test_adapter_sip.py +3 -2
  57. telcoladder-0.3.0/tests/test_anonymize.py +476 -0
  58. {telcoladder-0.2.0 → telcoladder-0.3.0}/tests/test_correlate_nf.py +10 -3
  59. {telcoladder-0.2.0 → telcoladder-0.3.0}/tests/test_coverage.py +24 -21
  60. telcoladder-0.3.0/tests/test_coverage_pieces.py +146 -0
  61. {telcoladder-0.2.0 → telcoladder-0.3.0}/tests/test_diameter_flow.py +2 -1
  62. {telcoladder-0.2.0 → telcoladder-0.3.0}/tests/test_diameter_redirect.py +4 -3
  63. {telcoladder-0.2.0 → telcoladder-0.3.0}/tests/test_diameter_roles.py +39 -2
  64. {telcoladder-0.2.0 → telcoladder-0.3.0}/tests/test_e2e_correlation.py +5 -1
  65. telcoladder-0.3.0/tests/test_embedded_supi.py +130 -0
  66. {telcoladder-0.2.0 → telcoladder-0.3.0}/tests/test_flow_handle.py +6 -3
  67. {telcoladder-0.2.0 → telcoladder-0.3.0}/tests/test_identities.py +20 -5
  68. telcoladder-0.3.0/tests/test_lanes.py +151 -0
  69. telcoladder-0.3.0/tests/test_load_progress.py +96 -0
  70. {telcoladder-0.2.0 → telcoladder-0.3.0}/tests/test_n26_handover.py +8 -5
  71. {telcoladder-0.2.0 → telcoladder-0.3.0}/tests/test_no_real_subscriber_data.py +6 -0
  72. {telcoladder-0.2.0 → telcoladder-0.3.0}/tests/test_overview.py +24 -5
  73. {telcoladder-0.2.0 → telcoladder-0.3.0}/tests/test_plugins.py +2 -2
  74. telcoladder-0.3.0/tests/test_procedure_labels.py +153 -0
  75. telcoladder-0.3.0/tests/test_procedure_taxonomy.py +155 -0
  76. {telcoladder-0.2.0 → telcoladder-0.3.0}/tests/test_procedures.py +149 -5
  77. telcoladder-0.3.0/tests/test_quoted_tunnels.py +281 -0
  78. {telcoladder-0.2.0 → telcoladder-0.3.0}/tests/test_release_attribution.py +16 -9
  79. telcoladder-0.3.0/tests/test_rrc_containers.py +110 -0
  80. telcoladder-0.3.0/tests/test_sbi_consumer_roles.py +138 -0
  81. telcoladder-0.3.0/tests/test_sbi_late_body.py +238 -0
  82. telcoladder-0.3.0/tests/test_sbi_n1n2_sender.py +113 -0
  83. {telcoladder-0.2.0 → telcoladder-0.3.0}/tests/test_sbi_n2_bridge.py +23 -8
  84. telcoladder-0.3.0/tests/test_sbi_provider_roles.py +34 -0
  85. telcoladder-0.3.0/tests/test_session_activity.py +140 -0
  86. {telcoladder-0.2.0 → telcoladder-0.3.0}/tests/test_sip_calls.py +12 -5
  87. {telcoladder-0.2.0 → telcoladder-0.3.0}/tests/test_summary.py +37 -5
  88. {telcoladder-0.2.0 → telcoladder-0.3.0}/tests/test_timers.py +12 -5
  89. {telcoladder-0.2.0 → telcoladder-0.3.0}/tests/test_tshark_prefs.py +41 -0
  90. telcoladder-0.3.0/tests/test_ue_role.py +159 -0
  91. telcoladder-0.3.0/tests/test_ui_readability.py +112 -0
  92. {telcoladder-0.2.0 → telcoladder-0.3.0}/tests/test_viewer_session.py +48 -7
  93. telcoladder-0.3.0/tests/test_volte_e2e_call.py +180 -0
  94. telcoladder-0.3.0/tests/test_volte_e2e_decoding.py +179 -0
  95. telcoladder-0.3.0/tests/test_volte_e2e_identity.py +199 -0
  96. {telcoladder-0.2.0 → telcoladder-0.3.0}/tests/test_web_assets.py +4 -1
  97. telcoladder-0.2.0/telcoladder/calls.py +0 -312
  98. telcoladder-0.2.0/telcoladder/correlate.py +0 -98
  99. telcoladder-0.2.0/telcoladder/static/app.css +0 -1
  100. telcoladder-0.2.0/telcoladder/static/app.js +0 -271
  101. {telcoladder-0.2.0 → telcoladder-0.3.0}/LICENSE +0 -0
  102. {telcoladder-0.2.0 → telcoladder-0.3.0}/NOTICE +0 -0
  103. {telcoladder-0.2.0 → telcoladder-0.3.0}/setup.cfg +0 -0
  104. {telcoladder-0.2.0 → telcoladder-0.3.0}/telcoladder/__main__.py +0 -0
  105. {telcoladder-0.2.0 → telcoladder-0.3.0}/telcoladder/adapters/carrier.py +0 -0
  106. {telcoladder-0.2.0 → telcoladder-0.3.0}/telcoladder/adapters/gtp.py +0 -0
  107. {telcoladder-0.2.0 → telcoladder-0.3.0}/telcoladder/adapters/megaco.py +0 -0
  108. {telcoladder-0.2.0 → telcoladder-0.3.0}/telcoladder/adapters/ngap.py +0 -0
  109. {telcoladder-0.2.0 → telcoladder-0.3.0}/telcoladder/adapters/pfcp.py +0 -0
  110. {telcoladder-0.2.0 → telcoladder-0.3.0}/telcoladder/causes.py +0 -0
  111. {telcoladder-0.2.0 → telcoladder-0.3.0}/telcoladder/chrome.py +0 -0
  112. {telcoladder-0.2.0 → telcoladder-0.3.0}/telcoladder/data/causes/diameter_3gpp.yaml +0 -0
  113. {telcoladder-0.2.0 → telcoladder-0.3.0}/telcoladder/data/causes/diameter_base.yaml +0 -0
  114. {telcoladder-0.2.0 → telcoladder-0.3.0}/telcoladder/data/causes/gtpv2.yaml +0 -0
  115. {telcoladder-0.2.0 → telcoladder-0.3.0}/telcoladder/data/causes/megaco_error.yaml +0 -0
  116. {telcoladder-0.2.0 → telcoladder-0.3.0}/telcoladder/data/causes/nas_5gmm.yaml +0 -0
  117. {telcoladder-0.2.0 → telcoladder-0.3.0}/telcoladder/data/causes/nas_5gsm.yaml +0 -0
  118. {telcoladder-0.2.0 → telcoladder-0.3.0}/telcoladder/data/causes/nas_eps_emm.yaml +0 -0
  119. {telcoladder-0.2.0 → telcoladder-0.3.0}/telcoladder/data/causes/nas_eps_esm.yaml +0 -0
  120. {telcoladder-0.2.0 → telcoladder-0.3.0}/telcoladder/data/causes/ngap_misc.yaml +0 -0
  121. {telcoladder-0.2.0 → telcoladder-0.3.0}/telcoladder/data/causes/ngap_nas.yaml +0 -0
  122. {telcoladder-0.2.0 → telcoladder-0.3.0}/telcoladder/data/causes/ngap_protocol.yaml +0 -0
  123. {telcoladder-0.2.0 → telcoladder-0.3.0}/telcoladder/data/causes/ngap_radioNetwork.yaml +0 -0
  124. {telcoladder-0.2.0 → telcoladder-0.3.0}/telcoladder/data/causes/ngap_transport.yaml +0 -0
  125. {telcoladder-0.2.0 → telcoladder-0.3.0}/telcoladder/data/causes/pfcp.yaml +0 -0
  126. {telcoladder-0.2.0 → telcoladder-0.3.0}/telcoladder/data/causes/q850.yaml +0 -0
  127. {telcoladder-0.2.0 → telcoladder-0.3.0}/telcoladder/data/causes/s1ap_misc.yaml +0 -0
  128. {telcoladder-0.2.0 → telcoladder-0.3.0}/telcoladder/data/causes/s1ap_nas.yaml +0 -0
  129. {telcoladder-0.2.0 → telcoladder-0.3.0}/telcoladder/data/causes/s1ap_protocol.yaml +0 -0
  130. {telcoladder-0.2.0 → telcoladder-0.3.0}/telcoladder/data/causes/s1ap_radioNetwork.yaml +0 -0
  131. {telcoladder-0.2.0 → telcoladder-0.3.0}/telcoladder/data/causes/s1ap_transport.yaml +0 -0
  132. {telcoladder-0.2.0 → telcoladder-0.3.0}/telcoladder/data/causes/sip_status.yaml +0 -0
  133. {telcoladder-0.2.0 → telcoladder-0.3.0}/telcoladder/data/decode-as.yaml +0 -0
  134. {telcoladder-0.2.0 → telcoladder-0.3.0}/telcoladder/decode.py +0 -0
  135. {telcoladder-0.2.0 → telcoladder-0.3.0}/telcoladder/decodeas.py +0 -0
  136. {telcoladder-0.2.0 → telcoladder-0.3.0}/telcoladder/endpoints.py +0 -0
  137. {telcoladder-0.2.0 → telcoladder-0.3.0}/telcoladder/flowtable.py +0 -0
  138. {telcoladder-0.2.0 → telcoladder-0.3.0}/telcoladder/framebytes.py +0 -0
  139. {telcoladder-0.2.0 → telcoladder-0.3.0}/telcoladder/i18n.py +0 -0
  140. {telcoladder-0.2.0 → telcoladder-0.3.0}/telcoladder/nettrace.py +0 -0
  141. {telcoladder-0.2.0 → telcoladder-0.3.0}/telcoladder/pdusession.py +0 -0
  142. {telcoladder-0.2.0 → telcoladder-0.3.0}/telcoladder/plugins.py +0 -0
  143. {telcoladder-0.2.0 → telcoladder-0.3.0}/telcoladder/prefilter.py +0 -0
  144. {telcoladder-0.2.0 → telcoladder-0.3.0}/telcoladder/render_mermaid.py +0 -0
  145. {telcoladder-0.2.0 → telcoladder-0.3.0}/telcoladder/slicer.py +0 -0
  146. {telcoladder-0.2.0 → telcoladder-0.3.0}/telcoladder/static/theme.js +0 -0
  147. {telcoladder-0.2.0 → telcoladder-0.3.0}/telcoladder/timers.py +0 -0
  148. {telcoladder-0.2.0 → telcoladder-0.3.0}/telcoladder/translations/__init__.py +0 -0
  149. {telcoladder-0.2.0 → telcoladder-0.3.0}/telcoladder.egg-info/dependency_links.txt +0 -0
  150. {telcoladder-0.2.0 → telcoladder-0.3.0}/telcoladder.egg-info/entry_points.txt +0 -0
  151. {telcoladder-0.2.0 → telcoladder-0.3.0}/telcoladder.egg-info/requires.txt +0 -0
  152. {telcoladder-0.2.0 → telcoladder-0.3.0}/telcoladder.egg-info/top_level.txt +0 -0
  153. {telcoladder-0.2.0 → telcoladder-0.3.0}/tests/test_4g_identity_model.py +0 -0
  154. {telcoladder-0.2.0 → telcoladder-0.3.0}/tests/test_adapter_gtpv2.py +0 -0
  155. {telcoladder-0.2.0 → telcoladder-0.3.0}/tests/test_adapter_megaco.py +0 -0
  156. {telcoladder-0.2.0 → telcoladder-0.3.0}/tests/test_adapter_naseps.py +0 -0
  157. {telcoladder-0.2.0 → telcoladder-0.3.0}/tests/test_adapter_s1ap.py +0 -0
  158. {telcoladder-0.2.0 → telcoladder-0.3.0}/tests/test_adapters.py +0 -0
  159. {telcoladder-0.2.0 → telcoladder-0.3.0}/tests/test_archmap.py +0 -0
  160. {telcoladder-0.2.0 → telcoladder-0.3.0}/tests/test_batch.py +0 -0
  161. {telcoladder-0.2.0 → telcoladder-0.3.0}/tests/test_blast_radius.py +0 -0
  162. {telcoladder-0.2.0 → telcoladder-0.3.0}/tests/test_callflow_api.py +0 -0
  163. {telcoladder-0.2.0 → telcoladder-0.3.0}/tests/test_calls.py +0 -0
  164. {telcoladder-0.2.0 → telcoladder-0.3.0}/tests/test_carrier_polymorphism.py +0 -0
  165. {telcoladder-0.2.0 → telcoladder-0.3.0}/tests/test_causes.py +0 -0
  166. {telcoladder-0.2.0 → telcoladder-0.3.0}/tests/test_cli_encoding.py +0 -0
  167. {telcoladder-0.2.0 → telcoladder-0.3.0}/tests/test_cli_help.py +0 -0
  168. {telcoladder-0.2.0 → telcoladder-0.3.0}/tests/test_cli_summarize.py +0 -0
  169. {telcoladder-0.2.0 → telcoladder-0.3.0}/tests/test_decode.py +0 -0
  170. {telcoladder-0.2.0 → telcoladder-0.3.0}/tests/test_decodeas.py +0 -0
  171. {telcoladder-0.2.0 → telcoladder-0.3.0}/tests/test_docs_support_table.py +0 -0
  172. {telcoladder-0.2.0 → telcoladder-0.3.0}/tests/test_extract.py +0 -0
  173. {telcoladder-0.2.0 → telcoladder-0.3.0}/tests/test_failure_scenarios.py +0 -0
  174. {telcoladder-0.2.0 → telcoladder-0.3.0}/tests/test_filter_composition.py +0 -0
  175. {telcoladder-0.2.0 → telcoladder-0.3.0}/tests/test_flows_api.py +0 -0
  176. {telcoladder-0.2.0 → telcoladder-0.3.0}/tests/test_flowtable.py +0 -0
  177. {telcoladder-0.2.0 → telcoladder-0.3.0}/tests/test_frame_filter.py +0 -0
  178. {telcoladder-0.2.0 → telcoladder-0.3.0}/tests/test_frame_time.py +0 -0
  179. {telcoladder-0.2.0 → telcoladder-0.3.0}/tests/test_framebytes.py +0 -0
  180. {telcoladder-0.2.0 → telcoladder-0.3.0}/tests/test_gtp_adapter.py +0 -0
  181. {telcoladder-0.2.0 → telcoladder-0.3.0}/tests/test_i18n.py +0 -0
  182. {telcoladder-0.2.0 → telcoladder-0.3.0}/tests/test_identifier_reuse.py +0 -0
  183. {telcoladder-0.2.0 → telcoladder-0.3.0}/tests/test_index_race.py +0 -0
  184. {telcoladder-0.2.0 → telcoladder-0.3.0}/tests/test_ip_fragments.py +0 -0
  185. {telcoladder-0.2.0 → telcoladder-0.3.0}/tests/test_ipsec.py +0 -0
  186. {telcoladder-0.2.0 → telcoladder-0.3.0}/tests/test_mcp.py +0 -0
  187. {telcoladder-0.2.0 → telcoladder-0.3.0}/tests/test_message_abs_ts.py +0 -0
  188. {telcoladder-0.2.0 → telcoladder-0.3.0}/tests/test_min_python.py +0 -0
  189. {telcoladder-0.2.0 → telcoladder-0.3.0}/tests/test_nettrace.py +0 -0
  190. {telcoladder-0.2.0 → telcoladder-0.3.0}/tests/test_nf_ladder.py +0 -0
  191. {telcoladder-0.2.0 → telcoladder-0.3.0}/tests/test_packaging.py +0 -0
  192. {telcoladder-0.2.0 → telcoladder-0.3.0}/tests/test_packets.py +0 -0
  193. {telcoladder-0.2.0 → telcoladder-0.3.0}/tests/test_pdusession.py +0 -0
  194. {telcoladder-0.2.0 → telcoladder-0.3.0}/tests/test_pfcp_correlation.py +0 -0
  195. {telcoladder-0.2.0 → telcoladder-0.3.0}/tests/test_prefilter.py +0 -0
  196. {telcoladder-0.2.0 → telcoladder-0.3.0}/tests/test_probe.py +0 -0
  197. {telcoladder-0.2.0 → telcoladder-0.3.0}/tests/test_python_baseline.py +0 -0
  198. {telcoladder-0.2.0 → telcoladder-0.3.0}/tests/test_render_mermaid.py +0 -0
  199. {telcoladder-0.2.0 → telcoladder-0.3.0}/tests/test_sequence_rules.py +0 -0
  200. {telcoladder-0.2.0 → telcoladder-0.3.0}/tests/test_session_decode_params.py +0 -0
  201. {telcoladder-0.2.0 → telcoladder-0.3.0}/tests/test_tmsi_identity.py +0 -0
  202. {telcoladder-0.2.0 → telcoladder-0.3.0}/tests/test_tshark.py +0 -0
  203. {telcoladder-0.2.0 → telcoladder-0.3.0}/tests/test_user_dlt.py +0 -0
  204. {telcoladder-0.2.0 → telcoladder-0.3.0}/tests/test_validation_gate.py +0 -0
  205. {telcoladder-0.2.0 → telcoladder-0.3.0}/tests/test_web.py +0 -0
  206. {telcoladder-0.2.0 → telcoladder-0.3.0}/tests/test_web_i18n.py +0 -0
  207. {telcoladder-0.2.0 → telcoladder-0.3.0}/tests/test_wireview.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: telcoladder
3
- Version: 0.2.0
3
+ Version: 0.3.0
4
4
  Summary: Turn telecom signalling captures into Mermaid sequence diagrams — 5G core, 4G/EPC and IMS on one timeline.
5
5
  Author: gollumw
6
6
  License: PolyForm-Noncommercial-1.0.0
@@ -99,7 +99,7 @@ cell cites the frame it came from.
99
99
  | Generation | Protocols | Cause explanations |
100
100
  |---|---|---|
101
101
  | **5G core** | NGAP, NAS-5GS, HTTP/2 SBI, PFCP, GTP-U | 206 |
102
- | **4G / EPC** | S1AP, NAS-EPS, GTPv2-C (S11, S5/S8, N26) | 236 |
102
+ | **4G / EPC** | S1AP, NAS-EPS, GTPv2-C (S11, S5/S8, N26), SGsAP (SGs) | 236 |
103
103
  | **IMS** | SIP (calls, KPIs), Diameter, H.248/MEGACO | 333 |
104
104
 
105
105
  Every cause code is resolved through a hand-verified table to the specification
@@ -136,6 +136,16 @@ telcoladder serve # http://127.0.0.1:3005
136
136
  claude mcp add telcoladder -- telcoladder mcp
137
137
  ```
138
138
 
139
+ **5. Hand a capture to someone else.** `telcoladder anonymize in.pcap out.pcap`
140
+ rewrites subscriber identities, addresses, hostnames, PLMN and cell identifiers
141
+ into keyed pseudonyms of the *same length* — TBCD, ASCII, JSON and HPACK-Huffman
142
+ alike — recomputes every checksum, then re-reads its own output and refuses to
143
+ keep it if any original value is still visible. The output walks the same
144
+ pipeline to the same procedures, roles and failures; only the names differ.
145
+ Same key, same pseudonyms across captures; the key is printed once and never
146
+ written down. Compressed HTTP/2 bodies cannot be rewritten in place and are
147
+ refused unless `--blank-opaque-bodies`.
148
+
139
149
  **4. Windows, no install.** Download `TelcoLadder-Windows-x64.zip` from the
140
150
  [Releases](https://github.com/gollumw/TelcoLadder/releases) page — a standalone
141
151
  executable in a portable zip, built by CI from the tagged source. Unzip,
@@ -211,11 +221,20 @@ Each of these is a fixture in `tests/fixtures/` you can run yourself.
211
221
  the scopes described above. On a production trace with TLS on SBI and
212
222
  ECIES-protected SUCIs the N2 side still forms its own per-UE flow; what
213
223
  could not be read is counted and reported, not silently dropped.
214
- - **Splits a subscriber's traffic into procedures** — registration, attach,
215
- PDU session, service request, deregistration, context release, handover,
216
- IMS registration and call — each with outcome, cause, first failure,
217
- duration, and where applicable the initiator, the matched timer, or the
218
- handover preparation and execution times.
224
+ - **Splits a subscriber's traffic into scenarios** — registration, attach,
225
+ PDU session, service request (UE- or network-triggered), dedicated bearer
226
+ setup, modification and release, deregistration, handover
227
+ (including one that was **cancelled**, which is not a failure), idle
228
+ mobility, IMS registration and call — each with outcome, cause, first
229
+ failure, duration, and where applicable the initiator, the matched timer, or
230
+ the handover preparation and execution times. **The axis is what the
231
+ subscriber was doing, not which protocol carried it**: the S6a exchange
232
+ inside an attach is part of that attach, the context release that ends a
233
+ scenario is part of that scenario (its initiator and cause travel with it,
234
+ and the xDR still lists the release as a row of its own), and an HSS answer of "unknown user"
235
+ is that attach's failure. A Diameter exchange that belongs to no scenario
236
+ stands on its own as an HSS-initiated one — under 4G for S6a/Gx and under IMS
237
+ for Cx/Sh, which the Application-Id decides.
219
238
  - **Reads Diameter through the DRA**: S6a/S6d, Cx/Dx, Sh, Rx, Gx, SWx and S6b,
220
239
  roles from who initiates which command, a request seen on both sides of a
221
240
  relay shown as one transaction with two hops, a relayed failure counted once.
@@ -289,8 +308,19 @@ diagram, Mermaid as the output, and a verified explanation of what went wrong.
289
308
  invisible; the packets still appear as their NGAP carrier. GTP-U joins the
290
309
  subscriber but carries no throughput or loss KPIs; there is no RTP adapter;
291
310
  ISUP and CAMEL are recognised but not read.
311
+ - **Joins through a tunnel an SBI message quotes are inferences.** They bind by
312
+ direction, inside a time window, never across a release, and never where they
313
+ would give one flow two SUPIs; the summary counts each one. What remains: a
314
+ stale forwarded quote that arrives after its tunnel was released, where the UPF
315
+ reused that exact TEID within 10 s for a UE whose flow shows no SUPI, could
316
+ still be joined. On a single capture point that order violates the protocol.
292
317
  - **Mermaid gets slow with very large flows.** Use `--max-messages`; truncation
293
318
  is always stated inside the diagram.
319
+ - **`anonymize` proves absence only for what tshark can name.** Identities it
320
+ never decoded stay where they are; TLS payloads are opaque; gzip bodies and
321
+ bodies reassembled across DATA frames are refused rather than guessed at;
322
+ IPv6 text and binary forms, and TAC text and binary forms, are pseudonymised
323
+ independently. The report lists every one of these.
294
324
 
295
325
  ## How it is verified
296
326
 
@@ -67,7 +67,7 @@ cell cites the frame it came from.
67
67
  | Generation | Protocols | Cause explanations |
68
68
  |---|---|---|
69
69
  | **5G core** | NGAP, NAS-5GS, HTTP/2 SBI, PFCP, GTP-U | 206 |
70
- | **4G / EPC** | S1AP, NAS-EPS, GTPv2-C (S11, S5/S8, N26) | 236 |
70
+ | **4G / EPC** | S1AP, NAS-EPS, GTPv2-C (S11, S5/S8, N26), SGsAP (SGs) | 236 |
71
71
  | **IMS** | SIP (calls, KPIs), Diameter, H.248/MEGACO | 333 |
72
72
 
73
73
  Every cause code is resolved through a hand-verified table to the specification
@@ -104,6 +104,16 @@ telcoladder serve # http://127.0.0.1:3005
104
104
  claude mcp add telcoladder -- telcoladder mcp
105
105
  ```
106
106
 
107
+ **5. Hand a capture to someone else.** `telcoladder anonymize in.pcap out.pcap`
108
+ rewrites subscriber identities, addresses, hostnames, PLMN and cell identifiers
109
+ into keyed pseudonyms of the *same length* — TBCD, ASCII, JSON and HPACK-Huffman
110
+ alike — recomputes every checksum, then re-reads its own output and refuses to
111
+ keep it if any original value is still visible. The output walks the same
112
+ pipeline to the same procedures, roles and failures; only the names differ.
113
+ Same key, same pseudonyms across captures; the key is printed once and never
114
+ written down. Compressed HTTP/2 bodies cannot be rewritten in place and are
115
+ refused unless `--blank-opaque-bodies`.
116
+
107
117
  **4. Windows, no install.** Download `TelcoLadder-Windows-x64.zip` from the
108
118
  [Releases](https://github.com/gollumw/TelcoLadder/releases) page — a standalone
109
119
  executable in a portable zip, built by CI from the tagged source. Unzip,
@@ -179,11 +189,20 @@ Each of these is a fixture in `tests/fixtures/` you can run yourself.
179
189
  the scopes described above. On a production trace with TLS on SBI and
180
190
  ECIES-protected SUCIs the N2 side still forms its own per-UE flow; what
181
191
  could not be read is counted and reported, not silently dropped.
182
- - **Splits a subscriber's traffic into procedures** — registration, attach,
183
- PDU session, service request, deregistration, context release, handover,
184
- IMS registration and call — each with outcome, cause, first failure,
185
- duration, and where applicable the initiator, the matched timer, or the
186
- handover preparation and execution times.
192
+ - **Splits a subscriber's traffic into scenarios** — registration, attach,
193
+ PDU session, service request (UE- or network-triggered), dedicated bearer
194
+ setup, modification and release, deregistration, handover
195
+ (including one that was **cancelled**, which is not a failure), idle
196
+ mobility, IMS registration and call — each with outcome, cause, first
197
+ failure, duration, and where applicable the initiator, the matched timer, or
198
+ the handover preparation and execution times. **The axis is what the
199
+ subscriber was doing, not which protocol carried it**: the S6a exchange
200
+ inside an attach is part of that attach, the context release that ends a
201
+ scenario is part of that scenario (its initiator and cause travel with it,
202
+ and the xDR still lists the release as a row of its own), and an HSS answer of "unknown user"
203
+ is that attach's failure. A Diameter exchange that belongs to no scenario
204
+ stands on its own as an HSS-initiated one — under 4G for S6a/Gx and under IMS
205
+ for Cx/Sh, which the Application-Id decides.
187
206
  - **Reads Diameter through the DRA**: S6a/S6d, Cx/Dx, Sh, Rx, Gx, SWx and S6b,
188
207
  roles from who initiates which command, a request seen on both sides of a
189
208
  relay shown as one transaction with two hops, a relayed failure counted once.
@@ -257,8 +276,19 @@ diagram, Mermaid as the output, and a verified explanation of what went wrong.
257
276
  invisible; the packets still appear as their NGAP carrier. GTP-U joins the
258
277
  subscriber but carries no throughput or loss KPIs; there is no RTP adapter;
259
278
  ISUP and CAMEL are recognised but not read.
279
+ - **Joins through a tunnel an SBI message quotes are inferences.** They bind by
280
+ direction, inside a time window, never across a release, and never where they
281
+ would give one flow two SUPIs; the summary counts each one. What remains: a
282
+ stale forwarded quote that arrives after its tunnel was released, where the UPF
283
+ reused that exact TEID within 10 s for a UE whose flow shows no SUPI, could
284
+ still be joined. On a single capture point that order violates the protocol.
260
285
  - **Mermaid gets slow with very large flows.** Use `--max-messages`; truncation
261
286
  is always stated inside the diagram.
287
+ - **`anonymize` proves absence only for what tshark can name.** Identities it
288
+ never decoded stay where they are; TLS payloads are opaque; gzip bodies and
289
+ bodies reassembled across DATA frames are refused rather than guessed at;
290
+ IPv6 text and binary forms, and TAC text and binary forms, are pseudonymised
291
+ independently. The report lists every one of these.
262
292
 
263
293
  ## How it is verified
264
294
 
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "telcoladder"
3
- version = "0.2.0"
3
+ version = "0.3.0"
4
4
  description = "Turn telecom signalling captures into Mermaid sequence diagrams — 5G core, 4G/EPC and IMS on one timeline."
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.11"
@@ -5,4 +5,4 @@ Phase 2 主攻 IMS(SIP / Diameter / GTP)—— 協定以 adapter 形式插
5
5
  核心資料模型 (`telcoladder.model`) 已預留跨協定的身分關聯欄位。
6
6
  """
7
7
 
8
- __version__ = "0.2.0"
8
+ __version__ = "0.3.0"
@@ -0,0 +1,88 @@
1
+ """一個訂戶在這份擷取檔裡做了什麼:打電話、只有 IMS 註冊與查詢、或一般 session。
2
+
3
+ 總覽「偵測到的會話」依此分組(使用者裁定 2026-09-14)。原本抽屜只按身分列,15 個訂戶攤成
4
+ 一排,看不出哪些是電話觸發的。
5
+
6
+ **每一類都從引擎已有的事實讀,不從協定名稱猜場景:**
7
+
8
+ * `call` —— 這個訂戶的某條流程是一通電話的一腿(`calls.build`),或它的 MSISDN 就是某通
9
+ 電話主叫/被叫的國際號碼。後者讓被叫那一側(號碼鍵的 HSS/計費流程)也歸進來。
10
+ * `ims` —— 沒有通話,但有 IMS 世代的程序段(SIP 註冊、Cx/Sh)或 SIP 訊息。
11
+ * `session` —— 其餘有訂戶身分的(4G/5G 附著、PDU/承載、行動管理)。
12
+ * `flows` —— 沒有訂戶鍵的那一桶(節點維護等),不是一個人。
13
+
14
+ **接取(VoLTE/VoNR/VoWiFi)只看線路宣告**(`P-Access-Network-Info`)。沒宣告就是空的,
15
+ 不從 GTP 的 RAT、ePDG 位址之類的線索推 —— 使用者裁定 2026-09-14。
16
+ """
17
+
18
+ from __future__ import annotations
19
+
20
+ from dataclasses import dataclass
21
+
22
+ from telcoladder import calls as callsmod
23
+ from telcoladder.flowtable import FlowTable
24
+ from telcoladder.model import IdKind
25
+ from telcoladder.calls import ACCESS_KINDS, access_kind
26
+ from telcoladder.pipeline import Analysis
27
+ from telcoladder.procedures import capture_end, segment_flow
28
+
29
+ #: 分組的固定詞彙與畫面上的順序。電話排最前 —— 那是這個需求的起點。
30
+ ACTIVITIES: tuple[str, ...] = ("call", "ims", "session", "flows")
31
+
32
+
33
+ @dataclass(frozen=True, slots=True)
34
+ class Activity:
35
+ kind: str
36
+ """`ACTIVITIES` 之一。"""
37
+ access: tuple[str, ...]
38
+ """這個訂戶自己送出的 SIP 請求宣告過的接取,依 `ACCESS_KINDS` 排序。沒宣告是空的。"""
39
+ calls: tuple[str, ...] = ()
40
+ """它參與的通話把手(`c:N`,與 `/calls` 同一組)。抽屜把電話掛在訂戶底下靠這個 ——
41
+ 瀏覽器不必從標籤字串猜號碼。"""
42
+
43
+
44
+ def classify(analysis: Analysis, table: FlowTable) -> list[Activity]:
45
+ """與 `table.subscribers` 逐一對齊。"""
46
+ end = capture_end(analysis)
47
+ call_list = callsmod.build(analysis)
48
+ numbers_of = {
49
+ call.handle: {n for n in (callsmod.caller_number(call), callsmod.callee_number(call)) if n}
50
+ for call in call_list
51
+ }
52
+ out: list[Activity] = []
53
+ for sub in table.subscribers:
54
+ flows = [analysis.flows[row.flow_id] for row in sub.sessions]
55
+ # **只看請求。** SIP 流程以 `From` 歸戶,所以主叫那條流程裡也有被叫的回應 —— 回應帶的是
56
+ # 被叫自己的接取。算進來的話,LTE 上的主叫會同時被標成 VoWiFi(實測 volte-e2e-call)。
57
+ declared = {
58
+ kind
59
+ for flow in flows
60
+ for msg in flow.messages
61
+ if msg.protocol == "sip" and not msg.label[:1].isdigit()
62
+ and (kind := access_kind(msg.detail.get("access-type")))
63
+ }
64
+ access = tuple(k for k in ACCESS_KINDS if k in declared)
65
+ if not sub.grouped:
66
+ out.append(Activity("flows", access))
67
+ continue
68
+ flow_ids = {row.flow_id for row in sub.sessions}
69
+ numbers = {
70
+ value.lstrip("+")
71
+ for flow in flows
72
+ for kind, value in flow.identity_keys
73
+ if kind is IdKind.MSISDN
74
+ }
75
+ joined = tuple(
76
+ call.handle for call in call_list
77
+ if flow_ids.intersection(call.flow_ids) or numbers & numbers_of[call.handle]
78
+ )
79
+ if joined:
80
+ out.append(Activity("call", access, joined))
81
+ continue
82
+ ims = any(
83
+ p.family == "ims"
84
+ for flow in flows
85
+ for p in segment_flow(flow, capture_end=end)[0]
86
+ ) or any(msg.protocol == "sip" for flow in flows for msg in flow.messages)
87
+ out.append(Activity("ims" if ims else "session", access))
88
+ return out
@@ -21,6 +21,7 @@
21
21
  | `CARRIER_LAYER` | 它的區塊在 tshark 輸出裡叫什麼層;**預設等於 `NAME`** |
22
22
  | `carrier_keys(block, frame)` | 從**載體區塊**推出的身分鍵,回 `frozenset[IdKey]` |
23
23
  | `blind_spots(frame)` | 這一格裡**我看得到卻讀不出來**的東西,見下 |
24
+ | `continuations(frame)` | 這一格裡**屬於更早某則訊息**的內容(HTTP/2 的 body 比標頭晚一格到),見 `attach_continuations()` |
24
25
 
25
26
  `CARRIER_LAYER` 存在是因為 **adapter 的名字與 tshark 的層名是兩回事**:
26
27
  `sbi.NAME` 是 `"sbi"`(會出現在 `Message.protocol` 上),但它的區塊在 `-T ek`
@@ -80,6 +81,7 @@ filter 是「把這個協定的封包留下來」,前提是 tshark **已經認
80
81
 
81
82
  from __future__ import annotations
82
83
 
84
+ from bisect import bisect_left
83
85
  from collections.abc import Iterable
84
86
  from functools import cache
85
87
  from typing import Protocol
@@ -93,6 +95,7 @@ from telcoladder.model import (
93
95
  BLIND_ECIES_PROTECTED_SUCI,
94
96
  BLIND_UNDECODED_STREAM,
95
97
  BlindSpot,
98
+ Continuation,
96
99
  IdKey,
97
100
  Message,
98
101
  )
@@ -121,18 +124,22 @@ class Adapter(Protocol):
121
124
  #: 選用。這一格裡「看得到協定層、但讀不出內容」的東西。見 `blind_spots()`。
122
125
  def blind_spots(self, frame: Frame) -> Iterable[BlindSpot]: ...
123
126
 
124
- #: 選用。**這段裸位元組是不是你的協定?** 只在擷取檔的 link type 是
125
- #: USER n(tshark 一個 dissector 都不掛)時才會被問到,見 `sniff_payload()`。
127
+ #: 選用。這一格裡屬於更早某則訊息的內容(標頭與 body 分兩格送)。見 `attach_continuations()`。
128
+ def continuations(self, frame: Frame) -> Iterable[Continuation]: ...
129
+
130
+ #: 選用。**這段裸位元組是不是你的協定?** 兩種情況會被問到(見 `sniff_payload()`):
131
+ #: 擷取檔的 link type 是 USER n(tshark 一個 dissector 都不掛);以及 `probe` 在
132
+ #: TCP 埠上看載荷的開頭 —— 那時拿到的可能只是一則訊息的第一個區段。
126
133
  def sniff(self, payload: bytes) -> bool: ...
127
134
 
128
135
 
129
136
  from telcoladder.adapters import ( # noqa: E402
130
- diameter, gtp, gtpv2, megaco, nas5gs, naseps, ngap, pfcp, s1ap, sbi, sip,
137
+ diameter, enum, gtp, gtpv2, megaco, nas5gs, naseps, ngap, pfcp, s1ap, sbi, sgsap, sip,
131
138
  )
132
139
 
133
140
  #: 不經外掛機制、永遠都在的那些。
134
141
  BUILTIN_ADAPTERS: tuple[Adapter, ...] = (
135
- ngap, s1ap, nas5gs, naseps, sip, megaco, sbi, diameter, pfcp, gtpv2, gtp,
142
+ ngap, s1ap, nas5gs, naseps, sip, megaco, sbi, diameter, sgsap, pfcp, gtpv2, gtp, enum,
136
143
  ) # type: ignore[assignment]
137
144
 
138
145
  _REQUIRED_ATTRS = ("NAME", "ORDER", "DISPLAY_FILTER", "DISSECTORS", "parse")
@@ -221,7 +228,7 @@ def protocol_filters(present: "set[str] | frozenset[str]") -> list[dict[str, str
221
228
  外掛加進來的協定不必為了好看而改核心程式碼。
222
229
  """
223
230
  labels = {"ngap": "NGAP / NAS", "nas-5gs": "NGAP / NAS", "sbi": "SBI",
224
- "pfcp": "PFCP", "gtp": "GTP-U", "diameter": "Diameter"}
231
+ "pfcp": "PFCP", "gtp": "GTP-U", "diameter": "Diameter", "sgsap": "SGsAP"}
225
232
  out: list[dict[str, str]] = []
226
233
  seen: set[str] = set()
227
234
  for adapter in adapters():
@@ -307,10 +314,64 @@ def blind_spots(frame: Frame) -> list[BlindSpot]:
307
314
  return out
308
315
 
309
316
 
317
+ def continuations(frame: Frame) -> list[Continuation]:
318
+ """問過每一個 adapter:這一格裡有沒有**屬於更早某則訊息**的內容?
319
+
320
+ 與 `blind_spots()` 同形:`pipeline` 逐格問,不指名任何 adapter。收齊之後由
321
+ `attach_continuations()` 一次接回去 —— 主人一定在前面的格裡,但得等全部訊息
322
+ 都建好了才找得到它。
323
+ """
324
+ out: list[Continuation] = []
325
+ for adapter in adapters():
326
+ hook = getattr(adapter, "continuations", None)
327
+ if hook is None:
328
+ continue
329
+ out.extend(hook(frame))
330
+ return out
331
+
332
+
333
+ def attach_continuations(messages: list[Message], pending: list[Continuation]) -> int:
334
+ """把每一段晚到的內容交給它的主人,回傳接上了幾段。
335
+
336
+ 主人是**時間上最近的前一則**同協定、帶著同一把鍵、來自同一個端點的訊息:
337
+
338
+ * 「同一個端點」就是方向 —— 請求的 body 與請求同方向,回應的 body 與回應同方向,
339
+ 同一條 stream 上的兩則訊息靠它分開。
340
+ * 「最近的前一則」處理先後 —— 鍵本身(SBI 的 stream 鍵)已經帶著連線,而同一條
341
+ 連線內 HTTP/2 從不重用 stream 編號。
342
+
343
+ 找不到主人(標頭在擷取起點之前、或標頭解不開)就略過:那段內容沒有地方掛,
344
+ 而**編一個主人比不接更糟** —— 那會把內容說的事實安到別人頭上。
345
+ """
346
+ if not pending:
347
+ return 0
348
+ wanted = {(c.protocol, c.key, c.src.key, c.src.port) for c in pending}
349
+ owners: dict[tuple, list[Message]] = {}
350
+ for msg in messages:
351
+ for key in msg.identity_keys:
352
+ slot = (msg.protocol, key, msg.src.key, msg.src.port)
353
+ if slot in wanted:
354
+ owners.setdefault(slot, []).append(msg)
355
+ frames: dict[tuple, list[int]] = {}
356
+ for slot, found in owners.items():
357
+ found.sort(key=lambda m: m.frame)
358
+ frames[slot] = [m.frame for m in found]
359
+ attached = 0
360
+ for cont in sorted(pending, key=lambda c: c.frame):
361
+ slot = (cont.protocol, cont.key, cont.src.key, cont.src.port)
362
+ at = bisect_left(frames.get(slot, []), cont.frame) - 1
363
+ if at < 0:
364
+ continue
365
+ cont.apply(owners[slot][at])
366
+ attached += 1
367
+ return attached
368
+
369
+
310
370
  def sniff_payload(payload: bytes) -> "Adapter | None":
311
371
  """問過每一個 adapter:這段裸位元組是不是你的協定?
312
372
 
313
- **只用在 USER DLT 的擷取檔上**(`probe.inspect()`):網元匯出的裸協定
373
+ **兩個呼叫端**(都在 `probe.inspect()`):USER DLT 的擷取檔,以及 TCP 埠上
374
+ 每條連線的前幾格載荷。前者是網元匯出的裸協定
314
375
  沒有任何鏈路/IP/傳輸層,tshark 對它一個 dissector 都不掛,每格都是
315
376
  `user_dlt` 底下一片 `data`。要它解,得先知道載荷是什麼 —— 而知道的
316
377
  是 adapter,不是核心(核心不認得任何一個協定的標頭形狀)。
@@ -68,7 +68,9 @@ from typing import Any
68
68
 
69
69
  from telcoladder.extract import Frame, first
70
70
  from telcoladder.extract import to_int as _to_int
71
- from telcoladder.identity import globally_unique, imsi_from_ims_identity
71
+ from telcoladder.identity import (
72
+ e164_digits, globally_unique, imsi_from_ims_identity, international_msisdn, msisdn_from_tbcd,
73
+ )
72
74
  from telcoladder.model import (
73
75
  ENDPOINT_DST_KEY,
74
76
  ENDPOINT_SRC_KEY,
@@ -323,10 +325,36 @@ def _identity_keys(block: dict[str, Any]) -> set[IdKey]:
323
325
  for impu in _as_list(block.get("diameter_diameter_Public-Identity")):
324
326
  if impu:
325
327
  keys.add(globally_unique(IdKind.IMPU, str(impu).strip()))
328
+ # `sip:+…@` 或 `tel:+…` 形式的公開身分就是號碼。**只收國際形式**(見
329
+ # `identity.international_msisdn`)—— 本地形式要補國碼,這裡不猜。
330
+ number = international_msisdn(str(impu))
331
+ if number:
332
+ keys.add(globally_unique(IdKind.MSISDN, number))
333
+
334
+ # **同一個門號的 Diameter 併成一條**(2026-09-13)。真實樣本上被叫號碼的 Cx 路由查詢
335
+ # 與三段 Sh 查詢各自只有 Session-Id,於是切成四條流程,沒有一條說得出「這是誰」。
336
+ #
337
+ # Sh 的 `User-Identity` 裡是 TBCD 的 `MSISDN`(國際形式)。
338
+ for raw in _as_list(block.get("diameter_diameter_MSISDN")):
339
+ number = msisdn_from_tbcd(raw)
340
+ if number:
341
+ keys.add(globally_unique(IdKind.MSISDN, number))
342
+ # Rf/Gy 的 `Subscription-Id`:型別與資料是位置對位置的陣列,**只收型別 0(END_USER_E164)**。
343
+ # 型別 1 是 IMSI、2 是 SIP URI —— 同一個欄位裝著不同的號碼空間,不看型別就會把 IMSI 當門號。
344
+ kinds = _as_list(block.get("diameter_diameter_Subscription-Id-Type"))
345
+ for kind, data in zip(kinds, _as_list(block.get("diameter_diameter_Subscription-Id-Data"))):
346
+ if _to_int(kind) == _SUBSCRIPTION_ID_E164:
347
+ number = e164_digits(data)
348
+ if number:
349
+ keys.add(globally_unique(IdKind.MSISDN, number))
326
350
 
327
351
  return keys
328
352
 
329
353
 
354
+ #: `Subscription-Id-Type` 的 END_USER_E164(RFC 4006 §8.47)。
355
+ _SUBSCRIPTION_ID_E164 = 0
356
+
357
+
330
358
  def _as_list(value: Any) -> list[Any]:
331
359
  if value is None:
332
360
  return []
@@ -386,6 +414,11 @@ def parse(frame: Frame) -> list[Message]:
386
414
  session = first(block.get("diameter_diameter_Session-Id"))
387
415
  if session:
388
416
  detail["session-id"] = str(session)
417
+ icid = first(block.get("diameter_diameter_IMS-Charging-Identifier"))
418
+ if icid:
419
+ # Rf 的 ICID —— 與 SIP `P-Charging-Vector` 的 `icid-value` 是同一個值。
420
+ # **只當屬性**,理由見 `adapters/sip.py` 同名那段。
421
+ detail["icid"] = str(icid).strip()
389
422
 
390
423
  origin_host = str(first(block.get("diameter_diameter_Origin-Host")) or "").strip()
391
424
  destination_host = str(first(block.get("diameter_diameter_Destination-Host")) or "").strip()
@@ -0,0 +1,112 @@
1
+ """ENUM(RFC 6116)—— 一個電話號碼在 DNS 裡對到哪個 SIP 位址。
2
+
3
+ ## 為什麼它在一通 VoLTE 電話裡
4
+
5
+ S-CSCF(或 AS)拿到被叫的國際號碼之後,問 DNS 的 `e164.arpa` 這個號碼的 NAPTR 紀錄:
6
+ 有紀錄就是 IMS 內的用戶(`E2U+sip` → `sip:+…@ims.…`),沒有(NXDOMAIN)通常就往
7
+ PSTN 送。**被叫號碼怎麼被路由出去**這一步只在這裡看得到,少了它梯形圖在 INVITE 從
8
+ S-CSCF 出去之前會有一段看不出原因的空白。
9
+
10
+ ## 只收 ENUM,不收一般 DNS
11
+
12
+ `DISPLAY_FILTER` 只要 `e164.arpa` 底下的 NAPTR。一般 DNS(網元彼此解主機名)不屬於任何
13
+ 一個訂戶,收進來只會在每一條流程裡灑雜訊 —— 那一類照舊由 `coverage` 報「認得、沒有 adapter」。
14
+
15
+ ## 身分
16
+
17
+ 查詢名稱就是號碼反過來寫(`identity.msisdn_from_enum_name`),所以一問一答都帶同一把
18
+ `MSISDN` 鍵,與 Diameter 的 Sh/Cx/Rf 同一個號碼空間:同一個門號的 ENUM 與 HSS 查詢
19
+ 併成同一條流程。
20
+
21
+ ## 結局
22
+
23
+ `NXDOMAIN` **不是失敗** —— 那是「這個號碼不在 ENUM 裡」,正常的路由答案。`SERVFAIL`、
24
+ `REFUSED` 這種伺服器沒有回答問題的才算。
25
+ """
26
+
27
+ from __future__ import annotations
28
+
29
+ from typing import Any
30
+
31
+ from telcoladder.extract import Frame, first
32
+ from telcoladder.extract import to_int as _to_int
33
+ from telcoladder.identity import globally_unique, msisdn_from_enum_name
34
+ from telcoladder.model import NF_ROLE_HINTS_KEY, Endpoint, IdKey, IdKind, Message
35
+
36
+ NAME = "enum"
37
+
38
+ #: 排在 Diameter(35)與 SGsAP(36)之後:它是路由查詢,讀清單時與訂閱資料相鄰。
39
+ ORDER = 37
40
+
41
+ #: NAPTR(35)且名稱在 `e164.arpa` 底下。**漏了這個 adapter 一格都收不到,而且不會報錯。**
42
+ DISPLAY_FILTER = 'dns.qry.type == 35 && dns.qry.name matches "\\\\.e164\\\\.arpa$"'
43
+
44
+ DISSECTORS = ("dns",)
45
+
46
+ #: NAPTR 的 RR type。
47
+ _NAPTR = 35
48
+
49
+ #: 回應碼(RFC 1035 §4.1.1)。只列會影響判斷的幾個,其餘照號碼顯示。
50
+ _RCODES = {0: "NOERROR", 2: "SERVFAIL", 3: "NXDOMAIN", 5: "REFUSED"}
51
+
52
+ #: 這幾個不算失敗:有答案,或明確回答「沒有這個號碼」。
53
+ _NOT_FAILURES = frozenset({0, 3})
54
+
55
+
56
+ def _as_list(value: Any) -> list[Any]:
57
+ if value is None:
58
+ return []
59
+ return value if isinstance(value, list) else [value]
60
+
61
+
62
+ def parse(frame: Frame) -> list[Message]:
63
+ messages: list[Message] = []
64
+ for block in frame.layer("dns"):
65
+ name = str(first(block.get("dns_dns_qry_name")) or "").strip()
66
+ if _to_int(first(block.get("dns_dns_qry_type"))) != _NAPTR:
67
+ continue
68
+ number = msisdn_from_enum_name(name)
69
+ if number is None:
70
+ continue
71
+ response = str(first(block.get("dns_dns_flags_response"))).lower() in ("true", "1")
72
+ rcode = _to_int(first(block.get("dns_dns_flags_rcode"))) if response else None
73
+ txid = _to_int(first(block.get("dns_dns_id")))
74
+
75
+ keys: set[IdKey] = {globally_unique(IdKind.MSISDN, number)}
76
+ detail: dict[str, str] = {"enum-number": number, "query-name": name}
77
+ client, server = (frame.dst_ip, frame.src_ip) if response else (frame.src_ip, frame.dst_ip)
78
+ if server:
79
+ detail[NF_ROLE_HINTS_KEY] = f"{server}=ENUM"
80
+ if txid is not None:
81
+ detail["transaction-id"] = str(txid)
82
+ # 問與答配對、同一則多跳觀測去重的鑰匙(`procedures._distinct`);範圍是發問方。
83
+ detail["end-to-end-id"] = f"{client}/{txid}/{'R' if response else 'Q'}"
84
+ label = "ENUM Query"
85
+ if response:
86
+ label = "ENUM Response"
87
+ if rcode is not None:
88
+ detail["rcode"] = _RCODES.get(rcode, str(rcode))
89
+ if rcode != 0:
90
+ label = f"ENUM Response ({detail['rcode']})"
91
+ services = [str(s) for s in _as_list(block.get("dns_dns_naptr_service"))]
92
+ regexes = [str(r) for r in _as_list(block.get("dns_dns_naptr_regex"))]
93
+ if regexes:
94
+ # 答案的原文:`E2U+sip !^.*$!sip:+…@ims.…!`。路由到哪裡寫在這裡,不另外推。
95
+ detail["naptr"] = "\n".join(
96
+ f"{services[i] if i < len(services) else ''} {regex}".strip()
97
+ for i, regex in enumerate(regexes)
98
+ )
99
+
100
+ messages.append(Message(
101
+ frame=frame.number,
102
+ ts=frame.ts,
103
+ abs_ts=frame.abs_ts,
104
+ protocol=NAME,
105
+ src=Endpoint(frame.src_ip, frame.src_port),
106
+ dst=Endpoint(frame.dst_ip, frame.dst_port),
107
+ label=label,
108
+ identity_keys=frozenset(keys),
109
+ is_failure=rcode is not None and rcode not in _NOT_FAILURES,
110
+ detail=detail,
111
+ ))
112
+ return messages
@@ -39,7 +39,7 @@ from typing import Any
39
39
 
40
40
  from telcoladder.extract import Frame, first
41
41
  from telcoladder.extract import to_int as _to_int
42
- from telcoladder.identity import globally_unique, gtp_control_tunnel, gtp_tunnel
42
+ from telcoladder.identity import globally_unique, gtp_control_tunnel, gtp_tunnel, gtpv2_transaction
43
43
  from telcoladder.model import (
44
44
  NF_ROLE_HINTS_KEY,
45
45
  CauseRef,
@@ -51,14 +51,21 @@ from telcoladder.model import (
51
51
 
52
52
  NAME = "gtpv2"
53
53
 
54
- #: adapter 之間的排列順序(小的先跑)。它不載送任何協定,所以這個數字只是
55
- #: 呈現偏好 —— 挑 45 是為了與同屬承載/隧道家族的 pfcp(40)與 gtp(50)相鄰。
56
- ORDER = 45
54
+ #: adapter 之間的排列順序(小的先跑)。**這個數字有語意**:GTPv2-C 載送 NAS-EPS
55
+ #: (見 `CARRIES`),而契約要求載體排在載荷之前(`test_carrier_precedes_payload_in_adapter_order`),
56
+ #: 所以它必須小於 nas-eps 的 21。挑 13:s1ap 是 11,12 留給外掛測試用的假 adapter。
57
+ #: 同一格裡只有 GTPv2 與它夾帶的 NAS,這個數字不影響其他協定的呈現順序。
58
+ ORDER = 13
57
59
 
58
60
  #: 丟給 tshark 的 display filter 片段。**漏了這個,adapter 一格都收不到,
59
61
  #: 而且完全不會報錯**。
60
62
  DISPLAY_FILTER = "gtpv2"
61
63
 
64
+ #: 這個 adapter 載送的協定。Context Request 的 Complete Request Message IE 夾著 UE 原始的
65
+ #: TAU/Attach request(TS 29.274)—— 新 MME 把它轉給舊 MME/AMF 驗證。tshark 把它掛在
66
+ #: `gtpv2.nas-eps`;不宣告的話那幾則 NAS 一則都收不到(實測一份 MME trace:9 則),而且不報錯。
67
+ CARRIES = ("nas-eps",)
68
+
62
69
  #: `telcoladder check` 要驗證存在的 dissector。
63
70
  DISSECTORS = ("gtpv2",)
64
71
 
@@ -173,6 +180,14 @@ MESSAGE_TYPES: dict[int, str] = {
173
180
  244: "SRVCC CS to PS Cancel Acknowledge",
174
181
  }
175
182
 
183
+ #: 回應型的訊息(名稱以 Response/Acknowledge/Acknowledgement 結尾)。**由名稱推導,不手列**。
184
+ #: 交易鍵的方向靠它:回應的發起方是它的**收件者**。命令的 Failure Indication 也是回應,但刻意
185
+ #: 不收 —— 漏收只是那一則配不回命令,名稱規則之外再手列一份才是會漂的東西。
186
+ RESPONSE_TYPES: frozenset[int] = frozenset(
187
+ code for code, name in MESSAGE_TYPES.items()
188
+ if name.endswith(("Response", "Acknowledge", "Acknowledgement"))
189
+ )
190
+
176
191
  #: F-TEID 的介面型別裡,哪些是控制面。**由名稱推導,不手列**(含 `GTP-C`)——
177
192
  #: 手列的集合會與 tshark 的表漂,而漂了不會有人知道。
178
193
  CONTROL_PLANE_INTERFACES: frozenset[int] = frozenset([6, 7, 10, 11, 12, 13, 14, 17, 18, 24, 25, 26, 27, 30, 32, 35, 36, 40])
@@ -237,6 +252,11 @@ def _identity_keys(block: dict[str, Any], frame: Frame) -> frozenset[IdKey]:
237
252
  # **進 SUPI,不是另開一把 IMSI**(T3 的單向門,CLAUDE.md §12)。
238
253
  keys.add(globally_unique(IdKind.SUPI, str(imsi)))
239
254
 
255
+ # 交易鍵:標頭 TEID 為 0 的回應(對方找不到 context)只剩序號接得回請求。
256
+ transaction = _transaction_key(block, frame)
257
+ if transaction is not None:
258
+ keys.add(transaction)
259
+
240
260
  # 標頭的 TEID 是**收件者**配的 —— 範圍是目的位址(比照 `gtp.py`)。
241
261
  # **0 要跳過**:那是「還沒有 context」,不是一個真的端點;
242
262
  # 不跳的話每一則第一次的請求都會共用 `<dst>/0` 而被黏成一條。
@@ -266,6 +286,17 @@ def _identity_keys(block: dict[str, Any], frame: Frame) -> frozenset[IdKey]:
266
286
  return frozenset(keys)
267
287
 
268
288
 
289
+ def _transaction_key(block: dict[str, Any], frame: Frame) -> IdKey | None:
290
+ """這則訊息所屬的那筆交易(`identity.gtpv2_transaction`)。回應的發起方是它的收件者。"""
291
+ message_type = _to_int(block.get("gtpv2_gtpv2_message_type"))
292
+ if message_type is None:
293
+ return None
294
+ seq = block.get("gtpv2_gtpv2_seq")
295
+ if message_type in RESPONSE_TYPES:
296
+ return gtpv2_transaction(frame.dst_ip, frame.src_ip, seq)
297
+ return gtpv2_transaction(frame.src_ip, frame.dst_ip, seq)
298
+
299
+
269
300
  def _role_hints(block: dict[str, Any]) -> str:
270
301
  """從 F-TEID 的介面型別讀出「哪個位址是哪個網元」。
271
302
 
@@ -289,8 +320,7 @@ def _as_list(value: Any) -> list[Any]:
289
320
 
290
321
 
291
322
  def carrier_keys(block: dict[str, Any], frame: Frame) -> frozenset[IdKey]:
292
- """契約入口。目前沒有 adapter 宣告被 GTPv2-C 載送(它可以夾帶 NAS,
293
- 但那不在 T6 的範圍),入口先留著 —— 契約要求載體提供它。"""
323
+ """契約入口:被夾帶的 NAS 從這裡借 GTPv2-C 那一則的鑰匙(控制面 TEID、F-TEID、IMSI)。"""
294
324
  return _identity_keys(block, frame)
295
325
 
296
326
 
@@ -309,6 +339,8 @@ def parse(frame: Frame) -> list[Message]:
309
339
  if cause_value is not None else None)
310
340
 
311
341
  detail: dict[str, str] = {"message-type": str(message_type)}
342
+ # 回應完成這筆交易:之後同一個序號是新的一輪(`lifecycle`)。
343
+ done = _transaction_key(block, frame) if message_type in RESPONSE_TYPES else None
312
344
 
313
345
  # **線路上直接說了誰是誰。** 見 `model.NF_ROLE_HINTS_KEY`:
314
346
  # `nf.py` 通用處理這個鍵,不認得 GTPv2。
@@ -333,6 +365,7 @@ def parse(frame: Frame) -> list[Message]:
333
365
  dst=Endpoint(frame.dst_ip, frame.dst_port),
334
366
  label=label,
335
367
  identity_keys=_identity_keys(block, frame),
368
+ releases=frozenset({done}) if done is not None else frozenset(),
336
369
  cause=cause,
337
370
  is_failure=cause_value is not None and cause_value >= REJECTION_CAUSE_FROM,
338
371
  detail=detail,