cservice.c File Reference

#include <cybergarage/upnp/cservice.h>
#include <cybergarage/upnp/cupnp.h>
#include <cybergarage/upnp/cupnp_function.h>
#include <cybergarage/upnp/cdevice.h>
#include <cybergarage/upnp/ssdp/cssdp.h>
#include <cybergarage/util/clog.h>
#include <cybergarage/util/cstring.h>

Functions

static void cg_upnp_service_initchildnodes (CgUpnpService *service)
static void cg_upnp_service_initactionlist (CgUpnpService *service)
static void cg_upnp_service_initservicestatetable (CgUpnpService *service)
CgUpnpServicecg_upnp_service_new ()
void cg_upnp_service_delete (CgUpnpService *service)
void cg_upnp_service_clear (CgUpnpService *service)
BOOL cg_upnp_service_isscpdurl (CgUpnpService *service, char *url)
BOOL cg_upnp_service_parsedescription (CgUpnpService *service, char *desciption, int descriptionLen)
BOOL cg_upnp_service_parsedescriptionurl (CgUpnpService *service, CgNetURL *url)
char * cg_upnp_service_getdescription (CgUpnpService *service, CgString *descStr)
char * cg_upnp_servicetype_getidentifier (char *serviceType)
char * cg_upnp_servicetype_geturn (char *serviceType)
char * cg_upnp_servicetype_getservice (char *serviceType)
char * cg_upnp_servicetype_gettype (char *serviceType)
char * cg_upnp_servicetype_getschematype (char *serviceType)
char * cg_upnp_servicetype_getversion (char *serviceType)
char * cg_upnp_service_getnotifyservicetypent (CgUpnpService *service, char *buf, int bufSize)
char * cg_upnp_service_getnotifyservicetypeusn (CgUpnpService *service, char *buf, int bufSize)
BOOL cg_upnp_service_announcefrom (CgUpnpService *service, char *bindAddr)
BOOL cg_upnp_service_byebyefrom (CgUpnpService *service, char *bindAddr)
CgUpnpActioncg_upnp_service_getactionbyname (CgUpnpService *service, char *name)
CgUpnpStateVariablecg_upnp_service_getstatevariablebyname (CgUpnpService *service, char *name)
void cg_upnp_service_setactionlistener (CgUpnpService *service, CG_UPNP_ACTION_LISTNER actionListener)
void cg_upnp_service_setquerylistener (CgUpnpService *service, CG_UPNP_STATEVARIABLE_LISTNER queryListener)
CgUpnpActionListcg_upnp_service_getactionlist (CgUpnpService *service)
CgUpnpActioncg_upnp_service_getactions (CgUpnpService *service)
CgUpnpServiceStateTablecg_upnp_service_getservicestatetable (CgUpnpService *service)
CgUpnpStateVariablecg_upnp_service_getstatevariables (CgUpnpService *service)
BOOL cg_upnp_service_addsubscriber (CgUpnpService *service, CgUpnpSubscriber *sub)
BOOL cg_upnp_service_removesubscriber (CgUpnpService *service, CgUpnpSubscriber *sub)
CgUpnpSubscribercg_upnp_service_getsubscriberbysid (CgUpnpService *service, char *sid)

Function Documentation

BOOL cg_upnp_service_addsubscriber ( CgUpnpService service,
CgUpnpSubscriber sub 
)

Add a subscriber to the service

Parameters:
service The service in question
sub The subscriber

BOOL cg_upnp_service_announcefrom ( CgUpnpService service,
char *  bindAddr 
)

Send a service announcement (advertisement) from the given address

Parameters:
service The service to advertise
bindAddr The address to attach to the announcement

BOOL cg_upnp_service_byebyefrom ( CgUpnpService service,
char *  bindAddr 
)

Send a byebye announcement (i.e. a cancelling advertisement) from the given address

Parameters:
service The service to announce from
bindAddr The address to attach to the announcement

void cg_upnp_service_clear ( CgUpnpService service  ) 

Clear the contents of a UPnP service

Parameters:
service The service to clear

void cg_upnp_service_delete ( CgUpnpService service  ) 

Destroy a UPnP service

Parameters:
service The service to destroy

CgUpnpAction* cg_upnp_service_getactionbyname ( CgUpnpService service,
char *  name 
)

Get an action from the service by the action's name

Parameters:
service The service in question
name The name of the action to look for
Returns:
CgUpnpAction* or NULL

CgUpnpActionList* cg_upnp_service_getactionlist ( CgUpnpService service  ) 

Get the service's list of actions (head of list)

Parameters:
service The service in question

CgUpnpAction* cg_upnp_service_getactions ( CgUpnpService service  ) 

Get the first action in the service's list of actions. Use as the starting point in iteration loops.

Parameters:
service The service in question

char* cg_upnp_service_getdescription ( CgUpnpService service,
CgString descStr 
)

Get the service's description XML nodes as a string

Parameters:
service The service in question
descStr The description string

