summaryrefslogtreecommitdiffstats
path: root/libseaudit/swig/seaudit.i
blob: 8c96d8961d7757f1488b11d1cb732fb15be423fe (plain)
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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
/**
 * @file
 * SWIG declarations for libseaudit.
 *
 * @author Jeremy A. Mowery jmowery@tresys.com
 * @author Jason Tang  jtang@tresys.com
 *
 * Copyright (C) 2006-2007 Tresys Technology, LLC
 *
 *  This library is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU Lesser General Public
 *  License as published by the Free Software Foundation; either
 *  version 2.1 of the License, or (at your option) any later version.
 *
 *  This library is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *  Lesser General Public License for more details.
 *
 *  You should have received a copy of the GNU Lesser General Public
 *  License along with this library; if not, write to the Free Software
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 */

%module seaudit

%{
#include <seaudit/avc_message.h>
#include <seaudit/bool_message.h>
#include <seaudit/filter.h>
#include <seaudit/load_message.h>
#include <seaudit/log.h>
#include <seaudit/message.h>
#include <seaudit/model.h>
#include <seaudit/parse.h>
#include <seaudit/report.h>
#include <seaudit/sort.h>
#include <seaudit/util.h>
#include <time.h>

/* Provide hooks so that language-specific modules can define the
 * callback function, used by the handler in seaudit_log_create().
 */
SWIGEXPORT seaudit_handle_fn_t seaudit_swig_message_callback = NULL;
SWIGEXPORT void * seaudit_swig_message_callback_arg = NULL;

%}

#ifdef SWIGJAVA
%javaconst(1);
/* get the java environment so we can throw exceptions */
%{
	static JNIEnv *seaudit_global_jenv;
	jint JNI_OnLoad(JavaVM *vm, void *reserved) {
		(*vm)->AttachCurrentThread(vm, (void **)&seaudit_global_jenv, NULL);
		return JNI_VERSION_1_2;
	}
%}
#endif

%include exception.i
%include stdint.i
%import apol.i

%{
#undef BEGIN_EXCEPTION
#undef END_EXCEPTION
%}

#ifdef SWIGJAVA

%exception {
	seaudit_global_jenv = jenv;
	$action
}

%{
#define BEGIN_EXCEPTION JNIEnv *local_jenv = seaudit_global_jenv; {
#define END_EXCEPTION }
%}

/* handle size_t correctly in java as architecture independent */
%typemap(jni) size_t "jlong"
%typemap(jtype) size_t "long"
%typemap(jstype) size_t "long"
%typemap("javaimports") SWIGTYPE, FILE* %{
import com.tresys.setools.qpol.*;
import com.tresys.setools.apol.*;
%}
%typemap(javabody) SWIGTYPE %{
    private long swigCPtr;
    protected boolean swigCMemOwn;

    public $javaclassname(long cPtr, boolean cMemoryOwn) {
        swigCMemOwn = cMemoryOwn;
        swigCPtr = cPtr;
    }

    public static long getCPtr($javaclassname obj) {
        return (obj == null) ? 0 : obj.swigCPtr;
    }
%}
/* the following handles the dependencies on qpol and apol */
%pragma(java) jniclassimports=%{
import com.tresys.setools.qpol.*;
import com.tresys.setools.apol.*;
%}
%pragma(java) jniclasscode=%{
	static {
		try
		{
			libseaudit_get_version ();
		}
		catch (UnsatisfiedLinkError ule)
		{
			System.loadLibrary("jseaudit");
		}
	}
%}
%pragma(java) moduleimports=%{
import com.tresys.setools.qpol.*;
import com.tresys.setools.apol.*;
%}
#else
/* not in java so handle size_t as architecture dependent */
#ifdef SWIGWORDSIZE64
typedef uint64_t size_t;
#else
typedef uint32_t size_t;
#endif
%{
#define BEGIN_EXCEPTION
#define END_EXCEPTION
%}
#endif

#ifdef SWIGJAVA
/* if java, pass the new exception macro to C not just SWIG */
#undef SWIG_exception
#define SWIG_exception(code, msg) {SWIG_JavaException(local_jenv, code, msg); goto fail;}
%inline %{
#undef SWIG_exception
#define SWIG_exception(code, msg) {SWIG_JavaException(local_jenv, code, msg); goto fail;}
%}
#endif

#ifdef SWIGTCL
/* implement a custom non thread-safe error handler */
%{
static char *message = NULL;
static void tcl_clear_error(void)
{
        free(message);
        message = NULL;
}
static void tcl_throw_error(const char *s)
{
	free(message);
	message = strdup(s);
}
static char *tcl_get_error(void)
{
	return message;
}
#undef SWIG_exception
#define SWIG_exception(code, msg) {tcl_throw_error(msg); goto fail;}
%}

%wrapper %{
/* Tcl module's initialization routine is expected to be named
 * Seaudit_Init(), but the output file will be called libtseaudit.so instead
 * of libseaudit.so.  Therefore add an alias from Tseaudit_Init() to the
 * real Seaudit_Init().
 */
SWIGEXPORT int Tseaudit_Init(Tcl_Interp *interp) {
	return SWIG_init(interp);
}
%}

%exception {
	char *err;
	tcl_clear_error();
	$action
	if ((err = tcl_get_error()) != NULL) {
                Tcl_Obj *obj = Tcl_NewStringObj(message, -1);
                Tcl_ResetResult(interp);
                Tcl_SetObjResult(interp, obj);
		goto fail;
	}
}
#undef SWIG_exception
#define SWIG_exception(code, msg) {tcl_throw_error(msg); goto fail;}
#endif

%inline %{
	typedef struct apol_string_vector apol_string_vector_t;
%}


