summaryrefslogtreecommitdiff
path: root/include/ftp_decoder.h
blob: 206ece99fd417e5089f22f9fb41d92c52af9482c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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