1
0
Fork 0
mbuni/mbuni/mmsc/mms_resolve.c

59 lines
1.7 KiB
C
Raw Normal View History

2005-03-23 05:55:16 +00:00
/*
* Mbuni - Open Source MMS Gateway
*
* Resolving MSISDNs to local/remote MMSCs
*
2008-07-10 09:46:58 +00:00
* Copyright (C) 2003 - 2008, Digital Solutions Ltd. - http://www.dsmagic.com
2005-03-23 05:55:16 +00:00
*
* Paul Bagyenda <bagyenda@dsmagic.com>
*
* This program is free software, distributed under the terms of
* the GNU General Public License, with a few exceptions granted (see LICENSE)
*/
2005-03-10 08:01:02 +00:00
#include <stdio.h>
#include <stdlib.h>
#include "mms_resolve.h"
#include "mmsc_cfg.h"
2005-03-10 08:01:02 +00:00
static void *mms_resolvermodule_init(char *settings)
{
return NULL;
}
static int mms_resolvermodule_fini(void *module_data)
{
return 0;
}
2009-10-14 03:36:32 +00:00
static Octstr *mms_resolve(Octstr * phonenum, char *src_int, char *src_id,
void *module_data, void *settings_p, void *proxyrelays_p)
2005-03-10 08:01:02 +00:00
{
/* Most custom implementations of this library will probably just ignore the two last arguments,
* but this one needs them
*/
MmscSettings *settings = (MmscSettings *) settings_p;
2005-03-10 08:01:02 +00:00
List *proxyrelays = (List *) proxyrelays_p;
int j, m;
if (does_prefix_match(settings->local_prefix, phonenum)) {
2006-05-22 10:06:22 +00:00
return settings->hostname ? octstr_duplicate(settings->hostname) : NULL;
} else if (proxyrelays && gwlist_len(proxyrelays) > 0) /* Step through proxies. */
for (j = 0, m = gwlist_len(proxyrelays); j < m; j++) {
MmsProxyRelay *mp = gwlist_get(proxyrelays, j);
2005-03-10 08:01:02 +00:00
if (does_prefix_match(mp->allowed_prefix, phonenum) &&
!does_prefix_match(mp->denied_prefix, phonenum)) {
2006-05-22 10:06:22 +00:00
return octstr_duplicate(mp->host);
2005-03-10 08:01:02 +00:00
}
}
return 0;
}
/* The function itself. */
MmsResolverFuncStruct mms_resolvefuncs = {
mms_resolvermodule_init,
mms_resolve,
mms_resolvermodule_fini
};