#ifdef SWIGPYTHON
/* map python file to C FILE struct pointer */
%typemap(in) FILE * {
	if (!PyFile_Check($input)) {
		PyErr_SetString(PyExc_TypeError, "Need a file!");
		return NULL;
	}
	$1 = PyFile_AsFile($input);
}
/* map string into C-style memory buffer */
%typemap(in) (const char *buffer, const size_t bufsize) {
	$1 = PyString_AsString($input);
	$2 = (size_t) PyString_Size($input);
}
#endif
#ifdef SWIGJAVA
/* map string into C-style memory buffer */
%typemap(in, noblock=1) (const char *buffer, const size_t bufsize) {
  $1 = 0;
  $2 = 0;
  if ($input) {
    $1 = ($1_ltype)JCALL2(GetStringUTFChars, jenv, $input, 0);
    if (!$1) return $null;
    $2 = strlen($1);
  }
}
%typemap(freearg, noblock=1) (const char *buffer, const size_t bufsize) {
  if ($1) JCALL2(ReleaseStringUTFChars, jenv, $input, $1);
}
#endif
#ifdef SWIGTCL
%typemap(in) FILE * {
	ClientData c;
	if (Tcl_GetOpenFile(interp, Tcl_GetString($input), 0, 1, &c) == TCL_ERROR)
		SWIG_exception(SWIG_RuntimeError, Tcl_GetStringResult(interp));
	$1 = (FILE*)c;
}
#endif

/* from <time.h> */
%{
	typedef struct tm tm_t;
%}
typedef struct tm {
	int tm_sec;   /* seconds */
	int tm_min;   /* minutes */
	int tm_hour;  /* hours */
	int tm_mday;  /* day of the month */
	int tm_mon;   /* month */
	int tm_year;  /* year */
	int tm_wday;  /* day of the week */
	int tm_yday;  /* day in the year */
	int tm_isdst; /* daylight saving time */
} tm_t;
%extend tm_t {
	tm_t() {
		struct tm *t;
		BEGIN_EXCEPTION
		t = calloc(1, sizeof(struct tm));
		if (!t) {
			SWIG_exception(SWIG_MemoryError, "Out of memory");
		}
		END_EXCEPTION
	fail:
		return t;
	};
	~tm_t() {
		free(self);
	}
	/* use default accessor style for the rest */
};

const char *libseaudit_get_version(void);

/* seaudit log */
typedef enum seaudit_log_type
{
	SEAUDIT_LOG_TYPE_INVALID = 0,
	SEAUDIT_LOG_TYPE_SYSLOG,
	SEAUDIT_LOG_TYPE_AUDITD
} seaudit_log_type_e;
typedef struct seaudit_log {} seaudit_log_t;
%extend seaudit_log_t {
	seaudit_log_t() {
		seaudit_log_t *slog;
		BEGIN_EXCEPTION
		slog = seaudit_log_create(seaudit_swig_message_callback, seaudit_swig_message_callback_arg);
		if (!slog) {
			SWIG_exception(SWIG_MemoryError, "Out of memory");
		}
		END_EXCEPTION
	fail:
		return slog;
	};
	~seaudit_log_t() {
		seaudit_log_destroy(&self);
	};
	void clear () {
		seaudit_log_clear(self);
	};
	%newobject get_users();
	apol_string_vector_t *get_users() {
		apol_vector_t *v;
		BEGIN_EXCEPTION
		v = seaudit_log_get_users(self);
		if (!v) {
			SWIG_exception(SWIG_MemoryError, "Out of memory");
		}
		END_EXCEPTION
	fail:
		return (apol_string_vector_t*)v;
	};
	%newobject get_roles();
	apol_string_vector_t *get_roles() {
		apol_vector_t *v;
		BEGIN_EXCEPTION
		v = seaudit_log_get_roles(self);
		if (!v) {
			SWIG_exception(SWIG_MemoryError, "Out of memory");
		}
		END_EXCEPTION
	fail:
		return (apol_string_vector_t*)v;
	};
	%newobject get_types();
	apol_string_vector_t *get_types() {
		apol_vector_t *v;
		BEGIN_EXCEPTION
		v = seaudit_log_get_types(self);
		if (!v) {
			SWIG_exception(SWIG_MemoryError, "Out of memory");
		}
		END_EXCEPTION
	fail:
		return (apol_string_vector_t*)v;
	};
	%newobject get_classes();
	apol_string_vector_t *get_classes() {
		apol_vector_t *v;
		BEGIN_EXCEPTION
		v = seaudit_log_get_classes(self);
		if (!v) {
			SWIG_exception(SWIG_MemoryError, "Out of memory");
		}
		END_EXCEPTION
	fail:
		return (apol_string_vector_t*)v;
	};
};

