Test API to operate the DLNA UPnP Service information

Overview

Definition of Test API for DLNA UPnP Service features. More…

// typedefs

typedef struct tapi_upnp_sv_allowed_values tapi_upnp_sv_allowed_values;
typedef struct tapi_upnp_state_variable tapi_upnp_state_variable;
typedef struct tapi_upnp_state_variables tapi_upnp_state_variables;
typedef struct tapi_upnp_argument tapi_upnp_argument;
typedef struct tapi_upnp_action_arguments tapi_upnp_action_arguments;
typedef struct tapi_upnp_action tapi_upnp_action;
typedef struct tapi_upnp_actions tapi_upnp_actions;
typedef struct tapi_upnp_service_info tapi_upnp_service_info;
typedef struct tapi_upnp_services tapi_upnp_services;

// structs

struct tapi_upnp_action;
struct tapi_upnp_argument;
struct tapi_upnp_service_info;
struct tapi_upnp_state_variable;
struct tapi_upnp_sv_allowed_values;

// global functions

SLIST_HEAD(tapi_upnp_state_variables, tapi_upnp_state_variable);
SLIST_HEAD(tapi_upnp_action_arguments, tapi_upnp_argument);
SLIST_HEAD(tapi_upnp_actions, tapi_upnp_action);
SLIST_HEAD(tapi_upnp_services, tapi_upnp_service_info);
const char* tapi_upnp_get_state_variable_property_string(const tapi_upnp_state_variable* variable, te_upnp_state_variable_property_idx property_idx);
te_errno tapi_upnp_get_state_variable_property_boolean(const tapi_upnp_state_variable* variable, te_upnp_state_variable_property_idx property_idx, bool* value);
static const char* tapi_upnp_get_state_variable_name(const tapi_upnp_state_variable* variable);
static const char* tapi_upnp_get_state_variable_type(const tapi_upnp_state_variable* variable);
static te_errno tapi_upnp_get_state_variable_send_events(const tapi_upnp_state_variable* variable, bool* value);
static const char* tapi_upnp_get_state_variable_default_value(const tapi_upnp_state_variable* variable);
static const char* tapi_upnp_get_state_variable_minimum(const tapi_upnp_state_variable* variable);
static const char* tapi_upnp_get_state_variable_maximum(const tapi_upnp_state_variable* variable);
static const char* tapi_upnp_get_state_variable_step(const tapi_upnp_state_variable* variable);
const tapi_upnp_sv_allowed_values* tapi_upnp_get_state_variable_allowed(const tapi_upnp_state_variable* variable);
const char* tapi_upnp_get_service_property_string(const tapi_upnp_service_info* service, te_upnp_service_property_idx property_idx);
static const char* tapi_upnp_get_service_id(const tapi_upnp_service_info* service);
static const char* tapi_upnp_get_service_udn(const tapi_upnp_service_info* service);
static const char* tapi_upnp_get_service_type(const tapi_upnp_service_info* service);
static const char* tapi_upnp_get_service_location(const tapi_upnp_service_info* service);
static const char* tapi_upnp_get_service_scpd_url(const tapi_upnp_service_info* service);
static const char* tapi_upnp_get_service_control_url(const tapi_upnp_service_info* service);
static const char* tapi_upnp_get_service_event_subscription_url(const tapi_upnp_service_info* service);
static const char* tapi_upnp_get_argument_name(const tapi_upnp_argument* argument);
static te_upnp_arg_direction tapi_upnp_get_argument_direction(const tapi_upnp_argument* argument);
static const tapi_upnp_state_variable* tapi_upnp_get_argument_variable(const tapi_upnp_argument* argument);
static const char* tapi_upnp_get_argument_value(const tapi_upnp_argument* argument);
te_errno tapi_upnp_set_argument_value(tapi_upnp_argument* argument, const char* value);
te_errno tapi_upnp_get_service_info(rcf_rpc_server* rpcs, tapi_upnp_device_info* device, const char* service_id, tapi_upnp_services* services);
void tapi_upnp_free_service_info(tapi_upnp_services* services);
te_errno tapi_upnp_invoke_action(rcf_rpc_server* rpcs, const tapi_upnp_service_info* service, tapi_upnp_action* action);
void tapi_upnp_print_service_info(const tapi_upnp_services* services);

