mUPnP for C
action.h File Reference
#include <mupnp/typedef.h>
#include <mupnp/xml/xml.h>
#include <mupnp/util/list.h>
#include <mupnp/util/string.h>
#include <mupnp/argument.h>
#include <mupnp/upnp_status.h>

Data Structures

struct  _mUpnpAction
 

Macros

#define MUPNP_ACTION_ELEM_NAME   "action"
 
#define MUPNP_ACTIONLIST_ELEM_NAME   "actionList"
 
#define MUPNP_ACTION_NAME   "name"
 
#define mupnp_action_next(action)
 
#define mupnp_action_isactionnode(node)
 
#define mupnp_action_getactionnode(action)
 
#define mupnp_action_setservice(action, service)
 
#define mupnp_action_getservice(action)
 
#define mupnp_action_setname(action, value)
 
#define mupnp_action_getname(action)
 
#define mupnp_action_isname(action, name)
 
#define mupnp_action_getargumentlist(action)
 
#define mupnp_action_getarguments(action)
 
#define mupnp_action_hasargumentbyname(action, name)
 
#define mupnp_action_setstatuscode(action, code)
 
#define mupnp_action_getstatuscode(action)
 
#define mupnp_action_setstatusdescription(action, value)
 
#define mupnp_action_getstatusdescription(action)
 
#define mupnp_action_setlistener(action, func)
 
#define mupnp_action_getlistener(action)
 
#define mupnp_action_setlistner   mupnp_action_setlistener
 
#define mupnp_action_getlistner   mupnp_action_getlistener
 
#define mupnp_action_setuserdata(action, value)
 
#define mupnp_action_getuserdata(action)
 
#define mupnp_actionlist_clear(actionList)
 
#define mupnp_actionlist_size(actionList)
 
#define mupnp_actionlist_gets(actionList)
 
#define mupnp_actionlist_add(actionList, action)
 

Typedefs

typedef struct _mUpnpAction mUpnpAction
 
typedef struct _mUpnpAction mUpnpActionList
 
typedef bool(* MUPNP_ACTION_LISTNER) (mUpnpAction *)
 

Functions

mUpnpActionmupnp_action_new (void)
 
void mupnp_action_delete (mUpnpAction *action)
 
void mupnp_action_setactionnode (mUpnpAction *action, mUpnpXmlNode *node)
 
mUpnpArgumentmupnp_action_getargumentbyname (mUpnpAction *action, const char *name)
 
char * mupnp_action_getargumentvaluebyname (mUpnpAction *action, const char *name)
 
bool mupnp_action_setargumentvaluebyname (mUpnpAction *action, const char *name, const char *value)
 
mUpnpActionListmupnp_actionlist_new (void)
 
void mupnp_actionlist_delete (mUpnpActionList *actionList)
 

Macro Definition Documentation

◆ MUPNP_ACTION_ELEM_NAME

#define MUPNP_ACTION_ELEM_NAME   "action"

◆ mupnp_action_getactionnode

#define mupnp_action_getactionnode ( action)
Value:
(action->actionNode)

Get the action's XML node (i.e. the XML representation of the action)

Parameters
actionThe action in question
Returns
mUpnpXmlNode*

◆ mupnp_action_getargumentlist

#define mupnp_action_getargumentlist ( action)
Value:
(action->argumentList)

Get the action's list of arguments

Parameters
actionThe action in question
Returns
mUpnpArgumentList*

◆ mupnp_action_getarguments

#define mupnp_action_getarguments ( action)
Value:
((mUpnpArgument*)mupnp_list_next((mUpnpList*)action->argumentList))
mUpnpList * mupnp_list_next(mUpnpList *list)
Definition list.c:234
Definition argument.h:55
The generic list interface in mUPnP.
Definition list.h:56

Get the first argument from the action's list of arguments. Use as the starting point in iteration loops.

Parameters
actionThe action in question
Returns
mUpnpArgument*

◆ mupnp_action_getlistener

#define mupnp_action_getlistener ( action)
Value:
(action->listener)

Get the action's listener function

Parameters
actionThe action in question
Returns
bool (*MUPNP_ACTION_LISTNER)(mUpnpAction *)

◆ mupnp_action_getlistner

#define mupnp_action_getlistner   mupnp_action_getlistener
Deprecated
Compatibility macro for typo correction

