summaryrefslogtreecommitdiff
path: root/logging.h
diff options
context:
space:
mode:
authorbeatrice <beatrice@dangofactory.net>2026-11-22 19:25:05 +0900
committerbeatrice <beatrice@dangofactory.net>2026-11-22 19:25:05 +0900
commitc7a201b58080c7a0f57b38c59e7865aa42c1d029 (patch)
treecde6146e3aada31e68594fd4f034abe90621ce34 /logging.h
downloadvsftpd-master.tar.gz
vsftpd-master.zip
Import vsftpd-3.0.5.tar.gzHEADlocal/vsftpdmaster
Diffstat (limited to 'logging.h')
-rw-r--r--logging.h84
1 files changed, 84 insertions, 0 deletions
diff --git a/logging.h b/logging.h
new file mode 100644
index 0000000..48f88ec
--- /dev/null
+++ b/logging.h
@@ -0,0 +1,84 @@
+#ifndef VSF_LOGGING_H
+#define VSF_LOGGING_H
+
+/* Forward delcarations */
+struct mystr;
+struct vsf_session;
+
+enum EVSFLogEntryType
+{
+ kVSFLogEntryNull = 1,
+ kVSFLogEntryDownload,
+ kVSFLogEntryUpload,
+ kVSFLogEntryMkdir,
+ kVSFLogEntryLogin,
+ kVSFLogEntryFTPInput,
+ kVSFLogEntryFTPOutput,
+ kVSFLogEntryConnection,
+ kVSFLogEntryDelete,
+ kVSFLogEntryRename,
+ kVSFLogEntryRmdir,
+ kVSFLogEntryChmod,
+ kVSFLogEntryDebug,
+};
+
+/* vsf_log_init()
+ * PURPOSE
+ * Initialize the logging services, by opening a writable file descriptor to
+ * the log file (should logging be enabled).
+ * PARAMETERS
+ * p_sess - the current session object
+ */
+void vsf_log_init(struct vsf_session* p_sess);
+
+/* vsf_log_start_entry()
+ * PURPOSE
+ * Denote the start of a logged operation. Importantly, timing information
+ * (if applicable) will be taken starting from this call.
+ * PARAMETERS
+ * p_sess - the current session object
+ * what - the type of operation which just started
+ */
+void vsf_log_start_entry(struct vsf_session* p_sess,
+ enum EVSFLogEntryType what);
+
+/* vsf_log_entry_pending()
+ * PURPOSE
+ * Determine whether a log entry has been started and not yet closed.
+ * RETURNS
+ * 0 if no log entry is pending; 1 if one is.
+ */
+int vsf_log_entry_pending(struct vsf_session* p_sess);
+
+/* vsf_log_clear_entry()
+ * PURPOSE
+ * Clears any pending log entry.
+ */
+void vsf_log_clear_entry(struct vsf_session* p_sess);
+
+/* vsf_log_do_log()
+ * PURPOSE
+ * Denote the end of a logged operation, specifying whether the operation
+ * was successful or not.
+ * PARAMETERS
+ * p_sess - the current session object
+ * succeeded - 0 for a failed operation, 1 for a successful operation
+ */
+void vsf_log_do_log(struct vsf_session* p_sess, int succeeded);
+
+/* vsf_log_line()
+ * PURPOSE
+ * Logs a single line of information, without disturbing any pending log
+ * operations (e.g. a download log spans a period of time).
+ * This call must be used for any logging calls nested within a call to
+ * the vsf_log_start_entry() function.
+ * PARAMETERS
+ * p_sess - the current session object
+ * what - the type of operation to log
+ * p_str - the string to log
+ */
+void vsf_log_line(struct vsf_session* p_sess, enum EVSFLogEntryType what,
+ struct mystr* p_str);
+
+#endif /* VSF_LOGGING_H */
+