Ejemplo n.º 1
0
mUpnpHttpServer *mupnp_http_server_new()
{
	mUpnpHttpServer *httpServer;

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

	httpServer = (mUpnpHttpServer *)malloc(sizeof(mUpnpHttpServer));

	if ( NULL != httpServer )
	{
		mupnp_list_node_init((mUpnpList *)httpServer);

		httpServer->sock = NULL;
		httpServer->acceptThread = NULL;
		httpServer->listener = NULL;

		/**** Thanks for Makela Aapo (10/31/05) ****/
		httpServer->clientThreads = NULL;

		mupnp_http_server_setuserdata(httpServer, NULL);

		mupnp_http_server_settimeout(httpServer, MUPNP_HTTP_SERVER_READ_TIMEOUT);

		/* Mutex */
		httpServer->mutex = mupnp_mutex_new();
	}

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

	return httpServer;
}
Ejemplo n.º 2
0
mUpnpXmlNode *mupnp_xml_node_new()
{
	mUpnpXmlNode *node;
	
	mupnp_log_debug_l4("Entering...\n");

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

	if ( NULL != node )
	{
		mupnp_list_node_init((mUpnpList *)node);

		node->name = mupnp_string_new();
		node->value = mupnp_string_new();
		node->attrList = mupnp_xml_attributelist_new();
		node->nodeList = mupnp_xml_nodelist_new();
		node->parentNode = NULL;
		node->userData = NULL;
		node->userDataDestructorFunc = NULL;
	}

	mupnp_log_debug_l4("Leaving...\n");
	
	return node;
}
Ejemplo n.º 3
0
mUpnpAvProtocolInfo *mupnp_upnpav_protocolinfo_new()
{
	mUpnpAvProtocolInfo *info;

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

	info = (mUpnpAvProtocolInfo *)malloc(sizeof(mUpnpAvProtocolInfo));

	if  ( NULL != info ) {
		mupnp_list_node_init((mUpnpList *)info);

		info->protocol = mupnp_string_new();
		info->network = mupnp_string_new();
		info->mimeType = mupnp_string_new();
		info->additionalInfo = mupnp_string_new();
		info->string = mupnp_string_new();

		mupnp_upnpav_protocolinfo_setprotocol(info, "*");
		mupnp_upnpav_protocolinfo_setnetwork(info, "*");
		mupnp_upnpav_protocolinfo_setmimetype(info, "*");
		mupnp_upnpav_protocolinfo_setadditionainfo(info, "*");
    }
	mupnp_log_debug_l4("Leaving...\n");

	return info;
}
Ejemplo n.º 4
0
mUpnpAction *mupnp_action_new()
{
	mUpnpAction *action;

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

	action = (mUpnpAction *)malloc(sizeof(mUpnpAction));

	if ( NULL != action )
	{
		mupnp_list_node_init((mUpnpList *)action);
		
		action->parentService = NULL;
		action->actionNode = NULL;

		action->argumentList = mupnp_argumentlist_new();
		
		action->upnpStatus = mupnp_status_new();
		action->listener = NULL;
		mupnp_action_setuserdata(action, NULL);
	}

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

	return action;
}
Ejemplo n.º 5
0
mUpnpHttpHeader* mupnp_http_header_new()
{
  mUpnpHttpHeader* header;

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

  header = (mUpnpHttpHeader*)malloc(sizeof(mUpnpHttpHeader));

  if (NULL != header) {
    mupnp_list_node_init((mUpnpList*)header);
    header->name = mupnp_string_new();
    header->value = mupnp_string_new();
  }

  return header;

  mupnp_log_debug_l4("Leaving...\n");
}
Ejemplo n.º 6
0
mUpnpArgument* mupnp_argument_new()
{
    mUpnpArgument* arg;

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

    arg = (mUpnpArgument*)malloc(sizeof(mUpnpArgument));

    if (NULL != arg) {
        mupnp_list_node_init((mUpnpList*)arg);

        arg->serviceNode = NULL;
        arg->argumentNode = NULL;

        arg->value = mupnp_string_new();
    }

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

    return arg;
}
Ejemplo n.º 7
0
mUpnpSSDPResponseServer* mupnp_ssdpresponse_server_new()
{
  mUpnpSSDPResponseServer* server;

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

  server = (mUpnpSSDPResponseServer*)malloc(sizeof(mUpnpSSDPResponseServer));

  if (NULL != server) {
    mupnp_list_node_init((mUpnpList*)server);

    server->httpuSock = NULL;
    server->recvThread = NULL;

    mupnp_ssdpresponse_server_setlistener(server, NULL);
    mupnp_ssdpresponse_server_setuserdata(server, NULL);
  }

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

  return server;
}
Ejemplo n.º 8
0
/**
 * Add a listener to the event listener list
 *
 * @param eventListenerList The event listener list
 * @param listener The listener to add
 *
 */
void mupnp_eventlistenerlist_add(mUpnpEventListenerList* eventListenerList, MUPNP_EVENT_LISTENER listener)
{
  mUpnpEventListenerList* list_node;

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

  if (listener == NULL)
    return;

  list_node = (mUpnpEventListenerList*)malloc(sizeof(mUpnpEventListenerList));

  if (NULL != list_node) {
    memset(list_node, 0, sizeof(mUpnpEventListenerList));
    list_node->listener = listener;
    mupnp_list_node_init((mUpnpList*)list_node);
    mupnp_list_add((mUpnpList*)eventListenerList, (mUpnpList*)list_node);
  }
  else
    mupnp_log_debug_s("Memory allocation failure!\n");

  mupnp_log_debug_l4("Leaving...\n");
}
Ejemplo n.º 9
0
mUpnpNetworkInterface *mupnp_net_interface_new()
{
	mUpnpNetworkInterface *netIf;

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

	netIf = (mUpnpNetworkInterface *)malloc(sizeof(mUpnpNetworkInterface));

	if ( NULL != netIf )
	{
		mupnp_list_node_init((mUpnpList *)netIf);
		netIf->name = mupnp_string_new();
		netIf->ipaddr = mupnp_string_new();
		netIf->netmask = mupnp_string_new();
		mupnp_net_interface_setindex(netIf, 0);
		memset(netIf->macaddr, 0, (size_t)MUPNP_NET_MACADDR_SIZE);
	}
	
	mupnp_log_debug_l4("Leaving...\n");

	return netIf;
}
Ejemplo n.º 10
0
/**
 * Create a new event subscriber
 */
mUpnpSubscriber* mupnp_subscriber_new()
{
  mUpnpSubscriber* sub;

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

  sub = (mUpnpSubscriber*)malloc(sizeof(mUpnpSubscriber));

  if (NULL != sub) {
    mupnp_list_node_init((mUpnpList*)sub);

    sub->sid = mupnp_string_new();
    sub->ifAddr = mupnp_string_new();
    sub->deliveryURL = mupnp_net_url_new();

    mupnp_subscriber_settimeout(sub, 0);
    mupnp_subscriber_renew(sub);
    mupnp_subscriber_setnotifycount(sub, 0);
  }

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

  return sub;
}