-
Notifications
You must be signed in to change notification settings - Fork 1
/
OpenDKIM.xs
1394 lines (1194 loc) · 26.9 KB
/
OpenDKIM.xs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
* This module is Copyright 2012 Khera Communications, Inc.
* It is licensed under the same terms as Perl itself.
*
* $Id$
*
*/
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
#include <opendkim/dkim.h>
/* h2xs -A -n Mail::OpenDKIM */
/* callbacks */
static SV *dns_callback = (SV *)NULL;
static SV *final_callback = (SV *)NULL;
static SV *key_lookup_callback = (SV *)NULL;
static SV *policy_lookup_callback = (SV *)NULL;
static SV *prescreen_callback = (SV *)NULL;
static SV *signature_handle_callback = (SV *)NULL;
static SV *signature_handle_free_callback = (SV *)NULL;
static SV *signature_tagvalues_callback = (SV *)NULL;
static SV *dns_query_cancel_callback = (SV *)NULL;
static SV *dns_query_service_callback = (SV *)NULL;
static SV *dns_query_start_callback = (SV *)NULL;
static SV *dns_query_waitreply_callback = (SV *)NULL;
/*
* dkim.h doesn't specify the contents of the DKIM and DKIM_SIGINFO structures, it just
* declares them :-(
* So this is an overkill size, that SHOULD be large enough. See dkim-types.h for more
* information about the structures
*/
#define SIZEOF_DKIM 4096
#define SIZEOF_DKIM_SIGINFO 1024
/*
* These routines allow us to call callbacks that are written in and supplied using Perl that
* are maintained and called from within the OpenDKIM library
*
* e.g.
* sub dns_callback {
* my $context = shift;
*
* print "DNS called back with context $context\n";
* }
*
* set_dns_callback({ function => \&callback, interval => 1 });
*
* These are all dummy callbacks that we pass to OpenDKIM, and when OpenDKIM calls them they
* call the Perl routines supplied by the caller
*/
/*
* called when the OpenDKIMlibrary wants to call the callback function provided to
* dkim_set_dns_callback
*/
static void
call_dns_callback(const void *context)
{
dSP;
SV *sv = dns_callback;
if(sv == NULL) {
croak("Internal error: call_dns_callback called, but nothing to call");
return;
}
PUSHMARK(SP);
XPUSHs(sv_2mortal(newSVpv(context, 0)));
PUTBACK;
call_sv(sv, G_DISCARD);
}
/*
* called when the OpenDKIMlibrary wants to call the callback function provided to
* dkim_set_final
*/
static DKIM_CBSTAT
call_final_callback(DKIM *dkim, DKIM_SIGINFO **sigs, int nsigs)
{
dSP;
int count, status;
SV *sv = final_callback;
if(sv == NULL) {
croak("Internal error: call_final_callback called, but nothing to call");
return DKIM_CBSTAT_ERROR;
}
PUSHMARK(SP);
XPUSHs(sv_2mortal(newSVpv((void *)dkim, SIZEOF_DKIM)));
XPUSHs(sv_2mortal(newSVpv((void *)sigs, nsigs * SIZEOF_DKIM_SIGINFO)));
XPUSHs(sv_2mortal(newSViv(nsigs)));
PUTBACK;
count = call_sv(sv, G_SCALAR);
SPAGAIN;
if(count != 1) {
croak("Internal error: final_callback routine returned %d items, 1 was expected",
count);
return DKIM_CBSTAT_ERROR;
}
status = POPi;
PUTBACK;
FREETMPS;
LEAVE;
return status;
}
/*
* called when the OpenDKIMlibrary wants to call the callback function provided to
* dkim_set_key_lookup
*/
static DKIM_CBSTAT
call_key_lookup_callback(DKIM *dkim, DKIM_SIGINFO *siginfo, unsigned char *buf, size_t buflen)
{
dSP;
int count, status;
SV *sv = key_lookup_callback;
if(sv == NULL) {
croak("Internal error: call_key_lookup_callback called, but nothing to call");
return DKIM_CBSTAT_ERROR;
}
PUSHMARK(SP);
XPUSHs(sv_2mortal(newSVpv((void *)dkim, SIZEOF_DKIM)));
XPUSHs(sv_2mortal(newSVpv((void *)siginfo, SIZEOF_DKIM_SIGINFO)));
XPUSHs(sv_2mortal(newSVpv((void *)buf, buflen + 1)));
XPUSHs(sv_2mortal(newSViv(buflen)));
PUTBACK;
count = call_sv(sv, G_SCALAR);
SPAGAIN;
if(count != 1) {
croak("Internal error: key_lookup_callback routine returned %d items, 1 was expected",
count);
return DKIM_CBSTAT_ERROR;
}
status = POPi;
PUTBACK;
FREETMPS;
LEAVE;
return status;
}
/*
* called when the OpenDKIMlibrary wants to call the callback function provided to
* dkim_set_policy_lookup
*/
static DKIM_CBSTAT
call_policy_lookup_callback(DKIM *dkim, unsigned char *query, _Bool excheck, unsigned char *buf, size_t buflen, int *qstat)
{
dSP;
int count, status;
SV *sv = policy_lookup_callback;
if(sv == NULL) {
croak("Internal error: call_policy_lookup_callback called, but nothing to call");
return DKIM_CBSTAT_ERROR;
}
PUSHMARK(SP);
XPUSHs(sv_2mortal(newSVpv((void *)dkim, SIZEOF_DKIM)));
XPUSHs(sv_2mortal(newSVpv((void *)query, 0)));
XPUSHs(sv_2mortal(newSViv(excheck)));
XPUSHs(sv_2mortal(newSVpv((void *)buf, buflen + 1)));
XPUSHs(sv_2mortal(newSViv(buflen)));
XPUSHs(sv_2mortal(newSVpv((void *)qstat, sizeof(int))));
PUTBACK;
count = call_sv(sv, G_SCALAR);
SPAGAIN;
if(count != 1) {
croak("Internal error: policy_lookup_callback routine returned %d items, 1 was expected",
count);
return DKIM_CBSTAT_ERROR;
}
status = POPi;
PUTBACK;
FREETMPS;
LEAVE;
return status;
}
/*
* called when the OpenDKIMlibrary wants to call the callback function provided to
* dkim_set_prescreen
*/
static DKIM_CBSTAT
call_prescreen_callback(DKIM *dkim, DKIM_SIGINFO **sigs, int nsigs)
{
dSP;
int count, status;
SV *sv = prescreen_callback;
if(sv == NULL) {
croak("Internal error: call_prescreen_callback called, but nothing to call");
return DKIM_CBSTAT_ERROR;
}
PUSHMARK(SP);
XPUSHs(sv_2mortal(newSVpv((void *)dkim, SIZEOF_DKIM)));
XPUSHs(sv_2mortal(newSVpv((void *)sigs, nsigs * SIZEOF_DKIM_SIGINFO)));
XPUSHs(sv_2mortal(newSViv(nsigs)));
PUTBACK;
count = call_sv(sv, G_SCALAR);
SPAGAIN;
if(count != 1) {
croak("Internal error: prescreen_callback routine returned %d items, 1 was expected",
count);
return DKIM_CBSTAT_ERROR;
}
status = POPi;
PUTBACK;
FREETMPS;
LEAVE;
return status;
}
/*
* called when the OpenDKIMlibrary wants to call the callback function provided to
* dkim_set_signature_handle
*/
static void *
call_signature_handle_callback(void *closure)
{
dSP;
int count;
void *v;
SV *sv = signature_handle_callback;
if(sv == NULL) {
croak("Internal error: call_signature_handle_callback called, but nothing to call");
return NULL;
}
PUSHMARK(SP);
/* libOpenDKIM doesn't tell us the size of closure, so use best guess :-( */
XPUSHs(sv_2mortal(newSVpv((void *)closure, BUFSIZ)));
PUTBACK;
count = call_sv(sv, G_SCALAR);
SPAGAIN;
if(count != 1) {
croak("Internal error: signature_handle_callback routine returned %d items, 1 was expected",
count);
return NULL;
}
v = POPp;
PUTBACK;
FREETMPS;
LEAVE;
return v;
}
/*
* called when the OpenDKIMlibrary wants to call the callback function provided to
* dkim_set_signature_handle_free
*/
static void
call_signature_handle_free_callback(void *closure, void *ptr)
{
dSP;
SV *sv = signature_handle_free_callback;
if(sv == NULL) {
croak("Internal error: call_handle_free_callback called, but nothing to call");
return;
}
PUSHMARK(SP);
/* libOpenDKIM doesn't tell us the size of closure, so use best guess :-( */
XPUSHs(sv_2mortal(newSVpv((void *)closure, BUFSIZ)));
XPUSHs(sv_2mortal(newSVpv((void *)ptr, BUFSIZ)));
PUTBACK;
call_sv(sv, G_DISCARD);
}
/*
* called when the OpenDKIMlibrary wants to call the callback function provided to
* dkim_set_signature_tagvalues
*/
static void
call_signature_tagvalues_callback(void *user, dkim_param_t pcode, const unsigned char *param, const unsigned char *value)
{
dSP;
SV *sv = signature_tagvalues_callback;
if(sv == NULL) {
croak("Internal error: call_signature_tagvalues_callback called, but nothing to call");
return;
}
PUSHMARK(SP);
/* libOpenDKIM doesn't tell us the size of user, so use best guess :-( */
XPUSHs(sv_2mortal(newSVpv((void *)user, BUFSIZ)));
XPUSHs(sv_2mortal(newSViv(pcode)));
XPUSHs(sv_2mortal(newSVpv(param, 0)));
XPUSHs(sv_2mortal(newSVpv(value, 0)));
PUTBACK;
call_sv(sv, G_DISCARD);
}
/*
* called when the OpenDKIMlibrary wants to call the callback function provided to
* dkim_set_query_cancel
*/
static int
call_dns_query_cancel_callback(void *a, void *b)
{
dSP;
int count, ret;
SV *sv = dns_query_cancel_callback;
if(sv == NULL) {
croak("Internal error: call_dns_query_cancel called, but nothing to call");
return -1;
}
PUSHMARK(SP);
XPUSHs(sv_2mortal(newSVpv(a, sizeof(void *))));
XPUSHs(sv_2mortal(newSVpv(b, sizeof(void *))));
PUTBACK;
count = call_sv(sv, G_SCALAR);
SPAGAIN;
if(count != 1) {
croak("Internal error: dns_query_cancel_callback routine returned %d items, 1 was expected",
count);
return -1;
}
ret = POPi;
PUTBACK;
FREETMPS;
LEAVE;
return ret;
}
/*
* called when the OpenDKIMlibrary wants to call the callback function provided to
* dkim_set_query_service
*/
static void
call_dns_query_service_callback(void *service)
{
dSP;
SV *sv = dns_query_service_callback;
if(sv == NULL) {
croak("Internal error: call_dns_query_service called, but nothing to call");
return;
}
PUSHMARK(SP);
XPUSHs(sv_2mortal(newSVpv(service, sizeof(void *))));
PUTBACK;
call_sv(sv, G_DISCARD);
}
/*
* called when the OpenDKIMlibrary wants to call the callback function provided to
* dkim_set_query_start
*/
static int
call_dns_query_start_callback(void *a, int b, unsigned char *c, unsigned char *d, size_t e, void **f)
{
dSP;
int count, ret;
SV *sv = dns_query_start_callback;
if(sv == NULL) {
croak("Internal error: call_dns_query_service called, but nothing to call");
return -1;
}
PUSHMARK(SP);
XPUSHs(sv_2mortal(newSVpv(a, sizeof(void *))));
XPUSHs(sv_2mortal(newSViv(b)));
XPUSHs(sv_2mortal(newSVpv(c, 0)));
XPUSHs(sv_2mortal(newSVpv(d, e + 1)));
XPUSHs(sv_2mortal(newSViv(e)));
XPUSHs(sv_2mortal(newSVpv((void *)f, sizeof(void **))));
PUTBACK;
count = call_sv(sv, G_SCALAR);
SPAGAIN;
if(count != 1) {
croak("Internal error: dns_query_start_callback routine returned %d items, 1 was expected",
count);
return -1;
}
ret = POPi;
PUTBACK;
FREETMPS;
LEAVE;
return ret;
}
/*
* called when the OpenDKIMlibrary wants to call the callback function provided to
* dkim_dns_set_query_waitreply
*/
static int
call_dns_query_waitreply_callback(void *a, void *b, struct timeval *c, size_t *d, int *e, int *f)
{
dSP;
int count, ret;
SV *sv = dns_query_start_callback;
if(sv == NULL) {
croak("Internal error: call_dns_query_service called, but nothing to call");
return -1;
}
PUSHMARK(SP);
XPUSHs(sv_2mortal(newSVpv(a, sizeof(void *))));
XPUSHs(sv_2mortal(newSVpv(b, sizeof(void *))));
XPUSHs(sv_2mortal(newSVpv((void *)c, sizeof(struct timeval))));
XPUSHs(sv_2mortal(newSVpv((void *)d, sizeof(size_t))));
XPUSHs(sv_2mortal(newSVpv((void *)e, sizeof(int))));
XPUSHs(sv_2mortal(newSVpv((void *)f, sizeof(int))));
PUTBACK;
count = call_sv(sv, G_SCALAR);
SPAGAIN;
if(count != 1) {
croak("Internal error: dns_query_waitreply_callback routine returned %d items, 1 was expected",
count);
return -1;
}
ret = POPi;
PUTBACK;
FREETMPS;
LEAVE;
return ret;
}
MODULE = Mail::OpenDKIM PACKAGE = Mail::OpenDKIM
PROTOTYPES: DISABLE
# These routines are called directly from the end user Perl code
unsigned long
dkim_ssl_version()
CODE:
RETVAL = dkim_ssl_version();
OUTPUT:
RETVAL
unsigned long
dkim_libversion()
CODE:
RETVAL = dkim_libversion();
OUTPUT:
RETVAL
const char *
dkim_getpolicystr(policy)
dkim_policy_t policy
CODE:
RETVAL = dkim_getpolicystr(policy);
OUTPUT:
RETVAL
const char *
dkim_getpresultstr(policy)
dkim_policy_t policy
CODE:
RETVAL = dkim_getpresultstr(policy);
OUTPUT:
RETVAL
const char *
dkim_getresultstr(result)
DKIM_STAT result
CODE:
RETVAL = dkim_getresultstr(result);
OUTPUT:
RETVAL
const char *
dkim_sig_geterrorstr(sigerr)
DKIM_SIGERROR sigerr
CODE:
RETVAL = dkim_sig_geterrorstr(sigerr);
OUTPUT:
RETVAL
int
dkim_mail_parse(line, user_out, domain_out)
char *line
unsigned char *user_out = NO_INIT
unsigned char *domain_out = NO_INIT
CODE:
RETVAL = dkim_mail_parse(line, &user_out, &domain_out);
OUTPUT:
user_out
domain_out
RETVAL
# These routines are called by the glue layer which supplies them with an OO interface
DKIM_LIB *
_dkim_init()
CODE:
RETVAL = dkim_init(NULL, NULL);
OUTPUT:
RETVAL
void
_dkim_close(d)
DKIM_LIB *d
CODE:
dkim_close(d);
DKIM_STAT
_dkim_options(lib, op, opt, data, len)
DKIM_LIB *lib
int op
int opt
void *data
size_t len
CODE:
RETVAL = dkim_options(lib, op, opt, data, len);
OUTPUT:
RETVAL
_Bool
_dkim_libfeature(d, fc)
DKIM_LIB *d
unsigned int fc
CODE:
RETVAL = dkim_libfeature(d, fc);
OUTPUT:
RETVAL
int
_dkim_flush_cache(d)
DKIM_LIB *d
CODE:
RETVAL = dkim_flush_cache(d);
OUTPUT:
RETVAL
#if OPENDKIM_LIB_VERSION >= 0x02080000
DKIM_STAT
_dkim_getcachestats(libhandle, queries, hits, expired, keys)
DKIM_LIB *libhandle
unsigned int queries = NO_INIT
unsigned int hits = NO_INIT
unsigned int expired = NO_INIT
unsigned int keys = NO_INIT
CODE:
RETVAL = dkim_getcachestats(libhandle, &queries, &hits, &expired, &keys, 0);
OUTPUT:
queries
hits
expired
keys
RETVAL
#else
DKIM_STAT
_dkim_getcachestats(queries, hits, expired)
unsigned int queries = NO_INIT
unsigned int hits = NO_INIT
unsigned int expired = NO_INIT
CODE:
RETVAL = dkim_getcachestats(&queries, &hits, &expired);
OUTPUT:
queries
hits
expired
RETVAL
#endif
DKIM *
_dkim_sign(libhandle, id, secretkey, selector, domain, hdrcanon_alg, bodycanon_alg, sign_alg, length, statp)
DKIM_LIB *libhandle
const char *id
const char *secretkey
const char *selector
const char *domain
dkim_canon_t hdrcanon_alg
dkim_canon_t bodycanon_alg
dkim_alg_t sign_alg
off_t length
DKIM_STAT statp = NO_INIT
CODE:
RETVAL = dkim_sign(libhandle, (const unsigned char *)id, NULL, (dkim_sigkey_t)secretkey, (const unsigned char *)selector, (const unsigned char *)domain, hdrcanon_alg, bodycanon_alg, sign_alg, length, &statp);
OUTPUT:
statp
RETVAL
# TODO: memclosure, if that is ever needed
DKIM *
_dkim_verify(libhandle, id, statp)
DKIM_LIB *libhandle
const char *id
DKIM_STAT statp = NO_INIT
CODE:
RETVAL = dkim_verify(libhandle, id, NULL, &statp);
OUTPUT:
statp
RETVAL
DKIM_STAT
_dkim_set_dns_callback(libopendkim, func, interval)
DKIM_LIB *libopendkim
SV *func
unsigned int interval
CODE:
if(dns_callback == (SV *)NULL)
dns_callback = newSVsv(func);
else
SvSetSV(dns_callback, func);
RETVAL = dkim_set_dns_callback(libopendkim, call_dns_callback, interval);
OUTPUT:
RETVAL
DKIM_STAT
_dkim_set_final(libopendkim, func)
DKIM_LIB *libopendkim
SV *func
CODE:
if(final_callback == (SV *)NULL)
final_callback = newSVsv(func);
else
SvSetSV(final_callback, func);
RETVAL = dkim_set_final(libopendkim, call_final_callback);
OUTPUT:
RETVAL
DKIM_STAT
_dkim_set_key_lookup(libopendkim, func)
DKIM_LIB *libopendkim
SV *func
CODE:
if(key_lookup_callback == (SV *)NULL)
key_lookup_callback = newSVsv(func);
else
SvSetSV(key_lookup_callback, func);
RETVAL = dkim_set_key_lookup(libopendkim, call_key_lookup_callback);
OUTPUT:
RETVAL
DKIM_STAT
_dkim_set_prescreen(libopendkim, func)
DKIM_LIB *libopendkim
SV *func
CODE:
if(prescreen_callback == (SV *)NULL)
prescreen_callback = newSVsv(func);
else
SvSetSV(prescreen_callback, func);
RETVAL = dkim_set_prescreen(libopendkim, call_prescreen_callback);
OUTPUT:
RETVAL
DKIM_STAT
_dkim_set_policy_lookup(libopendkim, func)
DKIM_LIB *libopendkim
SV *func
CODE:
if(policy_lookup_callback == (SV *)NULL)
policy_lookup_callback = newSVsv(func);
else
SvSetSV(policy_lookup_callback, func);
RETVAL = dkim_set_policy_lookup(libopendkim, call_policy_lookup_callback);
OUTPUT:
RETVAL
DKIM_STAT
_dkim_set_signature_handle(libopendkim, func)
DKIM_LIB *libopendkim
SV *func
CODE:
if(signature_handle_callback == (SV *)NULL)
signature_handle_callback = newSVsv(func);
else
SvSetSV(signature_handle_callback, func);
RETVAL = dkim_set_signature_handle(libopendkim, call_signature_handle_callback);
OUTPUT:
RETVAL
DKIM_STAT
_dkim_set_signature_handle_free(libopendkim, func)
DKIM_LIB *libopendkim
SV *func
CODE:
if(signature_handle_free_callback == (SV *)NULL)
signature_handle_free_callback = newSVsv(func);
else
SvSetSV(signature_handle_free_callback, func);
RETVAL = dkim_set_signature_handle_free(libopendkim, call_signature_handle_free_callback);
OUTPUT:
RETVAL
DKIM_STAT
_dkim_set_signature_tagvalues(libopendkim, func)
DKIM_LIB *libopendkim
SV *func
CODE:
if(signature_tagvalues_callback == (SV *)NULL)
signature_tagvalues_callback = newSVsv(func);
else
SvSetSV(signature_tagvalues_callback, func);
RETVAL = dkim_set_signature_tagvalues(libopendkim, call_signature_tagvalues_callback);
OUTPUT:
RETVAL
void
_dkim_dns_set_query_cancel(libopendkim, func)
DKIM_LIB *libopendkim
SV *func
CODE:
if(dns_query_cancel_callback == (SV *)NULL)
dns_query_cancel_callback = newSVsv(func);
else
SvSetSV(dns_query_cancel_callback, func);
dkim_dns_set_query_cancel(libopendkim, call_dns_query_cancel_callback);
void
_dkim_dns_set_query_service(libopendkim, func)
DKIM_LIB *libopendkim
SV *func
CODE:
if(dns_query_service_callback == (SV *)NULL)
dns_query_service_callback = newSVsv(func);
else
SvSetSV(dns_query_service_callback, func);
dkim_dns_set_query_service(libopendkim, call_dns_query_service_callback);
void
_dkim_dns_set_query_start(libopendkim, func)
DKIM_LIB *libopendkim
SV *func
CODE:
if(dns_query_start_callback == (SV *)NULL)
dns_query_start_callback = newSVsv(func);
else
SvSetSV(dns_query_start_callback, func);
dkim_dns_set_query_start(libopendkim, call_dns_query_start_callback);
void
_dkim_dns_set_query_waitreply(libopendkim, func)
DKIM_LIB *libopendkim
SV *func
CODE:
if(dns_query_waitreply_callback == (SV *)NULL)
dns_query_waitreply_callback = newSVsv(func);
else
SvSetSV(dns_query_waitreply_callback, func);
dkim_dns_set_query_waitreply(libopendkim, call_dns_query_waitreply_callback);
DKIM_STAT
_dkim_free(d)
DKIM *d
CODE:
RETVAL = dkim_free(d);
OUTPUT:
RETVAL
DKIM_STAT
_dkim_header(dkim, header, len)
DKIM *dkim
unsigned char *header
size_t len
CODE:
RETVAL = dkim_header(dkim, header, len);
OUTPUT:
RETVAL
DKIM_STAT
_dkim_body(dkim, bodyp, len)
DKIM *dkim
unsigned char *bodyp
size_t len
CODE:
RETVAL = dkim_body(dkim, bodyp, len);
OUTPUT:
RETVAL
DKIM_STAT
_dkim_eoh(dkim)
DKIM *dkim
CODE:
RETVAL = dkim_eoh(dkim);
OUTPUT:
RETVAL
DKIM_STAT
_dkim_chunk(dkim, chunkp, len)
DKIM *dkim
unsigned char *chunkp
size_t len
CODE:
RETVAL = dkim_chunk(dkim, chunkp, len);
OUTPUT:
RETVAL
DKIM_STAT
_dkim_eom(dkim)
DKIM *dkim
CODE:
RETVAL = dkim_eom(dkim, NULL);
OUTPUT:
RETVAL
const char *
_dkim_getid(dkim)
DKIM *dkim
CODE:
RETVAL = dkim_getid(dkim);
OUTPUT:
RETVAL
#if OPENDKIM_LIB_VERSION < 0x02070000
uint64_t
_dkim_get_msgdate(dkim)
DKIM *dkim
CODE:
RETVAL = dkim_get_msgdate(dkim);
OUTPUT:
RETVAL
#endif
DKIM_STAT
_dkim_get_sigsubstring(dkim, sig, buf, buflen)
DKIM *dkim
DKIM_SIGINFO *sig
char *buf
size_t buflen
CODE:
RETVAL = dkim_get_sigsubstring(dkim, sig, buf, &buflen);
OUTPUT:
buflen
RETVAL
DKIM_STAT
_dkim_key_syntax(dkim, str, len)
DKIM *dkim
unsigned char *str
size_t len
CODE:
RETVAL = dkim_key_syntax(dkim, str, len);
OUTPUT:
RETVAL
unsigned char *
_dkim_get_signer(dkim)
DKIM *dkim
CODE:
RETVAL = dkim_get_signer(dkim);
OUTPUT:
RETVAL
DKIM_STAT
_dkim_set_signer(dkim, signer)
DKIM *dkim
const char *signer
CODE:
RETVAL = dkim_set_signer(dkim, signer);
OUTPUT:
RETVAL
DKIM_STAT
_dkim_set_margin(dkim, margin)
DKIM *dkim
int margin
CODE:
RETVAL = dkim_set_margin(dkim, margin);
OUTPUT:
RETVAL
void *
_dkim_get_user_context(dkim)
DKIM *dkim
CODE:
RETVAL = dkim_get_user_context(dkim);
OUTPUT:
RETVAL
DKIM_STAT
_dkim_set_user_context(dkim, ctx)
DKIM *dkim
void *ctx
CODE:
RETVAL = dkim_set_user_context(dkim, ctx);
OUTPUT:
RETVAL
DKIM_STAT
_dkim_atps_check(dkim, sig, timeout, res)
DKIM *dkim
DKIM_SIGINFO *sig
struct timeval *timeout
dkim_atps_t res = NO_INIT;
CODE:
RETVAL = dkim_atps_check(dkim, sig, timeout, &res);
OUTPUT:
res
RETVAL
DKIM_STAT
_dkim_diffheaders(dkim, canon, maxcost, ohdrs, nohdrs, out, nout)
DKIM *dkim
dkim_canon_t canon
int maxcost
char *&ohdrs
int nohdrs
struct dkim_hdrdiff *out = NO_INIT
int nout = NO_INIT
CODE:
RETVAL = dkim_diffheaders(dkim, canon, maxcost, &ohdrs, nohdrs, &out, &nout);
OUTPUT:
out
nout
RETVAL
DKIM_STAT
_dkim_get_reputation(dkim, sig, qroot, rep)
DKIM *dkim
DKIM_SIGINFO *sig
char *qroot
int rep = NO_INIT
CODE:
RETVAL = dkim_get_reputation(dkim, sig, qroot, &rep);
OUTPUT:
rep
RETVAL
DKIM_STAT
_dkim_getsighdr(dkim, buf, len, initial)
DKIM *dkim
unsigned char *buf
size_t len
size_t initial