/* seaudit message */
typedef enum seaudit_message_type
{
	SEAUDIT_MESSAGE_TYPE_INVALID = 0,
	SEAUDIT_MESSAGE_TYPE_BOOL,
	SEAUDIT_MESSAGE_TYPE_AVC,
	SEAUDIT_MESSAGE_TYPE_LOAD
} seaudit_message_type_e;
typedef struct seaudit_message {} seaudit_message_t;
%extend seaudit_message_t {
	seaudit_message_t() {
		BEGIN_EXCEPTION
		SWIG_exception(SWIG_RuntimeError, "Canot directly create seaudit_message_t objects");
		END_EXCEPTION
	fail:
		return NULL;
	};
	~seaudit_message_t() {
		/* no op */
		return;
	};
	seaudit_message_type_e get_type() {
		seaudit_message_type_e te;
		(void)seaudit_message_get_data(self, &te);
		return te;
	};
	void *get_data() {
		seaudit_message_type_e te;
		return seaudit_message_get_data(self, &te);
	};
	const char *get_host() {
		return seaudit_message_get_host(self);
	};
	const tm_t *get_time() {
		return seaudit_message_get_time(self);
	}
	%newobject to_string();
	char *to_string() {
		char *str;
		BEGIN_EXCEPTION
		str = seaudit_message_to_string(self);
		if (!str) {
			SWIG_exception(SWIG_MemoryError, "Out of memory");
		}
		END_EXCEPTION
	fail:
		return str;
	};
	%newobject to_string_html();
	char *to_string_html() {
		char *str;
		BEGIN_EXCEPTION
		str = seaudit_message_to_string_html(self);
		if (!str) {
			SWIG_exception(SWIG_MemoryError, "Out of memory");
		}
		END_EXCEPTION
	fail:
		return str;
	};
	%newobject to_misc_string();
	char *to_misc_string() {
		char *str;
		BEGIN_EXCEPTION
		str = seaudit_message_to_misc_string(self);
		if (!str) {
			SWIG_exception(SWIG_MemoryError, "Out of memory");
		}
		END_EXCEPTION
	fail:
		return str;
	};
};
%inline %{
	seaudit_message_t *seaudit_message_from_void(void *x) {
		return (seaudit_message_t*)x;
	};
%}

/* seaudit load message */
typedef struct seaudit_load_message {} seaudit_load_message_t;
%extend seaudit_load_message_t {
	seaudit_load_message_t() {
		BEGIN_EXCEPTION
		SWIG_exception(SWIG_RuntimeError, "Cannot directly create seaudit_load_message_t objects");
		END_EXCEPTION
	fail:
		return NULL;
	};
	~seaudit_load_message_t() {
		/* no op */
		return;
	};
};
%inline %{
	seaudit_load_message_t *seaudit_load_message_from_void(void *msg) {
		return (seaudit_load_message_t*)msg;
	};
%}

/* seaudit bool message */
typedef struct seaudit_bool_message {} seaudit_bool_message_t;
%extend seaudit_bool_message_t {
	seaudit_bool_message_t(void *msg) {
		BEGIN_EXCEPTION
		SWIG_exception(SWIG_RuntimeError, "Cannot directly create seaudit_bool_message_t objects");
		END_EXCEPTION
	fail:
		return NULL;
	};
	~seaudit_bool_message_t() {
		/* no op */
		return;
	};
};
%inline %{
	seaudit_bool_message_t *seaudit_bool_message_from_void(void *msg) {
		return (seaudit_bool_message_t*)msg;
	};
%}

/* seaudit avc message */
typedef enum seaudit_avc_message_type
{
	SEAUDIT_AVC_UNKNOWN = 0,
	SEAUDIT_AVC_DENIED,
	SEAUDIT_AVC_GRANTED
} seaudit_avc_message_type_e;
typedef struct seaudit_avc_message {} seaudit_avc_message_t;
%extend seaudit_avc_message_t {
	seaudit_avc_message_t() {
		BEGIN_EXCEPTION
		SWIG_exception(SWIG_RuntimeError, "Cannot directly create seaudit_avc_message_t objects");
		END_EXCEPTION
	fail:
		return NULL;
	};
	~seaudit_avc_message_t() {
		/* no op */
		return;
	};
	seaudit_avc_message_type_e get_message_type() {
		return seaudit_avc_message_get_message_type(self);
	};
	long get_timestamp_nano() {
		return seaudit_avc_message_get_timestamp_nano(self);
	};
	const char *get_source_user() {
		return seaudit_avc_message_get_source_user(self);
	};
	const char *get_source_role() {
		return seaudit_avc_message_get_source_role(self);
	};
	const char *get_source_type() {
		return seaudit_avc_message_get_source_type(self);
	};
	const char *get_target_user() {
		return seaudit_avc_message_get_target_user(self);
	};
	const char *get_target_role() {
		return seaudit_avc_message_get_target_role(self);
	};
	const char *get_target_type() {
		return seaudit_avc_message_get_target_type(self);
	};
	const char *get_object_class() {
		return seaudit_avc_message_get_object_class(self);
	};
	const apol_string_vector_t *get_perm() {
		return (apol_string_vector_t*)seaudit_avc_message_get_perm(self);
	};
	const char *get_exe() {
		return seaudit_avc_message_get_exe(self);
	};
	const char *get_comm() {
		return seaudit_avc_message_get_comm(self);
	};
	const char *get_name() {
		return seaudit_avc_message_get_name(self);
	};
	int get_pid() {
		return (int)seaudit_avc_message_get_pid(self);
	};
	long get_inode() {
		return (long)seaudit_avc_message_get_inode(self);
	};
	const char *get_path() {
		return seaudit_avc_message_get_path(self);
	};
	const char *get_dev() {
		return seaudit_avc_message_get_dev(self);
	};
	const char *get_netif() {
		return seaudit_avc_message_get_netif(self);
	};
	int get_port() {
		return seaudit_avc_message_get_port(self);
	};
	const char *get_laddr() {
		return seaudit_avc_message_get_laddr(self);
	};
	int get_lport() {
		return seaudit_avc_message_get_lport(self);
	};
	const char *get_faddr() {
		return seaudit_avc_message_get_faddr(self);
	};
	int get_fport() {
		return seaudit_avc_message_get_fport(self);
	};
	const char *get_saddr() {
		return seaudit_avc_message_get_saddr(self);
	};
	int get_sport() {
		return seaudit_avc_message_get_sport(self);
	};
	const char *get_daddr() {
		return seaudit_avc_message_get_daddr(self);
	};
	int get_dport() {
		return seaudit_avc_message_get_dport(self);
	};
	int get_key() {
		return seaudit_avc_message_get_key(self);
	};
	int get_cap() {
		return seaudit_avc_message_get_cap(self);
	};
};
%inline %{
	seaudit_avc_message_t *seaudit_avc_message_from_void(void *msg) {
		return (seaudit_avc_message_t*)msg;
	};
%}

