void Test_DeletePortMappingRange(void)
{
    struct Upnp_Action_Request event;
    strcpy(event.DevUDN,"uuid:75802409-bccb-40e7-8e6c-fa095ecce13e");
    strcpy(event.ServiceID,"urn:upnp-org:serviceId:WANIPConn1");
    strcpy(event.ActionName,"DeletePortMappingRange");

    // add required portmappings
    Test_AddPortMapping();

    // Missing argument
    event.ActionRequest = ixmlParseBuffer(delete_portmapping_range_request_missing_parameter_xml);
    CU_ASSERT(DeletePortMappingRange(&event) == 402);

    // Invalid protocol
    event.ActionRequest = ixmlParseBuffer(delete_portmapping_range_request_invalid_protocol_xml);
    CU_ASSERT(DeletePortMappingRange(&event) == 402);

    // Delete range
    event.ActionRequest = ixmlParseBuffer(delete_portmapping_range_request_xml);
    CU_ASSERT(DeletePortMappingRange(&event) == 0);

    // Try to delete non-existent portmappings
    event.ActionRequest = ixmlParseBuffer(delete_portmapping_range_request_xml);
    CU_ASSERT(DeletePortMappingRange(&event) == 714);
}
void Test_DeletePortMapping(void)
{
    struct Upnp_Action_Request event;
    strcpy(event.DevUDN,"uuid:75802409-bccb-40e7-8e6c-fa095ecce13e");
    strcpy(event.ServiceID,"urn:upnp-org:serviceId:WANIPConn1");
    strcpy(event.ActionName,"DeletePortMapping");

    // add required portmappings
    Test_AddPortMapping();

    // Delete with remotehost
    event.ActionRequest = ixmlParseBuffer(delete_portmapping_request_xml);
    CU_ASSERT(DeletePortMapping(&event) == 0);

    // Delete with wildcarded remotehost
    event.ActionRequest = ixmlParseBuffer(delete_portmapping_request_wildcard_remotehost_xml);
    CU_ASSERT(DeletePortMapping(&event) == 0);

    // Invalid args
    event.ActionRequest = ixmlParseBuffer(delete_portmapping_request_missing_parameter_xml);
    CU_ASSERT(DeletePortMapping(&event) == 402);

    // Try to delete non-existent portmapping
    event.ActionRequest = ixmlParseBuffer(delete_portmapping_request_xml);
    CU_ASSERT(DeletePortMapping(&event) == 714);

    // Try to delete with invalid IP address as remotehost
    event.ActionRequest = ixmlParseBuffer(delete_portmapping_request_invalid_IP_xml);
    CU_ASSERT(DeletePortMapping(&event) == 402);
}
Exemple #3
0
/*
 * Extracts the result document from a SOAP response
 */
IXML_Document* parseBrowseResult( IXML_Document* p_doc )
{
    assert( p_doc );

    // ixml*_getElementsByTagName will ultimately only case the pointer to a Node
    // pointer, and pass it to a private function. Don't bother have a IXML_Document
    // version of getChildElementValue
    const char* psz_raw_didl = xml_getChildElementValue( (IXML_Element*)p_doc, "Result" );

    if( !psz_raw_didl )
        return NULL;

    /* First, try parsing the buffer as is */
    IXML_Document* p_result_doc = ixmlParseBuffer( psz_raw_didl );
    if( !p_result_doc ) {
        /* Missing namespaces confuse the ixml parser. This is a very ugly
         * hack but it is needeed until devices start sending valid XML.
         *
         * It works that way:
         *
         * The DIDL document is extracted from the Result tag, then wrapped into
         * a valid XML header and a new root tag which contains missing namespace
         * definitions so the ixml parser understands it.
         *
         * If you know of a better workaround, please oh please fix it */
        const char* psz_xml_result_fmt = "<?xml version=\"1.0\" ?>"
                                         "<Result xmlns:sec=\"urn:samsung:metadata:2009\">%s</Result>";

        char* psz_xml_result_string = NULL;
        if( -1 == asprintf( &psz_xml_result_string,
                            psz_xml_result_fmt,
                            psz_raw_didl) )
            return NULL;

        p_result_doc = ixmlParseBuffer( psz_xml_result_string );
        free( psz_xml_result_string );
    }

    if( !p_result_doc )
        return NULL;

    IXML_NodeList *p_elems = ixmlDocument_getElementsByTagName( p_result_doc,
                             "DIDL-Lite" );

    IXML_Node *p_node = ixmlNodeList_item( p_elems, 0 );
    ixmlNodeList_free( p_elems );

    return (IXML_Document*)p_node;
}
Exemple #4
0
KeyMode getState(char *message)
{

	IXML_Document *doc = NULL;
	char *state = NULL;

	if ((doc = ixmlParseBuffer(message)) == NULL)
		return -1;
	
	state = ixmlGetFirstDocumentItem(doc, "value");
	
	ixmlDocument_free(doc);
	if ((strcmp(state, "Powersaving") == 0) || (strcmp(state, "PartialActive") == 0))
	{
		printf("get state is POLICY\n");
		return POLICY;
	}
	else if (strcmp(state, "Active") == 0)
	{
		printf("get state is NORMAL\n");
		return NORMAL;
	}
	else
	{
		printf("get state is -1, failed!!!\n");
		return -1;
	}
}
Exemple #5
0
BOOL CVCAMetaParserIXML::ParseMetaData( unsigned char *pMetadata, int nLength )
{
	pMetadata[nLength] = '\0';
	m_pDOMDoc = ixmlParseBuffer((char*)pMetadata);
//	puts(ixmlPrintDocument(m_pDOMDoc));
	if(m_pDOMDoc) {
		ParseHeader();
		ParseStab();
		ParseObjects();
		ParseEvents();
		ParseCounts();
		
		ParseBlobsImp(_XML_TAMPERMAP, &m_TamperInfo);
		ParseBlobsImp(_XML_SCENECHANGEMAP, &m_SceneChangeInfo);
		ParseBlobsImp(_XML_BLOBMAP, &m_BlobMap);
		ParseBlobsImp(_XML_STATBLOBMAP, &m_StationaryMap);
		ParseBlobsImp(_XML_SMOKEMAP,&m_SmokeMap);
		ParseBlobsImp(_XML_FIREMAP,&m_FireMap);

		ParseCE();

		ixmlDocument_free(m_pDOMDoc);
	} else {
		printf("!!! Parsing Error\n");
	}

	return TRUE;
}
Exemple #6
0
/*
 * Extracts the result document from a SOAP response
 */
