Exemplo n.º 1
0
struct module_param* get_module_param(char* module, char* param_name)
{
	struct aaa_module* a;
	struct module_param* p;
	
	if ((a=find_module_by_name(module))==0)  goto no_module_found;
	for (p=a->exports->params;p&&(p->name);p++){
		if (strcmp(param_name, p->name)==0)
			return p;
	}
no_module_found:
	return 0;
}
Exemplo n.º 2
0
void ncai_library_unload_callback(const char* name)
{
    GlobalNCAI* ncai = VM_Global_State::loader_env->NCAI;

    if (!ncai->isEnabled())
        return;

    LMAutoUnlock lock(&ncai->mod_lock);

    ncaiError err = ncai_get_all_modules(&ncai->modules, NULL);
    assert(err == NCAI_ERROR_NONE);

    ncaiModule module = find_module_by_name(ncai->modules, name);
    assert(module);

    report_loaded_unloaded_module(module, false);
}
Exemplo n.º 3
0
//--------------------------------------------------------------------------
// WinCE device seems to freeze and require a hard reset if a bpt is
// set at coredll (and other system areas?)
// we never write there
bool win32_debmod_t::may_write(ea_t ea)
{
  static area_t forbidden_area;
  if ( forbidden_area.startEA == 0 )
  {
    wince_module_t coredll;
    find_module_by_name("coredll", &coredll);
    common_e32_lite &e32 = get_e32(&coredll);
    forbidden_area.startEA = e32.vbase;
    forbidden_area.endEA   = e32.vbase + e32.vsize;
  }
  if ( ea >= 0x80000000 || forbidden_area.contains(ea) )
  {
    SetLastError(ERROR_ACCESS_DENIED);
    return false;
  }
  return true;
}
Exemplo n.º 4
0
static int child_init(int rank)
{
    if(rank==PROC_RPC) {
        if(init_mi_child()!=0) {
            LM_CRIT("Failed to init the mi commands\n");
            return -1;
        }
    } else if(rank>0) {
        if(find_module_by_name("xmlrpc")!=0)
        {
            if(init_mi_child()!=0) {
                LM_CRIT("Failed to init the mi commands for xmlrpc usage\n");
                return -1;
            }
        }
    }

    return 0;
}
Exemplo n.º 5
0
static int
mod_init(void)
{
    pv_spec_t avp_spec;
    int *param;
	 modparam_t type;


    // initialize the canonical_uri_avp structure
    if (canonical_uri_avp.spec.s==NULL || canonical_uri_avp.spec.len<=0) {
        LOG(L_ERR, "missing/empty canonical_uri_avp parameter. using default.\n");
        canonical_uri_avp.spec.s = CANONICAL_URI_AVP_SPEC;
    }

    if (pv_parse_spec(&(canonical_uri_avp.spec), &avp_spec)==0 || avp_spec.type!=PVT_AVP) {
        LOG(L_CRIT, "invalid AVP specification for canonical_uri_avp: `%s'\n", canonical_uri_avp.spec.s);
        return -1;
    }
    if (pv_get_avp_name(0, &(avp_spec.pvp), &(canonical_uri_avp.name), &(canonical_uri_avp.type))!=0) {
        LOG(L_CRIT, "invalid AVP specification for canonical_uri_avp: `%s'\n", canonical_uri_avp.spec.s);
        return -1;
    }

    // initialize the signaling_ip_avp structure
    if (signaling_ip_avp.spec.s==NULL || signaling_ip_avp.spec.len<=0) {
        LOG(L_ERR, "missing/empty signaling_ip_avp parameter. using default.\n");
        signaling_ip_avp.spec.s = SIGNALING_IP_AVP_SPEC;
    }

    if (pv_parse_spec(&(signaling_ip_avp.spec), &avp_spec)==0 || avp_spec.type!=PVT_AVP) {
        LOG(L_CRIT, "invalid AVP specification for signaling_ip_avp: `%s'\n", signaling_ip_avp.spec.s);
        return -1;
    }
    if (pv_get_avp_name(0, &(avp_spec.pvp), &(signaling_ip_avp.name), &(signaling_ip_avp.type))!=0) {
        LOG(L_CRIT, "invalid AVP specification for signaling_ip_avp: `%s'\n", signaling_ip_avp.spec.s);
        return -1;
    }

    // initialize the sip_application_avp structure
    if (sip_application_avp.spec.s==NULL || sip_application_avp.spec.len<=0) {
        LOG(L_ERR, "missing/empty sip_application_avp parameter. using default.\n");
        sip_application_avp.spec.s = SIP_APPLICATION_AVP_SPEC;
    }

    if (pv_parse_spec(&(sip_application_avp.spec), &avp_spec)==0 || avp_spec.type!=PVT_AVP) {
        LOG(L_CRIT, "invalid AVP specification for sip_application_avp: `%s'\n", sip_application_avp.spec.s);
        return -1;
    }
    if (pv_get_avp_name(0, &(avp_spec.pvp), &(sip_application_avp.name), &(sip_application_avp.type))!=0) {
        LOG(L_CRIT, "invalid AVP specification for sip_application_avp: `%s'\n", sip_application_avp.spec.s);
        return -1;
    }

    // bind to the dialog API
    if (load_dlg_api(&dlg_api)!=0) {
        LOG(L_CRIT, "cannot load the dialog module API\n");
        return -1;
    }

    // load dlg_flag and default_timeout parameters from the dialog module
    param = find_param_export(find_module_by_name("dialog"), "dlg_flag", INT_PARAM, &type);
    if (!param) {
        LOG(L_CRIT, "cannot find dlg_flag parameter in the dialog module\n");
        return -1;
    }
    if (type != INT_PARAM) {
        LOG(L_CRIT, "dlg_flag parameter found but with wrong type: %d\n", type);
        return -1;
    }

    dialog_flag = *param;

    // register dialog creation callback
    if (dlg_api.register_dlgcb(NULL, DLGCB_CREATED, __dialog_created, NULL, NULL) != 0) {
        LOG(L_CRIT, "cannot register callback for dialog creation\n");
        return -1;
    }

    // register dialog loading callback
    if (dlg_api.register_dlgcb(NULL, DLGCB_LOADED, __dialog_loaded, NULL, NULL) != 0) {
        LOG(L_ERR, "cannot register callback for dialogs loaded from the database\n");
    }

    // register a pre-script callback to automatically enable dialog tracing
    if (register_script_cb(postprocess_request, POST_SCRIPT_CB|REQUEST_CB, 0) != 0) {
        LOG(L_CRIT, "ERROR:call_control:mod_init: could not register request postprocessing callback\n");
        return -1;
    }

    return 0;
}