diff options
author | Holger Hans Peter Freyther <zecke@selfish.org> | 2011-06-04 19:58:26 +0200 |
---|---|---|
committer | Holger Hans Peter Freyther <zecke@selfish.org> | 2012-05-02 19:24:28 +0200 |
commit | 522676b9a8eb56d235b5a66f641bd1b0a918b676 (patch) | |
tree | e4ceca564c95e1f489a97ea00c26774813d756c0 /openbsc/src/osmo-bsc/osmo_bsc_msc.c | |
parent | 1cd6c789cf4fcd5ac76e1ad72aac85dc987f191c (diff) |
bsc: Prepare to have multiple MSC connections
We now have a list of MSCs but in the code we will
try to access the MSC with the nr 0.
Diffstat (limited to 'openbsc/src/osmo-bsc/osmo_bsc_msc.c')
-rw-r--r-- | openbsc/src/osmo-bsc/osmo_bsc_msc.c | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/openbsc/src/osmo-bsc/osmo_bsc_msc.c b/openbsc/src/osmo-bsc/osmo_bsc_msc.c index 0ee83121f..31cbfb2a5 100644 --- a/openbsc/src/osmo-bsc/osmo_bsc_msc.c +++ b/openbsc/src/osmo-bsc/osmo_bsc_msc.c @@ -452,3 +452,43 @@ int osmo_bsc_msc_init(struct osmo_msc_data *data) return 0; } + +struct osmo_msc_data *osmo_msc_data_find(struct gsm_network *net, int nr) +{ + struct osmo_msc_data *msc_data; + + llist_for_each_entry(msc_data, &net->bsc_data->mscs, entry) + if (msc_data->nr == nr) + return msc_data; + return NULL; +} + +struct osmo_msc_data *osmo_msc_data_alloc(struct gsm_network *net, int nr) +{ + struct osmo_msc_data *msc_data; + + /* check if there is already one */ + msc_data = osmo_msc_data_find(net, nr); + if (msc_data) + return msc_data; + + msc_data = talloc_zero(net, struct osmo_msc_data); + if (!msc_data) + return NULL; + + llist_add_tail(&msc_data->entry, &net->bsc_data->mscs); + + /* Init back pointer */ + msc_data->network = net; + + INIT_LLIST_HEAD(&msc_data->dests); + msc_data->ping_timeout = 20; + msc_data->pong_timeout = 5; + msc_data->core_ncc = -1; + msc_data->core_mcc = -1; + msc_data->rtp_base = 4000; + + msc_data->nr = nr; + + return msc_data; +} |