Пример #1
0
static void
testStructReadout(xmlrpc_value * const structP,
                  unsigned int   const expectedSize) {

    xmlrpc_env env;
    xmlrpc_value * keyP;
    xmlrpc_value * valueP;

    unsigned int index;

    xmlrpc_env_init(&env);

    for (index = 0; index < expectedSize; ++index) {
        xmlrpc_struct_read_member(&env, structP, index, &keyP, &valueP);
        TEST_NO_FAULT(&env);
        xmlrpc_DECREF(keyP);
        xmlrpc_DECREF(valueP);
    }

    xmlrpc_struct_read_member(&env, structP, expectedSize, &keyP, &valueP);
    TEST_FAULT(&env, XMLRPC_INDEX_ERROR);

    for (index = 0; index < expectedSize; ++index) {
        xmlrpc_struct_get_key_and_value(&env, structP, index, &keyP, &valueP);
        TEST_NO_FAULT(&env);
    }
    xmlrpc_env_clean(&env);
}
Пример #2
0
xmlrpc_value* StartSendingVideo(xmlrpc_env *env, xmlrpc_value *param_array, void *user_data)
{
	MCU *mcu = (MCU *)user_data;
	MultiConf *conf = NULL;

	 //Parseamos
	int confId;
	int partId;
	char *sendVideoIp;
	int sendVideoPort;
	xmlrpc_value *rtpMap;
	xmlrpc_parse_value(env, param_array, "(iisiS)", &confId,&partId,&sendVideoIp,&sendVideoPort,&rtpMap);

	//Get the rtp map
	VideoCodec::RTPMap map;

	//Get map size
	int j = xmlrpc_struct_size(env,rtpMap);

	//Parse rtp map
	for (int i=0;i<j;i++)
	{
		xmlrpc_value *key, *val;
		const char *type;
		int codec;
		//Read member
		xmlrpc_struct_read_member(env,rtpMap,i,&key,&val);
		//Read name
		xmlrpc_parse_value(env,key,"s",&type);
		//Read value
		xmlrpc_parse_value(env,val,"i",&codec);
		//Add to map
		map[atoi(type)] = (VideoCodec::Type) codec;
		//Decrement ref counter
		xmlrpc_DECREF(key);
		xmlrpc_DECREF(val);
	}

	//Comprobamos si ha habido error
	if(env->fault_occurred)
		xmlerror(env,"Fault occurred\n");

	//Obtenemos la referencia
	if(!mcu->GetConferenceRef(confId,&conf))
		return xmlerror(env,"Conference does not exist");

	//La borramos
	int res = conf->StartSendingVideo(partId,sendVideoIp,sendVideoPort,map) != NULL;

	//Liberamos la referencia
	mcu->ReleaseConferenceRef(confId);

	//Salimos
	if(!res)
		return xmlerror(env,"Error\n");

	//Devolvemos el resultado
	return xmlok(env);
}
xmlrpc_value* MediaGatewayStartSendingText(xmlrpc_env *env, xmlrpc_value *param_array, void *user_data)
{
	MediaGateway *mediaGateway = (MediaGateway *)user_data;
	MediaBridgeSession *session = NULL;

	 //Parseamos
	int sessionId;
	char *sendTextIp;
	int sendTextPort;
	xmlrpc_value *rtpMap;
	xmlrpc_parse_value(env, param_array, "(isiS)", &sessionId,&sendTextIp,&sendTextPort,&rtpMap);

	//Comprobamos si ha habido error
	if(env->fault_occurred)
		return 0;

	//Get the rtp map
	TextCodec::RTPMap map;

	//Get map size
	int j = xmlrpc_struct_size(env,rtpMap);

	//Parse rtp map
	for (int i=0;i<j;i++)
	{
		xmlrpc_value *key, *val;
		const char *type;
		int codec;
		//Read member
		xmlrpc_struct_read_member(env,rtpMap,i,&key,&val);
		//Read name
		xmlrpc_parse_value(env,key,"s",&type);
		//Read value
		xmlrpc_parse_value(env,val,"i",&codec);
		//Add to map
		map[atoi(type)] = (TextCodec::Type) codec;
		//Decrement ref counter
		xmlrpc_DECREF(key);
		xmlrpc_DECREF(val);
	}

	//Obtenemos la referencia
	if(!mediaGateway->GetMediaBridgeRef(sessionId,&session))
		return xmlerror(env,"La sessionerencia no existe\n");

	//La borramos
	int res = session->StartSendingText(sendTextIp,sendTextPort,map);

	//Liberamos la referencia
	mediaGateway->ReleaseMediaBridgeRef(sessionId);

	//Salimos
	if(!res)
		return xmlerror(env,"Error\n");

	//Devolvemos el resultado
	return xmlok(env);
}
Пример #4
0
xmlrpc_value* StartReceivingText(xmlrpc_env *env, xmlrpc_value *param_array, void *user_data)
{
	MCU *mcu = (MCU *)user_data;
	MultiConf *conf = NULL;

	 //Parseamos
	int confId;
	int partId;
	xmlrpc_value *rtpMap;
	xmlrpc_parse_value(env, param_array, "(iiS)", &confId,&partId,&rtpMap);

	//Get the rtp map
	TextCodec::RTPMap map;

	int j = xmlrpc_struct_size(env,rtpMap);

	//Parse rtp map
	for (int i=0;i<j;i++)
	{
		xmlrpc_value *key, *val;
		const char *type;
		int codec;
		//Read member
		xmlrpc_struct_read_member(env,rtpMap,i,&key,&val);
		//Read name
		xmlrpc_parse_value(env,key,"s",&type);
		//Read value
		xmlrpc_parse_value(env,val,"i",&codec);
		//Add to map
		map[atoi(type)] = (TextCodec::Type) codec;
		//Decrement ref counter
		xmlrpc_DECREF(key);
		xmlrpc_DECREF(val);
	}

	//Comprobamos si ha habido error
	if(env->fault_occurred)
		xmlerror(env,"Fault occurred\n");

	//Obtenemos la referencia
	if(!mcu->GetConferenceRef(confId,&conf))
		return xmlerror(env,"Conference does not exist");

	//La borramos
	int recTextPort = conf->StartReceivingText(partId,map);

	//Liberamos la referencia
	mcu->ReleaseConferenceRef(confId);

	//Salimos
	if(!recTextPort)
		return xmlerror(env,"No se ha podido terminar la conferencia\n");

	//Devolvemos el resultado
	return xmlok(env,xmlrpc_build_value(env,"(i)",recTextPort,recTextPort));
}
Пример #5
0
            cMemberWrapper(xmlrpc_value *const structP,
                           unsigned int const index) {

                env_wrap env;

                xmlrpc_struct_read_member(&env.env_c, structP, index,
                                          &keyP, &valueP);

                throwIfError(env);
            }
