Milter协议

SMTP 和milter对应

SMTP Commands                           Milter Callbacks

(open SMTP connection)                  xxfi_connect
HELO ...                                xxfi_helo
MAIL From: ...                          xxfi_envfrom
RCPT To: ...                            xxfi_envrcpt
[more RCPTs]                            [xxfi_envrcpt]
DATA                                    xxfi_data
Header: ...                             xxfi_header
[more headers]                          [xxfi_header]   
.                                       xxfi_eoh
body...                                 xxfi_body
[more body...]                          [xxfi_body]
.                                       xxfi_eom
QUIT                                    xxfi_close

API

Library Control Functions(库控制功能)

smfi_opensocket                     Try to create the interface socket.(尝试创建接口套接字)
smfi_register                       Register a filter.(注册一个过滤器)
smfi_setconn                        Specify socket to use.(指定要使用套接字)
smfi_settimeout                     Set timeout.(设置超时)
smfi_setbacklog                     Define the incoming listen queue size.(定义传入的侦听队列大小)
smfi_setdbg                         Set the milter library debugging (tracing) level.(设置milter库调试(跟踪)级别)
smfi_stop                           Cause an orderly shutdown.(关闭)
smfi_main                           Hand control to libmilter.(人为控制libmilter)

Data Access Functions(数据访问功能)

smfi_getsymval                      Return the value of a symbol.(返回一个符号的值)
smfi_getpriv                        Get the private data pointer.(获取私有数据指针)
smfi_setpriv                        Set the private data pointer.(设置私有数据指针)
smfi_setreply                       Set the specific reply code to be used.(设置要使用的特定应答代码。)
smfi_setmlreply                     Set the specific multi-line reply to be used.(设置所使用的特定的多行回复)

Message Modification Functions(信息修改功能)

smfi_addheader                      Add a header to the message.(向消息添加一个标题)             SMFIF_ADDHDRS
smfi_chgheader                      Change or delete a header.(更改或删除一个标题)               SMFIF_CHGHDRS
smfi_insheader                      Insert a header into the message.(在消息中插入一个头)        SMFIF_ADDHDRS
smfi_chgfrom                        Change the envelope sender address.(更改信封发送方地址)      SMFIF_CHGFROM
smfi_addrcpt                        Add a recipient to the envelope.(在信封上加一个收件人)        SMFIF_ADDRCPT
smfi_addrcpt_par                    Add a recipient including ESMTP parameter to the envelope.(将ESMTP参数添加到信封中)  SMFIF_ADDRCPT_PAR
smfi_delrcpt                        Delete a recipient from the envelope.(从信封中删除一个收件人)  SMFIF_DELRCPT
smfi_replacebody                    Replace the body of the message.(替换消息的主体)               SMFIF_CHGBODY

Callbacks(回调)

xxfi_connect                    connection info(连接信息)
xxfi_helo                       SMTP HELO/EHLO command(SMTP HELO/ EHLO命令)
xxfi_envfrom                    envelope sender(信封发送方)
xxfi_envrcpt                    envelope recipient(信封发送方)
xxfi_data                       DATA command(信封发送方)
xxfi_unknown                    Unknown SMTP command(信封发送方)
xxfi_header                     header(信封发送方)
xxfi_eoh                        end of header(结束的头)
xxfi_body                       body block(主题)
xxfi_eom                        end of message(消息结束)
xxfi_abort                      message aborted(消息失败)
xxfi_close                      connection cleanup(连接清理)
xxfi_negotiate                  option negotiattion(选择谈判)

Other Message Handling Functions(其他消息处理功能)

smfi_progress               Report operation in progress.(报告正在进行中)
smfi_quarantine             Quarantine a message.(隔离一个消息)

Miscellaneous(其他)

smfi_version                libmilter (runtime) version info.(版本信息)
smfi_setsymlist             Set the list of macros that the milter wants to receive from the MTA for a protocol stage.(设置了milter想要从MTA获得的用于协议阶段的宏的列表。)

return value(返回值)

