SIGTRAN: add osmo_sccp_tx_disconn_data() helper
SCCP RLSD message might have up to 130 bytes of optional data according to ITU-T Rec Q.713 §4.5 - add helper which allows sending it and use it in example code. Related: OS#5579 Change-Id: I92ae22d2cab5863245fba3d904a300055fda34fe
This commit is contained in:
parent
768f36440f
commit
bb760c5915
|
@ -94,14 +94,16 @@ DEFUN(scu_unitdata_req, scu_unitdata_req_cmd,
|
|||
}
|
||||
|
||||
DEFUN(scu_disc_req, scu_disc_req_cmd,
|
||||
"disconnect-req <0-16777216>",
|
||||
"disconnect-req <0-16777216> [DATA]",
|
||||
"N-DISCONNT.req\n"
|
||||
"Connection ID\n")
|
||||
"Connection ID\n"
|
||||
"Optional Data\n")
|
||||
{
|
||||
struct osmo_sccp_user *scu = vty->index;
|
||||
int conn_id = atoi(argv[0]);
|
||||
|
||||
osmo_sccp_tx_disconn(scu, conn_id, NULL, 42);
|
||||
osmo_sccp_tx_disconn_data(scu, conn_id, NULL, 42, (const uint8_t *)argv[1], (argc > 1) ? strlen(argv[1]) + 1 : 0);
|
||||
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
|
@ -44,6 +44,10 @@ int osmo_sccp_tx_disconn(struct osmo_sccp_user *scu, uint32_t conn_id,
|
|||
const struct osmo_sccp_addr *resp_addr,
|
||||
uint32_t cause);
|
||||
|
||||
int osmo_sccp_tx_disconn_data(struct osmo_sccp_user *scu, uint32_t conn_id,
|
||||
const struct osmo_sccp_addr *resp_addr,
|
||||
uint32_t cause, const uint8_t *data, size_t len);
|
||||
|
||||
int osmo_sccp_tx_conn_resp_msg(struct osmo_sccp_user *scu, uint32_t conn_id,
|
||||
const struct osmo_sccp_addr *resp_addr,
|
||||
struct msgb *msg);
|
||||
|
|
|
@ -193,9 +193,9 @@ int osmo_sccp_tx_data_msg(struct osmo_sccp_user *scu, uint32_t conn_id,
|
|||
}
|
||||
|
||||
/* N-DISCONNECT.req */
|
||||
int osmo_sccp_tx_disconn(struct osmo_sccp_user *scu, uint32_t conn_id,
|
||||
const struct osmo_sccp_addr *resp_addr,
|
||||
uint32_t cause)
|
||||
int osmo_sccp_tx_disconn_data(struct osmo_sccp_user *scu, uint32_t conn_id,
|
||||
const struct osmo_sccp_addr *resp_addr,
|
||||
uint32_t cause, const uint8_t *data, size_t len)
|
||||
{
|
||||
struct msgb *msg;
|
||||
struct osmo_scu_prim *prim;
|
||||
|
@ -219,9 +219,21 @@ int osmo_sccp_tx_disconn(struct osmo_sccp_user *scu, uint32_t conn_id,
|
|||
param->conn_id = conn_id;
|
||||
param->cause = cause;
|
||||
|
||||
if (data && len) {
|
||||
msg->l2h = msgb_put(msg, len);
|
||||
memcpy(msg->l2h, data, len);
|
||||
}
|
||||
|
||||
return osmo_sccp_user_sap_down(scu, &prim->oph);
|
||||
}
|
||||
|
||||
int osmo_sccp_tx_disconn(struct osmo_sccp_user *scu, uint32_t conn_id,
|
||||
const struct osmo_sccp_addr *resp_addr,
|
||||
uint32_t cause)
|
||||
{
|
||||
return osmo_sccp_tx_disconn_data(scu, conn_id, resp_addr, cause, NULL, 0);
|
||||
}
|
||||
|
||||
/* N-CONNECT.resp */
|
||||
int osmo_sccp_tx_conn_resp_msg(struct osmo_sccp_user *scu, uint32_t conn_id,
|
||||
const struct osmo_sccp_addr *resp_addr,
|
||||
|
|
Loading…
Reference in New Issue