aboutsummaryrefslogtreecommitdiffstats
path: root/src/mtp_layer3.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mtp_layer3.c')
-rw-r--r--src/mtp_layer3.c63
1 files changed, 37 insertions, 26 deletions
diff --git a/src/mtp_layer3.c b/src/mtp_layer3.c
index ecc1370..507990d 100644
--- a/src/mtp_layer3.c
+++ b/src/mtp_layer3.c
@@ -183,32 +183,6 @@ static struct msgb *mtp_sccp_alloc_scmg(struct mtp_link_set *link,
return out;
}
-struct mtp_link_set *mtp_link_set_alloc(struct bsc_data *bsc)
-{
- struct mtp_link_set *link;
-
- link = talloc_zero(bsc, struct mtp_link_set);
- if (!link)
- return NULL;
-
- link->ctrg = rate_ctr_group_alloc(link,
- mtp_link_set_rate_ctr_desc(),
- bsc->num_linksets + 1);
- if (!link->ctrg) {
- LOGP(DINP, LOGL_ERROR, "Failed to allocate counter.\n");
- return NULL;
- }
-
-
- link->ni = MTP_NI_NATION_NET;
- INIT_LLIST_HEAD(&link->links);
-
- link->no = bsc->num_linksets++;
- llist_add(&link->entry, &bsc->linksets);
-
- return link;
-}
-
void mtp_link_set_stop(struct mtp_link_set *link)
{
struct mtp_link *lnk;
@@ -620,3 +594,40 @@ int mtp_link_set_add_link(struct mtp_link_set *set, struct mtp_link *lnk)
mtp_link_set_init_slc(set);
return 0;
}
+
+struct mtp_link_set *mtp_link_set_alloc(struct bsc_data *bsc)
+{
+ struct mtp_link_set *link;
+
+ link = talloc_zero(bsc, struct mtp_link_set);
+ if (!link)
+ return NULL;
+
+ link->ctrg = rate_ctr_group_alloc(link,
+ mtp_link_set_rate_ctr_desc(),
+ bsc->num_linksets + 1);
+ if (!link->ctrg) {
+ LOGP(DINP, LOGL_ERROR, "Failed to allocate counter.\n");
+ return NULL;
+ }
+
+
+ link->ni = MTP_NI_NATION_NET;
+ INIT_LLIST_HEAD(&link->links);
+
+ link->no = bsc->num_linksets++;
+ llist_add(&link->entry, &bsc->linksets);
+
+ return link;
+}
+
+struct mtp_link_set *mtp_link_set_num(struct bsc_data *bsc, int num)
+{
+ struct mtp_link_set *set;
+
+ llist_for_each_entry(set, &bsc->linksets, entry)
+ if (set->no == num)
+ return set;
+
+ return NULL;
+}