◆ mupnp_action_getname

#define mupnp_action_getname ( action)
Value:
#define MUPNP_ACTION_NAME
Definition action.h:34
#define mupnp_action_getactionnode(action)
Definition action.h:104
const char * mupnp_xml_node_getchildnodevalue(mUpnpXmlNode *node, const char *name)
Definition xml_node.c:216

Get the action's name

Parameters
actionThe action in question
Returns
char*

◆ mupnp_action_getservice

#define mupnp_action_getservice ( action)
Value:
((mUpnpService*)action->parentService)
Definition service.h:51

Get the action's parent service

Parameters
actionThe action in question
Returns
mUpnpService*

◆ mupnp_action_getstatuscode

#define mupnp_action_getstatuscode ( action)
Value:
mupnp_status_getcode(action->upnpStatus)
#define mupnp_status_getcode(upnpStat)
Definition upnp_status.h:77

Get the action's latest status code

Parameters
actionThe action in question
Returns
int

◆ mupnp_action_getstatusdescription

#define mupnp_action_getstatusdescription ( action)
Value:
mupnp_status_getdescription(action->upnpStatus)
#define mupnp_status_getdescription(upnpStat)
Definition upnp_status.h:92

Get the action's latest status description

Parameters
actionThe action in question
Returns
char*

◆ mupnp_action_getuserdata

#define mupnp_action_getuserdata ( action)
Value:
(action->userData)

Get the action's arbitrary user data pointer

Parameters
actionThe action in question
Returns
void*

◆ mupnp_action_hasargumentbyname

#define mupnp_action_hasargumentbyname ( action,
name )
Value:
((mupnp_action_getargumentbyname(action, name) != NULL) ? true : false)
mUpnpArgument * mupnp_action_getargumentbyname(mUpnpAction *action, const char *name)
Definition action.c:147
#define true
Definition typedef.h:63

Find out, whether the action has an argument by the given name

Parameters
actionThe action in question
nameThe name to look for
Returns
true if the action has the argument; otherwise false

◆ mupnp_action_isactionnode

#define mupnp_action_isactionnode ( node)
Value:
#define MUPNP_ACTION_ELEM_NAME
Definition action.h:31
#define mupnp_xml_node_isname(node, nodename)
Definition xml.h:123

Check, whether the given XML node is an action node

Parameters
nodeThe mUpnpXmlNode*

◆ mupnp_action_isname

#define mupnp_action_isname ( action,
name )
Value:
#define mupnp_action_getname(action)
Definition action.h:144
bool mupnp_streq(const char *str1, const char *str2)
Definition string_function.c:158

Check, whether the action's name matches the one given as parameter.

Parameters
actionThe action in question
nameThe name string to compare

◆ MUPNP_ACTION_NAME

#define MUPNP_ACTION_NAME   "name"

◆ mupnp_action_next

#define mupnp_action_next ( action)
Value:
Definition action.h:40

Get the next action in a list of actions. Use as an iterator.

Parameters
actionThe current action

◆ mupnp_action_setlistener

#define mupnp_action_setlistener ( action,
func )
Value:
(action->listener = func)

Set the action's listener function

Parameters
actionThe action in question
funcThe listener function of type: bool (*MUPNP_ACTION_LISTNER)(mUpnpAction *)

◆ mupnp_action_setlistner

#define mupnp_action_setlistner   mupnp_action_setlistener
Deprecated
Compatibility macro for typo correction

◆ mupnp_action_setname

#define mupnp_action_setname ( action,
value )
Value:
void mupnp_xml_node_setchildnode(mUpnpXmlNode *node, const char *name, const char *value)
Definition xml_node.c:105

Set the action's name

Parameters
actionThe action in question
valueThe action's name

◆ mupnp_action_setservice

#define mupnp_action_setservice ( action,
service )
Value:
(action->parentService = service)

Set the action's parent service

Parameters
actionThe action in question
serviceThe action's parent service

◆ mupnp_action_setstatuscode

#define mupnp_action_setstatuscode ( action,
code )
Value:
mupnp_status_setcode(action->upnpStatus, code)
#define mupnp_status_setcode(upnpStat, value)
Definition upnp_status.h:70

Set the action's latest status code

