CyberLink for C

caction.h File Reference

#include <cybergarage/typedef.h>
#include <cybergarage/xml/cxml.h>
#include <cybergarage/util/clist.h>
#include <cybergarage/util/cstring.h>
#include <cybergarage/upnp/cargument.h>
#include <cybergarage/upnp/cupnp_status.h>

Data Structures

struct  _CgUpnpAction

Defines

#define CG_UPNP_ACTION_ELEM_NAME   "action"
#define CG_UPNP_ACTIONLIST_ELEM_NAME   "actionList"
#define CG_UPNP_ACTION_NAME   "name"
#define cg_upnp_action_next(action)   (CgUpnpAction *)cg_list_next((CgList *)action)
#define cg_upnp_action_isactionnode(node)   cg_xml_node_isname(node, CG_UPNP_ACTION_ELEM_NAME)
#define cg_upnp_action_getactionnode(action)   (action->actionNode)
#define cg_upnp_action_setservice(action, service)   (action->parentService = service)
#define cg_upnp_action_getservice(action)   ((CgUpnpService *)action->parentService)
#define cg_upnp_action_setname(action, value)   cg_xml_node_setchildnode(cg_upnp_action_getactionnode(action), CG_UPNP_ACTION_NAME, value)
#define cg_upnp_action_getname(action)   cg_xml_node_getchildnodevalue(cg_upnp_action_getactionnode(action), CG_UPNP_ACTION_NAME)
#define cg_upnp_action_isname(action, name)   cg_streq(cg_upnp_action_getname(action), name)
#define cg_upnp_action_getargumentlist(action)   (action->argumentList)
#define cg_upnp_action_getarguments(action)   ((CgUpnpArgument *)cg_list_next((CgList *)action->argumentList))
#define cg_upnp_action_hasargumentbyname(action, name)   ((cg_upnp_action_getargumentbyname(action,name) != NULL) ? TRUE : FALSE)
#define cg_upnp_action_setstatuscode(action, code)   cg_upnp_status_setcode(action->upnpStatus, code)
#define cg_upnp_action_getstatuscode(action)   cg_upnp_status_getcode(action->upnpStatus)
#define cg_upnp_action_setstatusdescription(action, value)   cg_upnp_status_setdescription(action->upnpStatus, value)
#define cg_upnp_action_getstatusdescription(action)   cg_upnp_status_getdescription(action->upnpStatus)
#define cg_upnp_action_setlistener(action, func)   (action->listener = func)
#define cg_upnp_action_getlistener(action)   (action->listener)
#define cg_upnp_action_setlistner   cg_upnp_action_setlistener
#define cg_upnp_action_getlistner   cg_upnp_action_getlistener
#define cg_upnp_action_setuserdata(action, value)   (action->userData = value)
#define cg_upnp_action_getuserdata(action)   (action->userData)
#define cg_upnp_actionlist_clear(actionList)   cg_list_clear((CgList *)actionList, (CG_LIST_DESTRUCTORFUNC)cg_upnp_action_delete)
#define cg_upnp_actionlist_size(actionList)   cg_list_size((CgList *)actionList)
#define cg_upnp_actionlist_gets(actionList)   (CgUpnpAction *)cg_list_next((CgList *)actionList)
#define cg_upnp_actionlist_add(actionList, action)   cg_list_add((CgList *)actionList, (CgList *)action)

Typedefs

typedef struct _CgUpnpAction CgUpnpAction
typedef struct _CgUpnpAction CgUpnpActionList
typedef BOOL(* CG_UPNP_ACTION_LISTNER )(CgUpnpAction *)

Functions

CgUpnpAction * cg_upnp_action_new ()
void cg_upnp_action_delete (CgUpnpAction *action)
void cg_upnp_action_setactionnode (CgUpnpAction *action, CgXmlNode *node)
CgUpnpArgument * cg_upnp_action_getargumentbyname (CgUpnpAction *action, char *name)
char * cg_upnp_action_getargumentvaluebyname (CgUpnpAction *action, char *name)
BOOL cg_upnp_action_setargumentvaluebyname (CgUpnpAction *action, char *name, char *value)
CgUpnpActionList * cg_upnp_actionlist_new ()
void cg_upnp_actionlist_delete (CgUpnpActionList *actionList)

Define Documentation

#define CG_UPNP_ACTION_ELEM_NAME   "action"
#define cg_upnp_action_getactionnode (   action)    (action->actionNode)

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

Parameters:
actionThe action in question
Returns:
CgXmlNode*
#define cg_upnp_action_getargumentlist (   action)    (action->argumentList)

Get the action's list of arguments

Parameters:
actionThe action in question
Returns:
CgUpnpArgumentList*
#define cg_upnp_action_getarguments (   action)    ((CgUpnpArgument *)cg_list_next((CgList *)action->argumentList))

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:
CgUpnpArgument*
#define cg_upnp_action_getlistener (   action)    (action->listener)

Get the action's listener function

Parameters:
actionThe action in question
Returns:
BOOL (*CG_UPNP_ACTION_LISTNER)(CgUpnpAction *)
#define cg_upnp_action_getlistner   cg_upnp_action_getlistener
Deprecated:
Compatibility macro for typo correction
#define cg_upnp_action_getname (   action)    cg_xml_node_getchildnodevalue(cg_upnp_action_getactionnode(action), CG_UPNP_ACTION_NAME)

