diff options
author | Neels Hofmeyr <nhofmeyr@sysmocom.de> | 2016-02-12 14:28:11 +0100 |
---|---|---|
committer | Neels Hofmeyr <nhofmeyr@sysmocom.de> | 2016-03-03 16:19:10 +0100 |
commit | 23e7f28c5c77a57aad5331c5e27b29e2eccfe7c3 (patch) | |
tree | fcef687b7a5207016fed467a5d6d188885515ae5 /openbsc/include | |
parent | 243c7cb044c489b62d3cd4ad3631822d270989a8 (diff) |
mscsplit: getting grips on header scopes
Diffstat (limited to 'openbsc/include')
-rw-r--r-- | openbsc/include/openbsc/Makefile.am | 2 | ||||
-rw-r--r-- | openbsc/include/openbsc/iu_cs.h | 2 | ||||
-rw-r--r-- | openbsc/include/openbsc/msc_ifaces.h | 41 |
3 files changed, 35 insertions, 10 deletions
diff --git a/openbsc/include/openbsc/Makefile.am b/openbsc/include/openbsc/Makefile.am index 907119e04..4869603f2 100644 --- a/openbsc/include/openbsc/Makefile.am +++ b/openbsc/include/openbsc/Makefile.am @@ -19,7 +19,7 @@ noinst_HEADERS = abis_nm.h abis_rsl.h db.h gsm_04_08.h gsm_data.h \ gprs_gsup_client.h bsc_msg_filter.h \ oap.h oap_messages.h \ gtphub.h \ - iu.h iu_cs.h \ + msc_ifaces.h iu.h iu_cs.h \ common.h openbsc_HEADERS = gsm_04_08.h meas_rep.h bsc_api.h diff --git a/openbsc/include/openbsc/iu_cs.h b/openbsc/include/openbsc/iu_cs.h index 9c2be4176..656c4f6a4 100644 --- a/openbsc/include/openbsc/iu_cs.h +++ b/openbsc/include/openbsc/iu_cs.h @@ -6,5 +6,3 @@ struct gsm_subscriber_connection *subscr_conn_allocate_iu(struct gsm_network *ne uint8_t link_id, uint32_t conn_id); -int iucs_submit_dtap(struct gsm_subscriber_connection *conn, - struct msgb *msg); 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); |