Detailed Documentation

Definition of Test API for DLNA UPnP Service features.

Copyright (C) 2004-2022 OKTET Labs Ltd. All rights reserved.

Typedefs

typedef struct tapi_upnp_sv_allowed_values tapi_upnp_sv_allowed_values

UPnP state variable allowed values.

typedef struct tapi_upnp_state_variable tapi_upnp_state_variable

UPnP state variable parameters.

typedef struct tapi_upnp_argument tapi_upnp_argument

UPnP action argument parameters. Note! The only changable field is value. It can be set by user to specify a value or read to get the value after an action execution, other data is filled when service context is retrieved.

typedef struct tapi_upnp_action tapi_upnp_action

UPnP action.

typedef struct tapi_upnp_service_info tapi_upnp_service_info

UPnP service information.

Global Functions

SLIST_HEAD(tapi_upnp_state_variables, tapi_upnp_state_variable)

Head of the UPnP state variables list for particular service.

SLIST_HEAD(tapi_upnp_action_arguments, tapi_upnp_argument)

Head of the UPnP arguments list for particular service action.

SLIST_HEAD(tapi_upnp_actions, tapi_upnp_action)

Head of the UPnP actions list for particular service.

SLIST_HEAD(tapi_upnp_services, tapi_upnp_service_info)

Head of the UPnP services list.

const char* tapi_upnp_get_state_variable_property_string(const tapi_upnp_state_variable* variable, te_upnp_state_variable_property_idx property_idx)

Get a state variable property string value.

Parameters:

variable

State variable.

property_idx

Index of certain property in properties array.

Returns:

The string property value or NULL if the property is not found.

te_errno tapi_upnp_get_state_variable_property_boolean(const tapi_upnp_state_variable* variable, te_upnp_state_variable_property_idx property_idx, bool* value)

Get a state variable property boolean value.

Parameters:

variable

State variable.

property_idx

Index of certain property in properties array.

value

Requested value.

Returns:

Status code. On success, 0.

static const char* tapi_upnp_get_state_variable_name(const tapi_upnp_state_variable* variable)

Get a Name of the certain state variable.

Parameters:

variable

State variable.

Returns:

The Name of state variable.

static const char* tapi_upnp_get_state_variable_type(const tapi_upnp_state_variable* variable)

Get a Type of the certain state variable.

Parameters:

variable

State variable.

Returns:

The Type of state variable.

static te_errno tapi_upnp_get_state_variable_send_events(const tapi_upnp_state_variable* variable, bool* value)

Get a Send Events flag of the certain state variable.

Parameters:

variable

State variable.

value

Value to return.

Returns:

Status code. On success, 0.

static const char* tapi_upnp_get_state_variable_default_value(const tapi_upnp_state_variable* variable)

Get a Default Value of the certain state variable.

Parameters:

variable

State variable.

Returns:

The Default Value of state variable.

static const char* tapi_upnp_get_state_variable_minimum(const tapi_upnp_state_variable* variable)

Get a Minimum value of the certain state variable. c@ NULL is valid value for non-numerical state variable.

Parameters:

variable

State variable.

Returns:

The Minimum value of state variable.

static const char* tapi_upnp_get_state_variable_maximum(const tapi_upnp_state_variable* variable)

Get a Maximum value of the certain state variable. c@ NULL is valid value for non-numerical state variable.

Parameters:

variable

State variable.

Returns:

The Maximum value of state variable.

static const char* tapi_upnp_get_state_variable_step(const tapi_upnp_state_variable* variable)

Get a Step value of the certain state variable. c@ NULL is valid value for non-numerical state variable.

Parameters:

variable

State variable.

Returns:

The Step value of state variable.

const tapi_upnp_sv_allowed_values* tapi_upnp_get_state_variable_allowed(const tapi_upnp_state_variable* variable)

Get a Allowed Values array of the certain state variable.

Parameters:

variable

State variable.

Returns:

The Allowed Values array of state variable.

