pespin has submitted this change. ( https://gerrit.osmocom.org/c/libosmo-sigtran/+/43806?usp=email )
Change subject: sccp: Introduce N-NOTICE.ind Reason for return ......................................................................
sccp: Introduce N-NOTICE.ind Reason for return
The SCCP-User SAP primitive N-NOTICE.ind carries a "Reason for return" field, described in ITU Q.711 6.2.2.2.4 Reason for return.
According to Q.713 A.5 Return cause: "There is a one-to-one mapping between the return cause of UDTS, XUDTS or LUDTS messages and the reason for return in the N-NOTICE primitives".
Still, even if the values can be mapped one to one, the SCCP-User field is a field conceptually different than the return cause field sent over the wire in SCCP messages. Hence, add a new enum to sccp_sap.h so that users of SCCP-User can match existing values without having to use unintended sccp_types.h, which holds wire-format SCCP stuff.
Related: OS#2601 Change-Id: I492df5b57bdeefc02b334c4a4db3ca346767dc60 --- M TODO-RELEASE M include/osmocom/sccp/sccp_types.h M include/osmocom/sigtran/sccp_sap.h M src/sccp_sap.c M src/sccp_sclc.c 5 files changed, 58 insertions(+), 3 deletions(-)
Approvals: Jenkins Builder: Verified fixeria: Looks good to me, approved osmith: Looks good to me, but someone else must approve
diff --git a/TODO-RELEASE b/TODO-RELEASE index 22fd2f9..ac06fda 100644 --- a/TODO-RELEASE +++ b/TODO-RELEASE @@ -9,3 +9,4 @@ #library what description / commit summary line libosmocore >1.14.2 new VTY node L_CS7_QOS_CLASS_NODE added libosmo-sigtran added enum osmo_sccp_reset_reason_*, enum osmo_sccp_release_reason_* +libosmo-sigtran added enum osmo_sccp_return_reason diff --git a/include/osmocom/sccp/sccp_types.h b/include/osmocom/sccp/sccp_types.h index ab688b3..8e76568 100644 --- a/include/osmocom/sccp/sccp_types.h +++ b/include/osmocom/sccp/sccp_types.h @@ -231,7 +231,10 @@ static inline const char *osmo_sccp_release_cause_name(enum sccp_release_cause val) { return get_value_string(osmo_sccp_release_cause_names, val); }
-/* ITU-T Q.713, Section 3.12 Return cause */ +/* ITU-T Q.713, Section 3.12 Return cause + * Q.713 A.5 Return cause: "There is a one-to-one mapping between the return + * cause of UDTS, XUDTS or LUDTS messages and the reason for return in the + * N-NOTICE primitives" (Q.711 6.2.2.2.4 Reason for return) */ enum sccp_return_cause { SCCP_RETURN_CAUSE_NO_TRANSLATION_NATURE = 0, SCCP_RETURN_CAUSE_NO_TRANSLATION = 1, diff --git a/include/osmocom/sigtran/sccp_sap.h b/include/osmocom/sigtran/sccp_sap.h index d8ee43e..12bb602 100644 --- a/include/osmocom/sigtran/sccp_sap.h +++ b/include/osmocom/sigtran/sccp_sap.h @@ -198,6 +198,31 @@ OSMO_SCCP_REL_REASON_UNDEFINED = 0x100, };
+/* Q.711 6.2.2.2.4 Reason for return. + * Q.713 A.5 Return cause: "There is a one-to-one mapping between the return + * cause of UDTS, XUDTS or LUDTS messages and the reason for return in the + * N-NOTICE primitives" (ITU-T Q.713, Section 3.12 Return cause) */ +enum osmo_sccp_return_reason { + OSMO_SCCP_RETURN_REASON_NO_TRANSLATION_NATURE = 0, + OSMO_SCCP_RETURN_REASON_NO_TRANSLATION = 1, + OSMO_SCCP_RETURN_REASON_SUBSYSTEM_CONGESTION = 2, + OSMO_SCCP_RETURN_REASON_SUBSYSTEM_FAILURE = 3, + OSMO_SCCP_RETURN_REASON_UNEQUIPPED_USER = 4, + OSMO_SCCP_RETURN_REASON_MTP_FAILURE = 5, + OSMO_SCCP_RETURN_REASON_NETWORK_CONGESTION = 6, + OSMO_SCCP_RETURN_REASON_UNQUALIFIED = 7, + OSMO_SCCP_RETURN_REASON_ERROR_IN_MSG_TRANSPORT = 8, + OSMO_SCCP_RETURN_REASON_ERROR_IN_LOCAL_PROCESSING = 9, + OSMO_SCCP_RETURN_REASON_DEST_CANNOT_PERFORM_REASSEMBLY = 10, + OSMO_SCCP_RETURN_REASON_SCCP_FAILURE = 11, + OSMO_SCCP_RETURN_REASON_HOP_COUNTER_VIOLATION = 12, + OSMO_SCCP_RETURN_REASON_SEGMENTATION_NOT_SUPPORTED = 13, + OSMO_SCCP_RETURN_REASON_SEGMENTATION_FAILURE = 14 +}; +extern const struct value_string osmo_sccp_return_reason_names[]; +static inline const char *osmo_sccp_return_reason_name(enum osmo_sccp_return_reason val) +{ return get_value_string(osmo_sccp_return_reason_names, val); } + /* Q.711 6.3.2.2.5 Signalling point status */ enum osmo_sccp_sp_status { OSMO_SCCP_SP_S_INACCESSIBLE = 1, @@ -320,8 +345,7 @@ struct osmo_scu_notice_param { struct osmo_sccp_addr called_addr; struct osmo_sccp_addr calling_addr; - /* ITU Q.711 6.2.2.2.4 "Reason for return": - * enum sccp_return_cause (ITU Q.713 3.12), as per ITU Q.713 A.5. */ + /* ITU Q.711 6.2.2.2.4 "Reason for return" (enum osmo_sccp_return_reason): */ uint32_t cause; uint32_t importance; /* ITU Q.711 6.2.2.2.6, Q.713 3.19 */ /* user data */ diff --git a/src/sccp_sap.c b/src/sccp_sap.c index 95d2070..d0e0974 100644 --- a/src/sccp_sap.c +++ b/src/sccp_sap.c @@ -506,6 +506,29 @@ } }
+/* Q.711 6.2.2.2.4 Reason for return. + * Q.713 A.5 Return cause: "There is a one-to-one mapping between the return + * cause of UDTS, XUDTS or LUDTS messages and the reason for return in the + * N-NOTICE primitives" (ITU-T Q.713, Section 3.12 Return cause) + */ +const struct value_string osmo_sccp_return_reason_names[] = { + { OSMO_SCCP_RETURN_REASON_NO_TRANSLATION_NATURE, "no translation for an address of such nature" }, + { OSMO_SCCP_RETURN_REASON_NO_TRANSLATION, "no translation for this specific address" }, + { OSMO_SCCP_RETURN_REASON_SUBSYSTEM_CONGESTION, "subsystem congestion" }, + { OSMO_SCCP_RETURN_REASON_SUBSYSTEM_FAILURE, "subsystem failure" }, + { OSMO_SCCP_RETURN_REASON_UNEQUIPPED_USER, "unequipped user" }, + { OSMO_SCCP_RETURN_REASON_MTP_FAILURE, "MTP failure" }, + { OSMO_SCCP_RETURN_REASON_NETWORK_CONGESTION, "network congestion" }, + { OSMO_SCCP_RETURN_REASON_UNQUALIFIED, "unqualified" }, + { OSMO_SCCP_RETURN_REASON_ERROR_IN_MSG_TRANSPORT, "error in message transport" }, + { OSMO_SCCP_RETURN_REASON_ERROR_IN_LOCAL_PROCESSING, "error in local processing" }, + { OSMO_SCCP_RETURN_REASON_DEST_CANNOT_PERFORM_REASSEMBLY, "destination cannot perform reassembly" }, + { OSMO_SCCP_RETURN_REASON_SCCP_FAILURE, "SCCP failure" }, + { OSMO_SCCP_RETURN_REASON_HOP_COUNTER_VIOLATION, "hop counter violation" }, + { OSMO_SCCP_RETURN_REASON_SEGMENTATION_NOT_SUPPORTED, "segmentation not supported" }, + { OSMO_SCCP_RETURN_REASON_SEGMENTATION_FAILURE, "segmentation failure" }, + {} +};
/* get the Connection ID of the given SCU primitive */ static uint32_t scu_prim_conn_id(const struct osmo_scu_prim *prim) diff --git a/src/sccp_sclc.c b/src/sccp_sclc.c index 704c4bb..1d821f0 100644 --- a/src/sccp_sclc.c +++ b/src/sccp_sclc.c @@ -287,6 +287,10 @@ }
param->importance = xua_msg_get_u32(xua, SUA_IEI_IMPORTANCE); + /* Q.713 A.5 Return cause: "There is a one-to-one mapping between the + * return cause of UDTS, XUDTS or LUDTS messages and the reason for return in + * the N-NOTICE primitives" + */ param->cause = xua_msg_get_u32(xua, SUA_IEI_CAUSE) & ~SUA_CAUSE_T_MASK;
scu = sccp_user_find(inst, param->called_addr.ssn,