![]() |
![]()
| ![]() |
![]()
NAME
DESCRIPTIONThe smtpd(8) daemon provides a Simple Mail Transfer Protocol (SMTPD) implementation, which allows ordinary machines to become Mail eXchangers (MX). Some features that are commonly used by MX, such as querying databases for user credentials, are outside of the scope of SMTP and too complex to fit in smtpd(8). Because an MX may need to provide these features, smtpd(8) provides an API to implement table(5) backends with a simple text-based protocol. DESIGN
Because PROTOCOLThe protocol consist of human-readable lines exchanged between
The protocol begins with a handshake. First,
smtpd(8)
provides config|smtpd-version|7.5.0 config|protocol|0.1 config|tablename|devs config|ready Then, register|alias register|credentials register|ready Finally, smtpd(8) can start querying the table. For example: table|0.1|1713795082.354255|devs|lookup|alias|b72508d|op The “|” character is used to separate the fields and may only appear verbatim in the last field of the payload, in which case it should be considered a regular character and not a separator. No other field may contain a “|”. Each request has a common set of fields, followed by some other fields that are operation-specific. The common format consists of a protocol prefix ‘table’, the protocol version, the timestamp and the table name. For example: table|0.1|1713795091.202157|devs The protocol is inherently asynchronous, so multiple request may be sent without waiting for the table to reply. All the replies have a common prefix, followed by the operation-specific response. The common format consist of a prefix with the operation name in followed by ‘-result’, and the unique ID of the request. For example: lookup-result|b72508d The list of operations, operation-specific parameters and responses are as follows:
Each service has a specific format for the result. The exact syntax for the values and eventually the keys are described in table(5). The services and their result format are as follows:
EXAMPLESAssuming the table is called “devs”, here's an
example of a failed table|0.1|1713795097.394049|devs|update|478ff0d2 update-result|478ff0d2|error|failed to connect to the database A table|0.1|1713795103.314423|devs|check|netaddr|e5862859|192.168.0.7 check-result|e5862859|not-found A successful table|0.1|1713795110.354921|devs|lookup|userinfo|f993c74|op lookup-result|f993c74|found|1000:1000:/home/op A series of table|0.1|1713795116.227321|devs|fetch|source|189bd3ee lookup-result|189bd3ee|found|192.168.1.7 table|0.1|1713795120.162438|devs|fetch|source|9e4c56d4 lookup-result|9e4c56d4|found|10.0.0.8 table|0.1|1713795122.930928|devs|fetch|source|f2c8b906 lookup-result|f2c8b906|found|192.168.1.7 SEE ALSOHISTORY
|