mUPnP for C
action.c File Reference
#include <mupnp/action.h>
#include <mupnp/util/log.h>

Functions

static void mupnp_action_initchildnodes (mUpnpAction *action)
 
static void mupnp_action_initargumentlist (mUpnpAction *action)
 
mUpnpActionmupnp_action_new (void)
 Create a new UPnP action instance.
 
void mupnp_action_delete (mUpnpAction *action)
 Destroy a UPnP action and free all associated resources.
 
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)
 

Function Documentation

◆ mupnp_action_delete()

void mupnp_action_delete ( mUpnpAction * action)

Destroy a UPnP action and free all associated resources.

Releases all resources associated with the action, including:

  • All input and output arguments
  • UPnP status object
  • XML node representation (if any)
Parameters
actionThe action to destroy. May be NULL (no-op if NULL).
Note
After calling this function, the action pointer is invalid and must not be used.
Thread-safe: Must not be called concurrently with other operations on the same action.
See also
mupnp_action_new()

◆ 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_initargumentlist()

static void mupnp_action_initargumentlist ( mUpnpAction * action)
static

◆ mupnp_action_initchildnodes()

static void mupnp_action_initchildnodes ( mUpnpAction * action)
static

◆ mupnp_action_new()

mUpnpAction * mupnp_action_new ( void )

Create a new UPnP action instance.

Allocates and initializes a new UPnP action object. Actions represent operations that can be invoked on a UPnP service, similar to remote procedure calls. Each action has:

  • A name (action identifier)
  • Input arguments (parameters passed to the action)
  • Output arguments (return values from the action)
  • A listener callback (for device-side implementations)
  • Status information (for responses and errors)

The function initializes:

  • Argument list (empty)
  • UPnP status object for error reporting
  • Listener callback (NULL, must be set for device implementations)
Returns
A newly-created mUpnpAction on success, or NULL if memory allocation fails.
Note
The returned action must be freed with mupnp_action_delete() when no longer needed.
Thread-safe: Can be called concurrently from multiple threads.
For device implementations, set an action listener with the listener field to handle invocations from control points.
Actions are typically created during service initialization when parsing the SCPD document.
See also
mupnp_action_delete()
mupnp_action_setactionnode()
MUPNP_ACTION_LISTNER

◆ 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