Logo Search packages:      
Sourcecode: hlbr version File versions  Download package

int TCPListContentAddNode ( int  TestID,
int  RuleID,
char *  Args 
)

Add a rule node to this test

Parameters:
TestID Number of this test in the Globals.Tests[] array
RuleID Number of the rule in the Globals.Rules[] array
Args File name of the word list
Returns:
TRUE if successful or FALSE in case of failure

Definition at line 95 of file test_tcp_listcontent.c.

Referenced by InitTestTCPListContent().

                                                             {
      TCPListContentData*     data;
      FILE*             listf;
      char              LineBuff[10240];

#ifdef DEBUGPATH
      printf("In TCPListContentAddNode\n");
#endif

      listf = fopen(Args, "r");
      if (!listf){
            printf("Couldn't open file %s for 'tcp listcontent' test\n", Args);
            return FALSE;
      }

#ifdef DEBUG
      printf("Adding a Node with args from file %s\n", Args);
#endif

//                data=calloc(sizeof(TCPListContentData),1);
//                snprintf(data->tcp_content, MAX_CONTENT_LEN, "%s", Args);
      data=NULL;

      while (GetLine(listf, LineBuff, 10240)) {
#ifdef DEBUG
                  printf("Adding: %s\n", LineBuff);
#endif

                  if (!AddStringJTree(&TCPListContentTree, LineBuff, strlen(LineBuff), RuleID)) {
                              printf("Failed to add to tree\n");
//                            free(data);
//                            data=NULL;
                              return FALSE;
                  }
      }

      fclose(listf);
      
      return TestAddNode(TestID, RuleID, (void*)data);
}


Generated by  Doxygen 1.6.0   Back to index