mUPnP for C
subscriber.h File Reference
#include <mupnp/typedef.h>
#include <mupnp/util/list.h>
#include <mupnp/util/string.h>
#include <mupnp/net/url.h>
#include <mupnp/util/time.h>
#include <mupnp/statevariable.h>

Data Structures

struct  _mUpnpSubscriber
 

Macros

#define mupnp_subscriber_next(sub)
 
#define mupnp_subscriber_remove(sub)
 
#define mupnp_subscriber_setsid(sub, value)
 
#define mupnp_subscriber_getsid(sub)
 
#define mupnp_subscriber_settimeout(sub, value)
 
#define mupnp_subscriber_gettimeout(sub)
 
#define mupnp_subscriber_setsubscriptiontime(sub, value)
 
#define mupnp_subscriber_getsubscriptiontime(sub)
 
#define mupnp_subscriber_setnotifycount(sub, value)
 
#define mupnp_subscriber_getnotifycount(sub)
 
#define mupnp_subscriber_setdeliveryurl(sub, value)
 
#define mupnp_subscriber_getdeliveryhost(sub)
 
#define mupnp_subscriber_getdeliverypath(sub)
 
#define mupnp_subscriber_getdeliveryport(sub)
 
#define mupnp_subscriberlist_clear(subList)
 
#define mupnp_subscriberlist_size(subList)
 
#define mupnp_subscriberlist_gets(subList)
 
#define mupnp_subscriberlist_add(subList, sub)
 

Typedefs

typedef struct _mUpnpSubscriber mUpnpSubscriber
 
typedef struct _mUpnpSubscriber mUpnpSubscriberList
 

Functions

mUpnpSubscribermupnp_subscriber_new (void)
 
void mupnp_subscriber_delete (mUpnpSubscriber *sub)
 
void mupnp_subscriber_clear (mUpnpSubscriber *sub)
 
void mupnp_subscriber_renew (mUpnpSubscriber *sub)
 
long mupnp_subscriber_incrementnotifycount (mUpnpSubscriber *sub)
 
bool mupnp_subscriber_isexpired (mUpnpSubscriber *sub)
 
bool mupnp_subscriber_notify (mUpnpSubscriber *sub, mUpnpStateVariable *statVar)
 
bool mupnp_subscriber_notifyall (mUpnpSubscriber *sub, void *service)
 
mUpnpSubscriberListmupnp_subscriberlist_new (void)
 
void mupnp_subscriberlist_delete (mUpnpSubscriberList *subscriberlist)
 

Macro Definition Documentation

◆ mupnp_subscriber_getdeliveryhost

#define mupnp_subscriber_getdeliveryhost ( sub)
Value:
mupnp_net_url_gethost(sub->deliveryURL)
#define mupnp_net_url_gethost(urip)
Definition url.h:62

Set the subscriber's delivery host

Parameters
subThe event subscriber

◆ mupnp_subscriber_getdeliverypath

#define mupnp_subscriber_getdeliverypath ( sub)
Value:
mupnp_net_url_getpath(sub->deliveryURL)
#define mupnp_net_url_getpath(urip)
Definition url.h:64

Set the subscriber's delivery path

Parameters
subThe event subscriber

◆ mupnp_subscriber_getdeliveryport

#define mupnp_subscriber_getdeliveryport ( sub)
Value:
mupnp_net_url_getport(sub->deliveryURL)
#define mupnp_net_url_getport(urip)
Definition url.h:63

Set the subscriber's delivery port

Parameters
subThe event subscriber

◆ mupnp_subscriber_getnotifycount

#define mupnp_subscriber_getnotifycount ( sub)
Value:
(sub->notifyCount)

Get the notify count

Parameters
subThe event subscriber
Returns
Notify count

◆ mupnp_subscriber_getsid

#define mupnp_subscriber_getsid ( sub)
Value:
char * mupnp_string_getvalue(mUpnpString *str)
Definition string.c:177

Get the subscriber's SID (Subscription IDentifier) value

Parameters
subThe current event subscriber
Returns
Subscriber's SID

◆ mupnp_subscriber_getsubscriptiontime

#define mupnp_subscriber_getsubscriptiontime ( sub)
Value:
(sub->subscriptionTime)

Get the subscription time (duration)

Parameters
subThe event subscriber
Returns
Subscription time

◆ mupnp_subscriber_gettimeout

#define mupnp_subscriber_gettimeout ( sub)
Value:
(sub->timeout)

Get the subscription timeout (expiration time)

Parameters
subThe event subscriber
Returns
Timeout

◆ mupnp_subscriber_next

#define mupnp_subscriber_next ( sub)
Value:
mUpnpList * mupnp_list_next(mUpnpList *list)
Definition list.c:234
The generic list interface in mUPnP.
Definition list.h:56
Definition subscriber.h:39

Get the next subscriber in a subscriber list. Use as an iterator.

Parameters
subThe current event subscriber
Returns
Next subscriber or NULL

◆ mupnp_subscriber_remove

#define mupnp_subscriber_remove ( sub)
Value:
void mupnp_list_remove(mUpnpList *list)
Definition list.c:144

Remove the event subscriber from a subscriber list.

Parameters
subThe event subscriber to remove

◆ mupnp_subscriber_setdeliveryurl