SMFIS_CONTINUE
Continue processing the current connection, message, or recipient.
继续处理当前的连接、消息或接收方。

SMFIS_REJECT
For a connection-oriented routine, reject this connection; callxxfi_close.
For a message-oriented routine (except xxfi_eom or xxfi_abort), reject this message.
For a recipient-oriented routine, reject the current recipient (but continue processing the current message).
对于面向连接的例程,拒绝这个连接;callxxfi_close。
对于面向消息的例程(除了xxfi_eom or xxfi_abort),拒绝此消息。
对于面向接收方的例程,拒绝接收当前接收方(但继续处理当前消息)。

SMFIS_DISCARD
For a message- or recipient-oriented routine, accept this message, but silently discard it.
SMFIS_DISCARD should not be returned by a connection-oriented routine.
对于一个消息或以接收为导向的例程,接受这个消息,但要悄悄地丢弃它。
不应该通过面向连接的例程返回。

SMFIS_SKIP
Skip further callbacks of the same type in this transaction. Currently this return value is only allowed in xxfi_body(). It can be used if a milter has received sufficiently many body chunks to make a decision, but still wants to invoke message modification functions that are only allowed to be called from xxfi_eom(). Note: the milter must negotiate this behavior with the MTA, i.e., it must check whether the protocol action SMFIP_SKIP is available and if so, the milter must request it.
在此事务中跳过相同类型的进一步回调。当前这个返回值只允许在xxfi_body()中。如果一个milter接收到足够多的主体块来做决策,它可以被使用,但是仍然希望调用仅允许从xxfi_eom()调用的消息修改函数。注:milter必须与MTA协商这一行为。它必须检查协议动作smfip跳过是否可用,如果是,那么milter必须请求它。

SMFIS_NOREPLY
Do not send a reply back to the MTA. The milter must negotiate this behavior with the MTA, i.e., it must check whether the appropriate protocol action SMFIP_NR_* is available and if so, the milter must request it. If you set the SMFIP_NR_* protocol action for a callback, that callback must always reply with SMFIS_NOREPLY. Using any other reply code is a violation of the API. If in some cases your callback may return another value (e.g., due to some resource shortages), then you must not set SMFIP_NR_* and you must use SMFIS_CONTINUE as the default return code. (Alternatively you can try to delay reporting the problem to a later callback for which SMFIP_NR_* is not
不要将回复发送回MTA。milter必须与MTA协商这一行为。它必须检查是否有合适的协议操作SMFIP_NR_*,如果是,那么milter必须请求它。如果您为一个回调设置了SMFIP_NR_*协议操作,那么这个回调必须始终以SMFIS_NOREPLY的方式应答。使用任何其他回复代码都是对API的违背。如果在某些情况下,您的回调可能返回另一个值(例如:由于某些资源的短缺),您不能设置SMFIP_NR_*,您必须使用SMFIS_CONTINUE作为默认的返回代码。(或者,您可以尝试将问题的报告延迟到稍后的回调中,而SMFIP_NR_*不是这样的

SMFIS_ACCEPT
For a connection-oriented routine, accept this connection without further filter processing; call xxfi_close.
For a message- or recipient-oriented routine, accept this message without further filtering.
对于面向连接的例程,接受这个连接而不需要进一步的过滤处理;调用xxfi_close。
对于消息或接收面向对象的例程,接受此消息而不需要进一步过滤。

SMFIS_TEMPFAIL
Return a temporary failure, i.e., the corresponding SMTP command will return an appropriate 4xx status code. For a message-oriented routine (except xxfi_envfrom), fail for this message.
For a connection-oriented routine, fail for this connection; call xxfi_close.
For a recipient-oriented routine, only fail for the current recipient; continue message processing.
返回一个临时的失败,即相应的SMTP命令将返回一个适当的4xx状态代码。
对于面向消息的例程(除了xxfi_envfrom),此消息失败。
对于面向连接的例程,此连接失败;调用xxfi_close。
对于面向接收方的例程,只对当前接收方失败;
继续进行消息处理。
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值