File: grok_match.h

package info (click to toggle)
grok 1.20110708.1-4.3
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 2,460 kB
  • sloc: ansic: 3,469; ruby: 987; makefile: 276; sh: 124; yacc: 106
file content (40 lines) | stat: -rw-r--r-- 1,183 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/**
 * @file grok_match.h
 */
#ifndef _GROK_MATCH_H_
#define _GROK_MATCH_H_

#include "grok_capture_xdr.h"

typedef struct grok_match {
  /** The grok_t instance that generated this match.
   * This is a pointer to the grok parameter given to grok_exec().
   * @see grok_exec()
   */
  const grok_t *grok;

  /** Pointer to the string matched.
   * This is a pointer to the text parameter given to grok_exec() 
   * @see grok_exec()
   */
  const char *subject;

  /** Start position of the match. 0 is beginning of string */
  int start;

  /** End position of match. */
  int end;
} grok_match_t;

const grok_capture * grok_match_get_named_capture(const grok_match_t *gm,
                                                  const char *name);
int grok_match_get_named_substring(const grok_match_t *gm, const char *name,
                                   const char **substr, int *len);

void grok_match_walk_init(const grok_match_t *gm);
int grok_match_walk_next(const grok_match_t *gm,
                         char **name, int *namelen,
                         const char **substr, int *substrlen);
void grok_match_walk_end(const grok_match_t *gm);

#endif /*  _GROK_MATCH_H_ */