void mupnp_upnpav_dmr_addprotocolinfo(mUpnpAvRenderer *dmr, mUpnpAvProtocolInfo *info)
{
	mUpnpString *protocolInfos;
	mUpnpAvProtocolInfo *protocolInfo;
	mUpnpService *service;
	mUpnpStateVariable *stateVar;

	mupnp_upnpav_protocolinfolist_add(dmr->protocolInfoList, info);

	protocolInfos = mupnp_string_new();
	for (protocolInfo = mupnp_upnpav_dmr_getprotocolinfos(dmr); protocolInfo; protocolInfo = mupnp_upnpav_protocolinfo_next(protocolInfo)) {
		if (0 < mupnp_string_length(protocolInfos))
			mupnp_string_addvalue(protocolInfos, ",");
		mupnp_string_addvalue(protocolInfos, mupnp_upnpav_protocolinfo_getstring(protocolInfo));
	}

	service = mupnp_device_getservicebyexacttype(dmr->dev, CG_UPNPAV_DMR_CONNECTIONMANAGER_SERVICE_TYPE);
	stateVar = mupnp_service_getstatevariablebyname(service, CG_UPNPAV_DMR_CONNECTIONMANAGER_SINKPROTOCOLINFO);
	mupnp_statevariable_setvalue(stateVar, mupnp_string_getvalue(protocolInfos));

	mupnp_string_delete(protocolInfos);
}
Beispiel #2
0
void mupnp_soap_request_setcontent(mUpnpSoapRequest *soapReq, mUpnpXmlNode *node)
{
	mUpnpHttpRequest *httpReq;
		
	mupnp_log_debug_l4("Entering...\n");

	httpReq = mupnp_soap_request_gethttprequest(soapReq);
	
	/**** content type ****/
	mupnp_http_request_setcontenttype(httpReq, MUPNP_XML_CONTENT_TYPE);
	
	/**** content ****/
	mupnp_http_request_appendncontent(httpReq, MUPNP_SOAP_VERSION_HEADER,
					mupnp_strlen(MUPNP_SOAP_VERSION_HEADER));
	mupnp_http_request_appendncontent(httpReq, MUPNP_XML_CONTENT_LF,
					mupnp_strlen(MUPNP_XML_CONTENT_LF));
	mupnp_xml_node_tostring(node, true, httpReq->content);
		
	/**** content length ****/
	mupnp_http_request_setcontentlength(httpReq,
					 mupnp_string_length(httpReq->content));

	mupnp_log_debug_l4("Leaving...\n");
}
Beispiel #3
0
bool mupnp_ssdpresponse_server_post(mUpnpSSDPResponseServer* server, mUpnpSSDPRequest* ssdpReq)
{
  mUpnpHttpUSocket* httpuSock;
  char* ifAddr;
  const char* ssdpAddr;
  mUpnpString* ssdpMsg;
  size_t sentLen = 0;

  mupnp_log_debug_l4("Entering...\n");

  httpuSock = mupnp_ssdpresponse_server_getsocket(server);

  ifAddr = mupnp_socket_getaddress(httpuSock);
  ssdpAddr = mupnp_ssdp_gethostaddress(ifAddr);
  mupnp_ssdprequest_sethost(ssdpReq, ssdpAddr, MUPNP_SSDP_PORT);

  ssdpMsg = mupnp_string_new();
  mupnp_ssdprequest_tostring(ssdpReq, ssdpMsg);

  sentLen = mupnp_socket_sendto(httpuSock, ssdpAddr, MUPNP_SSDP_PORT, mupnp_string_getvalue(ssdpMsg), mupnp_string_length(ssdpMsg));
  mupnp_string_delete(ssdpMsg);

  mupnp_log_debug_l4("Leaving...\n");

  return (sentLen > 0);
}