文中的信件实体 和 信件体 是同一个概念都是指信件实体。
一。MIME信件实体分界线
Boundary分界线:在原boundary前加两个横线即“--”
结尾boundary:在原boundary前和后各加两个横线即“--”
二。Smtp解析模块在解析过程中,使用变量tx->mime_state->stack->top->data指向当前信件实体,新到的数据包括头部和数据都会保存到该结构体(该结构体会形成一个链表),该变量始终指向正在解析的数据要保存到的信件实体结构体指针,mime_state->stack以堆栈的形式组织所有信件实体:
tx->mime_state->stack->top->data
SMTPTransaction *tx;
MimeDecParseState *mime_state;
MimeDecStack *stack;
MimeDecStackNode *top;
MimeDecEntity *data,其中的next为兄弟信件实体链表,child为子信件实体链表
三。结构体说明
SMTPTransaction 该结构体表示一次smtp解析事务,所有smtp解析事务链接成一个链表
typedef struct SMTPTransaction_ {
/** id of this tx, starting at 0 */
uint64_t tx_id; //事务id,自增,唯一标识事务链表中的一个事务
//猜测:分别是服务器方向和客户端方向的报文检测标志,detect模块使用
uint64_t detect_flags_ts;
uint64_t detect_flags_tc;
//事务解析完成时设置done=1
int done;
/** indicates loggers done logging */
uint32_t logged;
//该事务上信件的所有信件实体的链表组织形式,方便遍历,每个节点存储一个信件实体
/** the first message contained in the session */
MimeDecEntity *msg_head;
//该事务上信件的所有信件实体的链表的尾指针
/** the last message contained in the session */
MimeDecEntity *msg_tail;
/** the mime decoding parser sta