CgSoapRequest *cg_soap_request_new()
{
    CgSoapRequest *soapReq;

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

    soapReq = (CgSoapRequest *)malloc(sizeof(CgSoapRequest));

    if ( NULL != soapReq )
    {
        soapReq->rootNodeList = cg_xml_nodelist_new();
        soapReq->soapRes = cg_soap_response_new();

        soapReq->httpReq = cg_http_request_new();
        soapReq->isHttpReqCreated = TRUE;
        cg_http_request_setcontenttype(soapReq->httpReq, CG_SOAP_CONTENT_TYPE);
        cg_http_request_setmethod(soapReq->httpReq, CG_HTTP_POST);

        cg_soap_request_setuserdata(soapReq, NULL);
    }

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

    return soapReq;
}
Beispiel #2
0
CgXmlNode *cg_xml_node_new()
{
	CgXmlNode *node;
	
	cg_log_debug_l4("Entering...\n");

	node = (CgXmlNode *)malloc(sizeof(CgXmlNode));

	if ( NULL != node )
	{
		cg_list_node_init((CgList *)node);

		node->name = cg_string_new();
		node->value = cg_string_new();
		node->attrList = cg_xml_attributelist_new();
		node->nodeList = cg_xml_nodelist_new();
		node->parentNode = NULL;
		node->userData = NULL;
		node->userDataDestructorFunc = NULL;
	}

	cg_log_debug_l4("Leaving...\n");
	
	return node;
}
Beispiel #3
0
/**
 * Create a new control point. Does not start any threads.
 *
 * @return A newly-created CgUpnpControlPoint
 */
CgUpnpControlPoint *cg_upnp_controlpoint_new()
{
	CgUpnpControlPoint *ctrlPoint;

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

	ctrlPoint = (CgUpnpControlPoint *)malloc(sizeof(CgUpnpControlPoint));

	if ( NULL != ctrlPoint )
	{
#ifdef CG_HTTP_USE_PERSISTENT_CONNECTIONS	
		cg_http_persistentconnection_init();
#endif
		ctrlPoint->mutex = cg_mutex_new();
		ctrlPoint->deviceRootNodeList = cg_xml_nodelist_new();
		ctrlPoint->deviceList = cg_upnp_devicelist_new();
		ctrlPoint->ssdpServerList = cg_upnp_ssdp_serverlist_new();
		ctrlPoint->ssdpResServerList = cg_upnp_ssdpresponse_serverlist_new();
		ctrlPoint->httpServerList = cg_http_serverlist_new();
		ctrlPoint->httpEventURI = cg_string_new();
		ctrlPoint->eventListeners = cg_upnp_eventlistenerlist_new();

		/* Expiration handling */
		ctrlPoint->expThread = cg_thread_new();
		cg_thread_setaction(ctrlPoint->expThread, cg_upnp_controlpoint_expirationhandler);
		cg_thread_setuserdata(ctrlPoint->expThread, ctrlPoint);
		ctrlPoint->expMutex = cg_mutex_new();
		ctrlPoint->expCond = cg_cond_new();
		
		ctrlPoint->ifCache = cg_net_interfacelist_new();
		
		cg_upnp_controlpoint_setssdplistener(ctrlPoint, NULL);
		cg_upnp_controlpoint_setssdpresponselistener(ctrlPoint, NULL);
		cg_upnp_controlpoint_sethttplistener(ctrlPoint, NULL);
		cg_upnp_controlpoint_setdevicelistener(ctrlPoint, NULL);
		
		cg_upnp_controlpoint_setssdpresponseport(ctrlPoint, CG_UPNP_CONTROLPOINT_SSDP_RESPONSE_DEFAULT_PORT);
		cg_upnp_controlpoint_setssdpsearchmx(ctrlPoint, CG_UPNP_CONTROLPOINT_SSDP_DEFAULT_SEARCH_MX);
		cg_upnp_controlpoint_seteventport(ctrlPoint, CG_UPNP_CONTROLPOINT_HTTP_EVENT_DEFAULT_PORT);
		cg_upnp_controlpoint_seteventsuburi(ctrlPoint, CG_UPNP_CONTROLPOINT_HTTP_EVENTSUB_URI);

		cg_upnp_controlpoint_setuserdata(ctrlPoint, NULL);
	}

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

	return ctrlPoint;
}
CgSoapResponse *cg_soap_response_new()
{
	CgSoapResponse *soapRes;

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

	soapRes = (CgSoapResponse *)malloc(sizeof(CgSoapResponse));

	if ( NULL != soapRes )
	{
		soapRes->rootNodeList = cg_xml_nodelist_new();

		soapRes->httpRes = cg_http_response_new();
		soapRes->isHttpResCreated = TRUE;
	
		cg_soap_response_setuserdata(soapRes, NULL);
	}

	return soapRes;

	cg_log_debug_l4("Leaving...\n");
}