예제 #1
0
struct gsm_subscriber *subscr_get_or_create(struct gsm_subscriber_group *sgrp,
					    const char *imsi)
{
	struct gsm_subscriber *subscr;

	llist_for_each_entry(subscr, subscr_bsc_active_subscribers(), entry) {
		if (strcmp(subscr->imsi, imsi) == 0 && subscr->group == sgrp)
			return subscr_get(subscr);
	}

	subscr = subscr_alloc();
	if (!subscr)
		return NULL;

	osmo_strlcpy(subscr->imsi, imsi, sizeof(subscr->imsi));
	subscr->group = sgrp;
	return subscr;
}
예제 #2
0
struct gsm_subscriber *subscr_get_or_create(struct gsm_network *net,
					    const char *imsi)
{
	struct gsm_subscriber *subscr;

	llist_for_each_entry(subscr, subscr_bsc_active_subscribers(), entry) {
		if (strcmp(subscr->imsi, imsi) == 0 && subscr->net == net)
			return subscr_get(subscr);
	}

	subscr = subscr_alloc();
	if (!subscr)
		return NULL;

	strcpy(subscr->imsi, imsi);
	subscr->net = net;
	return subscr;
}