IXML_Document* parseBrowseResult( IXML_Document* p_doc )
{
    ixmlRelaxParser( 1 );

    if ( !p_doc ) return 0;

    IXML_NodeList* p_result_list = ixmlDocument_getElementsByTagName( p_doc,
                                                                   "Result" );

    if ( !p_result_list ) return 0;

    IXML_Node* p_result_node = ixmlNodeList_item( p_result_list, 0 );

    ixmlNodeList_free( p_result_list );

    if ( !p_result_node ) return 0;

    IXML_Node* p_text_node = ixmlNode_getFirstChild( p_result_node );
    if ( !p_text_node ) return 0;

    const char* psz_result_string = ixmlNode_getNodeValue( p_text_node );

    IXML_Document* p_browse_doc = ixmlParseBuffer( psz_result_string );

    return p_browse_doc;
}
int cConnectionManager::GetCurrentConnectionInfo(Upnp_Action_Request* request){

  long id;
  if(ParseIntegerValue(request->ActionRequest, "ConnectionID", id) != UPNP_E_SUCCESS){
    esyslog("UPnP\tInvalid arguments. ConnectionID missing or wrong");
    SetError(request, UPNP_SOAP_E_INVALID_ARGS);
    return request->ErrCode;
  }
  int32_t connectionID = id;

  cVirtualConnection* connection = mVirtualConnections[connectionID];

  if(connection == NULL){
    esyslog("UPnP\tNo valid connection found with given ID=%d!", connectionID);
    SetError(request, UPNP_CMS_E_INVALID_CONNECTION_REFERENCE);
    return request->ErrCode;
  }

  std::stringstream ss;
  ss << "<u:" << request->ActionName << "Response xmlns:u=\"" << GetServiceDescription().serviceType << "\">"
     << "  <ProtocolInfo>" << connection->GetRemoteProtocolInfo() << "</ProtocolInfo>"
     << "  <PeerConnectionManager>" << connection->GetPeerConnectionManager() << "</PeerConnectionManager>"
     << "  <PeerConnectionID>" << connection->GetPeerConnectionID() << "</PeerConnectionID>"
     << "  <Direction>" << connection->GetDirectionString() << "</Direction>"
     << "  <RcsID>" << connection->GetRcsID() << "</RcsID>"
     << "  <AVTransportID>" << connection->GetAVTransportID() << "</AVTransportID>"
     << "  <Status>" << connection->GetStatusString() << "</Status>"
     << "</u:" << request->ActionName << "Response>";

  request->ActionResult = ixmlParseBuffer(ss.str().c_str());
  request->ErrCode = UPNP_E_SUCCESS;
  return request->ErrCode;
}
Exemple #8
0
/**************************************************************************
* Function: prepareParameter
* Functionality: it will get the parameter from pipe and check it
* @IN : fd: the file description id for the pipe
*      enable: enable or disable flag
* @OUT: 0 success, else failed.
* Used description:
    The parameter is a xml, it will get from the pipe
* Date: 20080108
* Changed history:
* Date 		Who		Reason
* 20080108	kelly  		First  creation
***************************************************************************/
int prepareParameter(char *objID)
{
	IXML_Document	* rootDom = NULL;
	char buffer[1024] = {0};
	char str[1024] = {0}; 
	char *strVal = NULL;

	while(1)
	{
		fgets(str, 1024, stdin);
		str[strlen(str)-1]=0;
		strcat(buffer, str);
		if(strstr(buffer,EndFlag))
			break;
	}

	if(strlen(buffer) == 0)
		goto failed;

	if((rootDom = ixmlParseBuffer(buffer))  == NULL) 
		goto failed;

	strVal = ixmlGetFirstDocumentItem( rootDom,"objID" );
	strcpy(objID,strVal);
	free(strVal);
	
	if (rootDom)
		ixmlDocument_free(rootDom);

	return 0;

failed:
        fprintf(stderr,"Got a command parameter->%s", buffer);
	return -1;
}
Exemple #9
0
// Extract attribute from URI_METADATA
const char *transport_get_attr_metadata(const char *key)
{
	IXML_Document *doc;
	IXML_Element *elm;
	const char *attr = NULL;

	const char *metadata = transport_get_var(TRANSPORT_VAR_AV_URI_META);

	if (!metadata || (strcmp(metadata, "") == 0))
		return NULL;

	doc = ixmlParseBuffer(metadata);
	if (doc)
	{
		// Locate 'res' element
		elm = ixmlDocument_getElementById(doc, "res");
		if (elm != NULL)
		{
			// Look for 'key' attribute in 'res' element
			attr = ixmlElement_getAttribute(elm, key);
			// Copy of result (caller must free)
			if (attr)
				attr = strdup(attr);
		}

		// Free the whole DOM
		ixmlDocument_free(doc);
	}

	DBG_PRINT(DBG_LVL1, "Track metadata: %s = %s\n", key, (attr) ? attr : "<not found>");

	// NULL if not found
	return attr;
}
Exemple #10
0
// Extracts the result document from a SOAP response
IXML_Document* parseBrowseResult( IXML_Document* doc )
{
    ixmlRelaxParser(1);

    if ( !doc ) return 0;

    IXML_NodeList* resultList = ixmlDocument_getElementsByTagName( doc,
                                                                   "Result" );

    if ( !resultList ) return 0;

    IXML_Node* resultNode = ixmlNodeList_item( resultList, 0 );

    ixmlNodeList_free( resultList );

    if ( !resultNode ) return 0;

    IXML_Node* textNode = ixmlNode_getFirstChild( resultNode );
    if ( !textNode ) return 0;

    const char* resultString = ixmlNode_getNodeValue( textNode );
    char* resultXML = strdup( resultString );

    IXML_Document* browseDoc = ixmlParseBuffer( resultXML );

    free( resultXML );

    return browseDoc;
}
Exemple #11
0
void Test_AddPortMapping(void)
{
    struct Upnp_Action_Request event;
    strcpy(event.DevUDN,"uuid:75802409-bccb-40e7-8e6c-fa095ecce13e");
    strcpy(event.ServiceID,"urn:upnp-org:serviceId:WANIPConn1");
    strcpy(event.ActionName,"AddPortMapping");

    // Add with remotehost
    event.ActionRequest = ixmlParseBuffer(add_portmapping_request_xml);
    CU_ASSERT(AddPortMapping(&event) == 0);

    // Add with wildcarded remotehost
    event.ActionRequest = ixmlParseBuffer(add_portmapping_request_wildcard_remotehost_xml);
    CU_ASSERT(AddPortMapping(&event) == 0);

    // Add with wildcarded internalclient
    event.ActionRequest = ixmlParseBuffer(add_portmapping_request_wildcard_internalclient_xml);
    CU_ASSERT(AddPortMapping(&event) == 715);

    // Add with wildcarded external port
    event.ActionRequest = ixmlParseBuffer(add_portmapping_request_wildcard_extport_xml);
    CU_ASSERT(AddPortMapping(&event) == 716);

    // Add with wildcarded internal port
    event.ActionRequest = ixmlParseBuffer(add_portmapping_request_wildcard_intport_xml);
    CU_ASSERT(AddPortMapping(&event) == 732);

    // Add with different port values
    event.ActionRequest = ixmlParseBuffer(add_portmapping_request_diff_ports_xml);
    CU_ASSERT(AddPortMapping(&event) == 724);

    // Invalid args
    event.ActionRequest = ixmlParseBuffer(add_portmapping_request_missing_parameter_xml);
    CU_ASSERT(AddPortMapping(&event) == 402);
}
Exemple #12
0
void Test_GetSpecificPortMappingEntry(void)
{
    struct Upnp_Action_Request event;
    strcpy(event.DevUDN,"uuid:75802409-bccb-40e7-8e6c-fa095ecce13e");
    strcpy(event.ServiceID,"urn:upnp-org:serviceId:WANIPConn1");
    strcpy(event.ActionName,"GetSpecificPortMappingEntry");

    // Ok
    event.ActionRequest = ixmlParseBuffer(get_specific_portmapping_entry_request_xml);
    CU_ASSERT(GetSpecificPortMappingEntry(&event) == 0);

    // Invalid args
    event.ActionRequest = ixmlParseBuffer(get_specific_portmapping_entry_inv_args_xml);
    CU_ASSERT(GetSpecificPortMappingEntry(&event) == 402);

    // No such entry
    event.ActionRequest = ixmlParseBuffer(get_specific_portmapping_entry_no_such_entry_xml);
    CU_ASSERT(GetSpecificPortMappingEntry(&event) == 714);
}
Exemple #13
0
void Test_RetrieveListOfPortMappings(void)
{
    struct Upnp_Action_Request event;
    strcpy(event.DevUDN,"uuid:75802409-bccb-40e7-8e6c-fa095ecce13e");
    strcpy(event.ServiceID,"urn:upnp-org:serviceId:WANIPConn1");
    strcpy(event.ActionName,"RetrieveListOfPortmappings");

    // Ok
    event.ActionRequest = ixmlParseBuffer(retrieve_port_list_request_xml);
    CU_ASSERT(GetListOfPortmappings(&event) == 0);

    // Invalid arguments
    event.ActionRequest = ixmlParseBuffer(retrieve_port_list_inv_args_xml);
    CU_ASSERT(GetListOfPortmappings(&event) == 402);

    // No results
    event.ActionRequest = ixmlParseBuffer(retrieve_port_list_no_results_xml);
    CU_ASSERT(GetListOfPortmappings(&event) == 714);
}
Exemple #14
0
int _test_SOAPServerCallback (
		SOAPServerContext *ctx, 
		SOAPRequest *request, 
		void *cookie)
{
	request->out.body = ixmlParseBuffer (		
			"<u:SetTargetResponse xmlns:u=\"urn:schemas-upnp-org:service:SwitchPower:1\" />");
	
	return (0);
}		
Exemple #15
0
/*
 * Extracts the result document from a SOAP response
 */
