UPnPsdk 0.1
Universal Plug and Play +, Software Development Kit
 
Loading...
Searching...
No Matches
Optional Tool API

Additional, optional utility API that can be helpful in writing applications. More...

Functions

PUPNP_Api void UpnpSetMaxJobsTotal (int mjt)
 Sets the maximum number of jobs in the internal thread pool.
 
PUPNP_Api const char * UpnpGetErrorMessage (int errorcode)
 Converts an SDK error code into a string error message suitable for display. The memory returned from this function should NOT be freed.
 
PUPNP_Api int UpnpResolveURL (const char *BaseURL, const char *RelURL, char *AbsURL)
 Combines a base URL and a relative URL into a single absolute URL.
 
PUPNP_Api int UpnpResolveURL2 (const char *BaseURL, const char *RelURL, char **AbsURL)
 Combines a base URL and a relative URL into a single absolute URL.
 
PUPNP_Api IXML_DocumentUpnpMakeAction (const char *ActionName, const char *ServType, int NumArg, const char *Arg,...)
 Creates an action request packet based on its input parameters (status variable name and value pair).
 
PUPNP_Api IXML_DocumentUpnpMakeActionResponse (const char *ActionName, const char *ServType, int NumArg, const char *Arg,...)
 Ceates an action response packet based on its output parameters (status variable name and value pair).
 
PUPNP_Api int UpnpAddToAction (IXML_Document **ActionDoc, const char *ActionName, const char *ServType, const char *ArgName, const char *ArgVal)
 Adds the argument in the action request.
 
PUPNP_Api int UpnpAddToActionResponse (IXML_Document **ActionResponse, const char *ActionName, const char *ServType, const char *ArgName, const char *ArgVal)
 Creates an action response packet based on its output parameters (status variable name and value pair).
 
PUPNP_Api IXML_DocumentUpnpCreatePropertySet (int NumArg, const char *Arg,...)
 Creates a property set message packet.
 
PUPNP_Api int UpnpAddToPropertySet (IXML_Document **PropSet, const char *ArgName, const char *ArgVal)
 Can be used when an application needs to transfer the status of many variables at once.
 

Detailed Description

Additional, optional utility API that can be helpful in writing applications.

This additional API can be compiled out in order to save code size in the library. Refer to the file README for details.

Function Documentation

◆ UpnpSetMaxJobsTotal()

PUPNP_Api void UpnpSetMaxJobsTotal ( int  mjt)

Sets the maximum number of jobs in the internal thread pool.

This option is intended for server applications to avoid an overflow of jobs when serving e.g. many web requests.

Definition at line 128 of file upnptools.cpp.

+ Here is the call graph for this function:

◆ UpnpGetErrorMessage()

PUPNP_Api const char * UpnpGetErrorMessage ( int  errorcode)

Converts an SDK error code into a string error message suitable for display. The memory returned from this function should NOT be freed.

Returns
An ASCII text string representation of the error message associated with the error code or the string "Unknown error code"
Parameters
[in]errorcodeThe SDK error code to convert.

Definition at line 116 of file upnptools.cpp.

◆ UpnpResolveURL()

PUPNP_Api int UpnpResolveURL ( const char *  BaseURL,
const char *  RelURL,
char *  AbsURL 
)

Combines a base URL and a relative URL into a single absolute URL.

The memory for AbsURL needs to be allocated by the caller and must be large enough to hold the BaseURL and RelURL combined.

Returns
An integer representing one of the following:
  • UPNP_E_SUCCESS: The operation completed successfully.
  • UPNP_E_INVALID_PARAM: RelURL is NULL.
  • UPNP_E_INVALID_URL: The BaseURL / RelURL combination does not form a valid URL.
  • UPNP_E_OUTOF_MEMORY: Insufficient resources exist to complete this operation.
Todo:
There is some unnecessary allocation and deallocation going on here because of the way resolve_rel_url() was originally written and used. In the future it would be nice to clean this up.
Parameters
[in]BaseURLThe base URL to combine.
[in]RelURLThe relative URL to BaseURL.
[out]AbsURLA pointer to a buffer to store the absolute URL.

Definition at line 135 of file upnptools.cpp.

+ Here is the call graph for this function:

◆ UpnpResolveURL2()

PUPNP_Api int UpnpResolveURL2 ( const char *  BaseURL,
const char *  RelURL,
char **  AbsURL 
)

Combines a base URL and a relative URL into a single absolute URL.

The memory for AbsURL becomes owned by the caller and should be freed later.

Returns
An integer representing one of the following:
  • UPNP_E_SUCCESS: The operation completed successfully.
  • UPNP_E_INVALID_PARAM: RelURL is NULL.
  • UPNP_E_INVALID_URL: The BaseURL / RelURL combination does not form a valid URL.
  • UPNP_E_OUTOF_MEMORY: Insufficient resources exist to complete this operation.
Parameters
[in]BaseURLThe base URL to combine.
[in]RelURLThe relative URL to BaseURL.
[out]AbsURLA pointer to a pointer to a buffer to store the absolute URL. Must be freed later by the caller.

Definition at line 154 of file upnptools.cpp.

+ Here is the call graph for this function:

◆ UpnpMakeAction()

