Back to index

opendkim  2.6.2
Defines | Functions | Variables
dr-test00.c File Reference
#include "build-config.h"
#include <sys/types.h>
#include <sys/select.h>
#include <assert.h>
#include <string.h>
#include <stdio.h>
#include "dkim-rep.h"

Go to the source code of this file.

Defines

#define TESTDOMAIN   "example.com"
#define TESTUSER1   "good"
#define TESTUSER2   "bad"

Functions

int main (int argc, char **argv)

Variables

static char dr_test00_c_id [] = "@(#)$Id: t-test124.c,v 1.2 2009/12/08 19:14:27 cm-msk Exp $"

Define Documentation

#define TESTDOMAIN   "example.com"

Definition at line 25 of file dr-test00.c.

#define TESTUSER1   "good"

Definition at line 26 of file dr-test00.c.

#define TESTUSER2   "bad"

Definition at line 27 of file dr-test00.c.


Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 40 of file dr-test00.c.

{
       int rep;
       DKIM_REP dr;
       void *qh = NULL;
       DKIM_REP_STAT status;
       struct timeval timeout;

#ifdef USE_GNUTLS
       (void) gnutls_global_init();
#endif /* USE_GNUTLS */

       printf("*** basic reputation checks\n");

       dr = dkim_rep_init(NULL, NULL, NULL);
       assert(dr != NULL);

       status = dkim_rep_query_start(dr, TESTUSER1, TESTDOMAIN,
                                     TESTDOMAIN, &qh);
       assert(status == DKIM_REP_DNS_SUCCESS);
       assert(qh != NULL);

       timeout.tv_sec = 5;
       timeout.tv_usec = 5;

       rep = 0;
       status = dkim_rep_query_check(dr, qh, &timeout, &rep);
       assert(status == DKIM_REP_STAT_FOUND);

       printf("--- %s@%s d=%s reputation %d\n", TESTUSER1, TESTDOMAIN,
              TESTDOMAIN, rep);

       status = dkim_rep_query_start(dr, TESTUSER2, TESTDOMAIN,
                                     TESTDOMAIN, &qh);
       assert(status == DKIM_REP_DNS_SUCCESS);
       assert(qh != NULL);

       timeout.tv_sec = 5;
       timeout.tv_usec = 5;

       rep = 0;
       status = dkim_rep_query_check(dr, qh, &timeout, &rep);
       assert(status == DKIM_REP_STAT_FOUND);

       printf("--- %s@%s d=%s reputation %d\n", TESTUSER2, TESTDOMAIN,
              TESTDOMAIN, rep);

       dkim_rep_close(dr);

       return 0;
}

Here is the call graph for this function:


Variable Documentation

char dr_test00_c_id[] = "@(#)$Id: t-test124.c,v 1.2 2009/12/08 19:14:27 cm-msk Exp $" [static]

Definition at line 6 of file dr-test00.c.