Browse code

Copy over the stats callbacks with the settings object

Shawn Webb authored on 2014/01/16 04:22:53
Showing 2 changed files
... ...
@@ -699,6 +699,16 @@ struct cl_settings *cl_engine_settings_copy(const struct cl_engine *engine)
699 699
     settings->cb_meta = engine->cb_meta;
700 700
     settings->engine_options = engine->engine_options;
701 701
 
702
+    settings->stats_data = engine->stats_data;
703
+    settings->cb_stats_add_sample = engine->cb_stats_add_sample;
704
+    settings->cb_stats_remove_sample = engine->cb_stats_remove_sample;
705
+    settings->cb_stats_decrement_count = engine->cb_stats_decrement_count;
706
+    settings->cb_stats_submit = engine->cb_stats_submit;
707
+    settings->cb_stats_flush = engine->cb_stats_flush;
708
+    settings->cb_stats_get_num = engine->cb_stats_get_num;
709
+    settings->cb_stats_get_size = engine->cb_stats_get_size;
710
+    settings->cb_stats_get_hostid = engine->cb_stats_get_hostid;
711
+
702 712
     return settings;
703 713
 }
704 714
 
... ...
@@ -752,6 +762,16 @@ int cl_engine_settings_apply(struct cl_engine *engine, const struct cl_settings
752 752
     engine->cb_hash = settings->cb_hash;
753 753
     engine->cb_meta = settings->cb_meta;
754 754
 
755
+    engine->stats_data = settings->stats_data;
756
+    engine->cb_stats_add_sample = settings->cb_stats_add_sample;
757
+    engine->cb_stats_remove_sample = settings->cb_stats_remove_sample;
758
+    engine->cb_stats_decrement_count = settings->cb_stats_decrement_count;
759
+    engine->cb_stats_submit = settings->cb_stats_submit;
760
+    engine->cb_stats_flush = settings->cb_stats_flush;
761
+    engine->cb_stats_get_num = settings->cb_stats_get_num;
762
+    engine->cb_stats_get_size = settings->cb_stats_get_size;
763
+    engine->cb_stats_get_hostid = settings->cb_stats_get_hostid;
764
+
755 765
     return CL_SUCCESS;
756 766
 }
757 767
 
... ...
@@ -367,6 +367,17 @@ struct cl_settings {
367 367
     uint64_t maxhtmlnotags; /* max size for scanning normalized HTML */
368 368
     uint64_t maxscriptnormalize; /* max size to normalize scripts */
369 369
     uint64_t maxziptypercg; /* max size to re-do zip filetype */
370
+
371
+    /* Statistics/intelligence gathering */
372
+    void *stats_data;
373
+    clcb_stats_add_sample cb_stats_add_sample;
374
+    clcb_stats_remove_sample cb_stats_remove_sample;
375
+    clcb_stats_decrement_count cb_stats_decrement_count;
376
+    clcb_stats_submit cb_stats_submit;
377
+    clcb_stats_flush cb_stats_flush;
378
+    clcb_stats_get_num cb_stats_get_num;
379
+    clcb_stats_get_size cb_stats_get_size;
380
+    clcb_stats_get_hostid cb_stats_get_hostid;
370 381
 };
371 382
 
372 383
 extern int (*cli_unrar_open)(int fd, const char *dirname, unrar_state_t *state);