Ejemplo n.º 1
0
void SetMXValue(mUpnpControlPoint *ctrlPoint)
{
        unsigned int mxValue;

        printf("Give new MX value: ");
        if (scanf("%u", &mxValue) == 1) {
                printf( "%d", mxValue );
                mupnp_controlpoint_setssdpsearchmx(ctrlPoint, mxValue);
        }
        printf( "\n" );
}
Ejemplo n.º 2
0
/**
 * Create a new control point. Does not start any threads.
 *
 * @return A newly-created mUpnpControlPoint
 */
mUpnpControlPoint *mupnp_controlpoint_new()
{
	mUpnpControlPoint *ctrlPoint;

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

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

	if ( NULL != ctrlPoint )
	{
#ifdef MUPNP_HTTP_USE_PERSISTENT_CONNECTIONS	
		mupnp_http_persistentconnection_init();
#endif
		ctrlPoint->mutex = mupnp_mutex_new();
		ctrlPoint->deviceRootNodeList = mupnp_xml_nodelist_new();
		ctrlPoint->deviceList = mupnp_devicelist_new();
		ctrlPoint->ssdpServerList = mupnp_ssdp_serverlist_new();
		ctrlPoint->ssdpResServerList = mupnp_ssdpresponse_serverlist_new();
		ctrlPoint->httpServerList = mupnp_http_serverlist_new();
		ctrlPoint->httpEventURI = mupnp_string_new();
		ctrlPoint->eventListeners = mupnp_eventlistenerlist_new();

		/* Expiration handling */
		ctrlPoint->expThread = mupnp_thread_new();
		mupnp_thread_setaction(ctrlPoint->expThread, mupnp_controlpoint_expirationhandler);
		mupnp_thread_setuserdata(ctrlPoint->expThread, ctrlPoint);
		ctrlPoint->expMutex = mupnp_mutex_new();
		ctrlPoint->expCond = mupnp_cond_new();
		
		ctrlPoint->ifCache = mupnp_net_interfacelist_new();
		
		mupnp_controlpoint_setssdplistener(ctrlPoint, NULL);
		mupnp_controlpoint_setssdpresponselistener(ctrlPoint, NULL);
		mupnp_controlpoint_sethttplistener(ctrlPoint, NULL);
		mupnp_controlpoint_setdevicelistener(ctrlPoint, NULL);
		
		mupnp_controlpoint_setssdpresponseport(ctrlPoint, MUPNP_CONTROLPOINT_SSDP_RESPONSE_DEFAULT_PORT);
		mupnp_controlpoint_setssdpsearchmx(ctrlPoint, MUPNP_CONTROLPOINT_SSDP_DEFAULT_SEARCH_MX);
		mupnp_controlpoint_seteventport(ctrlPoint, MUPNP_CONTROLPOINT_HTTP_EVENT_DEFAULT_PORT);
		mupnp_controlpoint_seteventsuburi(ctrlPoint, MUPNP_CONTROLPOINT_HTTP_EVENTSUB_URI);

		mupnp_controlpoint_setuserdata(ctrlPoint, NULL);
	}

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

	return ctrlPoint;
}