summaryrefslogtreecommitdiff
path: root/include/ftp_decoder.h
diff options
context:
space:
mode:
authorlijia <[email protected]>2024-07-22 10:34:56 +0800
committerlijia <[email protected]>2024-07-22 13:35:54 +0800
commit2ee4770462185daec28e8bb424c8e188e194c996 (patch)
treec4394242f00311d4d7d7c84011672364c851c691 /include/ftp_decoder.h
parent6e906a14fee875eff1cac600710f2cedcaaef9b6 (diff)
Initial commitHEADv1.0.1main
Diffstat (limited to 'include/ftp_decoder.h')
-rw-r--r--include/ftp_decoder.h38
1 files changed, 38 insertions, 0 deletions
diff --git a/include/ftp_decoder.h b/include/ftp_decoder.h
new file mode 100644
index 0000000..206ece9
--- /dev/null
+++ b/include/ftp_decoder.h
@@ -0,0 +1,38 @@
+#pragma once
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+#include <bits/types/struct_iovec.h>
+
+#define FTP_DECODER_CTRL_TOPIC "FTP_DECODER_CTRL_MESSAGE"
+#define FTP_DECODER_DATA_TOPIC "FTP_DECODER_DATA_MESSAGE"
+
+struct ftp_message;
+
+enum ftp_msg_type{
+ FTP_BANNER = 0,
+ FTP_ACCOUNT,
+ FTP_PASSWORD,
+ FTP_URI,
+ FTP_TRANS_MODE, // "PASV", "PORT"
+ FTP_TRANS_DIR, // "RETR", "STOR"
+ FTP_INVENTORY, // by command "LIST"
+ FTP_FILE_CONTENT, // by command "RETR" and "STOR"
+
+ FTP_MSG_MAX,
+};
+
+/**
+ * 1: success
+ * 0: failed or no available data
+*/
+int ftp_message_iterate(const struct ftp_message *msg, enum ftp_msg_type *type, struct iovec *value);
+
+void ftp_message_reset_iterator(const struct ftp_message *msg);
+
+const char *ftp_message_type_to_string(enum ftp_msg_type fmsg_type);
+
+#ifdef __cplusplus
+}
+#endif