/* Java does not permit parsing directly from a file; parsing may only
   be done through a memory buffer. */
#ifndef SWIGJAVA
int seaudit_log_parse(seaudit_log_t * log, FILE * syslog);
#endif
int seaudit_log_parse_buffer(seaudit_log_t * log, const char *buffer, const size_t bufsize);

/* seaudit filter */
typedef enum seaudit_filter_match
{
	SEAUDIT_FILTER_MATCH_ALL = 0,
	SEAUDIT_FILTER_MATCH_ANY
} seaudit_filter_match_e;
typedef enum seaudit_filter_visible
{
	SEAUDIT_FILTER_VISIBLE_SHOW = 0,
	SEAUDIT_FILTER_VISIBLE_HIDE
} seaudit_filter_visible_e;
typedef enum seaudit_filter_date_match
{
	SEAUDIT_FILTER_DATE_MATCH_BEFORE = 0,
	SEAUDIT_FILTER_DATE_MATCH_AFTER,
	SEAUDIT_FILTER_DATE_MATCH_BETWEEN
} seaudit_filter_date_match_e;
typedef struct seaudit_filter {} seaudit_filter_t;
%extend seaudit_filter_t {
	seaudit_filter_t(char *name = NULL) {
		seaudit_filter_t *sf = NULL;
		BEGIN_EXCEPTION
		sf = seaudit_filter_create(name);
		if (!sf) {
			SWIG_exception(SWIG_MemoryError, "Out of memory");
		}
		END_EXCEPTION
	fail:
		return sf;
	};
	seaudit_filter_t(seaudit_filter_t *in) {
		seaudit_filter_t *sf = NULL;
		BEGIN_EXCEPTION
		sf = seaudit_filter_create_from_filter(in);
		if (!sf) {
			SWIG_exception(SWIG_MemoryError, "Out of memory");
		}
		END_EXCEPTION
	fail:
		return sf;
	};
	~seaudit_filter_t() {
		seaudit_filter_destroy(&self);
	};
	void save(char *path) {
		BEGIN_EXCEPTION
		if (seaudit_filter_save_to_file(self, path)) {
			SWIG_exception(SWIG_RuntimeError, "Could not save filter");
		}
		END_EXCEPTION
	fail:
		return;
	};
	void set_match(seaudit_filter_match_e match) {
		BEGIN_EXCEPTION
		if (seaudit_filter_set_match(self, match)) {
			SWIG_exception(SWIG_RuntimeError, "Could not set filter matching method");
		}
		END_EXCEPTION
	fail:
		return;
	}
	seaudit_filter_match_e get_match() {
		return seaudit_filter_get_match(self);
	};
	void set_name(char *name) {
		BEGIN_EXCEPTION
		if (seaudit_filter_set_name(self, name)) {
			SWIG_exception(SWIG_RuntimeError, "Could not set filter name");
		}
		END_EXCEPTION
	fail:
		return;
	};
	const char *get_name() {
		return seaudit_filter_get_name(self);
	};
	void set_description(char *description) {
		BEGIN_EXCEPTION
		if (seaudit_filter_set_description(self, description)) {
			SWIG_exception(SWIG_RuntimeError, "Could not set filter description");
		}
		END_EXCEPTION
	fail:
		return;
	};
	const char *get_description() {
		return seaudit_filter_get_description(self);
	};
	void set_strict(bool is_strict) {
		seaudit_filter_set_strict(self, is_strict);
	};
	bool get_strict() {
		return seaudit_filter_get_strict(self);
	};
	void set_source_user(apol_string_vector_t *v) {
		BEGIN_EXCEPTION
		if (seaudit_filter_set_source_user(self, (apol_vector_t*)v)) {
			SWIG_exception(SWIG_RuntimeError, "Could not set source user list for filter");
		}
		END_EXCEPTION
	fail:
		return;
	};
	const apol_string_vector_t *get_source_user() {
		return (apol_string_vector_t*)seaudit_filter_get_source_user(self);
	};
	void set_source_role(apol_string_vector_t *v) {
		BEGIN_EXCEPTION
		if (seaudit_filter_set_source_role(self, (apol_vector_t*)v)) {
			SWIG_exception(SWIG_RuntimeError, "Could not set source role list for filter");
		}
		END_EXCEPTION
	fail:
		return;
	};
	const apol_string_vector_t *get_source_role() {
		return (apol_string_vector_t*)seaudit_filter_get_source_role(self);
	};
	void set_source_type(apol_string_vector_t *v) {
		BEGIN_EXCEPTION
		if (seaudit_filter_set_source_type(self, (apol_vector_t*)v)) {
			SWIG_exception(SWIG_RuntimeError, "Could not set source type list for filter");
		}
		END_EXCEPTION
	fail:
		return;
	};
	const apol_string_vector_t *get_source_type() {
		return (apol_string_vector_t*)seaudit_filter_get_source_type(self);
	};
	void set_target_user(apol_string_vector_t *v) {
		BEGIN_EXCEPTION
		if (seaudit_filter_set_target_user(self, (apol_vector_t*)v)) {
			SWIG_exception(SWIG_RuntimeError, "Could not set target user list for filter");
		}
		END_EXCEPTION
	fail:
		return;
	};
	const apol_string_vector_t *get_target_user() {
		return (apol_string_vector_t*)seaudit_filter_get_target_user(self);
	};
	void set_target_role(apol_string_vector_t *v) {
		BEGIN_EXCEPTION
		if (seaudit_filter_set_target_role(self, (apol_vector_t*)v)) {
			SWIG_exception(SWIG_RuntimeError, "Could not set target role list for filter");
		}
		END_EXCEPTION
	fail:
		return;
	};
	const apol_string_vector_t *get_target_role() {
		return (apol_string_vector_t*)seaudit_filter_get_target_role(self);
	};
	void set_target_type(apol_string_vector_t *v) {
		BEGIN_EXCEPTION
		if (seaudit_filter_set_target_type(self, (apol_vector_t*)v)) {
			SWIG_exception(SWIG_RuntimeError, "Could not set target type list for filter");
		}
		END_EXCEPTION
	fail:
		return;
	};
	const apol_string_vector_t *get_target_type() {
		return (apol_string_vector_t*)seaudit_filter_get_target_type(self);
	};
	void set_target_class(apol_string_vector_t *v) {
		BEGIN_EXCEPTION
		if (seaudit_filter_set_target_class(self, (apol_vector_t*)v)) {
			SWIG_exception(SWIG_RuntimeError, "Could not set target class list for filter");
		}
		END_EXCEPTION
	fail:
		return;
	};
	const apol_string_vector_t *get_target_class() {
		return (apol_string_vector_t*)seaudit_filter_get_target_class(self);
	};
	void set_permission(char *name) {
		BEGIN_EXCEPTION
		if (seaudit_filter_set_permission(self, name)) {
			SWIG_exception(SWIG_RuntimeError, "Could not set permission for filter");
		}
		END_EXCEPTION
	fail:
		return;
	};
	const char *get_permission() {
		return seaudit_filter_get_permission(self);
	};
	void set_executable(char *name) {
		BEGIN_EXCEPTION
		if (seaudit_filter_set_executable(self, name)) {
			SWIG_exception(SWIG_RuntimeError, "Could not set executable for filter");
		}
		END_EXCEPTION
	fail:
		return;
	};
	const char *get_executable() {
		return seaudit_filter_get_executable(self);
	};
	void set_host(char *name) {
		BEGIN_EXCEPTION
		if (seaudit_filter_set_host(self, name)) {
			SWIG_exception(SWIG_RuntimeError, "Could not set host for filter");
		}
		END_EXCEPTION
	fail:
		return;
	};
	const char *get_host() {
		return seaudit_filter_get_host(self);
	};
	void set_path(char *path) {
		BEGIN_EXCEPTION
		if (seaudit_filter_set_path(self, path)) {
			SWIG_exception(SWIG_RuntimeError, "Could not set path for filter");
		}
		END_EXCEPTION
	fail:
		return;
	};
	const char *get_path() {
		return seaudit_filter_get_path(self);
	};
	void set_command(char *name) {
		BEGIN_EXCEPTION
		if (seaudit_filter_set_command(self, name)) {
			SWIG_exception(SWIG_RuntimeError, "Could not set command for filter");
		}
		END_EXCEPTION
	fail:
		return;
	};
	void set_inode(long inode) {
		seaudit_filter_set_inode(self, (long) inode);
	};
	long get_inode() {
		return (long) seaudit_filter_get_inode(self);
	};
	void set_pid(long pid) {
		seaudit_filter_set_pid(self, (unsigned int) pid);
	};
	long get_pid() {
		return (long) seaudit_filter_get_pid(self);
	};
	const char *get_command() {
		return seaudit_filter_get_command(self);
	};
	void set_anyaddr(char *name) {
		BEGIN_EXCEPTION
		if (seaudit_filter_set_anyaddr(self, name)) {
			SWIG_exception(SWIG_RuntimeError, "Could not set ip address for filter");
		}
		END_EXCEPTION
	fail:
		return;
	};
	const char *get_anyaddr() {
		return seaudit_filter_get_anyaddr(self);
	};
	void set_anyport(int port) {
		seaudit_filter_set_anyport(self, port);
	};
	int get_anyport() {
		return seaudit_filter_get_anyport(self);
	};
	void set_laddr(char *name) {
		BEGIN_EXCEPTION
		if (seaudit_filter_set_laddr(self, name)) {
			SWIG_exception(SWIG_RuntimeError, "Could not set local address for filter");
		}
		END_EXCEPTION
	fail:
		return;
	};
	const char *get_laddr() {
		return seaudit_filter_get_laddr(self);
	};
	void set_lport(int port) {
		seaudit_filter_set_lport(self, port);
	};
	int get_lport() {
		return seaudit_filter_get_lport(self);
	};
	void set_faddr(char *name) {
		BEGIN_EXCEPTION
		if (seaudit_filter_set_faddr(self, name)) {
			SWIG_exception(SWIG_RuntimeError, "Could not set foreign address for filter");
		}
		END_EXCEPTION
	fail:
		return;
	};
	const char *get_faddr() {
		return seaudit_filter_get_faddr(self);
	};
	void set_fport(int port) {
		seaudit_filter_set_fport(self, port);
	};
	int get_fport() {
		return seaudit_filter_get_fport(self);
	};
	void set_saddr(char *name) {
		BEGIN_EXCEPTION
		if (seaudit_filter_set_saddr(self, name)) {
			SWIG_exception(SWIG_RuntimeError, "Could not set source address for filter");
		}
		END_EXCEPTION
	fail:
		return;
	};
	const char *get_saddr() {
		return seaudit_filter_get_saddr(self);
	};
	void set_sport(int port) {
		seaudit_filter_set_sport(self, port);
	};
	int get_sport() {
		return seaudit_filter_get_sport(self);
	};
	void set_daddr(char *name) {
		BEGIN_EXCEPTION
		if (seaudit_filter_set_daddr(self, name)) {
			SWIG_exception(SWIG_RuntimeError, "Could not set destination address for filter");
		}
		END_EXCEPTION
	fail:
		return;
	};
	const char *get_daddr() {
		return seaudit_filter_get_daddr(self);
	};
	void set_dport(int port) {
		seaudit_filter_set_dport(self, port);
	};
	int get_dport() {
		return seaudit_filter_get_dport(self);
	};
	void set_port(int port) {
		seaudit_filter_set_port(self, port);
	};
	int get_port() {
		return seaudit_filter_get_port(self);
	};
	void set_netif(char *name) {
		BEGIN_EXCEPTION
		if (seaudit_filter_set_netif(self, name)) {
			SWIG_exception(SWIG_RuntimeError, "Could not set network interface for filter");
		}
		END_EXCEPTION
	fail:
		return;
	};
	const char *get_netif() {
		return seaudit_filter_get_netif(self);
	};
	void set_key(int key) {
		seaudit_filter_set_key(self, key);
	};
	int get_key() {
		return seaudit_filter_get_key(self);
	};
	void set_cap(int cap) {
		seaudit_filter_set_cap(self, cap);
	};
	int get_cap() {
		return seaudit_filter_get_cap(self);
	};
	void set_message_type(seaudit_avc_message_type_e mtype) {
		BEGIN_EXCEPTION
		if (seaudit_filter_set_message_type(self, mtype)) {
			SWIG_exception(SWIG_RuntimeError, "Could not set message type for filter");
		}
		END_EXCEPTION
	fail:
		return;
	};
	seaudit_message_type_e get_message_type() {
		return seaudit_filter_get_message_type(self);
	};
	void set_date(struct tm *start, struct tm *end, seaudit_filter_date_match_e match) {
		BEGIN_EXCEPTION
		if (seaudit_filter_set_date(self, start, end, match)) {
			SWIG_exception(SWIG_RuntimeError, "Could not set date for filter");
		}
		END_EXCEPTION
	fail:
		return;
	};
	const struct tm *get_start_date() {
		const struct tm *s;
		const struct tm *e;
		seaudit_filter_date_match_e m;
		seaudit_filter_get_date(self, &s, &e, &m);
		return s;
	};
	const struct tm *get_end_date() {
		const struct tm *s;
		const struct tm *e;
		seaudit_filter_date_match_e m;
		seaudit_filter_get_date(self, &s, &e, &m);
		return e;
	};
	seaudit_filter_date_match_e get_date_match() {
		const struct tm *s;
		const struct tm *e;
		seaudit_filter_date_match_e m;
		seaudit_filter_get_date(self, &s, &e, &m);
		return m;
	};
};
%newobject seaudit_filter_create_from_file(const char*);
apol_vector_t *seaudit_filter_create_from_file(const char *filename);
%inline %{
	seaudit_filter_t *seaudit_filter_from_void(void *x) {
		return (seaudit_filter_t*)x;
	};
%}

