struct UpnpVirtualDirCallbacks

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

[more]int (*close)( IN UpnpWebFileHandle fileHnd )
Called by the web server to close a file opened via the open callback.
[more]int (*get_info)( IN const char* filename, OUT struct File_Info* info )
Called by the web server to query information on a file.
[more]UpnpWebFileHandle (*open)( IN const char* filename, IN enum UpnpOpenFileMode Mode )
Called by the web server to open a file.
[more]int (*read)( IN UpnpWebFileHandle fileHnd, OUT char* buf, IN size_t buflen )
Called by the web server to perform a sequential read from an open file.
[more]int (*seek)( IN UpnpWebFileHandle fileHnd, IN long offset, IN int origin )
Called by the web server to move the file pointer, or offset, into an open file.
[more]int (*write)( IN UpnpWebFileHandle fileHnd, IN char* buf, IN size_t buflen )
Called by the web server to perform a sequential write to an open file.


Documentation

The UpnpVirtualDirCallbacks structure contains the pointers to file-related callback functions a device application can register to virtualize URLs.
oint (*get_info)( IN const char* filename, OUT struct File_Info* info )
Called by the web server to query information on a file. The callback should return 0 on success or -1 on an error.
Parameters:
filename - The name of the file to query.
info - Pointer to a structure to store the information on the file.

oUpnpWebFileHandle (*open)( IN const char* filename, IN enum UpnpOpenFileMode Mode )
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.
Parameters:
filename - The name of the file to open.
Mode - The mode in which to open the file. Valid values are UPNP_READ or UPNP_WRITE.

oint (*read)( IN UpnpWebFileHandle fileHnd, OUT char* buf, IN size_t buflen )
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.
Parameters:
fileHnd - The handle of the file to read.
buf - The buffer in which to place the data.
buflen - The size of the buffer (i.e. the number of bytes to read).
Returns:
[int] 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. \end{itemzie}

oint (*write)( IN UpnpWebFileHandle fileHnd, IN char* buf, IN size_t buflen )
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.
Parameters:
fileHnd - The handle of the file to write.
buf - The buffer with the bytes to write.
buflen - The number of bytes to write.

oint (*seek)( IN UpnpWebFileHandle fileHnd, IN long offset, IN int origin )
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.
Parameters:
fileHnd - The handle of the file to move the file pointer.
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.
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.

oint (*close)( IN UpnpWebFileHandle fileHnd )
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.
Parameters:
fileHnd - The handle of the file to close.

Alphabetic index



This page was generated with the help of DOC++.