コード例 #1
0
static int mod_init( void )
{
	/* bind the ACC API */
	if (acc_load_api(&accb)<0) {
		LM_ERR("cannot bind to ACC API\n");
		return -1;
	}

	/* parse the extra string, if any */
	if (diameter_extra_str
			&& (diameter_extra=accb.parse_extra(diameter_extra_str))==0 ) {
		LM_ERR("failed to parse diameter_extra param\n");
		return -1;
	}

	memset(&_acc_diameter_engine, 0, sizeof(acc_engine_t));

	if(diameter_flag != -1)
		_acc_diameter_engine.acc_flag	   = diameter_flag;
	if(diameter_missed_flag != -1)
		_acc_diameter_engine.missed_flag = diameter_missed_flag;
	_acc_diameter_engine.acc_req     = acc_diameter_send_request;
	_acc_diameter_engine.acc_init    = acc_diameter_init;
	memcpy(_acc_diameter_engine.name, "diameter", 8);
	if(accb.register_engine(&_acc_diameter_engine)<0)
	{
		LM_ERR("cannot register ACC DIAMETER engine\n");
		return -1;
	}

	return 0;
}
コード例 #2
0
ファイル: acc_radius_mod.c プロジェクト: 4N7HR4X/kamailio
static int mod_init( void )
{
	if (radius_config==NULL || radius_config[0]=='\0') {
		LM_ERR("radius config file not set\n");
		return -1;
	}

	/* bind the ACC API */
	if (acc_load_api(&accb)<0) {
		LM_ERR("cannot bind to ACC API\n");
		return -1;
	}

	/* parse the extra string, if any */
	if (rad_extra_str && (rad_extra=accb.parse_extra(rad_extra_str))==0 ) {
		LM_ERR("failed to parse rad_extra param\n");
		return -1;
	}

	memset(&_acc_radius_engine, 0, sizeof(acc_engine_t));

	if(radius_flag != -1)
		_acc_radius_engine.acc_flag	   = 1<<radius_flag;
	if(radius_missed_flag != -1)
		_acc_radius_engine.missed_flag = 1<<radius_missed_flag;
	_acc_radius_engine.acc_req     = acc_radius_send_request;
	_acc_radius_engine.acc_init    = acc_radius_init;
	memcpy(_acc_radius_engine.name, "radius", 6);
	if(accb.register_engine(&_acc_radius_engine)<0)
	{
		LM_ERR("cannot register ACC RADIUS engine\n");
		return -1;
	}

	return 0;
}