/* seaudit sort */
typedef struct seaudit_sort {} seaudit_sort_t;
%extend seaudit_sort_t {
	seaudit_sort_t() {
		BEGIN_EXCEPTION
		SWIG_exception(SWIG_RuntimeError, "Cannot directly create seaudit_sort_t objects");
		END_EXCEPTION
	fail:
		return NULL;
	};
	seaudit_sort_t(seaudit_sort_t *in) {
		seaudit_sort_t *ss = NULL;
		BEGIN_EXCEPTION
		ss = seaudit_sort_create_from_sort(in);
		if (!ss) {
			SWIG_exception(SWIG_MemoryError, "Out of memory");
		}
		END_EXCEPTION
	fail:
		return ss;
	};
        ~seaudit_sort_t() {
		seaudit_sort_destroy(&self);
	};
};
%newobject seaudit_sort_by_message_type(const int);
seaudit_sort_t *seaudit_sort_by_message_type(const int direction);
%newobject seaudit_sort_by_date(const int);
seaudit_sort_t *seaudit_sort_by_date(const int direction);
%newobject seaudit_sort_by_host(const int);
seaudit_sort_t *seaudit_sort_by_host(const int direction);
%newobject seaudit_sort_by_permission(const int);
seaudit_sort_t *seaudit_sort_by_permission(const int direction);
%newobject seaudit_sort_by_source_user(const int);
seaudit_sort_t *seaudit_sort_by_source_user(const int direction);
%newobject seaudit_sort_by_source_role(const int);
seaudit_sort_t *seaudit_sort_by_source_role(const int direction);
%newobject seaudit_sort_by_source_type(const int);
seaudit_sort_t *seaudit_sort_by_source_type(const int direction);
%newobject seaudit_sort_by_target_user(const int);
seaudit_sort_t *seaudit_sort_by_target_user(const int direction);
%newobject seaudit_sort_by_target_role(const int);
seaudit_sort_t *seaudit_sort_by_target_role(const int direction);
%newobject seaudit_sort_by_target_type(const int);
seaudit_sort_t *seaudit_sort_by_target_type(const int direction);
%newobject seaudit_sort_by_object_class(const int);
seaudit_sort_t *seaudit_sort_by_object_class(const int direction);
%newobject seaudit_sort_by_executable(const int);
seaudit_sort_t *seaudit_sort_by_executable(const int direction);
%newobject seaudit_sort_by_command(const int);
seaudit_sort_t *seaudit_sort_by_command(const int direction);
%newobject seaudit_sort_by_name(const int);
seaudit_sort_t *seaudit_sort_by_name(const int direction);
%newobject seaudit_sort_by_path(const int);
seaudit_sort_t *seaudit_sort_by_path(const int direction);
%newobject seaudit_sort_by_device(const int);
seaudit_sort_t *seaudit_sort_by_device(const int direction);
%newobject seaudit_sort_by_inode(const int);
seaudit_sort_t *seaudit_sort_by_inode(const int direction);
%newobject seaudit_sort_by_pid(const int);
seaudit_sort_t *seaudit_sort_by_pid(const int direction);
%newobject seaudit_sort_by_port(const int);
extern seaudit_sort_t *seaudit_sort_by_port(const int direction);
%newobject seaudit_sort_by_laddr(const int);
extern seaudit_sort_t *seaudit_sort_by_laddr(const int direction);
%newobject seaudit_sort_by_lport(const int);
extern seaudit_sort_t *seaudit_sort_by_lport(const int direction);
%newobject seaudit_sort_by_faddr(const int);
extern seaudit_sort_t *seaudit_sort_by_faddr(const int direction);
%newobject seaudit_sort_by_fport(const int);
extern seaudit_sort_t *seaudit_sort_by_fport(const int direction);
%newobject seaudit_sort_by_saddr(const int);
extern seaudit_sort_t *seaudit_sort_by_saddr(const int direction);
%newobject seaudit_sort_by_sport(const int);
extern seaudit_sort_t *seaudit_sort_by_sport(const int direction);
%newobject seaudit_sort_by_daddr(const int);
extern seaudit_sort_t *seaudit_sort_by_daddr(const int direction);
%newobject seaudit_sort_by_dport(const int);
extern seaudit_sort_t *seaudit_sort_by_dport(const int direction);
%newobject seaudit_sort_by_key(const int);
extern seaudit_sort_t *seaudit_sort_by_key(const int direction);
%newobject seaudit_sort_by_cap(const int);
extern seaudit_sort_t *seaudit_sort_by_cap(const int direction);

