Show
Ignore:
Timestamp:
10/09/07 12:01:26 (15 years ago)
Author:
andreu
Message:

new aggregation method, new configuration files, corrections on the php script for graph generation.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/renetcolSender.c

    r47 r58  
    3131long type; 
    3232RulesPtr rulesListPtr; 
    33 char *rulesFileName; 
    3433char *keyId; 
    3534char *remoteHost; 
     
    7877    if (strncmp("DELETE", buffer, 6)==0){ 
    7978      /* DELETE ALL RULES FROM A REMOTE CLIENT */ 
    80       if (!(ruleFile = fopen(rulesFileName, "r"))) { 
    81         syslog (LOG_ERR, "error during %s opening\n", rulesFileName); 
     79      if (!(ruleFile = fopen(RULES_FILE, "r"))) { 
     80        syslog (LOG_ERR, "error during %s opening\n", RULES_FILE); 
    8281        close(sock); 
    8382        exit(1); 
     
    116115          } 
    117116          fclose(tmpFile); 
    118           if (remove(rulesFileName)!=0){ 
     117          if (remove(RULES_FILE)!=0){ 
    119118            syslog(LOG_ERR, "rules.txt remove pb: %s", strerror(errno)); 
    120119            close(sock); 
    121120            return 1; 
    122121          } 
    123           if (rename(FILE_TEMPO, rulesFileName)!=0){ 
     122          if (rename(FILE_TEMPO, RULES_FILE)!=0){ 
    124123            syslog(LOG_ERR, "rename file pb: %s", strerror(errno)); 
    125124            close(sock); 
     
    139138        return 1; 
    140139      } 
    141       if (!(ruleFile = fopen(rulesFileName, "a"))) { 
    142         syslog (LOG_ERR, "error during %s opening", rulesFileName); 
     140      if (!(ruleFile = fopen(RULES_FILE, "a"))) { 
     141        syslog (LOG_ERR, "error during %s opening", RULES_FILE); 
    143142        close(sock); 
    144143        return 1; 
     
    278277  } 
    279278  rulesListPtr = NULL; 
    280   rulesListPtr = getRules(rulesListPtr, rulesFileName); 
     279  rulesListPtr = getRules(rulesListPtr, RULES_FILE); 
    281280  tmp = rulesListPtr; 
    282281  for ( ; tmp; tmp=tmp->next) { 
     
    300299  pid_t renetcolPID = 0; 
    301300 
    302   if ( argc != 4) { 
     301  if ( argc != 3) { 
    303302    fprintf (stderr, 
    304              "%s: Usage: %s <key> <msg type> <rules file>\n exp: %s renetcol 1 rules.txt\n",  
     303             "%s: Usage: %s <key> <msg type>\n exp: %s renetcol 1 \n",  
    305304             argv[0], argv[0], argv[0]); 
    306305    exit(1); 
     
    314313  keyId = (char *) malloc((strlen(argv[1])+1) * sizeof(char)); 
    315314  strcpy (keyId, argv[1]); 
    316   rulesFileName = (char *) malloc((strlen(argv[3])+1) * sizeof(char)); 
    317   strcpy (rulesFileName, argv[3]); 
    318315  rulesListPtr = NULL; 
    319   rulesListPtr = getRules(rulesListPtr, rulesFileName); 
     316  rulesListPtr = getRules(rulesListPtr, RULES_FILE); 
    320317  /* we delete rules which are not type socket */ 
    321318  tmp = rulesListPtr;