aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/include/openbsc/msc_ifaces.h
diff options
context:
space:
mode:
authorNeels Hofmeyr <nhofmeyr@sysmocom.de>2016-02-12 14:28:11 +0100
committerNeels Hofmeyr <nhofmeyr@sysmocom.de>2016-03-03 16:19:10 +0100
commit23e7f28c5c77a57aad5331c5e27b29e2eccfe7c3 (patch)
treefcef687b7a5207016fed467a5d6d188885515ae5 /openbsc/include/openbsc/msc_ifaces.h
parent243c7cb044c489b62d3cd4ad3631822d270989a8 (diff)
mscsplit: getting grips on header scopes
Diffstat (limited to 'openbsc/include/openbsc/msc_ifaces.h')
-rw-r--r--openbsc/include/openbsc/msc_ifaces.h41
1 files changed, 34 insertions, 7 deletions
diff --git a/openbsc/include/openbsc/msc_ifaces.h b/openbsc/include/openbsc/msc_ifaces.h
index dc2b9e1da..2dee3918a 100644
--- a/openbsc/include/openbsc/msc_ifaces.h
+++ b/openbsc/include/openbsc/msc_ifaces.h
@@ -9,28 +9,55 @@
* 2G will use the A-interface,
* 3G aka UMTS will use the Iu-interface (for the MSC, it's IuCS).
*
- * Below callback structures allows linking parts of the MSC code without
+ * Below callback structures allow linking parts of the MSC code without
* having to include entire infrastructures of external libraries. For example,
* a unit test does not need to link against external ASN1 libraries if it is
* never going to encode actual outgoing messages. It is up to each building
- * scope to plug real world functions or to have mere dummy implementations. */
+ * scope to plug real world functions or to have mere dummy implementations.
+ *
+ * For example, for msc_tx_foo(ifaces, conn, msg), depending on
+ * conn->via_iface, either ifaces->a.tx() or ifaces.iu_cs.tx() is called to
+ * dispatch the msg.
+ *
+ * To replace the default dummy implementations, a user would do the likes of:
+ *
+ * int my_iu_cs_tx(...)
+ * {
+ * ...
+ * }
+ *
+ * int main(void)
+ * {
+ * global_msc_ifaces->network = my_network;
+ * global_msc_ifaces->iu_cs.tx = my_iu_cs_tx;
+ * ...
+ * }
+ *
+ * (or use readily available implementations like iu_tx() from libiu)
+ */
+
+struct msc_ifaces {
-extern struct {
+ /* global gsm_network to lookup BSC|RNC connections etc. */
+ struct gsm_network *network;
struct {
/* libmsc calls this to send out messages to an A-interface */
int (*tx)(struct msgb *msg, uint8_t sapi);
+ /* TODO: I don't understand sapi yet, may not apply to A-iface */
} a;
struct {
/* libmsc calls this to send out messages to an Iu-interface */
int (*tx)(struct msgb *msg, uint8_t sapi);
+ /* TODO: I don't understand sapi yet */
} iu_cs;
-} msc_ifaces;
+};
+
+extern struct msc_ifaces *global_msc_ifaces;
+int msc_tx_dtap(struct gsm_subscriber_connection *conn,
+ struct msgb *msg);
-/* Depending on conn->via_iface (A or IuCS), submit msg to the proper link api. */
-extern int msc_submit_dtap(struct gsm_subscriber_connection *conn,
- struct msgb *msg);