libUPnP 1.14.19
Data Fields
VirtualDirCallbacks Struct Reference

#include <VirtualDir.h>

Collaboration diagram for VirtualDirCallbacks:
Collaboration graph
[legend]

Data Fields

VDCallback_GetInfo get_info
 
VDCallback_Open open
 
VDCallback_Read read
 
VDCallback_Write write
 
VDCallback_Seek seek
 
VDCallback_Close close
 

Detailed Description

The VirtualDirCallbacks structure contains the pointers to file-related callback functions a device application can register to virtualize URLs.

Field Documentation

◆ close

VDCallback_Close VirtualDirCallbacks::close

Called by the web server to close a file opened via the open callback. It should return 0 on success, or a non-zero value on an error.

Referenced by http_RecvPostMessage(), http_SendMessage(), UpnpVirtualDir_set_CloseCallback(), and web_server_init().

◆ get_info

VDCallback_GetInfo VirtualDirCallbacks::get_info

Called by the web server to query information on a file. The callback should return 0 on success or -1 on an error.

Referenced by process_request(), UpnpVirtualDir_set_GetInfoCallback(), and web_server_init().

◆ open

VDCallback_Open VirtualDirCallbacks::open

Called by the web server to open a file. The callback should return a valid handle if the file can be opened. Otherwise, it should return NULL to signify an error.

Referenced by http_RecvPostMessage(), http_SendMessage(), UpnpVirtualDir_set_OpenCallback(), and web_server_init().

◆ read

VDCallback_Read VirtualDirCallbacks::read

Called by the web server to perform a sequential read from an open file. The callback should copy buflen bytes from the file into the buffer.

Returns
An integer representing one of the following:
  • 0: The file contains no more data (EOF).
  • > 0: A successful read of the number of bytes in the return code.
  • < 0: An error occurred reading the file.

Referenced by http_SendMessage(), UpnpVirtualDir_set_ReadCallback(), and web_server_init().

◆ seek

VDCallback_Seek VirtualDirCallbacks::seek

Called by the web server to move the file pointer, or offset, into an open file. The origin parameter determines where to start moving the file pointer. A value of SEEK_CUR moves the file pointer relative to where it is. The offset parameter can be either positive (move forward) or negative (move backward). SEEK_END moves relative to the end of the file. A positive offset extends the file. A negative offset moves backward in the file. Finally, SEEK_SET moves to an absolute position in the file. In this case, offset must be positive. The callback should return 0 on a successful seek or a non-zero value on an error.

Referenced by http_SendMessage(), UpnpVirtualDir_set_SeekCallback(), and web_server_init().

◆ write

VDCallback_Write VirtualDirCallbacks::write

Called by the web server to perform a sequential write to an open file. The callback should write buflen bytes into the file from the buffer. It should return the actual number of bytes written, which might be less than buflen in the case of a write error.

Referenced by http_RecvPostMessage(), UpnpVirtualDir_set_WriteCallback(), and web_server_init().


The documentation for this struct was generated from the following file: