This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
Max gerrit-no-reply at lists.osmocom.orgMax has submitted this change and it was merged. ( https://gerrit.osmocom.org/11929 ) Change subject: ctrl: add function to skip TRAP messages ...................................................................... ctrl: add function to skip TRAP messages This allows to easy skip TRAP messages when we do not want to process them (for example when waiting for REPLY to a single command). Update documentation and version accordingly. Change-Id: I51ce207c19a1ca96c3e2af7d5efd64f79b02fbb4 --- M osmopy/osmo_ipa.py 1 file changed, 17 insertions(+), 2 deletions(-) Approvals: Jenkins Builder: Verified Pau Espin Pedrol: Looks good to me, approved diff --git a/osmopy/osmo_ipa.py b/osmopy/osmo_ipa.py index c371023..f957f41 100755 --- a/osmopy/osmo_ipa.py +++ b/osmopy/osmo_ipa.py @@ -2,7 +2,7 @@ # -*- mode: python-mode; py-indent-tabs-mode: nil -*- """ /* - * Copyright (C) 2016 sysmocom s.f.m.c. GmbH + * Copyright (C) 2016-2018 sysmocom s.f.m.c. GmbH * * All Rights Reserved * @@ -28,7 +28,7 @@ """ Stateless IPA protocol multiplexer: add/remove/parse (extended) header """ - version = "0.0.6" + version = "0.0.7" TCP_PORT_OML = 3002 TCP_PORT_RSL = 3003 # OpenBSC extensions: OSMO, MGCP_OLD @@ -114,6 +114,21 @@ return struct.unpack('>HBB', data[:4]) + (data[4:], ) # length, protocol, extension, data return dlen, proto, None, data[3:] # length, protocol, _, data + def skip_traps(self, data): + """ + Take one or more ctrl messages and data and return first non-TRAP message or None + """ + if data == None or len(data) == 0: + return None + + (head, tail) = self.split_combined(data) + (length, _, _, payload) = self.del_header(head) + # skip over broken messages as well as TRAPs + if length == 0 or payload[:(length + 3)].decode('utf-8').startswith(self.CTRL_TRAP): + return self.skip_traps(tail) + + return head + def split_combined(self, data): """ Split the data which contains multiple concatenated IPA messages into tuple (first, rest) where 'rest' contains -- To view, visit https://gerrit.osmocom.org/11929 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: python/osmo-python-tests Gerrit-Branch: master Gerrit-MessageType: merged Gerrit-Change-Id: I51ce207c19a1ca96c3e2af7d5efd64f79b02fbb4 Gerrit-Change-Number: 11929 Gerrit-PatchSet: 4 Gerrit-Owner: Max <msuraev at sysmocom.de> Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org> Gerrit-Reviewer: Jenkins Builder (1000002) Gerrit-Reviewer: Max <msuraev at sysmocom.de> Gerrit-Reviewer: Pau Espin Pedrol <pespin at sysmocom.de> Gerrit-Reviewer: daniel <dwillmann at sysmocom.de> -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20181128/42f7c47a/attachment.htm>