char* cg_upnp_service_getnotifyservicetypent ( CgUpnpService service,
char *  buf,
int  bufSize 
)

char* cg_upnp_service_getnotifyservicetypeusn ( CgUpnpService service,
char *  buf,
int  bufSize 
)

CgUpnpServiceStateTable* cg_upnp_service_getservicestatetable ( CgUpnpService service  ) 

Get the service's state table

Parameters:
service The service in question

CgUpnpStateVariable* cg_upnp_service_getstatevariablebyname ( CgUpnpService service,
char *  name 
)

Get a state variable from the service's state table by the variable's name

Parameters:
service The service in question
name the name of the variable
Returns:
CgUpnpStateVariable* or NULL

CgUpnpStateVariable* cg_upnp_service_getstatevariables ( CgUpnpService service  ) 

Get the first state variable in the service's state table. Use as the starting point in iteration loops.

Parameters:
service The service in question

CgUpnpSubscriber* cg_upnp_service_getsubscriberbysid ( CgUpnpService service,
char *  sid 
)

Find a subscriber from the service's list of subscribers by its SID (Subscription ID)

Parameters:
service The service in question
sid The SID

static void cg_upnp_service_initactionlist ( CgUpnpService service  )  [static]

static void cg_upnp_service_initchildnodes ( CgUpnpService service  )  [static]

static void cg_upnp_service_initservicestatetable ( CgUpnpService service  )  [static]

BOOL cg_upnp_service_isscpdurl ( CgUpnpService service,
char *  url 
)

Compare the service's SCPD URL and the given location

Parameters:
service The service in question
url The URL (location) to compare
Returns:
TRUE if location is found from URL; otherwise FALSE

CgUpnpService* cg_upnp_service_new (  ) 

Create a new UPnP service

BOOL cg_upnp_service_parsedescription ( CgUpnpService service,
char *  description,
int  descriptionLen 
)

Create the service's contents from the given XML document

Parameters:
service The service to create
description The XML document to parse
descriptionLen The length of the XML document

BOOL cg_upnp_service_parsedescriptionurl ( CgUpnpService service,
CgNetURL url 
)

Create the service's contents from the given URL. Gets the XML document from the URL and passes it again to cg_upnp_service_parsedescription

Parameters:
service The service to create
url The URL of the document to parse

BOOL cg_upnp_service_removesubscriber ( CgUpnpService service,
CgUpnpSubscriber sub 
)

Remove a subscriber from the service

Parameters:
service The service in question
sub The subscriber to remove

void cg_upnp_service_setactionlistener ( CgUpnpService service,
CG_UPNP_ACTION_LISTNER  actionListener 
)

Set an action listener to the service

Parameters:
service The service in question
actionListener A callback function of type CG_UPNP_ACTION_LISTNER

void cg_upnp_service_setquerylistener ( CgUpnpService service,
CG_UPNP_STATEVARIABLE_LISTNER  queryListener 
)

Set a query listener to the service

Parameters:
service The service in question
queryListener A callback function of type CG_UPNP_STATEVARIABLE_LISTNER

char* cg_upnp_servicetype_getidentifier ( char *  serviceType  ) 

Get the identifier-part of a service type string (usually "urn")

Parameters:
serviceType A service type string (usually the result from cg_upnp_service_getservicetype)
Returns:
A newly-created char* if successful; otherwise NULL

char* cg_upnp_servicetype_getschematype ( char *  serviceType  ) 

Get the schema type part of a service type string (without last colon) (ex. "urn:schemas-upnp-org:service:ContentDirectory")

Parameters:
serviceType A service type string (usually the result from cg_upnp_service_getservicetype)
Returns:
A newly-created char* if successful; otherwise NULL

char* cg_upnp_servicetype_getservice ( char *  serviceType  ) 

Get the service part of a service type string (usually just "service")

Parameters:
serviceType A service type string (usually the result from cg_upnp_service_getservicetype)
Returns:
A newly-created char* if successful; otherwise NULL

char* cg_upnp_servicetype_gettype ( char *  serviceType  ) 

Get the type part of a service type string (ex. "ContentDirectory")

Parameters:
serviceType A service type string (usually the result from cg_upnp_service_getservicetype)
Returns:
A newly-created char* if successful; otherwise NULL

char* cg_upnp_servicetype_geturn ( char *  serviceType  ) 

Get the URN part of a service type string (usually "schemas-upnp-org")

Parameters:
serviceType A service type string (usually the result from cg_upnp_service_getservicetype)
Returns:
A newly-created char* if successful; otherwise NULL

char* cg_upnp_servicetype_getversion ( char *  serviceType  ) 

Get the version part of a service type string (ex. "1")

Parameters:
serviceType A service type string (usually the result from cg_upnp_service_getservicetype)
Returns:
A newly-created char* if successful; otherwise NULL


Generated on Tue Aug 8 14:56:29 2006 for CyberLinkC by  doxygen 1.4.7