UPnPsdk 0.1
Universal Plug and Play +, Software Development Kit
 
Loading...
Searching...
No Matches
upnptools.cpp File Reference

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

#include <upnp.hpp>
#include <upnptools.hpp>
#include <ThreadPool.hpp>
#include <uri.hpp>
#include <stdarg.h>
#include <stdio.h>
+ Include dependency graph for upnptools.cpp:

Go to the source code of this file.

Classes

struct  ErrorString
 Structure to maintain a error code and string associated with the error code. More...
 

Functions

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

Variables

constexpr int HEADER_LENGTH {2000}
 
struct ErrorString ErrorMessages []
 Array of error structures.
 

Detailed Description

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

Definition in file upnptools.cpp.


Class Documentation

◆ ErrorString

struct ErrorString

Structure to maintain a error code and string associated with the error code.

Definition at line 58 of file upnptools.cpp.

Class Members
int rc

Error code.

const char * rcError

Error description.

Function Documentation

◆ addToAction()

static int addToAction ( int  response,
IXML_Document **  ActionDoc,
const char *  ActionName,
const char *  ServType,
const char *  ArgName,
const char *  ArgValue 
)
static

Adds the argument in the action request or response.

This function creates the action request or response if it is a first argument, otherwise it will add the argument in the document.

Returns
UPNP_E_SUCCESS if successful, otherwise the appropriate error.
Parameters
[in]responseflag to tell if the ActionDoc is for response or request.
[in,out]ActionDocRequest or response document.
[in]ActionNameName of the action request or response.
[in]ServTypeService type.
[in]ArgNameName of the argument.
[in]ArgValueValue of the argument.

Definition at line 177 of file upnptools.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ makeAction()

static IXML_Document * makeAction ( int  response,
const char *  ActionName,
const char *  ServType,
int  NumArg,
const char *  Arg,
va_list  ArgList 
)
static

Creates the action request or response from the argument list.

Returns
Action request or response document if successful, otherwise returns NULL
Parameters
[in]responseflag to tell if the ActionDoc is for response or request.
[in]ActionNameName of the action request or response.
[in]ServTypeService type.
[in]NumArgNumber of arguments in the action request or response.
[in]Argpointer to the first argument.
[in]ArgListArgument list.

Definition at line 251 of file upnptools.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ HEADER_LENGTH

constexpr int HEADER_LENGTH {2000}
constexpr

Maximum action header buffer length.

Definition at line 52 of file upnptools.cpp.

◆ ErrorMessages

struct ErrorString ErrorMessages[]

Array of error structures.

Definition at line 68 of file upnptools.cpp.