static void resetConfig(SFVSConfig *cfg) { cfg->error = NO; cfg->sampling_n = 0; cfg->polling_secs = 0; cfg->header_bytes = SFL_DEFAULT_HEADER_SIZE; setStr(&cfg->agent_ip, NULL); setStr(&cfg->agent_dev, NULL); cfg->num_collectors = 0; strArrayReset(cfg->targets); setStr(&cfg->targetStr, NULL); }
static void formatTargets(EVMod *mod) { HSP_mod_OVS *mdata = (HSP_mod_OVS *)mod->data; strArrayReset(mdata->config.targets); for(int i = 0; i < mdata->config.num_collectors; i++) { char target[SFVS_MAX_LINELEN]; sprintf(target, "%s:%u", mdata->config.collectors[i].ip, mdata->config.collectors[i].port); strArrayAdd(mdata->config.targets, target); } strArraySort(mdata->config.targets); if(mdata->config.targetStr) my_free(mdata->config.targetStr); mdata->config.targetStr = strArrayStr(mdata->config.targets, "[", "\"", ", ", "]"); }
void strArrayFree(UTStringArray *ar) { strArrayReset(ar); if(ar->strs) my_free(ar->strs); my_free(ar); }
static void resetExtras(EVMod *mod) { HSP_mod_OVS *mdata = (HSP_mod_OVS *)mod->data; strArrayReset(mdata->extras); }
static void resetCmd(EVMod *mod) { HSP_mod_OVS *mdata = (HSP_mod_OVS *)mod->data; strArrayReset(mdata->cmd); strArrayAdd(mdata->cmd, SFVS_OVS_CMD); }