3.2.8 record.c:传递邮件信息

来源:互联网 发布:手机文件加密软件2016 编辑:程序博客网 时间:2024/06/07 07:02

record.c将文本信息编码为如下格式:

 

一个字节类型码+一个或多个字节的长度码+长度码指定长度的文本信息

/*     Thismodule reads and writes typed variable-length records.

/*     Eachrecord contains a 1-byte type code (0..255), a length

/*     (1or more bytes) and as much data as the length specifies.

 

这种“二进制”编码方式被用来在postfix模块间传递信息。postfix用该格式在smtpd模块和cleanup模块,cleanup模块和qmgr模块间传递邮件信息。

 

    类型信息在/global/rec_type.h中定义,约70多条,我们选几条重要的来举例:

 

#defineREC_TYPE_FROM        'S'               /* sender, required */

发件人地址

 

#defineREC_TYPE_RCPT         'R'              /* todo recipient, optional */

收件人或密送人地址

 

#defineREC_TYPE_CONT        'L'               /* long data record */

smtp DATA命令传入的长(超出line_length_limit参数限制)行

 

#defineREC_TYPE_NORM       'N'              /* normal data record */

smtp DATA命令传入的正常长度行

 

#defineREC_TYPE_ATTR        'A'              /* named attribute for extensions*/

REC_TYPE_ATTR类型表示常量标示,在/global/mail_proto.h中有这种几十个常量定义。smtp协议扩展参数均用此类型传递:

扩展参数ENVID

#defineMAIL_ATTR_DSN_ENVID   "envelope_id" /* dsn envelope id */

扩展参数RET

#defineMAIL_ATTR_DSN_RET        "ret_flags"       /* dsn full/headers */

扩展参数SMTPUTF8

#defineMAIL_ATTR_SMTPUTF8      "smtputf8"       /* RFC6531 support */

扩展参数BODY

#defineMAIL_ATTR_ENCODING     "encoding"       /* internal encoding */

#defineMAIL_ATTR_ENC_8BIT       "8bit"       /* 8BITMIME equivalent */

#defineMAIL_ATTR_ENC_7BIT       "7bit"       /* 7BIT equivalent */

#defineMAIL_ATTR_ENC_NONE    ""     /* encoding unknown */

扩展参数NOTIFY

#defineMAIL_ATTR_DSN_NOTIFY  "notify_flags"  /* dsn notify flags */

扩展参数ORCPT

#defineMAIL_ATTR_DSN_ORCPT   "dsn_orig_rcpt"       /* dsn original recipient */

 

#defineREC_TYPE_FILT   'L'               /* loop filter transport */

#defineREC_TYPE_RDR  '>'              /* redirect target */

这两种类型与postfix的内容过滤功能有关,见6.3.2。

 

record类型的数据主要通过rec_fputs、rec_fprintf等函数传递给下一个模块,此类函数的区别主要在数据格式化形式方面。;
0 0
原创粉丝点击