libupnp/docs/dist/html/upnp/UpnpVirtualDirCallbacks.html
2006-07-06 12:37:29 +00:00

134 lines
6.7 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>struct UpnpVirtualDirCallbacks</TITLE>
<META NAME="GENERATOR" CONTENT="DOC++ 3.4.10">
</HEAD>
<BODY BGCOLOR="#ffffff">
<H2>struct <A HREF="#DOC.DOCU">UpnpVirtualDirCallbacks</A></H2></H2><BLOCKQUOTE>The <B>UpnpVirtualDirCallbacks</B> structure contains the pointers to file-related callback functions a device application can register to virtualize URLs.</BLOCKQUOTE>
<HR>
<P><DL>
<DT>
<IMG ALT="[more]" BORDER=0 SRC=icon1.gif>int <B><A HREF="#DOC.1.4.2.14.6">(*close)</A></B>( IN UpnpWebFileHandle fileHnd )
<DD><I>Called by the web server to close a file opened via the <B>open</B> callback.</I>
<DT>
<IMG ALT="[more]" BORDER=0 SRC=icon1.gif>int <B><A HREF="#DOC.1.4.2.14.1">(*get_info)</A></B>( IN const char* filename, OUT struct File_Info* info )
<DD><I>Called by the web server to query information on a file.</I>
<DT>
<IMG ALT="[more]" BORDER=0 SRC=icon1.gif>UpnpWebFileHandle <B><A HREF="#DOC.1.4.2.14.2">(*open)</A></B>( IN const char* filename, IN enum UpnpOpenFileMode Mode )
<DD><I>Called by the web server to open a file.</I>
<DT>
<IMG ALT="[more]" BORDER=0 SRC=icon1.gif>int <B><A HREF="#DOC.1.4.2.14.3">(*read)</A></B>( IN UpnpWebFileHandle fileHnd, OUT char* buf, IN size_t buflen )
<DD><I>Called by the web server to perform a sequential read from an open file.</I>
<DT>
<IMG ALT="[more]" BORDER=0 SRC=icon1.gif>int <B><A HREF="#DOC.1.4.2.14.5">(*seek)</A></B>( IN UpnpWebFileHandle fileHnd, IN long offset, IN int origin )
<DD><I>Called by the web server to move the file pointer, or offset, into an open file.</I>
<DT>
<IMG ALT="[more]" BORDER=0 SRC=icon1.gif>int <B><A HREF="#DOC.1.4.2.14.4">(*write)</A></B>( IN UpnpWebFileHandle fileHnd, IN char* buf, IN size_t buflen )
<DD><I>Called by the web server to perform a sequential write to an open file.</I>
</DL></P>
<A NAME="DOC.DOCU"></A>
<HR>
<H2>Documentation</H2>
<BLOCKQUOTE>The <B>UpnpVirtualDirCallbacks</B> structure contains the pointers to
file-related callback functions a device application can register to
virtualize URLs. </BLOCKQUOTE>
<DL>
<A NAME="(*get_info)"></A>
<A NAME="DOC.1.4.2.14.1"></A>
<DT><IMG ALT="o" BORDER=0 SRC=icon2.gif><TT><B>int (*get_info)( IN const char* filename, OUT struct File_Info* info )</B></TT>
<DD>Called by the web server to query information on a file. The callback
should return 0 on success or -1 on an error.
<DL><DT><DT><B>Parameters:</B><DD><B>filename</B> - The name of the file to query.
<BR><B>info</B> - Pointer to a structure to store the
information on the file. <BR><DD></DL><P>
<A NAME="(*open)"></A>
<A NAME="DOC.1.4.2.14.2"></A>
<DT><IMG ALT="o" BORDER=0 SRC=icon2.gif><TT><B>UpnpWebFileHandle (*open)( IN const char* filename, IN enum UpnpOpenFileMode Mode )</B></TT>
<DD>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
<TT>NULL</TT> to signify an error.
<DL><DT><DT><B>Parameters:</B><DD><B>filename</B> - The name of the file to open.
<BR><B>Mode</B> - The mode in which to open the file.
Valid values are <TT>UPNP_READ</TT> or
<TT>UPNP_WRITE</TT>. <BR><DD></DL><P>
<A NAME="(*read)"></A>
<A NAME="DOC.1.4.2.14.3"></A>
<DT><IMG ALT="o" BORDER=0 SRC=icon2.gif><TT><B>int (*read)( IN UpnpWebFileHandle fileHnd, OUT char* buf, IN size_t buflen )</B></TT>
<DD>Called by the web server to perform a sequential read from an open
file. The callback should copy <B>buflen</B> bytes from the file into
the buffer.
<DL><DT><DT><B>Parameters:</B><DD><B>fileHnd</B> - The handle of the file to read.
<BR><B>buf</B> - The buffer in which to place the
data.
<BR><B>buflen</B> - The size of the buffer (i.e. the
number of bytes to read). <BR><DT><B>Returns:</B><DD> [int] An integer representing one of the following:
<UL>
<LI> <TT>0</TT>: The file contains no more data (EOF).
<LI> <TT>&gt;0</TT>: A successful read of the number of bytes in the
return code.
<LI> <TT>&lt;0</TT>: An error occurred reading the file.
\end{itemzie}
<BR><DD></DL><P>
<A NAME="(*write)"></A>
<A NAME="DOC.1.4.2.14.4"></A>
<DT><IMG ALT="o" BORDER=0 SRC=icon2.gif><TT><B>int (*write)( IN UpnpWebFileHandle fileHnd, IN char* buf, IN size_t buflen )</B></TT>
<DD>Called by the web server to perform a sequential write to an open
file. The callback should write <B>buflen</B> bytes into the file from
the buffer. It should return the actual number of bytes written,
which might be less than <B>buflen</B> in the case of a write error.
<DL><DT><DT><B>Parameters:</B><DD><B>fileHnd</B> - The handle of the file to write.
<BR><B>buf</B> - The buffer with the bytes to write.
<BR><B>buflen</B> - The number of bytes to write. <BR><DD></DL><P>
<A NAME="(*seek)"></A>
<A NAME="DOC.1.4.2.14.5"></A>
<DT><IMG ALT="o" BORDER=0 SRC=icon2.gif><TT><B>int (*seek)( IN UpnpWebFileHandle fileHnd, IN long offset, IN int origin )</B></TT>
<DD>Called by the web server to move the file pointer, or offset, into
an open file. The <B>origin</B> parameter determines where to start
moving the file pointer. A value of <TT>SEEK_CUR</TT> moves the
file pointer relative to where it is. The <B>offset</B> parameter can
be either positive (move forward) or negative (move backward).
<TT>SEEK_END</TT> moves relative to the end of the file. A positive
<B>offset</B> extends the file. A negative <B>offset</B> moves backward
in the file. Finally, <TT>SEEK_SET</TT> moves to an absolute position in
the file. In this case, <B>offset</B> must be positive. The callback
should return 0 on a successful seek or a non-zero value on an error.
<DL><DT><DT><B>Parameters:</B><DD><B>fileHnd</B> - The handle of the file to move the
file pointer.
<BR><B>offset</B> - 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
<B>origin</B> is <TT>SEEK_SET</TT>.
<BR><B>origin</B> - The position to move relative to. It
can be <TT>SEEK_CUR</TT> to move relative
to the current position,
<TT>SEEK_END</TT> to move relative to
the end of the file, or <TT>
SEEK_SET</TT> to specify an absolute
offset. <BR><DD></DL><P>
<A NAME="(*close)"></A>
<A NAME="DOC.1.4.2.14.6"></A>
<DT><IMG ALT="o" BORDER=0 SRC=icon2.gif><TT><B>int (*close)( IN UpnpWebFileHandle fileHnd )</B></TT>
<DD>Called by the web server to close a file opened via the <B>open</B>
callback. It should return 0 on success, or a non-zero value on an
error.
<DL><DT><DT><B>Parameters:</B><DD><B>fileHnd</B> - The handle of the file to close. <BR><DD></DL><P></DL>
<DL><DT><DD></DL><P><P><I><A HREF="index.html">Alphabetic index</A></I></P><HR>
<BR>
This page was generated with the help of <A HREF="http://docpp.sourceforge.net">DOC++</A>.
</BODY>
</HTML>