Deliver aggregate SMTP TLS reports
This commit is contained in:
@@ -96,6 +96,25 @@ typedef struct BongoTlsRptEvent {
|
||||
|
||||
typedef struct BongoTlsRptStore BongoTlsRptStore;
|
||||
|
||||
typedef struct BongoTlsRptDelivery {
|
||||
int64_t id;
|
||||
int endpoint_type;
|
||||
int attempts;
|
||||
int64_t day_start;
|
||||
int64_t created_at;
|
||||
int64_t expires_at;
|
||||
char report_domain[BONGO_TLSRPT_DOMAIN_SIZE];
|
||||
char report_id[BONGO_TLSRPT_DOMAIN_SIZE * 2];
|
||||
char endpoint_uri[BONGO_TLSRPT_URI_SIZE];
|
||||
char *json;
|
||||
} BongoTlsRptDelivery;
|
||||
|
||||
typedef enum BongoTlsRptDeliveryResult {
|
||||
BONGO_TLSRPT_DELIVERY_RETRY = 0,
|
||||
BONGO_TLSRPT_DELIVERY_SUCCESS = 1,
|
||||
BONGO_TLSRPT_DELIVERY_PERMANENT_FAILURE = 2
|
||||
} BongoTlsRptDeliveryResult;
|
||||
|
||||
/* Parse one complete TXT value after DNS character-string concatenation. */
|
||||
int BongoTlsRptParseRecord(const char *record, BongoTlsRptDnsPolicy *policy);
|
||||
|
||||
@@ -127,6 +146,34 @@ int BongoTlsRptStoreDeleteReport(BongoTlsRptStore *store,
|
||||
int64_t day_start,
|
||||
const char *reporting_policy);
|
||||
|
||||
/*
|
||||
* Atomically turn the oldest completed reporting-policy group into one
|
||||
* durable delivery per RUA endpoint. The corresponding event rows are
|
||||
* removed in the same SQLite write transaction, so events recorded after
|
||||
* the snapshot cannot be lost. Returns 1 when a batch was prepared, 0 when
|
||||
* no complete day is available, and -1 on error.
|
||||
*/
|
||||
int BongoTlsRptStorePrepareNext(BongoTlsRptStore *store,
|
||||
int64_t before_day_start,
|
||||
const char *organization_name,
|
||||
const char *contact_info,
|
||||
const char *submitter,
|
||||
int64_t now,
|
||||
int64_t initial_not_before);
|
||||
|
||||
/* Returns 1 for a due delivery, 0 when none is due, and -1 on error. */
|
||||
int BongoTlsRptStoreNextDelivery(BongoTlsRptStore *store, int64_t now,
|
||||
BongoTlsRptDelivery *delivery,
|
||||
int64_t *next_not_before);
|
||||
void BongoTlsRptDeliveryFree(BongoTlsRptDelivery *delivery);
|
||||
|
||||
int BongoTlsRptStoreFinishDelivery(BongoTlsRptStore *store,
|
||||
int64_t delivery_id,
|
||||
BongoTlsRptDeliveryResult result,
|
||||
int64_t next_attempt,
|
||||
const char *error);
|
||||
int BongoTlsRptStoreCleanupExpired(BongoTlsRptStore *store, int64_t now);
|
||||
|
||||
const char *BongoTlsRptPolicyTypeName(BongoTlsRptPolicyType type);
|
||||
const char *BongoTlsRptResultTypeName(BongoTlsRptResultType type);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user