~ubuntu-branches/ubuntu/trusty/syslog-ng/trusty-proposed

« back to all changes in this revision

Viewing changes to tests/unit/test_radix.c

  • Committer: Bazaar Package Importer
  • Author(s): Laszlo Boszormenyi (GCS)
  • Date: 2010-03-28 19:47:36 UTC
  • mfrom: (1.3.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20100328194736-1ob7kh1qr0fy8b9k
Tags: 3.1.0-1
* New upstream release.
* Fix path of syslog logfile (closes: #575722) and use tty10 instead of
  vc/10 to log on console.
* Provide syslog-ng in initscript (closes: #575723).

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
  for (i = 0; i < depth; i++)
22
22
    printf(" ");
23
23
 
24
 
  printf("%dPNODE: %d('%s') => '%s'\n", depth, node->parser->type, node->parser->name, (char *)node->value);
 
24
  printf("%dPNODE: %d('%s') => '%s'\n", depth, node->parser->type, log_msg_get_value_name(node->parser->handle, NULL), (char *)node->value);
25
25
 
26
26
  for (i = 0; i < node->num_children; i++)
27
27
    r_print_node(node->children[i], depth + 1);
50
50
insert_node(RNode *root, gchar *key)
51
51
{
52
52
  gchar *dup;
53
 
  
 
53
 
54
54
  /* NOTE: we need to duplicate the key as r_insert_node modifies its input
55
55
   * and it might be a read-only string literal */
56
 
  
 
56
 
57
57
  dup = g_strdup(key);
58
 
  r_insert_node(root, dup, key, TRUE);
 
58
  r_insert_node(root, dup, key, TRUE, NULL);
59
59
  g_free(dup);
60
60
}
61
61
 
62
62
void
63
63
test_search_value(RNode *root, gchar *key, gchar *expected_value)
64
64
{
65
 
  RNode *ret = r_find_node(root, key, key, strlen(key), NULL, NULL);
 
65
  RNode *ret = r_find_node(root, key, key, strlen(key), NULL);
66
66
 
67
67
  if (ret && expected_value)
68
68
    {
99
99
{
100
100
  RNode *ret;
101
101
  va_list args;
102
 
  GArray *matches = g_array_new(FALSE, TRUE, sizeof(LogMessageMatch));
103
 
  GPtrArray *match_names = g_ptr_array_new();
104
 
  LogMessageMatch *match;
105
 
  gchar *match_name;
 
102
  GArray *matches = g_array_new(FALSE, TRUE, sizeof(RParserMatch));
 
103
  RParserMatch *match;
 
104
  const gchar *match_name;
106
105
  gint i;
107
 
  
 
106
 
108
107
  g_array_set_size(matches, 1);
109
 
  g_ptr_array_set_size(match_names, 1);
110
108
  va_start(args, name1);
111
 
  
112
 
  ret = r_find_node(root, key, key, strlen(key), matches, match_names);
 
109
 
 
110
  ret = r_find_node(root, key, key, strlen(key), matches);
113
111
  if (ret && !name1)
114
112
    {
115
 
      printf("FAIL: found unexpected: '%s' => '%s'\n", key, (gchar *) ret->value);
 
113
      printf("FAIL: found unexpected: '%s' => '%s' matches: ", key, (gchar *) ret->value);
 
114
      for (i = 0; i < matches->len; i++)
 
115
        {
 
116
          match = &g_array_index(matches, RParserMatch, i);
 
117
          match_name = log_msg_get_value_name(match->handle, NULL);
 
118
          if (match_name)
 
119
            {
 
120
              if (!match->match)
 
121
                printf("'%s' => '%.*s'", match_name, match->len, &key[match->ofs]);
 
122
              else
 
123
                printf("'%s' => '%s'", match_name, match->match);
 
124
            }
 
125
        }
 
126
      printf("\n");
116
127
      fail = TRUE;
117
128
    }
118
129
  else if (ret && name1)
119
130
    {
120
131
      gint i = 1;
121
132
      gchar *name, *value;
122
 
      
 
133
 
123
134
      name = name1;
124
135
      value = va_arg(args, gchar *);
125
136
      while (name)
130
141
              fail = TRUE;
131
142
              goto out;
132
143
            }
133
 
          match = &g_array_index(matches, LogMessageMatch, i);
134
 
          match_name = g_ptr_array_index(match_names, i);
135
 
          
 
144
          match = &g_array_index(matches, RParserMatch, i);
 
145
          match_name = log_msg_get_value_name(match->handle, NULL);
 
146
 
136
147
          if (strcmp(match_name, name) != 0)
137
148
            {
138
149
              printf("FAIL: name does not match: '%s' => expecting %d. match, name %s != %s\n", key, i, name, match_name);
139
150
              fail = TRUE;
140
151
            }
141
 
          
142
 
          if (match->flags & LMM_REF_MATCH)
 
152
 
 
153
          if (!match->match)
143
154
            {
144
155
              if (strncmp(&key[match->ofs], value, match->len) != 0 || strlen(value) != match->len)
145
156
                {
163
174
      if (verbose)
164
175
        printf("PASS: all values match: '%s'\n", key);
165
176
    }
 
177
  else if (!ret && !name1)
 
178
    {
 
179
      if (verbose)
 
180
        printf("PASS: nothing was matched as expected: '%s'\n", key);
 
181
    }
166
182
  else
167
183
    {
168
184
      printf("FAIL: not found while expected: '%s' => none\n", key);
169
185
      fail = TRUE;
170
186
    }
171
 
    
 
187
 
172
188
 out:
173
189
  va_end(args);
174
 
  
 
190
 
175
191
  for (i = 0; i < matches->len; i++)
176
192
    {
177
 
      match_name = g_ptr_array_index(match_names, i);
178
 
 
179
 
      match = &g_array_index(matches, LogMessageMatch, i);
180
 
      if ((match->flags & LMM_REF_MATCH) == 0)
 
193
      match = &g_array_index(matches, RParserMatch, i);
 
194
      if (match->match)
181
195
        {
182
196
          g_free(match->match);
183
197
        }
184
 
      g_free(match_name);
185
198
    }
 
199
  g_array_free(matches, TRUE);
186
200
}
187
201
 
188
202
void
189
203
test_literals(void)
190
204
{
191
205
  RNode *root = r_new_node("", NULL);
192
 
  
 
206
 
193
207
  insert_node(root, "alma");
194
208
  insert_node(root, "korte");
195
209
  insert_node(root, "barack");
205
219
  insert_node(root, "korozott");
206
220
  insert_node(root, "al");
207
221
  insert_node(root, "all");
208
 
  
 
222
 
209
223
  test_search(root, "alma", TRUE);
210
224
  test_search(root, "korte", TRUE);
211
225
  test_search(root, "barack", TRUE);
237
251
  test_search_value(root, "koromi", "korom");
238
252
 
239
253
  test_search(root, "qwqw", FALSE);
240
 
  
 
254
 
241
255
  r_free_node(root, NULL);
242
256
}
243
257
 
245
259
test_parsers(void)
246
260
{
247
261
  RNode *root = r_new_node("", NULL);
248
 
  
 
262
 
249
263
  /* FIXME: more parsers */
250
264
  insert_node(root, "a@@NUMBER@@aa@@@@");
251
265
  insert_node(root, "a@@ab");
252
266
  insert_node(root, "a@@a@@");
253
 
  
 
267
 
254
268
  insert_node(root, "a@@@NUMBER:szam0@");
255
269
  insert_node(root, "a@NUMBER:szamx@aaa");
256
270
  insert_node(root, "a@NUMBER@");
277
291
  test_search_value(root, "a@ax", NULL);
278
292
 
279
293
  test_search_value(root, "a@15555", "a@@@NUMBER:szam0@");
280
 
  
 
294
 
281
295
  /* FIXME: this one fails, because the shorter match is returned. The
282
296
   * current radix implementation does not ensure the longest match when the
283
297
   * radix tree is split on a parser node. */
284
 
  
 
298
 
285
299
#if 0
286
300
  test_search_value(root, "a15555aaa", "a@NUMBER:szamx@aaa");
287
301
#endif
288
302
  test_search_value(root, "@a", "@@a");
289
303
  test_search_value(root, "@", "@@");
290
304
  test_search_value(root, "@@", "@@@@");
291
 
  
 
305
 
292
306
  r_free_node(root, NULL);
293
307
}
294
308
 
296
310
test_matches(void)
297
311
{
298
312
  RNode *root = r_new_node("", NULL);
299
 
  
 
313
 
300
314
  insert_node(root, "aaa @NUMBER:number@");
301
 
  insert_node(root, "bbb @IPv4:ipv4@");
 
315
  insert_node(root, "bbb @IPvANY:ip@");
 
316
  insert_node(root, "bbb4 @IPv4:ipv4@");
 
317
  insert_node(root, "bbb6 @IPv6:ipv6@");
302
318
  insert_node(root, "ccc @QSTRING:qstring:'@");
303
319
  insert_node(root, "ddd @ESTRING:estring::@");
 
320
  insert_node(root, "dddd @ESTRING:estring::*@");
 
321
  insert_node(root, "dddd2 @ESTRING:estring::*@ d");
304
322
  insert_node(root, "eee @STRING:string@");
305
 
  
306
 
  test_search_matches(root, "aaa 12345 hihihi", 
307
 
                      "number", "12345", 
308
 
                      NULL);
309
 
 
310
 
  test_search_matches(root, "bbb 192.168.1.1 huhuhu", 
311
 
                      "ipv4", "192.168.1.1", 
312
 
                      NULL);
313
 
 
314
 
  test_search_matches(root, "ccc 'quoted string' hehehe", 
315
 
                      "qstring", "quoted string", 
316
 
                      NULL);
317
 
 
318
 
  test_search_matches(root, "ddd estring: hehehe", 
319
 
                      "estring", "estring", 
320
 
                      NULL);
321
 
 
322
 
  test_search_matches(root, "eee string hehehe", 
323
 
                      "string", "string", 
324
 
                      NULL);
 
323
  insert_node(root, "fff @FLOAT:float@");
 
324
 
 
325
  test_search_matches(root, "aaa 12345 hihihi",
 
326
                      "number", "12345",
 
327
                      NULL);
 
328
 
 
329
  test_search_matches(root, "bbb 192.168.1.1 huhuhu",
 
330
                      "ip", "192.168.1.1",
 
331
                      NULL);
 
332
 
 
333
  test_search_matches(root, "aaa 12345 hihihi",
 
334
                      "number", "12345",
 
335
                      NULL);
 
336
 
 
337
  test_search_matches(root, "aaa 0xaf12345 hihihi",
 
338
                      "number", "0xaf12345",
 
339
                      NULL);
 
340
 
 
341
  test_search_matches(root, "aaa 0xAF12345 hihihi",
 
342
                      "number", "0xAF12345",
 
343
                      NULL);
 
344
 
 
345
  test_search_matches(root, "aaa 0x12345 hihihi",
 
346
                      "number", "0x12345",
 
347
                      NULL);
 
348
 
 
349
  test_search_matches(root, "aaa 0XABCDEF12345ABCDEF hihihi",
 
350
                      "number", "0XABCDEF12345ABCDEF",
 
351
                      NULL);
 
352
 
 
353
  test_search_matches(root, "bbb 192.168.1.1 huhuhu",
 
354
                      "ip", "192.168.1.1",
 
355
                      NULL);
 
356
 
 
357
  test_search_matches(root, "bbb 192.168.1.1. huhuhu",
 
358
                      "ip", "192.168.1.1",
 
359
                      NULL);
 
360
 
 
361
  test_search_matches(root, "bbb4 192.168.1.1 huhuhu",
 
362
                      "ipv4", "192.168.1.1",
 
363
                      NULL);
 
364
 
 
365
  test_search_matches(root, "bbb4 192.168.1.1. huhuhu",
 
366
                      "ipv4", "192.168.1.1",
 
367
                      NULL);
 
368
 
 
369
  test_search_matches(root, "bbb 192.168.1.1huhuhu",
 
370
                      "ip", "192.168.1.1",
 
371
                      NULL);
 
372
 
 
373
  test_search_matches(root, "bbb4 192.168.1.1huhuhu",
 
374
                      "ipv4", "192.168.1.1",
 
375
                      NULL);
 
376
 
 
377
  test_search_matches(root, "bbb4 192.168.1huhuhu", NULL);
 
378
  test_search_matches(root, "bbb4 192.168.1.huhuhu", NULL);
 
379
  test_search_matches(root, "bbb4 192.168.1 huhuhu", NULL);
 
380
  test_search_matches(root, "bbb4 192.168.1. huhuhu", NULL);
 
381
  test_search_matches(root, "bbb 192.168.1huhuhu", NULL);
 
382
  test_search_matches(root, "bbb 192.168.1.huhuhu", NULL);
 
383
  test_search_matches(root, "bbb 192.168.1 huhuhu", NULL);
 
384
  test_search_matches(root, "bbb 192.168.1. huhuhu", NULL);
 
385
 
 
386
  test_search_matches(root, "bbb6 ABCD:EF01:2345:6789:ABCD:EF01:2345:6789 huhuhu",
 
387
                      "ipv6", "ABCD:EF01:2345:6789:ABCD:EF01:2345:6789", NULL);
 
388
 
 
389
  test_search_matches(root, "bbb6 abcd:ef01:2345:6789:abcd:ef01:2345:6789 huhuhu",
 
390
                      "ipv6", "abcd:ef01:2345:6789:abcd:ef01:2345:6789", NULL);
 
391
 
 
392
  test_search_matches(root, "bbb6 0:0:0:0:0:0:0:0 huhuhu",
 
393
                      "ipv6", "0:0:0:0:0:0:0:0", NULL);
 
394
 
 
395
  test_search_matches(root, "bbb6 2001:DB8::8:800:200C:417A huhuhu",
 
396
                      "ipv6", "2001:DB8::8:800:200C:417A", NULL);
 
397
 
 
398
  test_search_matches(root, "bbb6 FF01::101 huhuhu",
 
399
                      "ipv6", "FF01::101", NULL);
 
400
 
 
401
  test_search_matches(root, "bbb6 ::1 huhuhu",
 
402
                      "ipv6", "::1", NULL);
 
403
 
 
404
  test_search_matches(root, "bbb6 :: huhuhu",
 
405
                      "ipv6", "::", NULL);
 
406
 
 
407
  test_search_matches(root, "bbb6 0:0:0:0:0:0:13.1.68.3 huhuhu",
 
408
                      "ipv6", "0:0:0:0:0:0:13.1.68.3", NULL);
 
409
 
 
410
  test_search_matches(root, "bbb6 ::202.1.68.3 huhuhu",
 
411
                      "ipv6", "::202.1.68.3", NULL);
 
412
 
 
413
  test_search_matches(root, "bbb6 2001:0DB8:0:CD30:: huhuhu",
 
414
                      "ipv6", "2001:0DB8:0:CD30::", NULL);
 
415
 
 
416
  test_search_matches(root, "bbb ABCD:EF01:2345:6789:ABCD:EF01:2345:6789 huhuhu",
 
417
                      "ip", "ABCD:EF01:2345:6789:ABCD:EF01:2345:6789", NULL);
 
418
 
 
419
  test_search_matches(root, "bbb abcd:ef01:2345:6789:abcd:ef01:2345:6789 huhuhu",
 
420
                      "ip", "abcd:ef01:2345:6789:abcd:ef01:2345:6789", NULL);
 
421
 
 
422
  test_search_matches(root, "bbb :: huhuhu",
 
423
                      "ip", "::", NULL);
 
424
 
 
425
  test_search_matches(root, "bbb 0:0:0:0:0:0:13.1.68.3 huhuhu",
 
426
                      "ip", "0:0:0:0:0:0:13.1.68.3", NULL);
 
427
 
 
428
  test_search_matches(root, "bbb ::202.1.68.3 huhuhu",
 
429
                      "ip", "::202.1.68.3", NULL);
 
430
 
 
431
  test_search_matches(root, "bbb 2001:0DB8:0:CD30:: huhuhu",
 
432
                      "ip", "2001:0DB8:0:CD30::", NULL);
 
433
 
 
434
  test_search_matches(root, "bbb6 ABCD:EF01:2345:6789:ABCD:EF01:2345:6789.huhuhu",
 
435
                      "ipv6", "ABCD:EF01:2345:6789:ABCD:EF01:2345:6789", NULL);
 
436
 
 
437
  test_search_matches(root, "bbb6 abcd:ef01:2345:6789:abcd:ef01:2345:6789.huhuhu",
 
438
                      "ipv6", "abcd:ef01:2345:6789:abcd:ef01:2345:6789", NULL);
 
439
 
 
440
  test_search_matches(root, "bbb6 0:0:0:0:0:0:0:0.huhuhu",
 
441
                      "ipv6", "0:0:0:0:0:0:0:0", NULL);
 
442
 
 
443
  test_search_matches(root, "bbb6 2001:DB8::8:800:200C:417A.huhuhu",
 
444
                      "ipv6", "2001:DB8::8:800:200C:417A", NULL);
 
445
 
 
446
  test_search_matches(root, "bbb6 FF01::101.huhuhu",
 
447
                      "ipv6", "FF01::101", NULL);
 
448
 
 
449
  test_search_matches(root, "bbb6 ::1.huhuhu",
 
450
                      "ipv6", "::1", NULL);
 
451
 
 
452
  test_search_matches(root, "bbb6 ::.huhuhu",
 
453
                      "ipv6", "::", NULL);
 
454
 
 
455
  test_search_matches(root, "bbb6 0:0:0:0:0:0:13.1.68.3.huhuhu",
 
456
                      "ipv6", "0:0:0:0:0:0:13.1.68.3", NULL);
 
457
 
 
458
  test_search_matches(root, "bbb6 ::202.1.68.3.huhuhu",
 
459
                      "ipv6", "::202.1.68.3", NULL);
 
460
 
 
461
  test_search_matches(root, "bbb6 2001:0DB8:0:CD30::.huhuhu",
 
462
                      "ipv6", "2001:0DB8:0:CD30::", NULL);
 
463
 
 
464
  test_search_matches(root, "bbb ABCD:EF01:2345:6789:ABCD:EF01:2345:6789.huhuhu",
 
465
                      "ip", "ABCD:EF01:2345:6789:ABCD:EF01:2345:6789", NULL);
 
466
 
 
467
  test_search_matches(root, "bbb abcd:ef01:2345:6789:abcd:ef01:2345:6789.huhuhu",
 
468
                      "ip", "abcd:ef01:2345:6789:abcd:ef01:2345:6789", NULL);
 
469
 
 
470
  test_search_matches(root, "bbb ::.huhuhu",
 
471
                      "ip", "::", NULL);
 
472
 
 
473
  test_search_matches(root, "bbb 0:0:0:0:0:0:13.1.68.3.huhuhu",
 
474
                      "ip", "0:0:0:0:0:0:13.1.68.3", NULL);
 
475
 
 
476
  test_search_matches(root, "bbb ::202.1.68.3.huhuhu",
 
477
                      "ip", "::202.1.68.3", NULL);
 
478
 
 
479
  test_search_matches(root, "bbb 2001:0DB8:0:CD30::.huhuhu",
 
480
                      "ip", "2001:0DB8:0:CD30::", NULL);
 
481
 
 
482
  test_search_matches(root, "bbb 1:2:3:4:5:6:7:8.huhuhu",
 
483
                      "ip", "1:2:3:4:5:6:7:8", NULL);
 
484
 
 
485
  test_search_matches(root, "bbb 1:2:3:4:5:6:7:8 huhuhu",
 
486
                      "ip", "1:2:3:4:5:6:7:8", NULL);
 
487
 
 
488
  test_search_matches(root, "bbb 1:2:3:4:5:6:7:8:huhuhu",
 
489
                      "ip", "1:2:3:4:5:6:7:8", NULL);
 
490
 
 
491
  test_search_matches(root, "bbb 1:2:3:4:5:6:7 huhu", NULL);
 
492
  test_search_matches(root, "bbb 1:2:3:4:5:6:7.huhu", NULL);
 
493
  test_search_matches(root, "bbb 1:2:3:4:5:6:7:huhu", NULL);
 
494
  test_search_matches(root, "bbb6 1:2:3:4:5:6:7 huhu", NULL);
 
495
  test_search_matches(root, "bbb6 1:2:3:4:5:6:7.huhu", NULL);
 
496
  test_search_matches(root, "bbb6 1:2:3:4:5:6:7:huhu", NULL);
 
497
  test_search_matches(root, "bbb 1:2:3:4:5:6:77777:8 huhu", NULL);
 
498
  test_search_matches(root, "bbb 1:2:3:4:5:6:1.2.333.4 huhu", NULL);
 
499
 
 
500
  test_search_matches(root, "ccc 'quoted string' hehehe",
 
501
                      "qstring", "quoted string",
 
502
                      NULL);
 
503
 
 
504
  test_search_matches(root, "ddd estring: hehehe",
 
505
                      "estring", "estring",
 
506
                      NULL);
 
507
 
 
508
  test_search_matches(root, "dddd estring:* hehehe",
 
509
                      "estring", "estring",
 
510
                      NULL);
 
511
 
 
512
  test_search_matches(root, "dddd estring:estring:* hehehe",
 
513
                      "estring", "estring:estring",
 
514
                      NULL);
 
515
 
 
516
  test_search_matches(root, "dddd estring:estring::* hehehe",
 
517
                      "estring", "estring:estring:",
 
518
                      NULL);
 
519
 
 
520
  test_search_matches(root, "dddd2 estring:estring::* d",
 
521
                      "estring", "estring:estring:",
 
522
                      NULL);
 
523
 
 
524
  test_search_matches(root, "dddd2 estring:estring::* ", NULL);
 
525
  test_search_matches(root, "dddd2 estring:estring::*", NULL);
 
526
  test_search_matches(root, "dddd2 estring:estring:*", NULL);
 
527
  test_search_matches(root, "dddd2 estring:estring", NULL);
 
528
 
 
529
  test_search_matches(root, "eee string hehehe",
 
530
                      "string", "string",
 
531
                      NULL);
 
532
 
 
533
  test_search_matches(root, "fff 12345 hihihi",
 
534
                      "float", "12345", NULL);
 
535
 
 
536
  test_search_matches(root, "fff 12345hihihi",
 
537
                      "float", "12345", NULL);
 
538
 
 
539
  test_search_matches(root, "fff 12.345hihihi",
 
540
                      "float", "12.345", NULL);
 
541
 
 
542
  test_search_matches(root, "fff 12.345.hihihi",
 
543
                      "float", "12.345", NULL);
 
544
 
 
545
  test_search_matches(root, "fff 12.345.6hihihi",
 
546
                      "float", "12.345", NULL);
 
547
 
 
548
  test_search_matches(root, "fff 12345.hihihi",
 
549
                      "float", "12345.", NULL);
 
550
 
 
551
  test_search_matches(root, "aaa v12345", NULL);
 
552
  test_search_matches(root, "bbb v12345", NULL);
 
553
  test_search_matches(root, "bbb4 v12345", NULL);
 
554
  test_search_matches(root, "bbb6 v12345", NULL);
 
555
  test_search_matches(root, "ccc v12345", NULL);
 
556
  test_search_matches(root, "ddd v12345", NULL);
 
557
  test_search_matches(root, "dddd v12345", NULL);
 
558
  test_search_matches(root, "fff v12345", NULL);
325
559
 
326
560
  r_free_node(root, NULL);
327
561
}
332
566
  RNode *root = r_new_node("", NULL);
333
567
 
334
568
  /* these are conflicting logs */
335
 
  r_insert_node(root, strdup("core.error(2): (svc/@STRING:service:._@:@NUMBER:instance_id@/plug): Connection to remote end failed; local='AF_INET(@IPv4:local_ip@:@NUMBER:local_port@)', remote='AF_INET(@IPv4:remote_ip@:@NUMBER:remote_port@)', error=@QSTRING:errormsg:'@"), "ZORP", TRUE);
336
 
  r_insert_node(root, strdup("core.error(2): (svc/@STRING:service:._@:@NUMBER:instance_id@/plug): Connection to remote end failed; local=@QSTRING:p:'@, remote=@QSTRING:p:'@, error=@QSTRING:p:'@"), "ZORP1", TRUE);
337
 
  r_insert_node(root, strdup("@NUMBER:Seq@, @ESTRING:DateTime:,@@ESTRING:Severity:,@@ESTRING:Comp:,@"), "3com", TRUE);
 
569
  r_insert_node(root, strdup("core.error(2): (svc/@STRING:service:._@:@NUMBER:instance_id@/plug): Connection to remote end failed; local='AF_INET(@IPv4:local_ip@:@NUMBER:local_port@)', remote='AF_INET(@IPv4:remote_ip@:@NUMBER:remote_port@)', error=@QSTRING:errormsg:'@"), "ZORP", TRUE, NULL);
 
570
  r_insert_node(root, strdup("core.error(2): (svc/@STRING:service:._@:@NUMBER:instance_id@/plug): Connection to remote end failed; local=@QSTRING:p:'@, remote=@QSTRING:p:'@, error=@QSTRING:p:'@"), "ZORP1", TRUE, NULL);
 
571
  r_insert_node(root, strdup("Deny@QSTRING:FIREWALL.DENY_PROTO: @src@QSTRING:FIREWALL.DENY_O_INT: :@@IPv4:FIREWALL.DENY_SRCIP@/@NUMBER:FIREWALL.DENY_SRCPORT@ dst"), "CISCO", TRUE, NULL);
 
572
  r_insert_node(root, strdup("@NUMBER:Seq@, @ESTRING:DateTime:,@@ESTRING:Severity:,@@ESTRING:Comp:,@"), "3com", TRUE, NULL);
338
573
 
339
574
  test_search_value(root, "core.error(2): (svc/intra.servers.alef_SSH_dmz.zajin:111/plug): Connection to remote end failed; local='AF_INET(172.16.0.1:56867)', remote='AF_INET(172.18.0.1:22)', error='No route to host'PAS", "ZORP");
 
575
  test_search_value(root, "Deny udp src OUTSIDE:10.0.0.0/1234 dst INSIDE:192.168.0.0/5678 by access-group \"OUTSIDE\" [0xb74026ad, 0x0]", "CISCO");
340
576
  test_search_matches(root, "1, 2006-08-22 16:31:39,INFO,BLK,", "Seq", "1", "DateTime", "2006-08-22 16:31:39", "Severity", "INFO", "Comp", "BLK", NULL);
 
577
 
341
578
  r_free_node(root, NULL);
342
579
 
343
580
}
347
584
main(int argc, char *argv[])
348
585
{
349
586
  app_startup();
350
 
  
 
587
 
351
588
  if (argc > 1)
352
589
    verbose = TRUE;
353
590
 
354
591
  msg_init(TRUE);
355
 
  
 
592
 
356
593
  test_literals();
357
594
  test_parsers();
358
595
  test_matches();