summaryrefslogtreecommitdiff
path: root/include/ftp_decoder.h
diff options
context:
space:
mode:
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