Parameters
actionThe action in question
codeThe status code (int)

◆ mupnp_action_setstatusdescription

#define mupnp_action_setstatusdescription ( action,
value )
Value:
mupnp_status_setdescription(action->upnpStatus, value)
#define mupnp_status_setdescription(upnpStat, value)
Definition upnp_status.h:85

Set the action's latest status description

Parameters
actionThe action in question
valueThe status description string

◆ mupnp_action_setuserdata

#define mupnp_action_setuserdata ( action,
value )
Value:
(action->userData = value)

Set the action's arbitrary user data pointer

Parameters
actionThe action in question
valueThe user data pointer (void*)

◆ mupnp_actionlist_add

#define mupnp_actionlist_add ( actionList,
action )
Value:
mupnp_list_add((mUpnpList*)actionList, (mUpnpList*)action)
void mupnp_list_add(mUpnpList *headList, mUpnpList *list)
Definition list.c:123

Add an action to a list of actions

Parameters
actionListThe list in question
actionThe action to add to the list

◆ mupnp_actionlist_clear

#define mupnp_actionlist_clear ( actionList)
Value:
void mupnp_action_delete(mUpnpAction *action)
Definition action.c:56
void mupnp_list_clear(mUpnpList *headList, MUPNP_LIST_DESTRUCTORFUNC destructorFunc)
Definition list.c:257
void(* MUPNP_LIST_DESTRUCTORFUNC)(void *)
Definition list.h:29

Clear the contents of a list of actions

Parameters
actionListThe list of actions to clear

◆ MUPNP_ACTIONLIST_ELEM_NAME

#define MUPNP_ACTIONLIST_ELEM_NAME   "actionList"

◆ mupnp_actionlist_gets

#define mupnp_actionlist_gets ( actionList)
Value:

Get the first action in a list of actions. Use as the starting point in iteration loops.

Parameters
actionListThe list in question
Returns
mUpnpAction*

◆ mupnp_actionlist_size

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

Get the number of actions in a list of actions

Parameters
actionListThe list in question
Returns
int

Typedef Documentation

◆ MUPNP_ACTION_LISTNER

typedef bool(* MUPNP_ACTION_LISTNER) (mUpnpAction *)

◆ mUpnpAction

typedef struct _mUpnpAction mUpnpAction

◆ mUpnpActionList

typedef struct _mUpnpAction mUpnpActionList

Function Documentation

◆ mupnp_action_delete()

void mupnp_action_delete ( mUpnpAction * action)

Destroy an action

Parameters
actionThe action to destroy

◆ mupnp_action_getargumentbyname()

mUpnpArgument * mupnp_action_getargumentbyname ( mUpnpAction * action,
const char * name )

Find an argument from the action by the argument's name.

Parameters
actionThe action in question
nameThe name of the argument to look for
Returns
mUpnpArgument* if successfull; otherwise NULL

◆ mupnp_action_getargumentvaluebyname()

char * mupnp_action_getargumentvaluebyname ( mUpnpAction * action,
const char * name )

Get a value of the specified argument from the action by the argument's name directly.

Parameters
actionThe action in question
nameThe name of the argument to look for
Returns
char* if successfull; otherwise NULL

◆ mupnp_action_new()

mUpnpAction * mupnp_action_new ( void )

Create a new action

Returns
mUpnpAction*

◆ mupnp_action_setactionnode()

void mupnp_action_setactionnode ( mUpnpAction * action,
mUpnpXmlNode * node )

Set the action's XML node (i.e. the XML representation of the action)

Parameters
actionThe action in question
nodeThe mUpnpXmlNode*

◆ mupnp_action_setargumentvaluebyname()

bool mupnp_action_setargumentvaluebyname ( mUpnpAction * action,
const char * name,
const char * value )

Set a value of the specified argument from the action by the argument's name directly.

Parameters
actionThe action in question
nameThe name of the argument to look for
valueThe value to set
Returns
true if successfull; otherwise NO

◆ mupnp_actionlist_delete()

void mupnp_actionlist_delete ( mUpnpActionList * actionList)

Destroy a list of actions

Parameters
actionListThe list of actions to destroy

◆ mupnp_actionlist_new()

mUpnpActionList * mupnp_actionlist_new ( void )

Create a new list of actions

Returns
mUpnpActionList*