libUPnP  1.6.17
Defines | Functions | Variables
sample_util.c File Reference
#include "sample_util.h"
#include <stdarg.h>
#include <stdio.h>
Include dependency graph for sample_util.c:

Defines

#define SAMPLE_UTIL_C
#define OLD_FIND_SERVICE_CODE
#define MAX_BUF   (8 * 1024)

Functions

int SampleUtil_Initialize (print_string print_function)
 Initializes the sample util. Must be called before any sample util functions. May be called multiple times.
int SampleUtil_RegisterUpdateFunction (state_update update_function)
int SampleUtil_Finish ()
 Releases Resources held by sample util.
char * SampleUtil_GetElementValue (IXML_Element *element)
 Given a DOM node such as <Channel>11</Channel>, this routine extracts the value (e.g., 11) from the node and returns it as a string. The string must be freed by the caller using free.
IXML_NodeListSampleUtil_GetFirstServiceList (IXML_Document *doc)
 Given a DOM node representing a UPnP Device Description Document, this routine parses the document and finds the first service list (i.e., the service list for the root device). The service list is returned as a DOM node list. The NodeList must be freed using NodeList_free.
char * SampleUtil_GetFirstDocumentItem (IXML_Document *doc,const char *item)
 Given a document node, this routine searches for the first element named by the input string item, and returns its value as a string. String must be freed by caller using free.
char * SampleUtil_GetFirstElementItem (IXML_Element *element,const char *item)
 Given a DOM element, this routine searches for the first element named by the input string item, and returns its value as a string. The string must be freed using free.
void SampleUtil_PrintEventType (Upnp_EventType S)
 Prints a callback event type as a string.
int SampleUtil_PrintEvent (Upnp_EventType EventType,void *Event)
 Prints callback event structure details.
int SampleUtil_FindAndParseService (IXML_Document *DescDoc,const char *location,const char *serviceType,char **serviceId,char **eventURL,char **controlURL)
 This routine finds the first occurance of a service in a DOM representation of a description document and parses it. Note that this function currently assumes that the eventURL and controlURL values in the service definitions are full URLs. Relative URLs are not handled here.
int SampleUtil_Print (const char *fmt,...)
 Function emulating printf that ultimately calls the registered print function with the formatted string.
void SampleUtil_StateUpdate (const char *varName,const char *varValue,const char *UDN,eventType type)
void linux_print (const char *format,...)
 Prints a string to standard out.

Variables

static int initialize_init = 1
static int initialize_register = 1
print_string gPrintFun = NULL
state_update gStateUpdateFun = NULL
ithread_mutex_t display_mutex

Detailed Description