int cfg_srv_transfer_preview(char *directive, char **argv, void *setdata) { struct ci_service_xdata *srv_xdata = ( struct ci_service_xdata *)setdata; if (argv == NULL || argv[0] == NULL) { ci_debug_printf(1, "Missing arguments in directive %s \n", directive); return 0; } ci_debug_printf(1, "Setting parameter :%s=%s\n", directive, argv[0]); ci_service_set_transfer_preview(srv_xdata,argv[0]); return 1; }
int srvclamav_init_service(ci_service_xdata_t * srv_xdata, struct ci_server_conf *server_conf) { int ret, i; magic_db = server_conf->MAGIC_DB; scantypes = (int *) malloc(ci_magic_types_num(magic_db) * sizeof(int)); scangroups = (int *) malloc(ci_magic_groups_num(magic_db) * sizeof(int)); for (i = 0; i < ci_magic_types_num(magic_db); i++) scantypes[i] = 0; for (i = 0; i < ci_magic_groups_num(magic_db); i++) scangroups[i] = 0; ci_debug_printf(10, "Going to initialize srvclamav\n"); ret = init_virusdb(); if (!ret) return 0; srv_clamav_xdata = srv_xdata; /*Needed by db_reload command */ set_istag(srv_clamav_xdata); ci_service_set_preview(srv_xdata, 1024); ci_service_enable_204(srv_xdata); ci_service_set_transfer_preview(srv_xdata, "*"); /*Initialize object pools*/ AVREQDATA_POOL = ci_object_pool_register("av_req_data_t", sizeof(av_req_data_t)); if(AVREQDATA_POOL < 0) { ci_debug_printf(1, " srvclamav_init_service: error registering object_pool av_req_data_t\n"); return 0; } /*initialize service commands */ register_command("srv_clamav:dbreload", MONITOR_PROC_CMD | CHILDS_PROC_CMD, dbreload_command); return 1; }
/* This function will be called when the service loaded */ int search_record_init_service(ci_service_xdata_t * srv_xdata, struct ci_server_conf *server_conf) { ci_debug_printf(5, "Initialization of Search Record module......\n"); /*Tell to the icap clients that we can support up to 1024 size of preview data*/ ci_service_set_preview(srv_xdata, 128); /*Tell to the icap clients that we support 204 responses*/ ci_service_enable_204(srv_xdata); /*Tell to the icap clients to send preview data for all files*/ ci_service_set_transfer_preview(srv_xdata, "*"); /*Tell to the icap clients that we want the X-Authenticated-User and X-Authenticated-Groups headers which contains the username and the groups in which belongs. */ /*ci_service_set_xopts(srv_xdata, CI_XAUTHENTICATEDUSER|CI_XAUTHENTICATEDGROUPS);*/ initPairs(&search_engine); addNewPair(&search_engine,baidu_matchurl,baidu_wordlist,baidu_site); addNewPair(&search_engine,google_matchurl,google_wordlist,google_site); return CI_OK; }
/** * Called after load_java_module(char * service_file) .<br> * initialize service OPTIONS parameter.<br> * prev = load_java_module(const char * service_file)<br> * next = post_init_java_handler(struct ci_server_conf * server_conf)<br> * * @param srv_xdata a pointer holds service parameter. * @param server_conf a pointer of server config. * @return CI_SERVICE_OK */ int java_init_service(ci_service_xdata_t * srv_xdata, struct ci_server_conf * server_conf) { ci_service_set_preview(srv_xdata, 1024); ci_service_enable_204(srv_xdata); ci_service_set_transfer_preview(srv_xdata, "*"); return CI_SERVICE_OK; }