/* seaudit model */
#ifdef SWIGPYTHON
/* handle ownership of filters and sorts passed to the model */
%typemap(in) seaudit_filter_t *filter {
	void *x = NULL;
	Py_IncRef($input);
	SWIG_ConvertPtr($input, &x,SWIGTYPE_p_seaudit_filter, 0 |  0 );
	$1 = (seaudit_filter_t*)x;
}
%typemap(in) seaudit_sort_t *ssort {
	void *x = NULL;
	Py_IncRef($input);
	SWIG_ConvertPtr($input, &x,SWIGTYPE_p_seaudit_sort, 0 |  0 );
	$1 = (seaudit_sort_t*)x;
}
#endif
typedef struct seaudit_model {} seaudit_model_t;
%extend seaudit_model_t {
	seaudit_model_t(char *name = NULL, seaudit_log_t *slog = NULL) {
		seaudit_model_t *smod;
		BEGIN_EXCEPTION
		smod = seaudit_model_create(name, slog);
		if (!smod) {
			SWIG_exception(SWIG_MemoryError, "Out of memory");
		}
		END_EXCEPTION
	fail:
		return smod;
	};
	seaudit_model_t(seaudit_model_t *in) {
		seaudit_model_t *smod;
		BEGIN_EXCEPTION
		smod = seaudit_model_create_from_model(in);
		if (!smod) {
			SWIG_exception(SWIG_MemoryError, "Out of memory");
		}
		END_EXCEPTION
	fail:
		return smod;
	};
	seaudit_model_t(char *path) {
		seaudit_model_t *smod;
		BEGIN_EXCEPTION
		smod = seaudit_model_create_from_file(path);
		if (!smod) {
			SWIG_exception(SWIG_MemoryError, "Out of memory");
		}
		END_EXCEPTION
	fail:
		return smod;
	}
	~seaudit_model_t() {
		seaudit_model_destroy(&self);
	};
	void save(char *path) {
		BEGIN_EXCEPTION
		if (seaudit_model_save_to_file(self, path)) {
			SWIG_exception(SWIG_RuntimeError, "Could not save seaudit model");
		}
		END_EXCEPTION
	fail:
		return;
	}
	const char *get_name() {
		return seaudit_model_get_name(self);
	};
	void set_name(char *name) {
		BEGIN_EXCEPTION
		if (seaudit_model_set_name(self, name)) {
			SWIG_exception(SWIG_RuntimeError, "Could not set model name");
		}
		END_EXCEPTION
	fail:
		return;
	};
	void append_log(seaudit_log_t *slog) {
		BEGIN_EXCEPTION
		if (seaudit_model_append_log(self, slog)) {
			SWIG_exception(SWIG_RuntimeError, "Could not append log to model");
		}
		END_EXCEPTION
	fail:
		return;
	};
	void append_filter(seaudit_filter_t *filter) {
		BEGIN_EXCEPTION
#ifdef SWIGJAVA /* duplicate so the garbage collector does not double free */
		seaudit_filter_t *tmp = seaudit_filter_create_from_filter(filter);
		if (seaudit_model_append_filter(self, tmp)) {
			seaudit_filter_destroy(&tmp);
			SWIG_exception(SWIG_RuntimeError, "Could not append filter to model");
		}
#else
		if (seaudit_model_append_filter(self, filter)) {
			SWIG_exception(SWIG_RuntimeError, "Could not append filter to model");
		}
#endif
		END_EXCEPTION
	fail:
		return;
	};
	const apol_vector_t *get_filters() {
		return seaudit_model_get_filters(self);
	};
	%delobject remove_filter();
	void remove_filter(seaudit_filter_t *filter) {
		BEGIN_EXCEPTION
		if (seaudit_model_remove_filter(self, filter)) {
			SWIG_exception(SWIG_ValueError, "Could not remove filter");
		}
		END_EXCEPTION
	fail:
		return;
	};
	void set_filter_match(seaudit_filter_match_e match) {
		BEGIN_EXCEPTION
		if (seaudit_model_set_filter_match(self, match)) {
			SWIG_exception(SWIG_RuntimeError, "Could not set filter matching method for model");
		}
		END_EXCEPTION
	fail:
		return;
	};
	seaudit_filter_match_e get_filter_match() {
		return seaudit_model_get_filter_match(self);
	};
	void set_filter_visible(seaudit_filter_visible_e vis) {
		BEGIN_EXCEPTION
		if (seaudit_model_set_filter_visible(self, vis)) {
			SWIG_exception(SWIG_RuntimeError, "Could not set filter visibility for model");
		}
		END_EXCEPTION
	fail:
		return;
	};
	seaudit_filter_visible_e get_filter_visible() {
		return seaudit_model_get_filter_visible(self);
	};
	void append_sort(seaudit_sort_t *ssort) {
		BEGIN_EXCEPTION
#ifdef SWIGJAVA
		seaudit_sort_t *tmp = seaudit_sort_create_from_sort(ssort);
		if (seaudit_model_append_sort(self, tmp)) {
			seaudit_sort_destroy(&tmp);
			SWIG_exception(SWIG_RuntimeError, "Could not append sort to model");
		}
#else
		if (seaudit_model_append_sort(self, ssort)) {
			SWIG_exception(SWIG_RuntimeError, "Could not append sort to model");
		}
#endif
		END_EXCEPTION
	fail:
		return;
	};
	void clear_sorts() {
		BEGIN_EXCEPTION
		if (seaudit_model_clear_sorts(self)) {
			SWIG_exception(SWIG_RuntimeError, "Could not clear model sorting criteria");
		}
		END_EXCEPTION
	fail:
		return;
	};
	int is_changed() {
		return seaudit_model_is_changed(self);
	};
	%newobject get_messages(seaudit_log_t*);
	apol_vector_t *get_messages(seaudit_log_t *slog) {
		apol_vector_t *v = NULL;
		BEGIN_EXCEPTION
		v = seaudit_model_get_messages(slog, self);
		if (!v) {
			SWIG_exception(SWIG_MemoryError, "Out of memory");
		}
		END_EXCEPTION
	fail:
		return v;
	};
	%newobject get_malformed_messages(seaudit_log_t*);
	apol_vector_t *get_malformed_messages(seaudit_log_t *slog) {
		apol_vector_t *v = NULL;
		BEGIN_EXCEPTION
		v = seaudit_model_get_malformed_messages(slog, self);
		if (!v) {
			SWIG_exception(SWIG_MemoryError, "Out of memory");
		}
		END_EXCEPTION
	fail:
		return v;
	};
	void hide_message(seaudit_message_t *message) {
		seaudit_model_hide_message(self, message);
	};
	size_t get_num_allows(seaudit_log_t *slog) {
		return seaudit_model_get_num_allows(slog, self);
	};
	size_t get_num_denies(seaudit_log_t *slog) {
		return seaudit_model_get_num_denies(slog, self);
	};
	size_t get_num_bools(seaudit_log_t *slog) {
		return seaudit_model_get_num_bools(slog, self);
	};
	size_t get_num_loads(seaudit_log_t *slog) {
		return seaudit_model_get_num_loads(slog, self);
	};
};

