diff options
Diffstat (limited to 'decoders/mail/mail_internal.h')
| -rw-r--r-- | decoders/mail/mail_internal.h | 104 |
1 files changed, 104 insertions, 0 deletions
diff --git a/decoders/mail/mail_internal.h b/decoders/mail/mail_internal.h new file mode 100644 index 0000000..c200172 --- /dev/null +++ b/decoders/mail/mail_internal.h @@ -0,0 +1,104 @@ +#pragma once + +#ifdef __cplusplus +extern "C" +{ +#endif + +#include <stellar/mail.h> + +#define MAIL_EXDATA_NAME "MAIL_EXDATA" +#define MAIL_COMMAND_TOPIC_NAME "MAIL_COMMAND" +#define MAIL_HEADER_TOPIC_NAME "MAIL_HEADER" +#define MAIL_BODY_TOPIC_NAME "MAIL_BODY" +#define MAIL_ATTACHMENT_TOPIC_NAME "MAIL_ATTACHMENT" +#define MAIL_EML_TOPIC_NAME "MAIL_EML" + +enum MAIL_MESSAGE_TYPE { + MAIL_MESSAGE_TYPE_COMMAND, + MAIL_MESSAGE_TYPE_HEADER, + MAIL_MESSAGE_TYPE_BODY, + MAIL_MESSAGE_TYPE_ATTACHMENT, + MAIL_MESSAGE_TYPE_EML, + MAIL_MESSAGE_TYPE_MAX, +}; + +struct mail_authentication { + const char *username; + size_t username_len; + const char *password; + size_t password_len; +}; + +struct mail_command { + enum MAIL_COMMAND cmd; + const char *arg; + size_t arg_len; + const char *cmd_line; + size_t cmd_line_len; +}; + +struct mail_body { + char *body; + size_t body_len; + size_t body_offset; + int is_body_finished; +}; + +struct mail_attachment { + char *attachment_name; + size_t attachment_name_len; + char *attachment; + size_t attachment_len; + size_t attachment_offset; + int is_attachment_finished; +}; + +struct mail_eml { + char *eml; + size_t eml_len; + size_t eml_offset; + int is_eml_finished; +}; + +struct mail_message { + enum MAIL_MESSAGE_TYPE type; + enum MAIL_PROTOCOL mail_protocol; + size_t mail_seq; + + struct mail_command command; + struct mail_header header; + struct mail_body body; + struct mail_attachment attachment; + struct mail_eml eml; + + struct session *sess_ref; +}; + +struct mail_session_ctx { + enum MAIL_PROTOCOL protocol; + + struct smtp_parser *smtp_parser; + //struct imap_parser *imap; + //struct pop3_parser *pop3; + + int is_mail_protocol; + struct mail_env *mail_env_ref; + struct session *sess_ref; +}; + +struct mail_env { + int command_topic_id; + int header_topic_id; + int body_topic_id; + int attachment_topic_id; + int eml_topic_id; + int exdata_id; + + struct module_manager *mod_mgr_ref; +}; + +#ifdef __cplusplus +} +#endif + |
