#include <upnpwebserver.h>
Public Member Functions | |
bool | init () |
bool | uninit () |
Static Public Member Functions | |
static cUPnPWebServer * | getInstance (const char *rootdir="/") |
static int | getInfo (const char *filename, struct File_Info *info) |
static UpnpWebFileHandle | open (const char *filename, UpnpOpenFileMode mode) |
static int | read (UpnpWebFileHandle fh, char *buf, size_t buflen) |
static int | write (UpnpWebFileHandle fh, char *buf, size_t buflen) |
static int | seek (UpnpWebFileHandle fh, off_t offset, int origin) |
static int | close (UpnpWebFileHandle fh) |
Friends | |
class | cUPnPServer |
This is the internal webserver. It distributes all the contents of the UPnP-Server.
int cUPnPWebServer::close | ( | UpnpWebFileHandle | fh | ) | [static] |
Closes the file
closes the opened file
Returns 0 on success, non-zero value otherwise
fh | the file handle of the opened file |
int cUPnPWebServer::getInfo | ( | const char * | filename, | |
struct File_Info * | info | |||
) | [static] |
Retrieve file information
Returns file related information for an virtual directory file
filename | The filename of which the information is gathered | |
info | The File_Info structure with the data |
cUPnPWebServer * cUPnPWebServer::getInstance | ( | const char * | rootdir = "/" |
) | [static] |
Returns the instance of the webserver
Returns the instance of the webserver. This will create a single instance of none is existing on the very first call. A subsequent call will return the same instance.
rootdir | the root directory of the webserver |
bool cUPnPWebServer::init | ( | void | ) |
Initializes the webserver
It enables the webserver which comes with the Intel SDK and creates virtual directories for shares media.
true
, if initializing was successfulfalse
, otherwise UpnpWebFileHandle cUPnPWebServer::open | ( | const char * | filename, | |
UpnpOpenFileMode | mode | |||
) | [static] |
Opens a virtual directory file
Opens a file in a virtual directory with the specified mode.
Possible modes are:
It returns a file handle to the opened file, NULL otherwise
filename | The file to open | |
mode | UPNP_WRITE for writing, UPNP_READ for reading. |
int cUPnPWebServer::read | ( | UpnpWebFileHandle | fh, | |
char * | buf, | |||
size_t | buflen | |||
) | [static] |
Reads from the opened file
Reads buflen
bytes from the file and stores the content to the buffer
Returns 0 no more bytes read (EOF) >0 bytes read from file
fh | the file handle of the opened file | |
buf | the buffer to write the bytes to | |
buflen | the maximum count of bytes to read |
int cUPnPWebServer::seek | ( | UpnpWebFileHandle | fh, | |
off_t | offset, | |||
int | origin | |||
) | [static] |
Seek in the file
Seeks in the opened file and sets the file pointer to the specified offset
Returns 0 on success, non-zero value otherwise
fh | the file handle of the opened file | |
offset | a negative oder positive value which moves the pointer forward or backward | |
origin | SEEK_CUR, SEEK_END or SEEK_SET |
bool cUPnPWebServer::uninit | ( | void | ) |
Uninitializes the webserver
This stops the webserver.
true
, if initializing was successfulfalse
, otherwise int cUPnPWebServer::write | ( | UpnpWebFileHandle | fh, | |
char * | buf, | |||
size_t | buflen | |||
) | [static] |
Writes to the opened file
Writes buflen
bytes from the buffer and stores the content in the file
Returns >0 bytes wrote to file, maybe less the buflen in case of write errors
fh | the file handle of the opened file | |
buf | the buffer to read the bytes from | |
buflen | the maximum count of bytes to write |