/* seaudit report */
typedef enum seaudit_report_format
{
	SEAUDIT_REPORT_FORMAT_TEXT,
	SEAUDIT_REPORT_FORMAT_HTML
} seaudit_report_format_e;
typedef struct seaudit_report {} seaudit_report_t;
%extend seaudit_report_t {
	seaudit_report_t(seaudit_model_t *m) {
		seaudit_report_t *sr;
		BEGIN_EXCEPTION
		sr = seaudit_report_create(m);
		if (!sr) {
			SWIG_exception(SWIG_MemoryError, "Out of memory");
		}
		END_EXCEPTION
	fail:
		return sr;
	};
	~seaudit_report_t() {
		seaudit_report_destroy(&self);
	};
	void write(seaudit_log_t *slog, char *path) {
		BEGIN_EXCEPTION
		if (seaudit_report_write(slog, self, path)) {
			SWIG_exception(SWIG_RuntimeError, "Could not write report to file");
		}
		END_EXCEPTION
	fail:
		return;
	};
	void set_format(seaudit_log_t *slog, seaudit_report_format_e format) {
		BEGIN_EXCEPTION
		if (seaudit_report_set_format(slog, self, format)) {
			SWIG_exception(SWIG_RuntimeError, "Could not set report format");
		}
		END_EXCEPTION
	fail:
		return;
	};
	void set_configuration(seaudit_log_t *slog, char *path) {
		BEGIN_EXCEPTION
		if (seaudit_report_set_configuration(slog, self, path)) {
			SWIG_exception(SWIG_RuntimeError, "Could not set report configuration file");
		}
		END_EXCEPTION
	fail:
		return;
	};
	void set_stylesheet(seaudit_log_t *slog, char *path, int use_stylesheet) {
		BEGIN_EXCEPTION
		if (seaudit_report_set_stylesheet(slog, self, path, use_stylesheet)) {
			SWIG_exception(SWIG_RuntimeError, "Could not set report stylesheet");
		}
		END_EXCEPTION
	fail:
		return;
	};
	void set_malformed(seaudit_log_t *slog, int do_malformed) {
		BEGIN_EXCEPTION
		if (seaudit_report_set_malformed(slog, self, do_malformed)) {
			SWIG_exception(SWIG_RuntimeError, "Could not set report malformed flag");
		}
		END_EXCEPTION
	fail:
		return;
	};
};