IXML_Document* parseBrowseResult( IXML_Document* p_doc )
{
    assert( p_doc );

    const char* psz_result_string = xml_getChildElementValue( p_doc, "Result" );

    if( !psz_result_string )
        return NULL;

    IXML_Document* p_browse_doc = ixmlParseBuffer( psz_result_string );

    return p_browse_doc;
}
Exemple #16
0
/*
*****************************************************************************
** FUNCTION NAME: ParseCMD
**
** FUNCTION INPUTS:
**  @char *ptrXml: xml string will be parse
**  @char **objID: return the objID if exists
**  @char **cdid: return the cdid
**  @char **category: return the category
**
** FUNCTION DESCRIPTION
**   This function will parse command xml string.
**
** FUNCTION OUTPUTS:
**   Returns ZAPP_SUCCESS on success, or ZAPP_FAILED on failed.
**
** HISTORY:
** 2008-7-4	Steven Leong	Created
*****************************************************************************
*/
int ParseCMD(char *ptrXml, char **objID, char **cdid, char **category)
{
	IXML_Document *dom = NULL;
	IXML_Node *node = NULL;
	char *ptrObjID = NULL;
	char *ptrCdid = NULL;
	char *ptrCategory = NULL;
	int ret = ZAPP_SUCCESS;
	char strArray[BUF_128_BITS];
	
	if((dom = ixmlParseBuffer(ptrXml))==NULL){
		dprintf("Parse command xml string failed.\n");
		return ZAPP_FAILED;
	}

	if((node = ixmlGetFirstNodeByTagName(dom, "cmd"))==NULL){
		dprintf("Cannot get cmd tag.\n");
		ixmlDocument_free(dom);
		return ZAPP_FAILED;
	}
	
	ptrObjID = ixmlGetFirstElementItem((IXML_Element*)node, "objID");
	ptrCdid = ixmlGetFirstElementItem((IXML_Element*)node, "cdid");
	ptrCategory = ixmlGetFirstElementItem((IXML_Element*)node, "categoryname");
	
	/*NOTE: we need to check objID's format,
	if it's ROOT_ALLAL_ALXXX, change it to unsigned int. */
	if(ptrObjID == NULL){
		*objID = NULL;
	}
	else {
		if(strstr(ptrObjID, "AL")){
			/* string objID, like: ROOT_ALLAL_ALxxx */
			memset(strArray, 0, BUF_128_BITS);
			sprintf(strArray, "%u", GetTrackNum(ptrObjID, "AL"));
			*objID = strdup(strArray);
		}
		else{
			/* int objID */
			*objID = strdup(ptrObjID);
		}
	}
	*cdid = (ptrCdid==NULL) ? NULL : strdup(ptrCdid);
	*category = (ptrCategory==NULL) ? NULL : strdup(ptrCategory);

	ZFREE(ptrObjID);
	ZFREE(ptrCdid);
	ZFREE(ptrCategory);
	ixmlDocument_free(dom);
	return ret;
}
int cConnectionManager::GetProtocolInfo(Upnp_Action_Request* request){
  std::stringstream ss;

  std::string protocolInfo = tools::StringListToCSV(mMediaServer->GetManager().GetSupportedProtocolInfos());

  ss << "<u:" << request->ActionName << "Response xmlns:u=\"" << GetServiceDescription().serviceType << "\">"
     << "  <Source>" << protocolInfo.c_str() << "</Source>"
     << "  <Sink></Sink>"
     << "</u:" << request->ActionName << "Response>";

  request->ActionResult = ixmlParseBuffer(ss.str().c_str());
  request->ErrCode = UPNP_E_SUCCESS;
  return request->ErrCode;
}
Exemple #18
0
int MediaServer::sendActionCb( Upnp_EventType eventType,
                               void *p_event, void *p_cookie )
{
    if( eventType != UPNP_CONTROL_ACTION_COMPLETE )
        return 0;
    IXML_Document** pp_sendActionResult = (IXML_Document** )p_cookie;
    Upnp_Action_Complete *p_result = (Upnp_Action_Complete *)p_event;

    /* The only way to dup the result is to print it and parse it again */
    DOMString tmpStr = ixmlPrintNode( ( IXML_Node * ) p_result->ActionResult );
    if (tmpStr == NULL)
        return 0;

    *pp_sendActionResult = ixmlParseBuffer( tmpStr );
    ixmlFreeDOMString( tmpStr );
    return 0;
}
int cConnectionManager::GetCurrentConnectionIDs(Upnp_Action_Request* request){
  std::string IDs = this->GetConnectionIDsCVS();
  if(IDs.empty()){
    SetError(request, UPNP_E_INTERNAL_ERROR);
    return request->ErrCode;
  }

  std::stringstream ss;

  ss << "<u:" << request->ActionName << "Response xmlns:u=\"" << GetServiceDescription().serviceType << "\">"
     << "  <ConnectionIDs>" << IDs << "</ConnectionIDs>"
     << "</u:" << request->ActionName << "Response>";

  request->ActionResult = ixmlParseBuffer(ss.str().c_str());
  request->ErrCode = UPNP_E_SUCCESS;
  return request->ErrCode;
}
Exemple #20
0
int createThumbnailPhoto(const char *path, char **attr2)
{
	IXML_Document 	*doc = NULL;
	char 			reqXML[2048] = {0};
	char 			thumbnail[1024] = {0};
	char 			respondBuf[2048] = {0};
	char 			*errNum = NULL;
	char 			*errMsg = NULL;
	int  			respondLen = 2048;

	getThumbnail(path, thumbnail);

	if(fileExists(thumbnail) == 1)
		remove(thumbnail);

	sprintf (reqXML, "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
			"<cmd>"
			"<InputLocation>%s</InputLocation>"
			"<OutputLocation>%s</OutputLocation>"
			"<Size>128</Size>"
			"</cmd>",
			path, thumbnail);
	
	if(processTCPReqRsp(ZAPP_ZSCALE_SOCKET, reqXML, strlen(reqXML), respondBuf, &respondLen, 3) == 0){
		if((doc = ixmlParseBuffer(respondBuf)) != NULL){
			errNum = ixmlGetFirstDocumentItem(doc, "err");
			if(strcmp(errNum, "0") != 0){
				errMsg = ixmlGetFirstDocumentItem(doc, "msg");
				ZError(DBG_MISC, "create thumbnail failed. errNum->%s, errMsg-> %s", errNum, errMsg);
				free(errMsg);
			}
			else
				*attr2 = strdup(thumbnail);

			free(errNum);
			ixmlDocument_free(doc);
		}
		else
			ZError(DBG_MISC, "zscale respond is NULL");
	}
	else
		ZError(DBG_MISC, "call zscale failed.");

	return 0;
}
Exemple #21
0
bool client::read_device_description(const std::string &location, struct device_description &device_description)
{
    char *buffer = NULL;
    char content_type[LINE_SIZE];
    if (::UpnpDownloadUrlItem(location.c_str(), &buffer, content_type) == UPNP_E_SUCCESS)
    {
        IXML_Document * const doc = ixmlParseBuffer(buffer);
        if (doc)
        {
            IXML_Node * const root_elm = get_element(&doc->n, "root");
            if (root_elm)
            {
                IXML_Node * const device_elm = get_element(root_elm, "device");
                if (device_elm)
                {
                    device_description.devicetype = get_text(get_element(device_elm, "deviceType"));
                    device_description.friendlyname = get_text(get_element(device_elm, "friendlyName"));
                    device_description.manufacturer = get_text(get_element(device_elm, "manufacturer"));
                    device_description.modelname = get_text(get_element(device_elm, "modelName"));
                    device_description.udn = get_text(get_element(device_elm, "UDN"));

                    device_description.presentation_url = get_text(get_element(device_elm, "presentationURL"));

                    IXML_Node * const icon_list_elm = get_element(device_elm, "iconList");
                    if (icon_list_elm)
                    {
                        IXML_Node * const icon_elm = get_element(icon_list_elm, "icon");
                        if (icon_elm)
                        {
                            device_description.icon_url = get_text(get_element(icon_elm, "url"));
                        }
                    }

                    ixmlDocument_free(doc);
                }
            }
        }

        ::free(buffer);
        return true;
    }

    return false;
}
Exemple #22
0
void Test_GetEthernetLinkStatus(void)
{
    struct Upnp_Action_Request event;
    strcpy(event.DevUDN,"uuid:75802409-bccb-40e7-8e6c-fa095ecce13e");
    strcpy(event.ServiceID,"urn:upnp-org:serviceId:WANEthLinkC1");
    strcpy(event.ActionName,"GetEthernetLinkStatus");

    event.ActionRequest = ixmlParseBuffer(get_ethernet_link_status_request_xml);

    // Up
    strcpy(g_vars.extInterfaceName,"eth0");
    CU_ASSERT(GetEthernetLinkStatus(&event) == 0);
    CU_ASSERT(strcmp(EthernetLinkStatus,"Up") == 0);

    // Down
    strcpy(g_vars.extInterfaceName,"eth7");
    CU_ASSERT(GetEthernetLinkStatus(&event) == 0);
    CU_ASSERT(strcmp(EthernetLinkStatus,"Down") == 0);
}
Exemple #23
0
void AVTransport::handleEvent(ArgMap vars) {
#if 0
//	log()<<"got avtransport event"<<vars.size();
	if (!vars.contains("LastChange")) return;
	QString change = vars["LastChange"];
	IXML_Document* doc = ixmlParseBuffer(qPrintable(change));
	if (!doc) {
		log()<<"failed parsing lastchange";
		return;
	}
//	log() << ixmlPrintDocument(doc);
	ArgMap args;
	for(Nodeptr i=doc->n.firstChild->firstChild->firstChild; i; i=i->nextSibling) {
//		log()<<i->nodeName<<i->firstAttr->nodeValue;
		args[QString::fromUtf8(i->nodeName)] = QString::fromUtf8(i->firstAttr->nodeValue);
	}
//	log()<<args;
	emit lastChange(args);
#endif
}
Exemple #24
0
void YX_CD_ParseMetadataByUri(char *metadata, char *uri, char **protocolInfo, t_MEDIA_INFO* minfo )
{
	if( !(metadata && uri && minfo) )
		return;
	
	memset(minfo, 0, sizeof(t_MEDIA_INFO));
	
	IXML_Document *subdoc = ixmlParseBuffer( metadata );
	IXML_NodeList* items =	ixmlDocument_getElementsByTagName (subdoc, "item"); 
	IXML_Node* const node = ixmlNodeList_item(items,  0);
	IXML_Element* const elem = (IXML_Element*)node;
	IXML_NodeList* const reslist = ixmlElement_getElementsByTagName ((IXML_Element*)elem, "res");
	int nb_reslist = ixmlNodeList_length (reslist);
	
	if( nb_reslist > 0 )
		nb_reslist = s_YX_CD_GetMinfoByUri(uri, reslist, nb_reslist, protocolInfo, minfo);
	
	if (reslist)
		ixmlNodeList_free (reslist);
	if (items)
		ixmlNodeList_free (items);
}
Exemple #25
0
void Test_AddAnyPortMapping(void)
{
    struct Upnp_Action_Request event;
    char *port = NULL;
    int result;

    strcpy(event.ActionName,"AddAnyPortMapping");
    strcpy(event.DevUDN,"00:22132:24324");
    strcpy(event.ServiceID,"99");

    // Add new port mapping
    event.ActionRequest = ixmlParseBuffer(add_any_port_mapping_ok_xml);

    CU_ASSERT(AddAnyPortMapping(&event) == 0);
    port = GetFirstDocumentItem(event.ActionResult, "NewReservedPort");
    CU_ASSERT(strcmp(port, "100") == 0);

    // Add it again
    event.ActionRequest = ixmlParseBuffer(add_any_port_mapping_reserved_xml);
    result = AddAnyPortMapping(&event);
    CU_ASSERT(result == 0);

    port = GetFirstDocumentItem(event.ActionResult, "NewReservedPort");
    CU_ASSERT(strcmp(port, "100") != 0);

    // Wildcard in internal client
    event.ActionRequest = ixmlParseBuffer(add_any_port_mapping_wild_card_in_internal_client_xml);
    CU_ASSERT(AddAnyPortMapping(&event) == 715);

    // Wildcard in external port
    event.ActionRequest = ixmlParseBuffer(add_any_port_mapping_wild_card_in_external_port_xml);
    result = AddAnyPortMapping(&event);
    CU_ASSERT(result == 716);

    // Different internal and external port values
    event.ActionRequest = ixmlParseBuffer(add_any_port_mapping_different_port_values_xml);
    CU_ASSERT(AddAnyPortMapping(&event) == 724);

    // Missing parameter
    event.ActionRequest = ixmlParseBuffer(add_any_port_mapping_missing_parameter_xml);
    CU_ASSERT(AddAnyPortMapping(&event) == 402);
}
Exemple #26
0
RTPXML_Document *rtpxmlParseBuffer(char *buffer)
{
	return ixmlParseBuffer(buffer);
}
/**************************************************************************
* Function: prepareParameter
* Functionality: it will get the parameter from pipe and check it
* @IN : fd: the file description id for the pipe
*      enable: enable or disable flag
* @OUT: 0 success, else failed.
* Used description:
    The parameter is a xml, it will get from the pipe
* Date: 20080108
* Changed history:
* Date 		Who		Reason
* 20080108	kelly  		First  creation
***************************************************************************/
int prepareParameter(PSystemConfig **pList,int *count)
{
    IXML_Document *rootDom = NULL;
    IXML_NodeList   *nodeList = NULL;
    IXML_NodeList   *nodeList2 = NULL;
    IXML_Node       *node = NULL;
    IXML_Node       *cmdNode = NULL;
    char buffer[1024] = {0};
    char Str[1024] = {0};
    int i = 0;
	int nodeLen = 0;
	PSystemConfig *pConfigList  = NULL;

    while(1)
    {
        fgets(Str, 1024, stdin);
        strcat(buffer, Str);
        if(strstr(buffer,EndFlag))
            break;
    }

	if(strlen(buffer) == 0)
		goto failed;

	if((rootDom = ixmlParseBuffer(buffer)) == NULL)
		goto failed;
	if((nodeList = ixmlDocument_getElementsByTagName(rootDom,"cmd")) != NULL) 
	{
		cmdNode   = ixmlGetFirstNodeByTagName(rootDom,"cmd");
		nodeList2 = ixmlNode_getChildNodes(cmdNode);
		nodeLen   = ixmlNodeList_length(nodeList2);
/*        fprintf(stderr, "=======nodeLen -> [%d]\n", nodeLen);*/
		pConfigList = (PSystemConfig*)malloc(sizeof(PSystemConfig) * nodeLen);
		memset(pConfigList, 0, sizeof(PSystemConfig)*nodeLen);

		node = ixmlNodeList_item(nodeList, 0);
		node = ixmlNode_getFirstChild(node);
		for(i=0; i<nodeLen; i++) {
			if(node){
				pConfigList[i] = (PSystemConfig)malloc(sizeof(SystemConfig));
				memset(pConfigList[i],0,sizeof(SystemConfig));
				pConfigList[i]->name = strdup(ixmlNode_getNodeName(node));
				if(i != nodeLen-1)
				node = ixmlNode_getNextSibling(node);
			}
			else{
				fprintf(stderr, "===== node is empty. i->[%d]\n", i);
			}
		}
	}

	*count = nodeLen;

	if(pConfigList){
		*pList = pConfigList;
	}
	else{
		fprintf(stderr, " !!!!!!pLIST is NULL");
	}

	if (rootDom)
		ixmlDocument_free(rootDom);
	if (nodeList)
		ixmlNodeList_free(nodeList);
	if (nodeList2)
		ixmlNodeList_free(nodeList2);
	return i;

failed:
        fprintf(stderr,"Got a command parameter->%s", buffer);
        //fprintf(stderr,"Got a command parameter->%s", buffer);
    return i;
}
/**************************************************************************
 * Function: ParaseXMLString
 * Functionality: parase the xml string
 * @IN :  XMLString: the xml string

 * @OUT:   NetConfig: fill this struct from xml string 
WifiParam:wifi config parameters
0 OK else error
 * Used description:
 get the xml string and fill the struct NetworkConfig
 * Date: 20080117
 * Changed history:
 * Date          Who             Reason
 * 20080117     sandy           First  creation
 ***************************************************************************/ 
