laforge has submitted this change. ( https://gerrit.osmocom.org/c/libosmo-sigtran/+/40157?usp=email )
Change subject: cosmetic: osmo_sccp_user_bind() clarify prim_cb msgb ownership in documentation
......................................................................
cosmetic: osmo_sccp_user_bind() clarify prim_cb msgb ownership in documentation
Change-Id: I6dcda9221aa77809fe0f10e0e159558aad07885c
---
M src/sccp_user.c
1 file changed, 22 insertions(+), 4 deletions(-)
Approvals:
fixeria: Looks good to me, but someone else must approve
laforge: Looks good to me, approved
Jenkins Builder: Verified
diff --git a/src/sccp_user.c b/src/sccp_user.c
index b869dab..62ae9ed 100644
--- a/src/sccp_user.c
+++ b/src/sccp_user.c
@@ -92,9 +92,14 @@
/*! \brief Bind a SCCP User to a given Point Code
* \param[in] inst SCCP Instance
* \param[in] name human-readable name
+ * \param[in] prim_cb User provided callback to pass a primitive/msg up the stack
* \param[in] ssn Sub-System Number to bind to
* \param[in] pc Point Code to bind to, or OSMO_SS7_PC_INVALID if none.
- * \returns Callee-allocated SCCP User on success; negative otherwise */
+ * \returns Callee-allocated SCCP User on success; negative otherwise
+ *
+ * Ownership of oph->msg in prim_cb is transferred to the user of the
+ * registered callback when called.
+ */
static struct osmo_sccp_user *
sccp_user_bind_pc(struct osmo_sccp_instance *inst, const char *name,
osmo_prim_cb prim_cb, uint16_t ssn, uint32_t pc)
@@ -127,9 +132,14 @@
/*! \brief Bind a given SCCP User to a given SSN+PC
* \param[in] inst SCCP Instance
* \param[in] name human-readable name
+ * \param[in] prim_cb User provided callback to pass a primitive/msg up the stack
* \param[in] ssn Sub-System Number to bind to
* \param[in] pc Point Code to bind to
- * \returns Callee-allocated SCCP User on success; negative otherwise */
+ * \returns Callee-allocated SCCP User on success; negative otherwise
+ *
+ * Ownership of oph->msg in prim_cb is transferred to the user of the
+ * registered callback when called.
+ */
struct osmo_sccp_user *
osmo_sccp_user_bind_pc(struct osmo_sccp_instance *inst, const char *name,
osmo_prim_cb prim_cb, uint16_t ssn, uint32_t pc)
@@ -140,8 +150,13 @@
/*! \brief Bind a given SCCP User to a given SSN (at any PC)
* \param[in] inst SCCP Instance
* \param[in] name human-readable name
+ * \param[in] prim_cb User provided callback to pass a primitive/msg up the stack
* \param[in] ssn Sub-System Number to bind to
- * \returns Callee-allocated SCCP User on success; negative otherwise */
+ * \returns Callee-allocated SCCP User on success; negative otherwise
+ *
+ * Ownership of oph->msg in prim_cb is transferred to the user of the
+ * registered callback when called.
+ */
struct osmo_sccp_user *
osmo_sccp_user_bind(struct osmo_sccp_instance *inst, const char *name,
osmo_prim_cb prim_cb, uint16_t ssn)
@@ -175,7 +190,10 @@
/*! \brief Send a SCCP User SAP Primitive up to the User
* \param[in] scu SCCP User to whom to send the primitive
* \param[in] prim Primitive to send to the user
- * \returns return value of the SCCP User's prim_cb() function */
+ * \returns return value of the SCCP User's prim_cb() function
+ *
+ * Ownership of prim->oph->msg is passed to the user of the registered callback
+ */
int sccp_user_prim_up(struct osmo_sccp_user *scu, struct osmo_scu_prim *prim)
{
LOGP(DLSCCP, LOGL_DEBUG, "Delivering %s to SCCP User '%s'\n",
--
To view, visit https://gerrit.osmocom.org/c/libosmo-sigtran/+/40157?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: libosmo-sigtran
Gerrit-Branch: master
Gerrit-Change-Id: I6dcda9221aa77809fe0f10e0e159558aad07885c
Gerrit-Change-Number: 40157
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
laforge has submitted this change. ( https://gerrit.osmocom.org/c/python/pyosmocom/+/40117?usp=email )
Change subject: osmocom.construct: Bytes + GreedyBytes with automatic hexstring-conversion
......................................................................
osmocom.construct: Bytes + GreedyBytes with automatic hexstring-conversion
This is a convenience version of the Bytes / GreedyBytes construct
that accepts not only a bytes/bytearray object, but also a hex-encoded
string within the encoder.
Related: OS#6774
Change-Id: I59f500c925848872a7fa38d6dbf3d6ea72bc3a90
---
M src/osmocom/construct.py
1 file changed, 16 insertions(+), 2 deletions(-)
Approvals:
fixeria: Looks good to me, but someone else must approve
Jenkins Builder: Verified
osmith: Looks good to me, approved
diff --git a/src/osmocom/construct.py b/src/osmocom/construct.py
index 7a2851a..5e062c3 100644
--- a/src/osmocom/construct.py
+++ b/src/osmocom/construct.py
@@ -10,9 +10,10 @@
# pylint: disable=import-error,no-name-in-module
from construct.lib.containers import Container, ListContainer
from construct.core import EnumIntegerString
-from construct import Adapter, Prefixed, Int8ub, GreedyBytes, Default, Flag, Byte, Construct, Enum
-from construct import BitsInteger, BitStruct, Bytes, StreamError, stream_read_entire, stream_write
+from construct import Adapter, Prefixed, Int8ub, Default, Flag, Byte, Construct, Enum
+from construct import BitsInteger, BitStruct, StreamError, stream_read_entire, stream_write
from construct import SizeofError, IntegerError, swapbytes
+import construct
from construct.core import evaluate
from construct.lib import integertypes
@@ -33,6 +34,19 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
+class Bytes(construct.Bytes):
+ """Just like construct.Bytes but supporting hex-string input."""
+ def _build(self, obj, stream, context, path):
+ data = h2b(obj) if isinstance(obj, str) else obj
+ return super()._build(data, stream, context, path)
+
+(a)construct.core.singleton
+class GreedyBytes(construct.GreedyBytes.__class__):
+ """Just like construct.GreedyBytes but supporting hex-string input."""
+ def _build(self, obj, stream, context, path):
+ data = h2b(obj) if isinstance(obj, str) else obj
+ return super()._build(data, stream, context, path)
+
class HexAdapter(Adapter):
"""convert a bytes() type to a string of hex nibbles."""
--
To view, visit https://gerrit.osmocom.org/c/python/pyosmocom/+/40117?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: python/pyosmocom
Gerrit-Branch: master
Gerrit-Change-Id: I59f500c925848872a7fa38d6dbf3d6ea72bc3a90
Gerrit-Change-Number: 40117
Gerrit-PatchSet: 3
Gerrit-Owner: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter <pmaier(a)sysmocom.de>
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Attention is currently required from: lynxis lazus, pespin.
neels has posted comments on this change by pespin. ( https://gerrit.osmocom.org/c/osmo-hnbgw/+/40162?usp=email )
Change subject: rua: Handle event TX_DIRECT_TRANSFER in disconnected state discarding msg
......................................................................
Patch Set 1:
(4 comments)
Patchset:
PS1:
IMHO this patch should not modify the event handler function,
but only add the event to the list of permitted events.
The larger part of this patch seems like a workaround for a customer not providing a pcap...
File src/osmo-hnbgw/context_map_rua.c:
https://gerrit.osmocom.org/c/osmo-hnbgw/+/40162/comment/3b3c727c_fcfaf6e7?u… :
PS1, Line 285: condition
We have data to be sent out on RUA, but RUA is already disconnected.
This can happen for any forsaken reason (RAN disconnected, CN disconnected, something went wrong on layer 2, ...) and we can't make any detailed statement here other than that.
I believe this isn't called a race condition, is it
https://gerrit.osmocom.org/c/osmo-hnbgw/+/40162/comment/f62ebfa0_021631e9?u… :
PS1, Line 290: msgb_l2len(ranap_msg), osmo_hexdump(msgb_l2(ranap_msg), msgb_l2len(ranap_msg)));
I think we should not print entire messages' hexdump on NOTICE.
can we put the log message on DEBUG instead?
It might make sense to log the dry fact on NOTICE,
and additionally, separately the hexdump on DEBUG,
and sanity-limit the hexdump length?
https://gerrit.osmocom.org/c/osmo-hnbgw/+/40162/comment/ddeb620e_8eea5a36?u… :
PS1, Line 295: all
it's no longer all events
--
To view, visit https://gerrit.osmocom.org/c/osmo-hnbgw/+/40162?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: osmo-hnbgw
Gerrit-Branch: master
Gerrit-Change-Id: Id68f219ce776fbbfaa80d3b3ed976f48bef4f883
Gerrit-Change-Number: 40162
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: lynxis lazus <lynxis(a)fe80.eu>
Gerrit-Reviewer: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: lynxis lazus <lynxis(a)fe80.eu>
Gerrit-Comment-Date: Sun, 27 Apr 2025 03:42:17 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No