From 8064a463c944f90babab59ab9de54677f6203b65 Mon Sep 17 00:00:00 2001 From: matt335672 <30179339+matt335672@users.noreply.github.com> Date: Wed, 22 Mar 2023 14:48:20 +0000 Subject: [PATCH] libipm: Add libipm_change_facility() call --- libipm/libipm.c | 22 ++++++++++++++++++++++ libipm/libipm.h | 20 ++++++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/libipm/libipm.c b/libipm/libipm.c index 737d7e5f..7d56f196 100644 --- a/libipm/libipm.c +++ b/libipm/libipm.c @@ -216,3 +216,25 @@ libipm_clear_flags(struct trans *trans, unsigned int flags) priv->flags &= ~flags; } } + +/*****************************************************************************/ + +void +libipm_change_facility(struct trans *trans, + enum libipm_facility old_facility, + enum libipm_facility new_facility) +{ + struct libipm_priv *priv = (struct libipm_priv *)trans->extra_data; + + if (priv != NULL) + { + if (priv->facility != old_facility) + { + LOG(LOG_LEVEL_WARNING, "Not changing libipm facility - bad value"); + } + else + { + priv->facility = new_facility; + } + } +} diff --git a/libipm/libipm.h b/libipm/libipm.h index 6f9ace7e..fb75fc97 100644 --- a/libipm/libipm.h +++ b/libipm/libipm.h @@ -119,6 +119,26 @@ libipm_set_flags(struct trans *trans, unsigned int flags); void libipm_clear_flags(struct trans *trans, unsigned int flags); + +/** + * Change the facility number for the transport + * @param trans libipm transport + * @param old_facility old transport facility + * @param new_facility new transport facility + * + * This call is required if a libipm transport changes a facility number. + * This can be used to implement switches from one functional server state to + * another. + * + * The caller must be aware of the previous facility to change the facility. + * In the event of a mismatch, a message is logged and no action is taken. + */ +void +libipm_change_facility(struct trans *trans, + enum libipm_facility old_facility, + enum libipm_facility new_facility); + + /** * Initialise an output message *