Пример #6
0
/* FIXME terminates the program if it fails */
int get_int_from_struct_by_idx(xmlrpc_value *structP, int index, int *rv)
{
	xmlrpc_env env;
	xmlrpc_env_init(&env);
	xmlrpc_value *keyP;
	xmlrpc_value *valueP;
	
	xmlrpc_struct_read_member(&env, structP, index, &keyP, &valueP);            /* increment refcount of returned values */
	die_if_fault_occurred_line(&env, __LINE__);
	xmlrpc_read_int(&env, valueP, rv);
	die_if_fault_occurred_line(&env, __LINE__);
	xmlrpc_DECREF(valueP);
	return 1;
}
Пример #7
0
/* FIXME terminates the programm if it fails  */
int get_struct_item_by_idx(xmlrpc_value *structP, int index, key_value_pair *rv)
{
	xmlrpc_env env;
	xmlrpc_env_init(&env);
	xmlrpc_value *keyP;
	xmlrpc_value *valueP;
	int length;
	const char *string;
	
	xmlrpc_struct_read_member(&env, structP, index, &keyP, &valueP);		/* increment refcount of returned values */
	die_if_fault_occurred_line(&env, __LINE__);
	xmlrpc_read_string(&env, keyP, (const char **)&rv->key);
	/* handle value type */
	switch ( xmlrpc_value_type(valueP) ) {
		case XMLRPC_TYPE_INT:
			xmlrpc_read_int(&env, valueP, &rv->value.integer);
			die_if_fault_occurred_line(&env, __LINE__);
			rv->type = TYPE_INTEGER;
			break;
		case XMLRPC_TYPE_STRING:
			xmlrpc_read_string(&env, valueP, &string);
			printf("get_struct_item_by_idx: ptr = %p, string value = '%s'\n", string, string);
			die_if_fault_occurred_line(&env, __LINE__);
			rv->value.string = (char *)string;
			rv->type = TYPE_STRING;
			break;
		default:
			fprintf(stderr, "Wrong type of return value in key: '%s', exiting...\n", rv->key);
			exit(1);
	}
	xmlrpc_DECREF(keyP);							/* decrement refcount */
	xmlrpc_DECREF(valueP);
	die_if_fault_occurred_line(&env, __LINE__);
	/* FIXME add error handling */

	return 1;
}