From 84b8162cde174ff02eb46cf6cba0fe7b449c5528 Mon Sep 17 00:00:00 2001 From: Christian Spielberger Date: Mon, 23 Oct 2023 11:34:47 +0200 Subject: [PATCH 1/3] sess: add sipsess_ack_pending() can be used for unit tests --- include/re_sipsess.h | 1 + src/sipsess/sess.c | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/include/re_sipsess.h b/include/re_sipsess.h index 28cc2b6cc..87006197b 100644 --- a/include/re_sipsess.h +++ b/include/re_sipsess.h @@ -73,3 +73,4 @@ bool sipsess_refresh_allowed(const struct sipsess *sess); void sipsess_close_all(struct sipsess_sock *sock); struct sip_dialog *sipsess_dialog(const struct sipsess *sess); void sipsess_abort(struct sipsess *sess); +bool sipsess_ack_pending(const struct sipsess *sess); diff --git a/src/sipsess/sess.c b/src/sipsess/sess.c index e919e0d65..511a6e062 100644 --- a/src/sipsess/sess.c +++ b/src/sipsess/sess.c @@ -352,3 +352,9 @@ bool sipsess_refresh_allowed(const struct sipsess *sess) return ((sess->established || sess->refresh_allowed) && !sess->terminated && !sess->awaiting_answer); } + + +bool sipsess_ack_pending(const struct sipsess *sess) +{ + return sess->replyl.head ? true : false; +} From 5fe0dff2839ece862b5aa84398674eeb54b7f416 Mon Sep 17 00:00:00 2001 From: Christian Spielberger Date: Mon, 23 Oct 2023 11:42:15 +0200 Subject: [PATCH 2/3] sess: add NULL pointer check --- src/sipsess/sess.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sipsess/sess.c b/src/sipsess/sess.c index 511a6e062..85ed42fc4 100644 --- a/src/sipsess/sess.c +++ b/src/sipsess/sess.c @@ -356,5 +356,5 @@ bool sipsess_refresh_allowed(const struct sipsess *sess) bool sipsess_ack_pending(const struct sipsess *sess) { - return sess->replyl.head ? true : false; + return sess && sess->replyl.head ? true : false; } From 71d7193d16c673fa84342a2702daa1373a66e0c0 Mon Sep 17 00:00:00 2001 From: Christian Spielberger Date: Mon, 23 Oct 2023 11:53:46 +0200 Subject: [PATCH 3/3] sess: add doxygen to sipsess_ack_pending() --- src/sipsess/sess.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/sipsess/sess.c b/src/sipsess/sess.c index 85ed42fc4..bb62db33c 100644 --- a/src/sipsess/sess.c +++ b/src/sipsess/sess.c @@ -354,6 +354,14 @@ bool sipsess_refresh_allowed(const struct sipsess *sess) } +/** + * Return true if there is an open SIP Session Reply for which an ACK is + * expected + * + * @param sess SIP Session + * + * @return True if ACK is pending, otherwise false + */ bool sipsess_ack_pending(const struct sipsess *sess) { return sess && sess->replyl.head ? true : false;