#define mupnp_subscriber_setdeliveryurl ( sub,
value )
Value:
mupnp_net_url_set(sub->deliveryURL, value)
#define mupnp_net_url_set(urip, value)
Definition url.h:42

Set the subscriber's delivery URL

Parameters
subThe event subscriber
valueThe delivery URL

◆ mupnp_subscriber_setnotifycount

#define mupnp_subscriber_setnotifycount ( sub,
value )
Value:
(sub->notifyCount = value)

Set the notify count to a certain value.

Parameters
subThe event subscriber
valueNotify count

◆ mupnp_subscriber_setsid

#define mupnp_subscriber_setsid ( sub,
value )
Value:
mupnp_string_setvalue(sub->sid, value)
void mupnp_string_setvalue(mUpnpString *str, const char *value)
Definition string.c:84

Set the subscriber's SID (Subscription IDentifier) value

Parameters
subThe event subscriber
valueThe SID value

◆ mupnp_subscriber_setsubscriptiontime

#define mupnp_subscriber_setsubscriptiontime ( sub,
value )
Value:
(sub->subscriptionTime = value)

Set the subscription time (duration) to a certain value.

Parameters
subThe event subscriber
valueSubscription time

◆ mupnp_subscriber_settimeout

#define mupnp_subscriber_settimeout ( sub,
value )
Value:
(sub->timeout = value)

Set the subscription timeout (expiration time) to a certain value.

Parameters
subThe event subscriber
valueTimeout

◆ mupnp_subscriberlist_add

#define mupnp_subscriberlist_add ( subList,
sub )
Value:
void mupnp_list_add(mUpnpList *headList, mUpnpList *list)
Definition list.c:123

Add a new event subscriber to a subscriber list

Parameters
subListThe subscriber list to add to
subThe subscriber to add

◆ mupnp_subscriberlist_clear

#define mupnp_subscriberlist_clear ( subList)
Value:
void mupnp_list_clear(mUpnpList *headList, MUPNP_LIST_DESTRUCTORFUNC destructorFunc)
Definition list.c:257
void(* MUPNP_LIST_DESTRUCTORFUNC)(void *)
Definition list.h:29
void mupnp_subscriber_delete(mUpnpSubscriber *sub)
Definition subscriber.c:57

Clear the contents of a subscriber list

Parameters
subListThe subscriber list to clear

◆ mupnp_subscriberlist_gets

#define mupnp_subscriberlist_gets ( subList)
Value:

Get the first item in a subscriber list (use as the first step in iteration).

Parameters
subListThe subscriber list to evaluate

◆ mupnp_subscriberlist_size

#define mupnp_subscriberlist_size ( subList)
Value:
int mupnp_list_size(mUpnpList *headList)
Definition list.c:53

Get the size (node count) of a subscriber list

Parameters
subListThe subscriber list to evaluate

Typedef Documentation

◆ mUpnpSubscriber

The device-side structure for an event subscriber

◆ mUpnpSubscriberList

Function Documentation

◆ mupnp_subscriber_clear()

void mupnp_subscriber_clear ( mUpnpSubscriber * sub)

Clear the contents of an event subscriber

Todo
Lacks implementation (is it necessary?)
Parameters
subThe event subscriber

Clear the contents of an event subscriber

Todo
Lacks implementation (is it necessary?)
Parameters
subThe event subscriber

◆ mupnp_subscriber_delete()

void mupnp_subscriber_delete ( mUpnpSubscriber * sub)

Destroy an event subscriber

Parameters
subThe event subscriber

◆ mupnp_subscriber_incrementnotifycount()

long mupnp_subscriber_incrementnotifycount ( mUpnpSubscriber * sub)

Increment the event notify count by one

Parameters
subThe event subscriber
Returns
The new notify count

◆ mupnp_subscriber_isexpired()

bool mupnp_subscriber_isexpired ( mUpnpSubscriber * sub)

Check, whether a subscriber's event subscription has been expired

Parameters
subThe subscriber
Returns
true if the subscription has been expired; otherwise false

◆ mupnp_subscriber_new()

mUpnpSubscriber * mupnp_subscriber_new ( void )

Create a new event subscriber

◆ mupnp_subscriber_notify()

bool mupnp_subscriber_notify ( mUpnpSubscriber * sub,
mUpnpStateVariable * statVar )

Post a notification to an event subscriber. This is called in a device.

Parameters
subThe event subscriber
statVarThe evented state variable
Returns
true if succesful; otherwise false

◆ mupnp_subscriber_notifyall()

bool mupnp_subscriber_notifyall ( mUpnpSubscriber * sub,
void * service )

Post a notification to an event subscriber. This is called in a device.

Parameters
subThe event subscriber
serviceThe evented service
Returns
true if succesful; otherwise false

◆ mupnp_subscriber_renew()

void mupnp_subscriber_renew ( mUpnpSubscriber * sub)

Renew a subscription. Essentially sets subscription time (duration) to zero and resets notify count (== event key).

Parameters
subThe event subscriber

◆ mupnp_subscriberlist_delete()

void mupnp_subscriberlist_delete ( mUpnpSubscriberList * subscriberlist)

Destroy an event subscriber list

Parameters
subscriberlistThe list to destroy

◆ mupnp_subscriberlist_new()

mUpnpSubscriberList * mupnp_subscriberlist_new ( void )

Create a new event subscriber list