gb: Separate nsvc creation from NS message processing
This patch refactors gprs_ns_rcvmsg() by moving the parts relevant to
the NS messages into the new functions gprs_ns_vc_create() (nsvc
object creation) and gprs_ns_process_msg() (main NS automaton). These
do not contain code that directly depends on the link layer (they
call other functions that still do). This reduces the gprs_ns_rcvmsg()
function to calling these two functions and optionally setting up the
link layer specific fields of the nsvc.
Sponsored-by: On-Waves ehf
diff --git a/include/osmocom/gprs/gprs_ns.h b/include/osmocom/gprs/gprs_ns.h
index 8ca5a88..c709312 100644
--- a/include/osmocom/gprs/gprs_ns.h
+++ b/include/osmocom/gprs/gprs_ns.h
@@ -49,6 +49,15 @@
GPRS_NS_EVT_UNIT_DATA,
};
+/*! \brief Osmocom NS VC create status */
+enum gprs_ns_cs {
+ GPRS_NS_CS_CREATED, /*!< A NSVC object has been created */
+ GPRS_NS_CS_FOUND, /*!< A NSVC object has been found */
+ GPRS_NS_CS_REJECTED, /*!< Rejected and answered message */
+ GPRS_NS_CS_SKIPPED, /*!< Skipped message */
+ GPRS_NS_CS_ERROR, /*!< Failed to process message */
+};
+
struct gprs_nsvc;
/*! \brief Osmocom GPRS callback function type */
typedef int gprs_ns_cb_t(enum gprs_ns_evt event, struct gprs_nsvc *nsvc,