int ParaseXMLString(char * XMLString, NetworkConfig *NetConfig, PWifiConfig WifiParam)
{
	IXML_Document   * Dom = NULL;

	IXML_NodeList   *nodeList = NULL;
	IXML_Node       *node;

	/*parse the xml string, and get the needed value*/
	if(!(Dom = ixmlParseBuffer(XMLString))){
		fprintf(stderr, "Load Document error\n");
		return -1;
	}
	NetConfig->PreferNetwork = ixmlGetFirstDocumentItem(Dom,"PreferNetwork");
	NetConfig->IPDNS1 = ixmlGetFirstDocumentItem(Dom,"IPDNS1");
	NetConfig->IPDNS2 = ixmlGetFirstDocumentItem(Dom,"IPDNS2");

	if ((nodeList = ixmlDocument_getElementsByTagName(Dom,"Wired")) != NULL) {
		if ((node = ixmlNodeList_item(nodeList, 0)) != NULL) {
			NetConfig->WireConfig.Enabled = ixmlGetFirstElementItem((IXML_Element *)node, "Enabled");
			NetConfig->WireConfig.DHCPEnable = ixmlGetFirstElementItem((IXML_Element *)node, "DHCPEnable");
			NetConfig->WireConfig.IPAddr = ixmlGetFirstElementItem((IXML_Element *)node, "IPAddr");
			NetConfig->WireConfig.IPGateway = ixmlGetFirstElementItem((IXML_Element *)node, "IPGateway");
			NetConfig->WireConfig.IPSubnetMask = ixmlGetFirstElementItem((IXML_Element *)node, "IPSubnetMask");
		}
		if (nodeList)
			ixmlNodeList_free(nodeList);
	}

	if ((nodeList = ixmlDocument_getElementsByTagName(Dom,"Wireless")) != NULL) {
		if ((node = ixmlNodeList_item(nodeList, 0)) != NULL) {
			WifiParam->encryption = ixmlGetFirstElementItem((IXML_Element *)node, "Encryption");
			WifiParam->ssid = ixmlGetFirstElementItem((IXML_Element *)node, "ESSID");
			WifiParam->key = ixmlGetFirstElementItem((IXML_Element *)node, "Key");
			NetConfig->WifiConfig.Enabled = ixmlGetFirstElementItem((IXML_Element *)node, "Enabled");
			NetConfig->WifiConfig.DHCPEnable = ixmlGetFirstElementItem((IXML_Element *)node, "DHCPEnable");
			NetConfig->WifiConfig.IPAddr = ixmlGetFirstElementItem((IXML_Element *)node, "IPAddr");
			NetConfig->WifiConfig.IPGateway = ixmlGetFirstElementItem((IXML_Element *)node, "IPGateway");
			NetConfig->WifiConfig.IPSubnetMask = ixmlGetFirstElementItem((IXML_Element *)node, "IPSubnetMask");
		}
		if (nodeList)
			ixmlNodeList_free(nodeList);
	}


	if(Dom){
		ixmlDocument_free(Dom);
		Dom = NULL;
	}

#if 0
	printf("the DNS is %s %s \n", NetConfig->IPDNS1, NetConfig->IPDNS2);
	printf("the return NetConfig.DHCPStatus is %s\n", NetConfig->DHCPStatus);
	printf("the return NetConfig.PreferNetwork is %s\n", NetConfig->PreferNetwork);

	printf("the return NetConfig.WireConfig.Enabled is %s\n", NetConfig->WireConfig.Enabled);
	printf("the return NetConfig.WireConfig.DHCPEnable is %s\n", NetConfig->WireConfig.DHCPEnable);
	printf("the return NetConfig.WireConfig.IPAddr is %s\n", NetConfig->WireConfig.IPAddr);
	printf("the return NetConfig.WireConfig.IPSubnetMask is %s\n", NetConfig->WireConfig.IPSubnetMask);
	printf("the return NetConfig.WireConfig.IPSubnetMask is %s\n", NetConfig->WireConfig.IPGateway);

	printf("the return NetConfig.WifiConfig.Enabled is %s\n", NetConfig->WifiConfig.Enabled);
	printf("the return NetConfig.WifiConfig.DHCPEnable is %s\n", NetConfig->WifiConfig.DHCPEnable);
	printf("the return NetConfig.WifiConfig.IPAddr is %s\n", NetConfig->WifiConfig.IPAddr);
	printf("the return NetConfig.WifiConfig.IPSubnetMask is %s\n", NetConfig->WifiConfig.IPSubnetMask);
	printf("the return NetConfig.WifiConfig.IPGateway is %s\n", NetConfig->WifiConfig.IPGateway);
#endif

	return 0;
}
Exemple #29
0
/*
	Function:Prints a callback event type as a string;
	INPUT:
		S -- The callback event;
	SUCCESS:0;
	ERROR:-1;		
*/
int
PrintEvent( IN Upnp_EventType EventType,
                       IN void *Event )
{

    ithread_mutex_lock( &display_mutex );

    SA_Print
        ( "\n\n\n======================================================================\n" );
    SA_Print
        ( "----------------------------------------------------------------------\n" );
    PrintEventType( EventType );

    switch ( EventType ) {

            /*
               SSDP 
             */
        case UPNP_DISCOVERY_ADVERTISEMENT_ALIVE:
        case UPNP_DISCOVERY_ADVERTISEMENT_BYEBYE:
        case UPNP_DISCOVERY_SEARCH_RESULT:
            {
                struct Upnp_Discovery *d_event =
                    ( struct Upnp_Discovery * )Event;

                SA_Print( "ErrCode     =  %d\n",
                                  d_event->ErrCode );
                SA_Print( "Expires     =  %d\n",
                                  d_event->Expires );
                SA_Print( "DeviceId    =  %s\n",
                                  d_event->DeviceId );
                SA_Print( "DeviceType  =  %s\n",
                                  d_event->DeviceType );
                SA_Print( "ServiceType =  %s\n",
                                  d_event->ServiceType );
                SA_Print( "ServiceVer  =  %s\n",
                                  d_event->ServiceVer );
                SA_Print( "Location    =  %s\n",
                                  d_event->Location );
	

                SA_Print( "OS          =  %s\n", d_event->Os );
                SA_Print( "Ext         =  %s\n", d_event->Ext );
	
		sem_post(&ServerSem);

            }
            break;

        case UPNP_DISCOVERY_SEARCH_TIMEOUT:
            // Nothing to print out here
            break;

            /*
               SOAP 
             */
        case UPNP_CONTROL_ACTION_REQUEST:
            {
                struct Upnp_Action_Request *a_event =
                    ( struct Upnp_Action_Request * )Event;
                char *xmlbuff = NULL;

                SA_Print( "ErrCode     =  %d\n",
                                  a_event->ErrCode );
                SA_Print( "ErrStr      =  %s\n", a_event->ErrStr );
                SA_Print( "ActionName  =  %s\n",
                                  a_event->ActionName );
                SA_Print( "UDN         =  %s\n", a_event->DevUDN );
                SA_Print( "ServiceID   =  %s\n",
                                  a_event->ServiceID );
                if( a_event->ActionRequest ) {
                    xmlbuff = ixmlPrintNode( ( IXML_Node * ) a_event->ActionRequest );	
			
                    if( xmlbuff )
                        SA_Print( "ActRequest  =  %s\n", xmlbuff );
                    if( xmlbuff )
                        ixmlFreeDOMString( xmlbuff );
                    xmlbuff = NULL;
                } else {
                    SA_Print( "ActRequest  =  (null)\n" );
                }

                if( a_event->ActionResult ) {
                    xmlbuff = ixmlPrintNode( ( IXML_Node * ) a_event->ActionResult );
                    if( xmlbuff )
                        SA_Print( "ActResult   =  %s\n", xmlbuff );
                    if( xmlbuff )
                        ixmlFreeDOMString( xmlbuff );
                    xmlbuff = NULL;
                } else {
                    SA_Print( "ActResult   =  (null)\n" );
                }
            }
            break;

        case UPNP_CONTROL_ACTION_COMPLETE:
            {
                struct Upnp_Action_Complete *a_event =
                    ( struct Upnp_Action_Complete * )Event;
                char *xmlbuff = NULL;

                SA_Print( "ErrCode     =  %d\n",
                                  a_event->ErrCode );
                SA_Print( "CtrlUrl     =  %s\n",
                                  a_event->CtrlUrl );

                if( a_event->ActionRequest ) {
                    xmlbuff = ixmlPrintNode( ( IXML_Node * ) a_event->ActionRequest );
                    if( xmlbuff )
                        SA_Print( "ActRequest  =  %s\n", xmlbuff );
                    if( xmlbuff )
                        ixmlFreeDOMString( xmlbuff );
                    xmlbuff = NULL;
                } else {
                    SA_Print( "ActRequest  =  (null)\n" );
                }

                if( a_event->ActionResult ) 
		{
		    xmlbuff = ixmlPrintNode( ( IXML_Node * ) a_event->ActionResult );
                    if( xmlbuff )
                        SA_Print( "ActResult   =  %s\n", xmlbuff );

		if(strncmp(NowCommand,"Browse",6) == 0)
		{

			FNode *Now = (FNode *)malloc(sizeof(FNode));

			FNode *Last = NowNode;

			NowNode -> LeftChild = Now;		

			IXML_Document *document = ixmlParseBuffer(XMLP_GetFirstDocumentItem(a_event->ActionResult,"Result"));

			IXML_NodeList *ContainerList = ixmlElement_getElementsByTagName( ( IXML_Element * ) document, "container" );

			IXML_Node *ContainerNode = ixmlNodeList_item(ContainerList,0);

			IXML_NodeList *FileList = ixmlElement_getElementsByTagName( ( IXML_Element * ) document, "item" );

			IXML_Node *FileNode = ixmlNodeList_item(FileList,0);

			int ContainerLength = ixmlNodeList_length(ContainerList);

			int FileLength = ixmlNodeList_length(FileList);
		
			if(ContainerLength)
			{

				int i=0;
	
				for(i=0;i<ContainerLength;i++)
				{		

					char *Container_id = ixmlElement_getAttribute(( IXML_Element * ) ContainerNode,"id");

					IXML_NodeList *Title = ixmlElement_getElementsByTagName( ( IXML_Element * ) ContainerNode, "dc:title" );
	
					IXML_Node *TitleNode = ixmlNodeList_item(Title,0);

					TitleNode= ixmlNode_getFirstChild(TitleNode);

					char *TitleName = strdup(ixmlNode_getNodeValue(TitleNode));

					SA_Print("%s %s\n", Container_id,TitleName);

					Now -> Type = 0;

					strcpy(Now -> Name,TitleName);

					strcpy(Now -> Url,Container_id);

					Now -> LeftChild = NULL;
			
					Now -> Brother = NULL;

					Now -> Brother = (FNode *)malloc(sizeof(FNode));

					Last = Now;

					Now = Now -> Brother;

					ContainerNode = ixmlNode_getNextSibling(ContainerNode);
			
				}

			}

			if(FileLength)
			{	

				int j=0;	

				for(j=0;j<FileLength;j++)
				{		

					IXML_NodeList *Path = ixmlElement_getElementsByTagName( ( IXML_Element * ) FileNode, "res" );
	
					IXML_Node *PathNode = ixmlNodeList_item(Path,0);

					PathNode= ixmlNode_getFirstChild(PathNode);

					char *PathName = strdup(ixmlNode_getNodeValue(PathNode));

					IXML_NodeList *Title = ixmlElement_getElementsByTagName( ( IXML_Element * ) FileNode, "dc:title" );
	
					IXML_Node *TitleNode = ixmlNodeList_item(Title,0);

					TitleNode= ixmlNode_getFirstChild(TitleNode);

					char *TitleName = strdup(ixmlNode_getNodeValue(TitleNode));

					SA_Print( "%s %s\n", PathName,TitleName);

					Now -> Type = 1;

					strcpy(Now -> Name,TitleName);

					strcpy(Now -> Url,PathName);

					Now -> LeftChild = NULL;
			
					Now -> Brother = NULL;

					Now -> Brother = (FNode *)malloc(sizeof(FNode));

					Last = Now;	

					Now = Now -> Brother;
			
					FileNode = ixmlNode_getNextSibling(FileNode);
			
				}
					
			}

			Last -> Brother = NULL;

			Last -> LeftChild = NULL;

			free(Now);

			Now = NULL;


		}

                if( xmlbuff )
	        {
                      	ixmlFreeDOMString( xmlbuff );
                   	xmlbuff = NULL;
                }


		}
		else 
		{
                    SA_Print( "ActResult   =  (null)\n" );
                }

		sem_post(&BrowseSem);

            }
            break;

            /*
               GENA 
             */
        case UPNP_EVENT_SUBSCRIPTION_REQUEST:
            {
                struct Upnp_Subscription_Request *sr_event =
                    ( struct Upnp_Subscription_Request * )Event;

                SA_Print( "ServiceID   =  %s\n",
                                  sr_event->ServiceId );
                SA_Print( "UDN         =  %s\n", sr_event->UDN );
                SA_Print( "SID         =  %s\n", sr_event->Sid );
            }
            break;

        case UPNP_EVENT_RECEIVED:
            break;

        case UPNP_EVENT_RENEWAL_COMPLETE:
            {
                struct Upnp_Event_Subscribe *es_event =
                    ( struct Upnp_Event_Subscribe * )Event;

                SA_Print( "SID         =  %s\n", es_event->Sid );
                SA_Print( "ErrCode     =  %d\n",
                                  es_event->ErrCode );
                SA_Print( "TimeOut     =  %d\n",
                                  es_event->TimeOut );
            }
            break;

        case UPNP_EVENT_SUBSCRIBE_COMPLETE:
        case UPNP_EVENT_UNSUBSCRIBE_COMPLETE:
            {
                struct Upnp_Event_Subscribe *es_event =
                    ( struct Upnp_Event_Subscribe * )Event;

                SA_Print( "SID         =  %s\n", es_event->Sid );
                SA_Print( "ErrCode     =  %d\n",
                                  es_event->ErrCode );
                SA_Print( "PublisherURL=  %s\n",
                                  es_event->PublisherUrl );
                SA_Print( "TimeOut     =  %d\n",
                                  es_event->TimeOut );
            }
            break;

        case UPNP_EVENT_AUTORENEWAL_FAILED:
        case UPNP_EVENT_SUBSCRIPTION_EXPIRED:
            {
                struct Upnp_Event_Subscribe *es_event =
                    ( struct Upnp_Event_Subscribe * )Event;

                SA_Print( "SID         =  %s\n", es_event->Sid );
                SA_Print( "ErrCode     =  %d\n",
                                  es_event->ErrCode );
                SA_Print( "PublisherURL=  %s\n",
                                  es_event->PublisherUrl );
                SA_Print( "TimeOut     =  %d\n",
                                  es_event->TimeOut );
            }
            break;
	default:
	    break;
    }
    SA_Print
        ( "----------------------------------------------------------------------\n" );
    SA_Print
        ( "======================================================================\n\n\n\n" );

    ithread_mutex_unlock( &display_mutex );
    return ( 0 );
}
/**************************************************************************
* Function: prepareParameter
* Functionality: it will get the parameter from pipe and check it
* @IN : fd: the file description id for the pipe
*      enable: enable or disable flag
* @OUT: 0 success, else failed.
* Used description:
    The parameter is a xml, it will get from the pipe
* Date: 20080108
* Changed history:
* Date 		Who		Reason
* 20080108	kelly  		First  creation
***************************************************************************/
int prepareParameter(PSystemConfig **pList,int *count)
{
    IXML_Document *rootDom = NULL;
    IXML_NodeList   *nodeList = NULL;
    IXML_NodeList   *nodeList2 = NULL;
    IXML_Node       *node = NULL;
    IXML_Node       *cmdNode = NULL;
	IXML_Node       *node2 = NULL;
    char buffer[1024] = {0};
    char Str[1024] = {0};
    int i = 0;
	int i_ret=0;
	int nodeLen = 0;
	PSystemConfig *pConfigList = NULL;

    while(1)
    {
        fgets(Str, 1024, stdin);
        strcat(buffer, Str);
        if(strstr(buffer,EndFlag))
            break;
    }

    if(strlen(buffer) == 0)
        goto failed;

    if((rootDom = ixmlParseBuffer(buffer)) == NULL){
		i_ret = -1;
		goto Err_handler;
	}

	if((nodeList = ixmlDocument_getElementsByTagName(rootDom,"cmd")) != NULL) 
	{
		cmdNode   = ixmlGetFirstNodeByTagName(rootDom,"cmd");
		nodeList2 = ixmlNode_getChildNodes(cmdNode);
		nodeLen   = ixmlNodeList_length(nodeList2);

		pConfigList = (PSystemConfig*)malloc(sizeof(PSystemConfig) * nodeLen);
		memset(pConfigList, 0, sizeof(PSystemConfig)*nodeLen);

		node = ixmlNodeList_item(nodeList, 0);
		node = ixmlNode_getFirstChild(node);
		while (node != NULL)
		{
			pConfigList[i] = (PSystemConfig)malloc(sizeof(SystemConfig));
			memset(pConfigList[i],0,sizeof(SystemConfig));						
			pConfigList[i]->name = strdup(ixmlNode_getNodeName(node));


			node2 = ixmlNode_getFirstChild(node);
			pConfigList[i]->value = (ixmlNode_getNodeValue(node2))?strdup(ixmlNode_getNodeValue(node2)):strdup("");

/*            fprintf(stderr, "name->%s , value ->%s\n" , pConfigList[i]->name , pConfigList[i]->value);		*/

			i_ret=CheckVariable(pConfigList[i]->name,pConfigList[i]->value);
			if(i_ret<0)
			{
				i_ret = -3;
				goto Err_handler;
			}

			node = ixmlNode_getNextSibling(node);
			i++;
		}
	}

	*count = nodeLen;

	if(pConfigList){
		*pList = pConfigList;
	}
	else{
		fprintf(stderr, " !!!!!!pLIST is NULL");
	}

	if (rootDom)
        ixmlDocument_free(rootDom);
    if (nodeList)
        ixmlNodeList_free(nodeList);
    if (nodeList2)
        ixmlNodeList_free(nodeList2);
    return i;

failed:
        fprintf(stderr,"Got a command parameter->%s", buffer);
        //fprintf(stderr,"Got a command parameter->%s", buffer);
		return i;
Err_handler:
		if (rootDom)
			ixmlDocument_free(rootDom);
		if (nodeList)
			ixmlNodeList_free(nodeList);
		if (nodeList2)
			ixmlNodeList_free(nodeList2);
		return i_ret;
}