upnp.h
Go to the documentation of this file.
#ifndef UPNP_H
#define UPNP_H
/*******************************************************************************
*
* Copyright (c) 2000-2003 Intel Corporation
* All rights reserved.
* Copyright (C) 2011-2012 France Telecom All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* * Neither name of Intel Corporation nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
******************************************************************************/
#include "UpnpGlobal.h"
#include "UpnpInet.h"
#include "ixml.h"
#include "upnpconfig.h"
/*
* \todo Document the exact reason of these include files and solve this
* include mess in an include file like UpnpTime.h
*/
#ifdef _WIN32
#include <time.h>
#if defined(UPNP_USE_MSVCPP) || defined(UPNP_USE_BCBPP)
#include <sys/types.h> /* needed for off_t */
#endif
#elif (defined(BSD) && BSD >= 199306)
#include <time.h>
#else
/* Other systems ??? */
#endif
#ifdef UPNP_ENABLE_OPEN_SSL
#include <openssl/ssl.h>
#endif
#define LINE_SIZE (size_t)180
#define NAME_SIZE (size_t)256
#define MNFT_NAME_SIZE 64
#define MODL_NAME_SIZE 32
#define SERL_NUMR_SIZE 64
#define MODL_DESC_SIZE 64
#define UPNP_INFINITE -1
#define UPNP_USING_CHUNKED -3
#define UPNP_UNTIL_CLOSE -4
#define UPNP_E_SUCCESS 0
#define UPNP_E_INVALID_HANDLE -100
#define UPNP_E_INVALID_PARAM -101
#define UPNP_E_OUTOF_HANDLE -102
#define UPNP_E_OUTOF_CONTEXT -103
#define UPNP_E_OUTOF_MEMORY -104
#define UPNP_E_INIT -105
#define UPNP_E_BUFFER_TOO_SMALL -106
#define UPNP_E_INVALID_DESC -107
#define UPNP_E_INVALID_URL -108
#define UPNP_E_INVALID_SID -109
#define UPNP_E_INVALID_DEVICE -110
#define UPNP_E_INVALID_SERVICE -111
#define UPNP_E_BAD_RESPONSE -113
#define UPNP_E_BAD_REQUEST -114
#define UPNP_E_INVALID_ACTION -115
#define UPNP_E_FINISH -116
#define UPNP_E_INIT_FAILED -117
#define UPNP_E_URL_TOO_BIG -118
#define UPNP_E_BAD_HTTPMSG -119
#define UPNP_E_ALREADY_REGISTERED -120
#define UPNP_E_INVALID_INTERFACE -121
#define UPNP_E_NETWORK_ERROR -200
#define UPNP_E_SOCKET_WRITE -201
#define UPNP_E_SOCKET_READ -202
#define UPNP_E_SOCKET_BIND -203
#define UPNP_E_SOCKET_CONNECT -204
#define UPNP_E_OUTOF_SOCKET -205
#define UPNP_E_LISTEN -206
#define UPNP_E_TIMEDOUT -207
#define UPNP_E_SOCKET_ERROR -208
#define UPNP_E_FILE_WRITE_ERROR -209
#define UPNP_E_CANCELED -210
#define UPNP_E_EVENT_PROTOCOL -300
#define UPNP_E_SUBSCRIBE_UNACCEPTED -301
#define UPNP_E_UNSUBSCRIBE_UNACCEPTED -302
#define UPNP_E_NOTIFY_UNACCEPTED -303
#define UPNP_E_INVALID_ARGUMENT -501
#define UPNP_E_FILE_NOT_FOUND -502
#define UPNP_E_FILE_READ_ERROR -503
#define UPNP_E_EXT_NOT_XML -504
#define UPNP_E_NO_WEB_SERVER -505
#define UPNP_E_OUTOF_BOUNDS -506
#define UPNP_E_NOT_FOUND -507
#define UPNP_E_INTERNAL_ERROR -911
/* SOAP-related error codes */
#define UPNP_SOAP_E_INVALID_ACTION 401
#define UPNP_SOAP_E_INVALID_ARGS 402
#define UPNP_SOAP_E_OUT_OF_SYNC 403
#define UPNP_SOAP_E_INVALID_VAR 404
#define UPNP_SOAP_E_ACTION_FAILED 501
/* @} ErrorCodes */
/*
* Opaque data structures. The following includes are data structures that
* must be externally visible. Since version 1.8.0, only an opaque typedef
* is visible from the outside world. Any operation on these data types
* must be done using the appropriate interface functions.
*
* This policy has the great advantage that it is now possible to change
* the internal implementation of these data structures without breaking
* the API.
*/
#include "UpnpActionComplete.h"
#include "UpnpActionRequest.h"
#include "UpnpDiscovery.h"
#include "UpnpEvent.h"
#include "UpnpEventSubscribe.h"
#include "UpnpFileInfo.h"
#include "UpnpStateVarComplete.h"
#include "UpnpStateVarRequest.h"
#include "UpnpSubscriptionRequest.h"
enum UpnpOpenFileMode
{
UPNP_READ,
UPNP_WRITE
};
typedef int UpnpClient_Handle;
typedef int UpnpDevice_Handle;
typedef char Upnp_SID[44];
enum Upnp_SType_e
{
UPNP_S_ALL,
UPNP_S_ROOT,
UPNP_S_DEVICE,
UPNP_S_SERVICE
};
typedef enum Upnp_SType_e Upnp_SType;
enum Upnp_DescType_e
{
UPNPREG_URL_DESC,
UPNPREG_FILENAME_DESC,
UPNPREG_BUF_DESC
};
typedef enum Upnp_DescType_e Upnp_DescType;
#include "Callback.h"
/* @} Constants and Types */
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
UPNP_EXPORT_SPEC int UpnpInit2(
const char *IfName,
unsigned short DestPort);
#ifdef UPNP_ENABLE_OPEN_SSL
UPNP_EXPORT_SPEC int UpnpInitSslContext(
int initOpenSslLib,
const SSL_METHOD *sslMethod);
#endif
UPNP_EXPORT_SPEC int UpnpFinish(void);
UPNP_EXPORT_SPEC unsigned short UpnpGetServerPort(void);
UPNP_EXPORT_SPEC unsigned short UpnpGetServerPort6(void);
UPNP_EXPORT_SPEC unsigned short UpnpGetServerUlaGuaPort6(void);
UPNP_EXPORT_SPEC char *UpnpGetServerIpAddress(void);
UPNP_EXPORT_SPEC char *UpnpGetServerIp6Address(void);
UPNP_EXPORT_SPEC char *UpnpGetServerUlaGuaIp6Address(void);
UPNP_EXPORT_SPEC int UpnpRegisterRootDevice(
const char *DescUrl,
Upnp_FunPtr Callback,
const void *Cookie,
UpnpDevice_Handle *Hnd);
UPNP_EXPORT_SPEC int UpnpRegisterRootDevice2(
Upnp_DescType descriptionType,
const char *description,
size_t bufferLen,
int config_baseURL,
Upnp_FunPtr Fun,
const void *Cookie,
UpnpDevice_Handle *Hnd);
UPNP_EXPORT_SPEC int UpnpRegisterRootDevice3(
const char *DescUrl,
Upnp_FunPtr Callback,
const void *Cookie,
UpnpDevice_Handle *Hnd,
int AddressFamily);
UPNP_EXPORT_SPEC int UpnpRegisterRootDevice4(
const char *DescUrl,
Upnp_FunPtr Callback,
const void *Cookie,
UpnpDevice_Handle *Hnd,
int AddressFamily,
const char *LowerDescUrl);
UPNP_EXPORT_SPEC int UpnpUnRegisterRootDevice(
UpnpDevice_Handle Hnd);
UPNP_EXPORT_SPEC int UpnpUnRegisterRootDeviceLowPower(
UpnpDevice_Handle Hnd,
int PowerState,
int SleepPeriod,
int RegistrationState);
UPNP_EXPORT_SPEC int UpnpRegisterClient(
Upnp_FunPtr Callback,
const void *Cookie,
UpnpClient_Handle *Hnd);
UPNP_EXPORT_SPEC int UpnpUnRegisterClient(
UpnpClient_Handle Hnd);
UPNP_EXPORT_SPEC int UpnpSetContentLength(
UpnpClient_Handle Hnd,
size_t contentLength);
UPNP_EXPORT_SPEC int UpnpSetMaxContentLength(
size_t contentLength);
/* @} Initialization and Registration */
/******************************************************************************
******************************************************************************
* *
* D I S C O V E R Y *
* *
******************************************************************************
******************************************************************************/
UPNP_EXPORT_SPEC int UpnpSearchAsync(
UpnpClient_Handle Hnd,
int Mx,
const char *TTarget_constarget_const,
const void *Cookie_const);
UPNP_EXPORT_SPEC int UpnpSendAdvertisement(
UpnpDevice_Handle Hnd,
int Exp);
UPNP_EXPORT_SPEC int UpnpSendAdvertisementLowPower(
UpnpDevice_Handle Hnd,
int Exp,
int PowerState,
int SleepPeriod,
int RegistrationState);
/* @} Discovery */
/******************************************************************************
******************************************************************************
* *
* C O N T R O L *
* *
******************************************************************************
******************************************************************************/
UPNP_EXPORT_SPEC int UpnpGetServiceVarStatus(
UpnpClient_Handle Hnd,
const char *ActionURL,
const char *VarName,
DOMString *StVarVal);
UPNP_EXPORT_SPEC int UpnpGetServiceVarStatusAsync(
UpnpClient_Handle Hnd,
const char *ActionURL,
const char *VarName,
Upnp_FunPtr Fun,
const void *Cookie);
UPNP_EXPORT_SPEC int UpnpSendAction(
UpnpClient_Handle Hnd,
const char *ActionURL,
const char *ServiceType,
const char *DevUDN,
IXML_Document *Action,
IXML_Document **RespNode);
UPNP_EXPORT_SPEC int UpnpSendActionEx(
UpnpClient_Handle Hnd,
const char *ActionURL,
const char *ServiceType,
const char *DevUDN,
IXML_Document *Header,
IXML_Document *Action,
IXML_Document **RespNode);
UPNP_EXPORT_SPEC int UpnpSendActionAsync(
UpnpClient_Handle Hnd,
const char *ActionURL,
const char *ServiceType,
const char *DevUDN,
IXML_Document *Action,
Upnp_FunPtr Fun,
const void *Cookie);
UPNP_EXPORT_SPEC int UpnpSendActionExAsync(
UpnpClient_Handle Hnd,
const char *ActionURL,
const char *ServiceType,
const char *DevUDN,
IXML_Document *Header,
IXML_Document *Action,
Upnp_FunPtr Fun,
const void *Cookie);
/******************************************************************************
******************************************************************************
* *
* E V E N T I N G *
* *
******************************************************************************
******************************************************************************/
UPNP_EXPORT_SPEC int UpnpAcceptSubscription(
UpnpDevice_Handle Hnd,
const char *DevID,
const char *ServID,
const char **VarName,
const char **NewVal,
int cVariables,
const Upnp_SID SubsId);
UPNP_EXPORT_SPEC int UpnpAcceptSubscriptionExt(
UpnpDevice_Handle Hnd,
const char *DevID,
const char *ServID,
IXML_Document *PropSet,
const Upnp_SID SubsId);
UPNP_EXPORT_SPEC int UpnpNotify(
UpnpDevice_Handle,
const char *DevID,
const char *ServID,
const char **VarName,
const char **NewVal,
int cVariables);
UPNP_EXPORT_SPEC int UpnpNotifyExt(
UpnpDevice_Handle,
const char *DevID,
const char *ServID,
IXML_Document *PropSet);
UPNP_EXPORT_SPEC int UpnpRenewSubscription(
UpnpClient_Handle Hnd,
int *TimeOut,
const Upnp_SID SubsId);
UPNP_EXPORT_SPEC int UpnpRenewSubscriptionAsync(
UpnpClient_Handle Hnd,
int TimeOut,
Upnp_SID SubsId,
Upnp_FunPtr Fun,
const void *Cookie);
UPNP_EXPORT_SPEC int UpnpSetMaxSubscriptions(
UpnpDevice_Handle Hnd,
int MaxSubscriptions);
UPNP_EXPORT_SPEC int UpnpSetMaxSubscriptionTimeOut(
UpnpDevice_Handle Hnd,
int MaxSubscriptionTimeOut);
UPNP_EXPORT_SPEC int UpnpSubscribe(
UpnpClient_Handle Hnd,
const char *PublisherUrl,
int *TimeOut,
Upnp_SID SubsId);
UPNP_EXPORT_SPEC int UpnpSubscribeAsync(
UpnpClient_Handle Hnd,
const char *PublisherUrl,
int TimeOut,
Upnp_FunPtr Fun,
const void *Cookie);
UPNP_EXPORT_SPEC int UpnpUnSubscribe(
UpnpClient_Handle Hnd,
const Upnp_SID SubsId);
UPNP_EXPORT_SPEC int UpnpUnSubscribeAsync(
UpnpClient_Handle Hnd,
Upnp_SID SubsId,
Upnp_FunPtr Fun,
const void *Cookie);
/******************************************************************************
******************************************************************************
* *
* C L I E N T - A P I *
* *
******************************************************************************
******************************************************************************/
enum Upnp_HttpMethod_e
{
UPNP_HTTPMETHOD_PUT = 0,
UPNP_HTTPMETHOD_DELETE = 1,
UPNP_HTTPMETHOD_GET = 2,
UPNP_HTTPMETHOD_HEAD = 3,
UPNP_HTTPMETHOD_POST = 4
};
typedef enum Upnp_HttpMethod_e Upnp_HttpMethod;
UPNP_EXPORT_SPEC int UpnpDownloadUrlItem(
const char *url,
char **outBuf,
char *contentType);
UPNP_EXPORT_SPEC int UpnpOpenHttpGet(
const char *url,
void **handle,
char **contentType,
int *contentLength,
int *httpStatus,
int timeout);
UPNP_EXPORT_SPEC int UpnpOpenHttpGetProxy(
const char *url,
const char *proxy_str,
void **handle,
char **contentType,
int *contentLength,
int *httpStatus,
int timeout);
UPNP_EXPORT_SPEC int UpnpOpenHttpGetEx(
const char *url,
void **handle,
char **contentType,
int *contentLength,
int *httpStatus,
int lowRange,
int highRange,
int timeout);
UPNP_EXPORT_SPEC int UpnpReadHttpGet(
void *handle,
char *buf,
size_t *size,
int timeout);
UPNP_EXPORT_SPEC int UpnpHttpGetProgress(
void *handle,
size_t *length,
size_t *total);
UPNP_EXPORT_SPEC int UpnpCancelHttpGet(
void *handle);
UPNP_EXPORT_SPEC int UpnpCloseHttpGet(
void *handle);
UPNP_EXPORT_SPEC int UpnpOpenHttpPost(
const char *url,
void **handle,
const char *contentType,
int contentLength,
int timeout);
UPNP_EXPORT_SPEC int UpnpWriteHttpPost(
void *handle,
char *buf,
size_t *size,
int timeout);
UPNP_EXPORT_SPEC int UpnpCloseHttpPost(
void *handle,
int *httpStatus,
int timeout);
UPNP_EXPORT_SPEC int UpnpOpenHttpConnection(
const char *url,
void **handle,
int timeout);
UPNP_EXPORT_SPEC int UpnpMakeHttpRequest(
/* ![in] The method to use to make the request. */
Upnp_HttpMethod method,
const char *url,
void *handle,
UpnpString *headers,
const char *contentType,
int contentLength,
int timeout);
UPNP_EXPORT_SPEC int UpnpWriteHttpRequest(
void *handle,
char *buf,
size_t *size,
int timeout);
UPNP_EXPORT_SPEC int UpnpEndHttpRequest(
void *handle,
int timeout);
UPNP_EXPORT_SPEC int UpnpGetHttpResponse(
void *handle,
UpnpString *headers,
char **contentType,
int *contentLength,
int *httpStatus,
int timeout);
UPNP_EXPORT_SPEC int UpnpReadHttpResponse(
void *handle,
char *buf,
size_t *size,
int timeout);
UPNP_EXPORT_SPEC int UpnpCloseHttpConnection(
void *handle);
UPNP_EXPORT_SPEC int UpnpDownloadXmlDoc(
const char *url,
IXML_Document **xmlDoc);
/******************************************************************************
******************************************************************************
* *
* W E B S E R V E R A P I *
* *
******************************************************************************
******************************************************************************/
UPNP_EXPORT_SPEC int UpnpSetWebServerRootDir(
const char *rootDir);
typedef void *UpnpWebFileHandle;
typedef int (*VDCallback_GetInfo)(
const char *filename,
UpnpFileInfo *info,
const void *cookie,
const void **request_cookie);
UPNP_EXPORT_SPEC int UpnpVirtualDir_set_GetInfoCallback(
VDCallback_GetInfo callback);
typedef UpnpWebFileHandle (*VDCallback_Open)(
const char *filename,
enum UpnpOpenFileMode Mode,
const void *cookie,
const void *request_cookie);
UPNP_EXPORT_SPEC int UpnpVirtualDir_set_OpenCallback(VDCallback_Open callback);
typedef int (*VDCallback_Read)(
UpnpWebFileHandle fileHnd,
char *buf,
size_t buflen,
const void *cookie,
const void *request_cookie);
UPNP_EXPORT_SPEC int UpnpVirtualDir_set_ReadCallback(VDCallback_Read callback);
typedef int (*VDCallback_Write)(
UpnpWebFileHandle fileHnd,
char *buf,
size_t buflen,
const void *cookie,
const void *request_cookie);
UPNP_EXPORT_SPEC int UpnpVirtualDir_set_WriteCallback(
VDCallback_Write callback);
typedef int (*VDCallback_Seek)(
UpnpWebFileHandle fileHnd,
off_t offset,
int origin,
const void *cookie,
const void *request_cookie);
UPNP_EXPORT_SPEC int UpnpVirtualDir_set_SeekCallback(VDCallback_Seek callback);
typedef int (*VDCallback_Close)(
UpnpWebFileHandle fileHnd,
const void *cookie,
const void *request_cookie);
UPNP_EXPORT_SPEC int UpnpVirtualDir_set_CloseCallback(
VDCallback_Close callback);
UPNP_EXPORT_SPEC int UpnpEnableWebserver(
int enable);
UPNP_EXPORT_SPEC int UpnpIsWebserverEnabled(void);
/*
* \brief Callback for validating HTTP requests HOST header values.
*
* @param hostname the value in the request HOST header.
* @return An integer representing one of the following:
* \li \c UPNP_E_SUCCESS: a request with the HOST header set to hostname
* should be processed.
* \li \c UPNP_E_BAD_HTTPMSG the request should be rejected.
*/
typedef int (*WebCallback_HostValidate)(const char *hostname, void *cookie);
/*
* \brief Set callback for validating HTTP requests HOST header values.
*
* @param callback the host validating callback function or NULL.
* @param cookie the chocolate you like.
*/
UPNP_EXPORT_SPEC void UpnpSetHostValidateCallback(
WebCallback_HostValidate callback, void *cookie);
/*
* \brief Enable or disable literal IP redirection.
*
* @param enable Zero to disable (default) non-zero to enable.
*/
UPNP_EXPORT_SPEC void UpnpSetAllowLiteralHostRedirection(int enable);
UPNP_EXPORT_SPEC int UpnpAddVirtualDir(
const char *dirName,
const void *cookie,
const void **oldcookie);
UPNP_EXPORT_SPEC int UpnpRemoveVirtualDir(
const char *dirName);
UPNP_EXPORT_SPEC void UpnpRemoveAllVirtualDirs(void);
/* @} Web Server API */
#ifdef __cplusplus
}
#endif /* __cplusplus */
/* @} UPnPAPI UPnP API */
#endif /* UPNP_H */
Callback.h
Upnp_FunPtr
int(* Upnp_FunPtr)(Upnp_EventType EventType, const void *Event, void *Cookie)
Definition Callback.h:145
UpnpActionComplete.h
Header file for UpnpActionComplete methods.
UpnpActionRequest.h
Header file for UpnpActionRequest methods.
UpnpDiscovery.h
Header file for UpnpDiscovery methods.
UpnpEventSubscribe.h
Header file for UpnpEventSubscribe methods.
UpnpEvent.h
Header file for UpnpEvent methods.
UpnpFileInfo.h
Header file for UpnpFileInfo methods.
UpnpGlobal.h
Defines constants that for some reason are not defined on some systems.
UPNP_EXPORT_SPEC
#define UPNP_EXPORT_SPEC
Export functions on WIN32 DLLs.
Definition UpnpGlobal.h:98
UpnpInet.h
Provides a platform independent way to include TCP/IP types and functions.
UpnpStateVarComplete.h
Header file for UpnpStateVarComplete methods.
UpnpStateVarRequest.h
Header file for UpnpStateVarRequest methods.
UpnpSubscriptionRequest.h
Header file for UpnpSubscriptionRequest methods.
UpnpCloseHttpGet
int UpnpCloseHttpGet(void *handle)
Closes the connection and frees memory that was allocated for the handle parameter.
Definition upnpapi.c:3460
UpnpSendActionEx
int UpnpSendActionEx(UpnpClient_Handle Hnd, const char *ActionURL, const char *ServiceType, const char *DevUDN, IXML_Document *Header, IXML_Document *Action, IXML_Document **RespNode)
Sends a message to change a state variable in a service.
Definition upnpapi.c:2924
UpnpSearchAsync
int UpnpSearchAsync(UpnpClient_Handle Hnd, int Mx, const char *TTarget_constarget_const, const void *Cookie_const)
Searches for devices matching the given search target.
Definition upnpapi.c:2046
UpnpRemoveAllVirtualDirs
void UpnpRemoveAllVirtualDirs(void)
Removes all virtual directory mappings.
Definition upnpapi.c:4440
UpnpVirtualDir_set_GetInfoCallback
int UpnpVirtualDir_set_GetInfoCallback(VDCallback_GetInfo callback)
Sets the get_info callback function to be used to access a virtual directory.
Definition upnpapi.c:4512
UpnpRenewSubscriptionAsync
int UpnpRenewSubscriptionAsync(UpnpClient_Handle Hnd, int TimeOut, Upnp_SID SubsId, Upnp_FunPtr Fun, const void *Cookie)
Renews a subscription that is about to expire, generating a callback when the operation is complete.
Definition upnpapi.c:2524
VDCallback_Close
int(* VDCallback_Close)(UpnpWebFileHandle fileHnd, const void *cookie, const void *request_cookie)
Close callback function prototype.
Definition upnp.h:2737
Upnp_SID
char Upnp_SID[44]
Holds the subscription identifier for a subscription between a client and a device.
Definition upnp.h:448
UpnpOpenHttpGet
int UpnpOpenHttpGet(const char *url, void **handle, char **contentType, int *contentLength, int *httpStatus, int timeout)
Gets a file specified in a URL.
Definition upnpapi.c:3376
UpnpGetServerPort
unsigned short UpnpGetServerPort(void)
Returns the internal server IPv4 UPnP listening port.
Definition upnpapi.c:755
UpnpRegisterRootDevice2
int UpnpRegisterRootDevice2(Upnp_DescType descriptionType, const char *description, size_t bufferLen, int config_baseURL, Upnp_FunPtr Fun, const void *Cookie, UpnpDevice_Handle *Hnd)
Registers a device application with the UPnP Library. Similar to UpnpRegisterRootDevice,...
Definition upnpapi.c:1079
Upnp_DescType_e
Upnp_DescType_e
Specifies the type of description in UpnpRegisterRootDevice2.
Definition upnp.h:484
UpnpReadHttpGet
int UpnpReadHttpGet(void *handle, char *buf, size_t *size, int timeout)
Gets specified number of bytes from a file specified in a URL.
Definition upnpapi.c:3462
UpnpSubscribeAsync
int UpnpSubscribeAsync(UpnpClient_Handle Hnd, const char *PublisherUrl, int TimeOut, Upnp_FunPtr Fun, const void *Cookie)
Performs the same operation as UpnpSubscribe, but returns immediately and calls the registered callba...
Definition upnpapi.c:2186
UpnpCloseHttpPost
int UpnpCloseHttpPost(void *handle, int *httpStatus, int timeout)
Sends and receives any pending data, closes the connection with the server, and frees memory allocate...
Definition upnpapi.c:3365
UpnpSendAdvertisementLowPower
int UpnpSendAdvertisementLowPower(UpnpDevice_Handle Hnd, int Exp, int PowerState, int SleepPeriod, int RegistrationState)
Sends out the discovery announcements for all devices and services for a device.
Definition upnpapi.c:1925
UpnpSendActionAsync
int UpnpSendActionAsync(UpnpClient_Handle Hnd, const char *ActionURL, const char *ServiceType, const char *DevUDN, IXML_Document *Action, Upnp_FunPtr Fun, const void *Cookie)
Sends a message to change a state variable in a service, generating a callback when the operation is ...
Definition upnpapi.c:2982
UpnpRenewSubscription
int UpnpRenewSubscription(UpnpClient_Handle Hnd, int *TimeOut, const Upnp_SID SubsId)
Renews a subscription that is about to expire.
Definition upnpapi.c:2463
UpnpSubscribe
int UpnpSubscribe(UpnpClient_Handle Hnd, const char *PublisherUrl, int *TimeOut, Upnp_SID SubsId)
Registers a control point to receive event notifications from another device.
Definition upnpapi.c:2263
UpnpUnSubscribeAsync
int UpnpUnSubscribeAsync(UpnpClient_Handle Hnd, Upnp_SID SubsId, Upnp_FunPtr Fun, const void *Cookie)
Removes a subscription of a control point from a service previously subscribed to using UpnpSubscribe...
Definition upnpapi.c:2388
UpnpAcceptSubscriptionExt
int UpnpAcceptSubscriptionExt(UpnpDevice_Handle Hnd, const char *DevID, const char *ServID, IXML_Document *PropSet, const Upnp_SID SubsId)
Similar to UpnpAcceptSubscription() except that it takes a DOM document for the variables to event ra...
Definition upnpapi.c:2777
UpnpEnableWebserver
int UpnpEnableWebserver(int enable)
Enables or disables the webserver.
Definition upnpapi.c:4461
UpnpRegisterRootDevice4
int UpnpRegisterRootDevice4(const char *DescUrl, Upnp_FunPtr Callback, const void *Cookie, UpnpDevice_Handle *Hnd, int AddressFamily, const char *LowerDescUrl)
Registers a device application for a specific address family with the UPnP library....
Definition upnpapi.c:1268
UpnpOpenHttpPost
int UpnpOpenHttpPost(const char *url, void **handle, const char *contentType, int contentLength, int timeout)
Makes an HTTP POST request message, opens a connection to the server and sends the POST request to th...
Definition upnpapi.c:3341
UpnpWebFileHandle
void * UpnpWebFileHandle
The type of handle returned by the web server for open requests.
Definition upnp.h:2602
UpnpDownloadUrlItem
int UpnpDownloadUrlItem(const char *url, char **outBuf, char *contentType)
Downloads a file specified in a URL.
Definition upnpapi.c:3529
UpnpAddVirtualDir
int UpnpAddVirtualDir(const char *dirName, const void *cookie, const void **oldcookie)
Adds a virtual directory mapping.
Definition upnpapi.c:4324
UpnpReadHttpResponse
int UpnpReadHttpResponse(void *handle, char *buf, size_t *size, int timeout)
Reads the content of a response using a connection previously created by UpnpOpenHttpConnection.
Definition upnpapi.c:3519
UpnpSetMaxContentLength
int UpnpSetMaxContentLength(size_t contentLength)
Sets the maximum content-length that the SDK will process on an incoming SOAP requests or responses.
Definition upnpapi.c:4615
UpnpMakeHttpRequest
int UpnpMakeHttpRequest(Upnp_HttpMethod method, const char *url, void *handle, UpnpString *headers, const char *contentType, int contentLength, int timeout)
Makes a HTTP request using a connection previously created by UpnpOpenHttpConnection.
Definition upnpapi.c:3477
UpnpSendAction
int UpnpSendAction(UpnpClient_Handle Hnd, const char *ActionURL, const char *ServiceType, const char *DevUDN, IXML_Document *Action, IXML_Document **RespNode)
Sends a message to change a state variable in a service.
Definition upnpapi.c:2867
VDCallback_GetInfo
int(* VDCallback_GetInfo)(const char *filename, UpnpFileInfo *info, const void *cookie, const void **request_cookie)
Get-info callback function prototype.
Definition upnp.h:2607
UpnpUnSubscribe
int UpnpUnSubscribe(UpnpClient_Handle Hnd, const Upnp_SID SubsId)
Removes the subscription of a control point from a service previously subscribed to using UpnpSubscri...
Definition upnpapi.c:2336
UpnpFinish
int UpnpFinish(void)
Initializes the OpenSSL library, and the OpenSSL context for use with pupnp.
Definition upnpapi.c:664
UpnpGetServerUlaGuaIp6Address
char * UpnpGetServerUlaGuaIp6Address(void)
Returns the IPv6 unique-local or globally-unique listening ip address.
Definition upnpapi.c:807
UpnpOpenHttpGetProxy
int UpnpOpenHttpGetProxy(const char *url, const char *proxy_str, void **handle, char **contentType, int *contentLength, int *httpStatus, int timeout)
Gets a file specified in a URL through the specified proxy.
Definition upnpapi.c:3407
Upnp_HttpMethod_e
Upnp_HttpMethod_e
Different HTTP methods.
Definition upnp.h:1936
UpnpVirtualDir_set_WriteCallback
int UpnpVirtualDir_set_WriteCallback(VDCallback_Write callback)
Sets the write callback function to be used to access a virtual directory.
Definition upnpapi.c:4548
UpnpIsWebserverEnabled
int UpnpIsWebserverEnabled(void)
Returns 1 if the webserver is enabled, or 0 if it is not.
Definition upnpapi.c:4491
UpnpWriteHttpPost
int UpnpWriteHttpPost(void *handle, char *buf, size_t *size, int timeout)
Sends a request to a server to copy the contents of a buffer to the URI specified in the UpnpOpenHttp...
Definition upnpapi.c:3360
UpnpVirtualDir_set_SeekCallback
int UpnpVirtualDir_set_SeekCallback(VDCallback_Seek callback)
Sets the seek callback function to be used to access a virtual directory.
Definition upnpapi.c:4560
UpnpHttpGetProgress
int UpnpHttpGetProgress(void *handle, size_t *length, size_t *total)
Retrieve progress information of a http-get transfer.
Definition upnpapi.c:3467
UpnpSetMaxSubscriptions
int UpnpSetMaxSubscriptions(UpnpDevice_Handle Hnd, int MaxSubscriptions)
Sets the maximum number of subscriptions accepted per service.
Definition upnpapi.c:2102
UpnpGetServiceVarStatus
int UpnpGetServiceVarStatus(UpnpClient_Handle Hnd, const char *ActionURL, const char *VarName, DOMString *StVarVal)
Queries the state of a state variable of a service on another device.
Definition upnpapi.c:3282
UpnpVirtualDir_set_ReadCallback
int UpnpVirtualDir_set_ReadCallback(VDCallback_Read callback)
Sets the read callback function to be used to access a virtual directory.
Definition upnpapi.c:4536
UpnpGetServerIpAddress
char * UpnpGetServerIpAddress(void)
Returns the local IPv4 listening ip address.
Definition upnpapi.c:787
UpnpInit2
int UpnpInit2(const char *IfName, unsigned short DestPort)
Initializes the Linux SDK for UPnP Devices (IPv4 or IPv6).
Definition upnpapi.c:535
UpnpNotify
int UpnpNotify(UpnpDevice_Handle, const char *DevID, const char *ServID, const char **VarName, const char **NewVal, int cVariables)
Sends out an event change notification to all control points subscribed to a particular service.
Definition upnpapi.c:2599
UpnpClient_Handle
int UpnpClient_Handle
Returned when a control point application registers with UpnpRegisterClient.
Definition upnp.h:429
UpnpSetWebServerRootDir
int UpnpSetWebServerRootDir(const char *rootDir)
Sets the document root directory for the internal web server.
UpnpCloseHttpConnection
int UpnpCloseHttpConnection(void *handle)
Closes the connection created with UpnpOpenHttpConnection and frees any memory associated with the co...
Definition upnpapi.c:3524
UpnpGetServerUlaGuaPort6
unsigned short UpnpGetServerUlaGuaPort6(void)
Returns the internal server IPv6 ULA or GUA UPnP listening port.
Definition upnpapi.c:775
UpnpSetMaxSubscriptionTimeOut
int UpnpSetMaxSubscriptionTimeOut(UpnpDevice_Handle Hnd, int MaxSubscriptionTimeOut)
Sets the maximum time-out accepted for a subscription request or renewal.
Definition upnpapi.c:2142
UpnpGetServiceVarStatusAsync
int UpnpGetServiceVarStatusAsync(UpnpClient_Handle Hnd, const char *ActionURL, const char *VarName, Upnp_FunPtr Fun, const void *Cookie)
Queries the state of a variable of a service, generating a callback when the operation is complete.
Definition upnpapi.c:3210
UpnpRegisterRootDevice3
int UpnpRegisterRootDevice3(const char *DescUrl, Upnp_FunPtr Callback, const void *Cookie, UpnpDevice_Handle *Hnd, int AddressFamily)
Registers a device application for a specific address family with the UPnP library.
Definition upnpapi.c:1251
UpnpSetContentLength
int UpnpSetContentLength(UpnpClient_Handle Hnd, size_t contentLength)
Definition upnpapi.c:4584
UpnpSendActionExAsync
int UpnpSendActionExAsync(UpnpClient_Handle Hnd, const char *ActionURL, const char *ServiceType, const char *DevUDN, IXML_Document *Header, IXML_Document *Action, Upnp_FunPtr Fun, const void *Cookie)
Sends a message to change a state variable in a service, generating a callback when the operation is ...
Definition upnpapi.c:3081
UpnpSendAdvertisement
int UpnpSendAdvertisement(UpnpDevice_Handle Hnd, int Exp)
Sends out the discovery announcements for all devices and services for a device.
Definition upnpapi.c:1915
UpnpNotifyExt
int UpnpNotifyExt(UpnpDevice_Handle, const char *DevID, const char *ServID, IXML_Document *PropSet)
Similar to UpnpNotify except that it takes a DOM document for the event rather than an array of strin...
Definition upnpapi.c:2649
VDCallback_Seek
int(* VDCallback_Seek)(UpnpWebFileHandle fileHnd, off_t offset, int origin, const void *cookie, const void *request_cookie)
Seek callback function prototype.
Definition upnp.h:2707
Upnp_SType_e
Upnp_SType_e
Represents the different types of searches that can be performed using the SDK for UPnP Devices API.
Definition upnp.h:459
UpnpDevice_Handle
int UpnpDevice_Handle
Returned when a device application registers with UpnpRegisterRootDevice, UpnpRegisterRootDevice2,...
Definition upnp.h:439
UpnpRegisterRootDevice
int UpnpRegisterRootDevice(const char *DescUrl, Upnp_FunPtr Callback, const void *Cookie, UpnpDevice_Handle *Hnd)
Registers a device application with the UPnP Library.
Definition upnpapi.c:886
UpnpRegisterClient
int UpnpRegisterClient(Upnp_FunPtr Callback, const void *Cookie, UpnpClient_Handle *Hnd)
Registers a control point application with the UPnP Library.
Definition upnpapi.c:1544
UpnpUnRegisterRootDeviceLowPower
int UpnpUnRegisterRootDeviceLowPower(UpnpDevice_Handle Hnd, int PowerState, int SleepPeriod, int RegistrationState)
Unregisters a root device registered with UpnpRegisterRootDevice, UpnpRegisterRootDevice2,...
Definition upnpapi.c:1456
UpnpOpenHttpGetEx
int UpnpOpenHttpGetEx(const char *url, void **handle, char **contentType, int *contentLength, int *httpStatus, int lowRange, int highRange, int timeout)
Gets specified number of bytes from a file specified in the URL.
Definition upnpapi.c:3439
UpnpAcceptSubscription
int UpnpAcceptSubscription(UpnpDevice_Handle Hnd, const char *DevID, const char *ServID, const char **VarName, const char **NewVal, int cVariables, const Upnp_SID SubsId)
Accepts a subscription request and sends out the current state of the eventable variables for a servi...
Definition upnpapi.c:2692
UpnpGetServerPort6
unsigned short UpnpGetServerPort6(void)
Returns the internal server IPv6 link-local (LLA) UPnP listening port.
Definition upnpapi.c:763
UpnpUnRegisterRootDevice
int UpnpUnRegisterRootDevice(UpnpDevice_Handle Hnd)
Unregisters a root device registered with UpnpRegisterRootDevice, UpnpRegisterRootDevice2,...
Definition upnpapi.c:1446
UpnpRemoveVirtualDir
int UpnpRemoveVirtualDir(const char *dirName)
Removes a virtual directory mapping made with UpnpAddVirtualDir.
Definition upnpapi.c:4393
UpnpEndHttpRequest
int UpnpEndHttpRequest(void *handle, int timeout)
Indicates the end of a HTTP request previously made by UpnpMakeHttpRequest.
Definition upnpapi.c:3499
UpnpDownloadXmlDoc
int UpnpDownloadXmlDoc(const char *url, IXML_Document **xmlDoc)
Downloads an XML document specified in a URL.
Definition upnpapi.c:3545
UpnpCancelHttpGet
int UpnpCancelHttpGet(void *handle)
Set the cancel flag of the handle parameter.
Definition upnpapi.c:3458
UpnpWriteHttpRequest
int UpnpWriteHttpRequest(void *handle, char *buf, size_t *size, int timeout)
Writes the content of a HTTP request initiated by a UpnpMakeHttpRequest call. The end of the content ...
Definition upnpapi.c:3494
VDCallback_Write
int(* VDCallback_Write)(UpnpWebFileHandle fileHnd, char *buf, size_t buflen, const void *cookie, const void *request_cookie)
Write callback function prototype.
Definition upnp.h:2681
UpnpVirtualDir_set_OpenCallback
int UpnpVirtualDir_set_OpenCallback(VDCallback_Open callback)
Sets the open callback function to be used to access a virtual directory.
Definition upnpapi.c:4524
VDCallback_Read
int(* VDCallback_Read)(UpnpWebFileHandle fileHnd, char *buf, size_t buflen, const void *cookie, const void *request_cookie)
Read callback function prototype.
Definition upnp.h:2656
VDCallback_Open
UpnpWebFileHandle(* VDCallback_Open)(const char *filename, enum UpnpOpenFileMode Mode, const void *cookie, const void *request_cookie)
Open callback function prototype.
Definition upnp.h:2632
UpnpGetServerIp6Address
char * UpnpGetServerIp6Address(void)
Returns the IPv6 link-local listening ip address.
Definition upnpapi.c:795
UpnpUnRegisterClient
int UpnpUnRegisterClient(UpnpClient_Handle Hnd)
Unregisters a control point application, unsubscribing all active subscriptions.
Definition upnpapi.c:1600
UpnpOpenHttpConnection
int UpnpOpenHttpConnection(const char *url, void **handle, int timeout)
Opens a connection to the server.
Definition upnpapi.c:3472
UpnpGetHttpResponse
int UpnpGetHttpResponse(void *handle, UpnpString *headers, char **contentType, int *contentLength, int *httpStatus, int timeout)
Gets the response from the server using a connection previously created by UpnpOpenHttpConnection.
Definition upnpapi.c:3504
UpnpVirtualDir_set_CloseCallback
int UpnpVirtualDir_set_CloseCallback(VDCallback_Close callback)
Sets the close callback function to be used to access a virtual directory.
Definition upnpapi.c:4572
UPNPREG_FILENAME_DESC
@ UPNPREG_FILENAME_DESC
Definition upnp.h:490
UPNPREG_BUF_DESC
@ UPNPREG_BUF_DESC
Definition upnp.h:494
UPNPREG_URL_DESC
@ UPNPREG_URL_DESC
Definition upnp.h:486
UPNP_S_ROOT
@ UPNP_S_ROOT
Definition upnp.h:464
UPNP_S_ALL
@ UPNP_S_ALL
Definition upnp.h:461
UPNP_S_SERVICE
@ UPNP_S_SERVICE
Definition upnp.h:472
UPNP_S_DEVICE
@ UPNP_S_DEVICE
Definition upnp.h:468
UpnpString
struct s_UpnpString UpnpString
Type of the string objects inside libupnp.
Definition UpnpString.h:33
DOMString
#define DOMString
The type of DOM strings.
Definition ixml.h:48
ixml.h
_IXML_Document
Data structure representing the DOM Document.
Definition ixml.h:160
s_UpnpFileInfo
Definition UpnpFileInfo.c:19