VirtualDir.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. #ifndef VIRTUALDIR_H
  2. #define VIRTUALDIR_H
  3. /** The \b VirtualDirCallbacks structure contains the pointers to
  4. * file-related callback functions a device application can register to
  5. * virtualize URLs.
  6. */
  7. struct VirtualDirCallbacks
  8. {
  9. /** Called by the web server to query information on a file. The callback
  10. * should return 0 on success or -1 on an error. */
  11. VDCallback_GetInfo get_info;
  12. /** Called by the web server to open a file. The callback should return
  13. * a valid handle if the file can be opened. Otherwise, it should return
  14. * \c NULL to signify an error. */
  15. VDCallback_Open open;
  16. /** Called by the web server to perform a sequential read from an open
  17. * file. The callback should copy \b buflen bytes from the file into
  18. * the buffer.
  19. * @return An integer representing one of the following:
  20. * \li <tt> 0</tt>: The file contains no more data (EOF).
  21. * \li <tt> > 0</tt>: A successful read of the number of bytes in the
  22. * return code.
  23. * \li <tt> < 0</tt>: An error occurred reading the file.
  24. */
  25. VDCallback_Read read;
  26. /** Called by the web server to perform a sequential write to an open
  27. * file. The callback should write \b buflen bytes into the file from
  28. * the buffer. It should return the actual number of bytes written,
  29. * which might be less than \b buflen in the case of a write error.
  30. */
  31. VDCallback_Write write;
  32. /** Called by the web server to move the file pointer, or offset, into
  33. * an open file. The \b origin parameter determines where to start
  34. * moving the file pointer. A value of \c SEEK_CUR moves the
  35. * file pointer relative to where it is. The \b offset parameter can
  36. * be either positive (move forward) or negative (move backward).
  37. * \c SEEK_END moves relative to the end of the file. A positive
  38. * \b offset extends the file. A negative \b offset moves backward
  39. * in the file. Finally, \c SEEK_SET moves to an absolute position in
  40. * the file. In this case, \b offset must be positive. The callback
  41. * should return 0 on a successful seek or a non-zero value on an error.
  42. */
  43. VDCallback_Seek seek;
  44. /** Called by the web server to close a file opened via the \b open
  45. * callback. It should return 0 on success, or a non-zero value on an
  46. * error.
  47. */
  48. VDCallback_Close close;
  49. };
  50. typedef struct virtual_Dir_List
  51. {
  52. struct virtual_Dir_List *next;
  53. char dirName[NAME_SIZE];
  54. } virtualDirList;
  55. #endif /* VIRTUALDIR_H */