aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc
diff options
context:
space:
mode:
authorNeels Hofmeyr <nhofmeyr@sysmocom.de>2016-04-19 22:24:47 +0200
committerNeels Hofmeyr <nhofmeyr@sysmocom.de>2016-04-19 22:24:47 +0200
commit5d5a25bc5aed88900a7b26d4c8ddbbb53fbe4945 (patch)
tree9bc0f05c65dbcda362a30239678fcdcc309f9b57 /openbsc
parent95c9f296346d14e1362d95776b7339c02499610a (diff)
iu.h: add iu_link_del()
Diffstat (limited to 'openbsc')
-rw-r--r--openbsc/include/openbsc/iu.h2
-rw-r--r--openbsc/src/libiu/iu.c15
2 files changed, 17 insertions, 0 deletions
diff --git a/openbsc/include/openbsc/iu.h b/openbsc/include/openbsc/iu.h
index b261cb0ed..f9c5a2e28 100644
--- a/openbsc/include/openbsc/iu.h
+++ b/openbsc/include/openbsc/iu.h
@@ -37,6 +37,8 @@ typedef int (* iu_rab_ass_resp_cb_t )(struct ue_conn_ctx *ue_ctx, uint8_t rab_id
int iu_init(void *ctx, const char *listen_addr, uint16_t listen_port,
iu_recv_cb_t iu_recv_cb, iu_event_cb_t iu_event_cb);
+void iu_link_del(struct osmo_sua_link *link);
+
int iu_tx(struct msgb *msg, uint8_t sapi);
int iu_rab_act_cs(struct ue_conn_ctx *ue_ctx, uint32_t rtp_ip, uint16_t rtp_port);
diff --git a/openbsc/src/libiu/iu.c b/openbsc/src/libiu/iu.c
index 20590766a..2a6196193 100644
--- a/openbsc/src/libiu/iu.c
+++ b/openbsc/src/libiu/iu.c
@@ -62,6 +62,21 @@ struct ue_conn_ctx *ue_conn_ctx_find(struct osmo_sua_link *link,
return NULL;
}
+/* Discard/invalidate all ue_conn_ctx entries that reference the
+ * given link, since this link is invalid and about to be deallocated. For
+ * each ue_conn_ctx, invoke the iu_event_cb_t with IU_EVENT_LINK_INVALIDATED.
+ */
+void iu_link_del(struct osmo_sua_link *link)
+{
+ struct ue_conn_ctx *uec, *uec_next;
+ llist_for_each_entry_safe(uec, uec_next, &ue_conn_ctx_list, list) {
+ if (uec->link != link)
+ continue;
+ uec->link = NULL;
+ global_iu_event_cb(uec, IU_EVENT_LINK_INVALIDATED, NULL);
+ }
+}
+
/***********************************************************************
* RANAP handling
***********************************************************************/