Browse code

Add functions to set the stats callbacks. Don't submit stats when verifying CVDs.

Shawn Webb authored on 2014/01/08 05:14:17
Showing 3 changed files
... ...
@@ -1784,6 +1784,7 @@ test_database (const char *newfile, const char *newdb, int bytecode)
1784 1784
     {
1785 1785
         return FCE_TESTFAIL;
1786 1786
     }
1787
+    cl_engine_set_clcb_stats_submit(engine, NULL);
1787 1788
 
1788 1789
     if ((ret =
1789 1790
          cl_load (newfile, engine, &newsigs,
... ...
@@ -567,6 +567,7 @@ int cl_cvdverify(const char *file)
567 567
 	fclose(fs);
568 568
 	return CL_EMEM;
569 569
     }
570
+    engine->cb_stats_submit = NULL; /* Don't submit stats if we're just verifying a CVD */
570 571
 
571 572
     ret = cli_cvdload(fs, engine, NULL, CL_DB_STDOPT | CL_DB_PUA, !!cli_strbcasestr(file, ".cld"), file, 1);
572 573
 
... ...
@@ -461,3 +461,48 @@ static cli_flagged_sample_t *find_sample(cli_intel_t *intel, const char *virname
461 461
 
462 462
     return NULL;
463 463
 }
464
+
465
+void cl_engine_set_clcb_stats_submit(struct cl_engine *engine, clcb_stats_submit callback)
466
+{
467
+    engine->cb_stats_submit = callback;
468
+}
469
+
470
+void cl_engine_stats_set_cbdata(struct cl_engine *engine, void *cbdata)
471
+{
472
+    engine->stats_data = cbdata;
473
+}
474
+
475
+void cl_engine_set_clcb_stats_add_sample(struct cl_engine *engine, clcb_stats_add_sample callback)
476
+{
477
+    engine->cb_stats_add_sample = callback;
478
+}
479
+
480
+void cl_engine_set_clcb_stats_remove_sample(struct cl_engine *engine, clcb_stats_remove_sample callback)
481
+{
482
+    engine->cb_stats_remove_sample = callback;
483
+}
484
+
485
+void cl_engine_set_clcb_stats_decrement_count(struct cl_engine *engine, clcb_stats_decrement_count callback)
486
+{
487
+    engine->cb_stats_decrement_count = callback;
488
+}
489
+
490
+void cl_engine_set_clcb_stats_flush(struct cl_engine *engine, clcb_stats_flush callback)
491
+{
492
+    engine->cb_stats_flush = callback;
493
+}
494
+
495
+void cl_engine_set_clcb_stats_get_num(struct cl_engine *engine, clcb_stats_get_num callback)
496
+{
497
+    engine->cb_stats_get_num = callback;
498
+}
499
+
500
+void cl_engine_set_clcb_stats_get_size(struct cl_engine *engine, clcb_stats_get_size callback)
501
+{
502
+    engine->cb_stats_get_size = callback;
503
+}
504
+
505
+void cl_engine_set_clcb_stats_get_hostid(struct cl_engine *engine, clcb_stats_get_hostid callback)
506
+{
507
+    engine->cb_stats_get_hostid = callback;
508
+}