const char* tapi_upnp_get_service_property_string(const tapi_upnp_service_info* service, te_upnp_service_property_idx property_idx)

Get a service property string value.

Parameters:

service

Service context.

property_idx

Index of certain property in properties array.

Returns:

The string property value or NULL if the property is not found.

static const char* tapi_upnp_get_service_id(const tapi_upnp_service_info* service)

Get a Service ID.

Parameters:

service

Service context.

Returns:

The Service ID.

static const char* tapi_upnp_get_service_udn(const tapi_upnp_service_info* service)

Get a Service Unique Device Name.

Parameters:

service

Service context.

Returns:

The Service Unique Device Name.

static const char* tapi_upnp_get_service_type(const tapi_upnp_service_info* service)

Get a Service Type.

Parameters:

service

Service context.

Returns:

The Service Type.

static const char* tapi_upnp_get_service_location(const tapi_upnp_service_info* service)

Get a Service Location.

Parameters:

service

Service context.

Returns:

The Service Location.

static const char* tapi_upnp_get_service_scpd_url(const tapi_upnp_service_info* service)

Get a Service Control Protocol Document URL.

Parameters:

service

Service context.

Returns:

The Service Control Protocol Document URL.

static const char* tapi_upnp_get_service_control_url(const tapi_upnp_service_info* service)

Get a Service Control URL.

Parameters:

service

Service context.

Returns:

The Service Control URL.

static const char* tapi_upnp_get_service_event_subscription_url(const tapi_upnp_service_info* service)

Get a Service Event Subscription URL.

Parameters:

service

Service context.

Returns:

The Service Event Subscription URL.

static const char* tapi_upnp_get_argument_name(const tapi_upnp_argument* argument)

Get an Argument name.

Parameters:

argument

UPnP action argument.

Returns:

The Argument name.

static te_upnp_arg_direction tapi_upnp_get_argument_direction(const tapi_upnp_argument* argument)

Get an Argument direction.

Parameters:

argument

UPnP action argument.

Returns:

The Argument direction.

static const tapi_upnp_state_variable* tapi_upnp_get_argument_variable(const tapi_upnp_argument* argument)

Get an Argument variable.

Parameters:

argument

UPnP action argument.

Returns:

The Argument variable.

static const char* tapi_upnp_get_argument_value(const tapi_upnp_argument* argument)

Get an Argument value.

Parameters:

argument

UPnP action argument.

Returns:

The Argument value.

te_errno tapi_upnp_set_argument_value(tapi_upnp_argument* argument, const char* value)

Set an Argument value. Note, previous set value will be freed, i.e. it is no need to free argument before to set it.

Parameters:

argument

UPnP action argument.

value

Null-terminated string value to set, or NULL to free argument and set it to NULL.

Returns:

Status code. On success, 0.

te_errno tapi_upnp_get_service_info(rcf_rpc_server* rpcs, tapi_upnp_device_info* device, const char* service_id, tapi_upnp_services* services)

Retrieve an information about available UPnP services. Note, services should be freed with tapi_upnp_free_service_info when it is no longer needed.

Parameters:

rpcs

RPC server handle.

device

The device which provides the service, can be unspecified (NULL).

service_id

Service ID string or NULL.

services

Service context list.

Returns:

Status code. On success, 0.

See also:

tapi_upnp_free_service_info

void tapi_upnp_free_service_info(tapi_upnp_services* services)

Empty the list of UPnP services (free allocated memory) which was obtained with tapi_upnp_get_service_info.

Parameters:

services

List of services.

See also:

tapi_upnp_get_service_info

te_errno tapi_upnp_invoke_action(rcf_rpc_server* rpcs, const tapi_upnp_service_info* service, tapi_upnp_action* action)

Execute a UPnP action. Note! IN arguments value of the action should be initialized by user or set to NULL, OUT arguments value must be initialized with NULL.

Parameters:

rpcs

RPC server handle.

service

Service context.

action

Requested action to invoke.

Returns:

Status code.

void tapi_upnp_print_service_info(const tapi_upnp_services* services)

Print UPnP services context using RING function. This function should be used for debugging purpose.

Parameters:

services

Services context list.