# Overview

[back to index]

For basic processig of an arriving message under Domain-Based Message Authentication, Reporting and Conformance ("DMARC"), make the following calls:

1. `opendmarc_policy_library_init(&lib);`
   - initialize an instance of the library
   - this must be done once before any of the other calls are made
   - this needs to be called once when the application is started, but its result can be reused at the start of processing of each message
2. `dmarc = opendmarc_policy_connect_init(ip-address, ip-version);`
   - initialize a handle set up for signing all messages from a new connection
   - establishes the context needed for evaluating SPF
   - the handle returned here can be used for all messages that arrive from the given IP address; simply call opendmarc_policy_connect_rset() between each message
   - each thread must request its own handle for processing messages
3. `opendmarc_policy_store_from_domain(dmarc, domain);`
   - store the domain name found in the From: field of an arriving message
4. `opendmarc_policy_store_spf(dmarc, ...);`
   - stores the SPF result details for the current message once they are available from some other API
5. `opendmarc_policy_store_dkim(dmarc, ...);`
   - stores a set of DKIM result details for the current message once they are available from some other API
   - this can be called multiple times per message since a single message can have multiple DKIM signatures attached to it
6. `opendmarc_policy_query_dmarc(dmarc);`
   - performs DMARC policy query and evaluation on the message based on details provided above
7. `opendmarc_get_policy_to_enforce(dmarc);`
   - report the policy in effect over the From: domain found in the message; indicates what the final disposition of the current message should be
8. `opendmarc_policy_connect_shutdown(dmarc);`
   - shuts down the previously allocated handle
9. `opendmarc_policy_library_shutdown(lib);`
   - free resources related to the library

Copyright (c) 2013, The Trusted Domain Project. All rights reserved.
By using this file, you agree to the terms and conditions set forth in the respective licenses.