ifapi_io.3 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283
  1. .TH "ifapi_io" 3 "Fri Oct 7 2022" "Version 3.2.0" "tpm2-tss" \" -*- nroff -*-
  2. .ad l
  3. .nh
  4. .SH NAME
  5. ifapi_io
  6. .SH SYNOPSIS
  7. .br
  8. .PP
  9. .SS "Functions"
  10. .in +1c
  11. .ti -1c
  12. .RI "TSS2_RC \fBifapi_io_check_file_writeable\fP (const char *file)"
  13. .br
  14. .ti -1c
  15. .RI "TSS2_RC \fBifapi_io_dirfiles\fP (const char *dirname, char ***files, size_t *numfiles)"
  16. .br
  17. .ti -1c
  18. .RI "TSS2_RC \fBifapi_io_dirfiles_all\fP (const char *searchPath, char ***pathlist, size_t *numPaths)"
  19. .br
  20. .ti -1c
  21. .RI "bool \fBifapi_io_path_exists\fP (const char *path)"
  22. .br
  23. .ti -1c
  24. .RI "TSS2_RC \fBifapi_io_poll\fP (\fBIFAPI_IO\fP *io)"
  25. .br
  26. .ti -1c
  27. .RI "TSS2_RC \fBifapi_io_poll_handles\fP (\fBIFAPI_IO\fP *io, FAPI_POLL_HANDLE **handles, size_t *num_handles)"
  28. .br
  29. .ti -1c
  30. .RI "TSS2_RC \fBifapi_io_read_async\fP (struct \fBIFAPI_IO\fP *io, const char *filename)"
  31. .br
  32. .ti -1c
  33. .RI "TSS2_RC \fBifapi_io_read_finish\fP (struct \fBIFAPI_IO\fP *io, uint8_t **buffer, size_t *length)"
  34. .br
  35. .ti -1c
  36. .RI "TSS2_RC \fBifapi_io_remove_file\fP (const char *file)"
  37. .br
  38. .ti -1c
  39. .RI "TSS2_RC \fBifapi_io_write_async\fP (struct \fBIFAPI_IO\fP *io, const char *filename, const uint8_t *buffer, size_t length)"
  40. .br
  41. .ti -1c
  42. .RI "TSS2_RC \fBifapi_io_write_finish\fP (struct \fBIFAPI_IO\fP *io)"
  43. .br
  44. .in -1c
  45. .SH "Detailed Description"
  46. .PP
  47. Provides internal basic IO functions for policy and key store module\&.
  48. .SH "Function Documentation"
  49. .PP
  50. .SS "TSS2_RC ifapi_io_check_file_writeable (const char * file)"
  51. Check whether a file is writeable\&.
  52. .PP
  53. \fBParameters:\fP
  54. .RS 4
  55. \fIfile\fP The name of the fileto be checked\&.
  56. .RE
  57. .PP
  58. \fBReturn values:\fP
  59. .RS 4
  60. \fITSS2_RC_SUCCESS\fP if the directories existed or were successfully created
  61. .br
  62. \fITSS2_FAPI_RC_IO_ERROR\fP if an I/O error occurred
  63. .RE
  64. .PP
  65. .SS "TSS2_RC ifapi_io_dirfiles (const char * dirname, char *** files, size_t * numfiles)"
  66. Enumerate the list of files in a directory\&.
  67. .PP
  68. Enumerage the regular files (no directories, symlinks etc) from a given directory\&.
  69. .PP
  70. \fBParameters:\fP
  71. .RS 4
  72. \fIdirname\fP The directory to list files from\&.
  73. .br
  74. \fIfiles\fP The list of file names\&.
  75. .br
  76. \fInumfiles\fP The size of files\&.
  77. .RE
  78. .PP
  79. \fBReturn values:\fP
  80. .RS 4
  81. \fITSS2_RC_SUCCESS\fP if the directories were successfully removed
  82. .br
  83. \fITSS2_FAPI_RC_IO_ERROR\fP if an I/O error occurred
  84. .br
  85. \fITSS2_FAPI_RC_MEMORY\fP if memory could not be allocated to hold the read data\&.
  86. .br
  87. \fITSS2_FAPI_RC_BAD_REFERENCE\fP a invalid null pointer is passed\&.
  88. .RE
  89. .PP
  90. .SS "TSS2_RC ifapi_io_dirfiles_all (const char * searchPath, char *** pathlist, size_t * numPaths)"
  91. Recursive enumerate the list of files in a directory\&.
  92. .PP
  93. Enumerage the regular files (no directories, symlinks etc) from a given directory\&.
  94. .PP
  95. \fBParameters:\fP
  96. .RS 4
  97. \fIsearchPath\fP The directory to list files from\&.
  98. .br
  99. \fIpathlist\fP The list of file names\&.
  100. .br
  101. \fInumPaths\fP The size of files\&.
  102. .RE
  103. .PP
  104. \fBReturn values:\fP
  105. .RS 4
  106. \fITSS2_RC_SUCCESS\fP if the directories were successfully removed
  107. .br
  108. \fITSS2_FAPI_RC_IO_ERROR\fP if an I/O error occurred
  109. .br
  110. \fITSS2_FAPI_RC_MEMORY\fP if memory could not be allocated to hold the read data\&.
  111. .RE
  112. .PP
  113. .SS "bool ifapi_io_path_exists (const char * path)"
  114. Determine whether a path exists\&.
  115. .PP
  116. \fBParameters:\fP
  117. .RS 4
  118. \fIpath\fP The absolute path of the file\&.
  119. .RE
  120. .PP
  121. \fBReturn values:\fP
  122. .RS 4
  123. \fItrue\fP The file exists\&.
  124. .br
  125. \fIfalse\fP The file does not exist\&.
  126. .RE
  127. .PP
  128. .SS "TSS2_RC ifapi_io_poll (\fBIFAPI_IO\fP * io)"
  129. Wait for file I/O to be ready\&.
  130. .PP
  131. If FAPI state automata are in a file I/O state it will be waited for an event on a file descriptor\&.
  132. .PP
  133. \fBParameters:\fP
  134. .RS 4
  135. \fIio\fP The input/output context being used for file I/O\&.
  136. .RE
  137. .PP
  138. \fBReturn values:\fP
  139. .RS 4
  140. \fITSS2_RC_SUCCESS\fP After the end of the wait\&.
  141. .br
  142. \fITSS2_FAPI_RC_IO_ERROR\fP if the poll function returns an error\&.
  143. .br
  144. \fITSS2_FAPI_RC_BAD_REFERENCE\fP a invalid null pointer is passed\&.
  145. .RE
  146. .PP
  147. .SS "TSS2_RC ifapi_io_poll_handles (\fBIFAPI_IO\fP * io, FAPI_POLL_HANDLE ** handles, size_t * num_handles)"
  148. Get a list of poll handles\&.
  149. .PP
  150. \fBParameters:\fP
  151. .RS 4
  152. \fIio\fP The input/output context being used for file I/O\&.
  153. .br
  154. \fIhandles\fP The array with the poll handles\&.
  155. .br
  156. \fInum_handles\fP The number of poll handles\&.
  157. .RE
  158. .PP
  159. \fBReturn values:\fP
  160. .RS 4
  161. \fITSS2_RC_SUCCESS\fP on success\&.
  162. .br
  163. \fITSS2_FAPI_RC_NO_HANDLE\fP In no poll events are stored in IO context\&.
  164. .br
  165. \fITSS2_FAPI_RC_MEMORY\fP If the output data cannot be allocated\&.
  166. .br
  167. \fITSS2_FAPI_RC_BAD_REFERENCE\fP a invalid null pointer is passed\&.
  168. .RE
  169. .PP
  170. .SS "TSS2_RC ifapi_io_read_async (struct \fBIFAPI_IO\fP * io, const char * filename)"
  171. Start reading a file's complete content into memory in an asynchronous way\&.
  172. .PP
  173. \fBParameters:\fP
  174. .RS 4
  175. \fIio\fP The input/output context being used for file I/O\&.
  176. .br
  177. \fIfilename\fP The name of the file to be read into memory\&.
  178. .RE
  179. .PP
  180. \fBReturn values:\fP
  181. .RS 4
  182. \fITSS2_RC_SUCCESS\fP if the function call was a success\&.
  183. .br
  184. \fITSS2_FAPI_RC_IO_ERROR\fP if an I/O error was encountered; such as the file was not found\&.
  185. .br
  186. \fITSS2_FAPI_RC_MEMORY\fP if memory could not be allocated to hold the read data\&.
  187. .RE
  188. .PP
  189. .SS "TSS2_RC ifapi_io_read_finish (struct \fBIFAPI_IO\fP * io, uint8_t ** buffer, size_t * length)"
  190. Finish reading a file's complete content into memory in an asynchronous way\&.
  191. .PP
  192. This function needs to be called repeatedly until it does not return TSS2_FAPI_RC_TRY_AGAIN\&.
  193. .PP
  194. \fBParameters:\fP
  195. .RS 4
  196. \fIio\fP The input/output context being used for file I/O\&.
  197. .br
  198. \fIbuffer\fP The data that was read from file\&. (callee-allocated; use free())
  199. .br
  200. \fIlength\fP The length of the data that was read from file\&.
  201. .RE
  202. .PP
  203. \fBReturn values:\fP
  204. .RS 4
  205. \fITSS2_RC_SUCCESS\fP if the function call was a success\&.
  206. .br
  207. \fITSS2_FAPI_RC_IO_ERROR\fP if an I/O error was encountered; such as the file was not found\&.
  208. .br
  209. \fITSS2_FAPI_RC_TRY_AGAIN\fP if the asynchronous operation is not yet complete\&. Call this function again later\&.
  210. .RE
  211. .PP
  212. .SS "TSS2_RC ifapi_io_remove_file (const char * file)"
  213. Remove a file\&.
  214. .PP
  215. \fBParameters:\fP
  216. .RS 4
  217. \fIfile\fP The absolute path of the file to be removed\&.
  218. .RE
  219. .PP
  220. \fBReturn values:\fP
  221. .RS 4
  222. \fITSS2_RC_SUCCESS\fP If the file was successfully removed
  223. .br
  224. \fITSS2_FAPI_RC_IO_ERROR\fP If the file could not be removed\&.
  225. .RE
  226. .PP
  227. .SS "TSS2_RC ifapi_io_write_async (struct \fBIFAPI_IO\fP * io, const char * filename, const uint8_t * buffer, size_t length)"
  228. Start writing a buffer into a file in an asynchronous way\&.
  229. .PP
  230. \fBParameters:\fP
  231. .RS 4
  232. \fIio\fP The input/output context being used for file I/O\&.
  233. .br
  234. \fIfilename\fP The name of the file to be read into memory\&.
  235. .br
  236. \fIbuffer\fP The buffer to be written\&.
  237. .br
  238. \fIlength\fP The number of bytes to be written\&.
  239. .RE
  240. .PP
  241. \fBReturn values:\fP
  242. .RS 4
  243. \fITSS2_RC_SUCCESS\fP if the function call was a success\&.
  244. .br
  245. \fITSS2_FAPI_RC_IO_ERROR\fP if an I/O error was encountered; such as the file was not found\&.
  246. .br
  247. \fITSS2_FAPI_RC_MEMORY\fP if memory could not be allocated to hold the read data\&.
  248. .RE
  249. .PP
  250. .SS "TSS2_RC ifapi_io_write_finish (struct \fBIFAPI_IO\fP * io)"
  251. Finish writing a buffer into a file in an asynchronous way\&.
  252. .PP
  253. This function needs to be called repeatedly until it does not return TSS2_FAPI_RC_TRY_AGAIN\&.
  254. .PP
  255. \fBParameters:\fP
  256. .RS 4
  257. \fIio\fP The input/output context being used for file I/O\&.
  258. .RE
  259. .PP
  260. \fBReturn values:\fP
  261. .RS 4
  262. \fITSS2_RC_SUCCESS\fP if the function call was a success\&.
  263. .br
  264. \fITSS2_FAPI_RC_IO_ERROR\fP if an I/O error was encountered; such as the file was not found\&.
  265. .br
  266. \fITSS2_FAPI_RC_TRY_AGAIN\fP if the asynchronous operation is not yet complete\&. Call this function again later\&.
  267. .RE
  268. .PP
  269. .SH "Author"
  270. .PP
  271. Generated automatically by Doxygen for tpm2-tss from the source code\&.