PUPNP_Api IXML_Document * UpnpMakeAction ( const char *  ActionName,
const char *  ServType,
int  NumArg,
const char *  Arg,
  ... 
)

Creates an action request packet based on its input parameters (status variable name and value pair).

Any number of input parameters can be passed to this function but every input variable name should have a matching value argument.

It is a wrapper function that calls makeAction() function to create the action request.

Returns
The action node of Upnp_Document type or NULL if the operation failed.
Parameters
[in]ActionNameName of the action request or response.
[in]ServTypeThe service type.
[in]NumArgNumber of argument pairs to be passed.
[in]Argpointer to the first argument.
[in]...Argument list.

Definition at line 329 of file upnptools.cpp.

+ Here is the call graph for this function:

◆ UpnpMakeActionResponse()

PUPNP_Api IXML_Document * UpnpMakeActionResponse ( const char *  ActionName,
const char *  ServType,
int  NumArg,
const char *  Arg,
  ... 
)

Ceates an action response packet based on its output parameters (status variable name and value pair).

Any number of input parameters can be passed to this function but every output variable name should have a matching value argument.

It is a wrapper function that calls makeAction() function to create the action request.

Returns
The action node of Upnp_Document type or NULL if the operation failed.
Parameters
[in]ActionNameThe action name.
[in]ServTypeThe service type..
[in]NumArgThe number of argument pairs passed.
[in]ArgThe status variable name and value pair.
[in]...Other status variable name and value pairs.

Definition at line 341 of file upnptools.cpp.

+ Here is the call graph for this function:

◆ UpnpAddToAction()

PUPNP_Api int UpnpAddToAction ( IXML_Document **  ActionDoc,
const char *  ActionName,
const char *  ServType,
const char *  ArgName,
const char *  ArgVal 
)

Adds the argument in the action request.

This API is specially suitable inside a loop to add any number input parameters into an existing action. If no action document exists in the beginning then a Upnp_Document variable initialized with NULL should be passed as a parameter.

It is a wrapper function that calls addToAction() function to add the argument in the action request.

Returns
An integer representing one of the following:
  • UPNP_E_SUCCESS: The operation completed successfully.
  • UPNP_E_INVALID_PARAM: One or more of the parameters are invalid.
  • UPNP_E_OUTOF_MEMORY: Insufficient resources exist to complete this operation.
Parameters
[in,out]ActionDocA pointer to store the action document node.
[in]ActionNameThe action name.
[in]ServTypeThe service type.
[in]ArgNameThe status variable name.
[in]ArgValThe status variable value.

Definition at line 354 of file upnptools.cpp.

+ Here is the call graph for this function:

◆ UpnpAddToActionResponse()

PUPNP_Api int UpnpAddToActionResponse ( IXML_Document **  ActionResponse,
const char *  ActionName,
const char *  ServType,
const char *  ArgName,
const char *  ArgVal 
)

Creates an action response packet based on its output parameters (status variable name and value pair).

This API is especially suitable inside a loop to add any number of input parameters into an existing action response. If no action document exists in the beginning, a Upnp_Document variable initialized with NULL should be passed as a parameter.

It is a wrapper function that calls addToAction() function to add the argument in the action request.

Returns
An integer representing one of the following:
  • UPNP_E_SUCCESS: The operation completed successfully.
  • UPNP_E_INVALID_PARAM: One or more of the parameters are invalid.
  • UPNP_E_OUTOF_MEMORY: Insufficient resources exist to complete this operation.
Parameters
[in,out]ActionResponsePointer to a document to store the action document node.
[in]ActionNameThe action name.
[in]ServTypeThe service type.
[in]ArgNameThe status variable name.
[in]ArgValThe status variable value.

Definition at line 360 of file upnptools.cpp.

+ Here is the call graph for this function:

◆ UpnpCreatePropertySet()

PUPNP_Api IXML_Document * UpnpCreatePropertySet ( int  NumArg,
const char *  Arg,
  ... 
)

Creates a property set message packet.

Any number of input parameters can be passed to this function but every input variable name should have a matching value input argument.

Returns
NULL on failure, or the property-set document node.
Parameters
[in]NumArgThe number of argument pairs passed.
[in]ArgThe status variable name and value pair.
[in]...Variable sized list with the rest of the parameters.

Definition at line 367 of file upnptools.cpp.

+ Here is the call graph for this function:

◆ UpnpAddToPropertySet()

PUPNP_Api int UpnpAddToPropertySet ( IXML_Document **  PropSet,
const char *  ArgName,
const char *  ArgVal 
)

Can be used when an application needs to transfer the status of many variables at once.

It can be used (inside a loop) to add some extra status variables into an existing property set. If the application does not already have a property set document, the application should create a variable initialized with NULL and pass that as the first parameter.

Returns
An integer representing one of the following:
  • UPNP_E_SUCCESS: The operation completed successfully.
  • UPNP_E_INVALID_PARAM: One or more of the parameters are invalid.
  • UPNP_E_OUTOF_MEMORY: Insufficient resources exist to complete this operation.
Parameters
[in,out]PropSetA pointer to the document containing the property set document node.
[in]ArgNameThe status variable name.
[in]ArgValThe status variable value.

Definition at line 410 of file upnptools.cpp.

+ Here is the call graph for this function: