| typedef void * | UpnpWebFileHandle |
| The type of handle returned by the web server for open requests. | |
| typedef int(* | VDCallback_GetInfo) (const char *filename, UpnpFileInfo *info, const void *cookie, const void **request_cookie) |
| Get-info callback function prototype. | |
| typedef UpnpWebFileHandle(* | VDCallback_Open) (const char *filename, enum UpnpOpenFileMode Mode, const void *cookie, const void *request_cookie) |
| Open callback function prototype. | |
| typedef int(* | VDCallback_Read) (UpnpWebFileHandle fileHnd, char *buf, size_t buflen, const void *cookie, const void *request_cookie) |
| Read callback function prototype. | |
| typedef int(* | VDCallback_Write) (UpnpWebFileHandle fileHnd, char *buf, size_t buflen, const void *cookie, const void *request_cookie) |
| Write callback function prototype. | |
| typedef int(* | VDCallback_Seek) (UpnpWebFileHandle fileHnd, off_t offset, int origin, const void *cookie, const void *request_cookie) |
| Seek callback function prototype. | |
| typedef int(* | VDCallback_Close) (UpnpWebFileHandle fileHnd, const void *cookie, const void *request_cookie) |
| Close callback function prototype. | |
| typedef int(* | WebCallback_HostValidate) (const char *hostname, void *cookie) |
| Callback for validating HTTP requests HOST header values. | |
| PUPNP_Api int | UpnpSetWebServerRootDir (const char *rootDir) |
| Sets the document root directory for the internal web server. | |
| PUPNP_Api int | UpnpVirtualDir_set_GetInfoCallback (VDCallback_GetInfo callback) |
| Sets the get_info callback function to be used to access a web directory. | |
| PUPNP_Api int | UpnpVirtualDir_set_OpenCallback (VDCallback_Open callback) |
| Sets the open callback function to be used to access a web directory. | |
| PUPNP_Api int | UpnpVirtualDir_set_ReadCallback (VDCallback_Read callback) |
| Sets the read callback function to be used to access a web directory. | |
| PUPNP_Api int | UpnpVirtualDir_set_WriteCallback (VDCallback_Write callback) |
| Sets the write callback function to be used to access a web directory. | |
| PUPNP_Api int | UpnpVirtualDir_set_SeekCallback (VDCallback_Seek callback) |
| Sets the seek callback function to be used to access a web directory. | |
| PUPNP_Api int | UpnpVirtualDir_set_CloseCallback (VDCallback_Close callback) |
| Sets the close callback function to be used to access a web directory. | |
| PUPNP_Api int | UpnpEnableWebserver (int enable) |
| Enables or disables the webserver. | |
| PUPNP_Api int | UpnpIsWebserverEnabled (void) |
| Returns the status of the webserver. | |
| PUPNP_Api void | UpnpSetHostValidateCallback (WebCallback_HostValidate callback, void *cookie) |
| Set callback for validating HTTP requests HOST header values. | |
| PUPNP_Api void | UpnpSetAllowLiteralHostRedirection (int enable) |
| Enable or disable literal IP redirection. | |
| PUPNP_Api int | UpnpSetWebServerCorsString (const char *corsString) |
| Assign the Access-Control-Allow-Origin specfied by the input const char* cors_string parameter to the global CORS string. | |
| PUPNP_Api int | UpnpAddVirtualDir (const char *newDirName, const void *cookie, const void **oldcookie) |
| Adds a web directory mapping. | |
| PUPNP_Api int | UpnpRemoveVirtualDir (const char *dirName) |
| Removes a web directory mapping made with UpnpAddVirtualDir(). | |
| PUPNP_Api void | UpnpRemoveAllVirtualDirs (void) |
| Removes all web directory mappings. | |
| typedef void* UpnpWebFileHandle |
| typedef int(* VDCallback_GetInfo) ( const char *filename, UpnpFileInfo *info, const void *cookie, const void **request_cookie) |
Get-info callback function prototype.
| [in] | filename | The name of the file to query. |
| [out] | info | Pointer to a structure to store the information on the file. |
| [in] | cookie | The cookie associated with this web directory |
| [out] | request_cookie | The cookie associated with this request |
| typedef UpnpWebFileHandle(* VDCallback_Open) ( const char *filename, enum UpnpOpenFileMode Mode, const void *cookie, const void *request_cookie) |
Open callback function prototype.
| [in] | filename | The name of the file to open. |
| [in] | Mode | The mode in which to open the file. Valid values are UPNP_READ or UPNP_WRITE. |
| [in] | cookie | The cookie associated with this web directory |
| [in] | request_cookie | The cookie associated with this request |
| typedef int(* VDCallback_Read) ( UpnpWebFileHandle fileHnd, char *buf, size_t buflen, const void *cookie, const void *request_cookie) |
Read callback function prototype.
| [in] | fileHnd | The handle of the file to read. |
| [out] | buf | The buffer in which to place the data. |
| [in] | buflen | The size of the buffer (i.e. the number of bytes to read). |
| [in] | cookie | The cookie associated with this web directory |
| [in] | request_cookie | The cookie associated with this request |
| typedef int(* VDCallback_Write) ( UpnpWebFileHandle fileHnd, char *buf, size_t buflen, const void *cookie, const void *request_cookie) |
Write callback function prototype.
| [in] | fileHnd | The handle of the file to write. |
| [in] | buf | The buffer with the bytes to write. |
| [in] | buflen | The number of bytes to write. |
| [in] | cookie | The cookie associated with this web directory |
| [in] | request_cookie | The cookie associated with this request |
| typedef int(* VDCallback_Seek) ( UpnpWebFileHandle fileHnd, off_t offset, int origin, const void *cookie, const void *request_cookie) |
Seek callback function prototype.
| [in] | fileHnd | The handle of the file to move the file pointer. |
| [in] | offset | The number of bytes to move in the file. Positive values move foward and negative values move backward. Note that this must be positive if the origin is SEEK_SET. |
| [in] | origin | The position to move relative to. It can be SEEK_CUR to move relative to the current position, SEEK_END to move relative to the end of the file, or SEEK_SET to specify an absolute offset. |
| [in] | cookie | The cookie associated with this web directory |
| [in] | request_cookie | The cookie associated with this request |
| typedef int(* VDCallback_Close) ( UpnpWebFileHandle fileHnd, const void *cookie, const void *request_cookie) |
Close callback function prototype.
| [in] | fileHnd | The handle of the file to close. |
| [in] | cookie | The cookie associated with this web directory |
| [in] | request_cookie | The cookie associated with this request |
| typedef int(* WebCallback_HostValidate) (const char *hostname, void *cookie) |
Callback for validating HTTP requests HOST header values.
| hostname | the value in the request HOST header. |
| cookie | Pointer to user data to pass to the callback function when invoked. |
UPNP_E_SUCCESS: a request with the HOST header set to hostname should be processed. UPNP_E_BAD_HTTPMSG the request should be rejected. | PUPNP_Api int UpnpSetWebServerRootDir | ( | const char * | rootDir | ) |
Sets the document root directory for the internal web server.
This directory is considered the root directory (i.e. "/") of the web server.
The function is independent of whether the web server is enabled or disabled. To select the root directory '/' of the filesystem on the local storage to be also the websites virtual root directory then use UpnpSetWebServerRootDir("//").
UPNP_E_SUCCESS: The operation completed successfully. UPNP_E_FINISH: The library has not been initialized. UPNP_E_INVALID_PARAM: rootDir argument is not valid. UPNP_E_OUTOF_MEMORY: Resource for storing string not available. | [in] | rootDir | Path on the filesystem of the local storage to be the root directory of the web server. |
Definition at line 3395 of file upnpapi.cpp.
Here is the call graph for this function:| PUPNP_Api int UpnpVirtualDir_set_GetInfoCallback | ( | VDCallback_GetInfo | callback | ) |
Sets the get_info callback function to be used to access a web directory.
UPNP_E_SUCCESS: The operation completed successfully. UPNP_E_INVALID_PARAM: callback is not a valid pointer. UPNP_E_INVALID_ARGUMENT: callback is not a valid pointer. Definition at line 3597 of file upnpapi.cpp.
| PUPNP_Api int UpnpVirtualDir_set_OpenCallback | ( | VDCallback_Open | callback | ) |
Sets the open callback function to be used to access a web directory.
UPNP_E_SUCCESS: The operation completed successfully. UPNP_E_INVALID_PARAM: callback is not a valid pointer. UPNP_E_INVALID_ARGUMENT: callback is not a valid pointer. Definition at line 3606 of file upnpapi.cpp.
| PUPNP_Api int UpnpVirtualDir_set_ReadCallback | ( | VDCallback_Read | callback | ) |
Sets the read callback function to be used to access a web directory.
UPNP_E_SUCCESS: The operation completed successfully. UPNP_E_INVALID_PARAM: callback is not a valid pointer. UPNP_E_INVALID_ARGUMENT: callback is not a valid pointer. Definition at line 3615 of file upnpapi.cpp.
| PUPNP_Api int UpnpVirtualDir_set_WriteCallback | ( | VDCallback_Write | callback | ) |
Sets the write callback function to be used to access a web directory.
UPNP_E_SUCCESS: The operation completed successfully. UPNP_E_INVALID_PARAM: callback is not a valid pointer. UPNP_E_INVALID_ARGUMENT: callback is not a valid pointer. Definition at line 3624 of file upnpapi.cpp.
| PUPNP_Api int UpnpVirtualDir_set_SeekCallback | ( | VDCallback_Seek | callback | ) |
Sets the seek callback function to be used to access a web directory.
UPNP_E_SUCCESS: The operation completed successfully. UPNP_E_INVALID_PARAM: callback is not a valid pointer. UPNP_E_INVALID_ARGUMENT: callback is not a valid pointer. Definition at line 3633 of file upnpapi.cpp.
| PUPNP_Api int UpnpVirtualDir_set_CloseCallback | ( | VDCallback_Close | callback | ) |
Sets the close callback function to be used to access a web directory.
UPNP_E_SUCCESS: The operation completed successfully. UPNP_E_INVALID_PARAM: callback is not a valid pointer. UPNP_E_INVALID_ARGUMENT: callback is not a valid pointer. Definition at line 3642 of file upnpapi.cpp.
| PUPNP_Api int UpnpEnableWebserver | ( | int | enable | ) |
Enables or disables the webserver.
UPNP_E_SUCCESS: The operation completed successfully. UPNP_E_FINISH: The library has not been initialized. UPNP_E_OUTOF_MEMORY: The web server could not be started due to an out-of-memory condition. UPNP_E_NO_WEB_SERVER: The internal web server has been compiled out so it can't be enabled or disabled. | [in] | enable | 1 to enable, 0 to disable. |
Definition at line 3564 of file upnpapi.cpp.
Here is the call graph for this function:
Here is the caller graph for this function:| PUPNP_Api int UpnpIsWebserverEnabled | ( | void | ) |
Returns the status of the webserver.
Definition at line 3580 of file upnpapi.cpp.
| PUPNP_Api void UpnpSetHostValidateCallback | ( | WebCallback_HostValidate | callback, |
| void * | cookie | ||
| ) |
Set callback for validating HTTP requests HOST header values.
| callback | the host validating callback function or NULL. |
| cookie | the chocolate you like. |
Definition at line 3587 of file upnpapi.cpp.
| PUPNP_Api void UpnpSetAllowLiteralHostRedirection | ( | int | enable | ) |
Enable or disable literal IP redirection.
| enable | Zero to disable (default) non-zero to enable. |
Definition at line 3593 of file upnpapi.cpp.
| PUPNP_Api int UpnpSetWebServerCorsString | ( | const char * | corsString | ) |
Assign the Access-Control-Allow-Origin specfied by the input const char* cors_string parameter to the global CORS string.
UPNP_E_SUCCESS: The operation completed successfully. UPNP_E_INVALID_ARGUMENT: rootDir is an invalid directory. | [in] | corsString | String having the Access-Control-Allow-Origin string. |
Definition at line 3410 of file upnpapi.cpp.
Here is the call graph for this function:| PUPNP_Api int UpnpAddVirtualDir | ( | const char * | newDirName, |
| const void * | cookie, | ||
| const void ** | oldcookie | ||
| ) |
Adds a web directory mapping.
All webserver requests containing the given directory are read using functions contained in a VirtualDirCallbacks structure registered via UpnpSetVirtualDirCallbacks().
UPNP_E_SUCCESS: The operation completed successfully. UPNP_E_FINISH: The library has not been initialized. UPNP_E_INVALID_ARGUMENT: dirName is not valid. | [in] | newDirName | The name of the new directory mapping to add. |
| [in] | cookie | The cookie to associated with this web directory |
| [out] | oldcookie | The cookie previously associated, if mapping is already present |
Definition at line 3423 of file upnpapi.cpp.
| PUPNP_Api int UpnpRemoveVirtualDir | ( | const char * | dirName | ) |
Removes a web directory mapping made with UpnpAddVirtualDir().
UPNP_E_SUCCESS: The operation completed successfully. UPNP_E_FINISH: The library has not been initialized. UPNP_E_INVALID_ARGUMENT: dirName is not valid. | [in] | dirName | The name of the web directory mapping to remove. |
Definition at line 3498 of file upnpapi.cpp.
| PUPNP_Api void UpnpRemoveAllVirtualDirs | ( | void | ) |
Removes all web directory mappings.
Definition at line 3544 of file upnpapi.cpp.
Here is the caller graph for this function: