#include #include #include "mms_resolve.h" #include "mms_util.h" static void *mms_resolvermodule_init(char *settings) { return NULL; } static int mms_resolvermodule_fini(void *module_data) { return 0; } static Octstr *mms_resolve(Octstr * phonenum, void *module_data, void *settings_p, void *proxyrelays_p) { /* Most custom implementations of this library will probably just ignore the two last arguments, * but this one needs them */ MmsBoxSettings *settings = (MmsBoxSettings *) settings_p; List *proxyrelays = (List *) proxyrelays_p; int j, m; if (does_prefix_match(settings->local_prefix, phonenum)) { return settings->hostname; } else if (proxyrelays && list_len(proxyrelays) > 0) /* Step through proxies. */ for (j = 0, m = list_len(proxyrelays); j < m; j++) { MmsProxyRelay *mp = list_get(proxyrelays, j); if (does_prefix_match(mp->allowed_prefix, phonenum) && !does_prefix_match(mp->denied_prefix, phonenum)) { return mp->host; } } return 0; } /* The function itself. */ MmsResolverFuncStruct mms_resolvefuncs = { mms_resolvermodule_init, mms_resolve, mms_resolvermodule_fini };