Get the action's name

Parameters:
actionThe action in question
Returns:
char*
#define cg_upnp_action_getservice (   action)    ((CgUpnpService *)action->parentService)

Get the action's parent service

Parameters:
actionThe action in question
Returns:
CgUpnpService*
#define cg_upnp_action_getstatuscode (   action)    cg_upnp_status_getcode(action->upnpStatus)

Get the action's latest status code

Parameters:
actionThe action in question
Returns:
int
#define cg_upnp_action_getstatusdescription (   action)    cg_upnp_status_getdescription(action->upnpStatus)

Get the action's latest status description

Parameters:
actionThe action in question
Returns:
char*
#define cg_upnp_action_getuserdata (   action)    (action->userData)

Get the action's arbitrary user data pointer

Parameters:
actionThe action in question
Returns:
void*
#define cg_upnp_action_hasargumentbyname (   action,
  name 
)    ((cg_upnp_action_getargumentbyname(action,name) != NULL) ? TRUE : FALSE)

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
#define cg_upnp_action_isactionnode (   node)    cg_xml_node_isname(node, CG_UPNP_ACTION_ELEM_NAME)

Check, whether the given XML node is an action node

Parameters:
nodeThe CgXmlNode*
#define cg_upnp_action_isname (   action,
  name 
)    cg_streq(cg_upnp_action_getname(action), name)

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

Parameters:
actionThe action in question
nameThe name string to compare
#define CG_UPNP_ACTION_NAME   "name"
#define cg_upnp_action_next (   action)    (CgUpnpAction *)cg_list_next((CgList *)action)

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

Parameters:
actionThe current action
#define cg_upnp_action_setlistener (   action,
  func 
)    (action->listener = func)

Set the action's listener function

Parameters:
actionThe action in question
funcThe listener function of type: BOOL (*CG_UPNP_ACTION_LISTNER)(CgUpnpAction *)
#define cg_upnp_action_setlistner   cg_upnp_action_setlistener
Deprecated:
Compatibility macro for typo correction
#define cg_upnp_action_setname (   action,
  value 
)    cg_xml_node_setchildnode(cg_upnp_action_getactionnode(action), CG_UPNP_ACTION_NAME, value)

Set the action's name

Parameters:
actionThe action in question
valueThe action's name
#define cg_upnp_action_setservice (   action,
  service 
)    (action->parentService = service)

Set the action's parent service

Parameters:
actionThe action in question
serviceThe action's parent service
#define cg_upnp_action_setstatuscode (   action,
  code 
)    cg_upnp_status_setcode(action->upnpStatus, code)

Set the action's latest status code

Parameters:
actionThe action in question
codeThe status code (int)
#define cg_upnp_action_setstatusdescription (   action,
  value 
)    cg_upnp_status_setdescription(action->upnpStatus, value)

Set the action's latest status description

Parameters:
actionThe action in question
valueThe status description string
#define cg_upnp_action_setuserdata (   action,
  value 
)    (action->userData = value)

Set the action's arbitrary user data pointer

Parameters:
actionThe action in question
valueThe user data pointer (void*)
#define cg_upnp_actionlist_add (   actionList,
  action 
)    cg_list_add((CgList *)actionList, (CgList *)action)

Add an action to a list of actions

Parameters:
actionListThe list in question
actionThe action to add to the list
#define cg_upnp_actionlist_clear (   actionList)    cg_list_clear((CgList *)actionList, (CG_LIST_DESTRUCTORFUNC)cg_upnp_action_delete)

Clear the contents of a list of actions

Parameters:
actionListThe list of actions to clear
#define CG_UPNP_ACTIONLIST_ELEM_NAME   "actionList"
#define cg_upnp_actionlist_gets (   actionList)    (CgUpnpAction *)cg_list_next((CgList *)actionList)

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

Parameters:
actionListThe list in question
Returns:
CgUpnpAction*
#define cg_upnp_actionlist_size (   actionList)    cg_list_size((CgList *)actionList)

Get the number of actions in a list of actions

Parameters:
actionListThe list in question
Returns:
int

Typedef Documentation

typedef struct _CgUpnpAction CgUpnpAction

Function Documentation

void cg_upnp_action_delete ( CgUpnpAction *  action)

Destroy an action

Parameters:
actionThe action to destroy
CgUpnpArgument* cg_upnp_action_getargumentbyname ( CgUpnpAction *  action,
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:
CgUpnpArgument* if successfull; otherwise NULL
char* cg_upnp_action_getargumentvaluebyname ( CgUpnpAction *  action,
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
CgUpnpAction* cg_upnp_action_new ( )

Create a new action

Returns:
CgUpnpAction*
void cg_upnp_action_setactionnode ( CgUpnpAction *  action,
CgXmlNode *  node 
)

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

Parameters:
actionThe action in question
nodeThe CgXmlNode*
BOOL cg_upnp_action_setargumentvaluebyname ( CgUpnpAction *  action,
char *  name,
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
void cg_upnp_actionlist_delete ( CgUpnpActionList *  actionList)

Destroy a list of actions

Parameters:
actionListThe list of actions to destroy
CgUpnpActionList* cg_upnp_actionlist_new ( )

Create a new list of actions

Returns:
CgUpnpActionList*