~ubuntu-branches/ubuntu/dapper/flow-tools/dapper

« back to all changes in this revision

Viewing changes to lib/ftlib.h

  • Committer: Bazaar Package Importer
  • Author(s): Radu Spineanu
  • Date: 2005-06-02 20:12:57 UTC
  • mfrom: (1.1.1 upstream) (2.1.1 sarge)
  • Revision ID: james.westby@ubuntu.com-20050602201257-jv0qdk3hjhpdf04b
Tags: 1:0.68-2
Fixed a bashism in init script (closes: #311568)

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24
24
 * SUCH DAMAGE.
25
25
 *
26
 
 *      $Id: ftlib.h,v 1.91 2003/12/01 03:02:28 maf Exp $
 
26
 *      $Id: ftlib.h,v 1.94 2005/05/10 15:51:33 maf Exp $
27
27
 */
28
28
 
29
29
#ifndef FTLIB_H
210
210
#define FT_FILE_SKIPTMP        0x4    /* skip tmp files */
211
211
#define FT_FILE_CHECKNAMES     0x8    /* check filenames for sanity */
212
212
 
 
213
#define FT_LP_MAXLINE          1024   /* maximum length of line */
 
214
 
213
215
/* TLV_ - stream value
214
216
 * DEC_ - bit in internal header to indicate successful decode
215
217
 */
511
513
  FT_LIST_HEAD(ftmap_ifnameh, ftmap_ifname) ifname;
512
514
};
513
515
 
514
 
#define FT_XLATE_TYPE_IP_SRC_ADDR2NET    0x1
515
 
#define FT_XLATE_TYPE_IP_DST_ADDR2NET    0x2
516
 
#define FT_XLATE_TYPE_IP_SRC_ADDR2CNET   0x3
517
 
#define FT_XLATE_TYPE_IP_DST_ADDR2CNET   0x4
518
 
#define FT_XLATE_TYPE_IP_PRIVACY_MASK    0x5
519
 
#define FT_XLATE_TYPE_TAG_MASK           0x6
520
 
#define FT_XLATE_TYPE_SCALE              0x7
521
 
#define FT_XLATE_TYPE_SRC_AS             0x8
522
 
#define FT_XLATE_TYPE_DST_AS             0x9
523
 
#define FT_XLATE_FLAG_STOP               0x1
524
 
 
525
516
#define FT_TAG_TYPE_MATCH_SRC_AS         0x1
526
517
#define FT_TAG_TYPE_MATCH_DST_AS         0x2
527
518
#define FT_TAG_TYPE_MATCH_AS             0x3
2119
2110
 
2120
2111
/* ftxlate */
2121
2112
 
2122
 
struct ftxlate_action {
2123
 
  FT_SLIST_ENTRY(ftxlate_action) chain; /* list of all actions */
2124
 
  int type; /* FT_XLATE_TYPE_MATCH_* */
2125
 
  char *name;
2126
 
  void *action;
2127
 
  void (*eval)(struct ftxlate_action *ftxa, char *rec,
2128
 
    struct fts3rec_offsets *fo);
2129
 
  u_int64 xfields;
2130
 
};
2131
 
 
2132
 
struct ftxlate_def_term {
2133
 
  FT_STAILQ_ENTRY(ftxlate_def_term) chain; /* list of terms */
2134
 
  FT_STAILQ_HEAD(xactdhead, ftxlate_def_term_actions) actions; /* actions */
2135
 
  int type; /* FT_XLATE_TYPE_MATCH_* */
2136
 
  struct ftfil_def *ftfd; /* filter definition */
2137
 
  int flags;
2138
 
  u_int64 xfields;
2139
 
};
2140
 
 
2141
 
struct ftxlate_def_term_actions {
2142
 
  FT_STAILQ_ENTRY(ftxlate_def_term_actions) chain; /* all actions */
2143
 
  struct ftxlate_action *action; /* filled in by resolve_actions */
2144
 
  char *name; /* temporary, invalid after config file is closed */
2145
 
};
2146
 
 
2147
 
struct ftxlate_def {
2148
 
  FT_SLIST_ENTRY(ftxlate_def) chain;
2149
 
  FT_STAILQ_HEAD(xdthead, ftxlate_def_term) terms; /* terms */
2150
 
  char *name;
2151
 
  u_int64 xfields;
2152
 
};
2153
 
 
2154
 
struct ftxlate_act_scale {
2155
 
  int scale;
2156
 
};
2157
 
 
2158
 
struct ftxlate_act_asn {
2159
 
  u_int16 as;
2160
 
};
2161
 
 
2162
 
struct ftxlate_act_tag_mask {
2163
 
  u_int32 src_mask;
2164
 
  u_int32 dst_mask;
2165
 
};
2166
 
 
2167
 
struct ftxlate_act_priv_mask {
2168
 
  u_int32 src_mask;
2169
 
  u_int32 dst_mask;
2170
 
};
2171
 
 
2172
2113
struct ftxlate {
2173
2114
  FT_SLIST_HEAD(xdefshead, ftxlate_def) defs; /* list of definitions */
2174
2115
  FT_SLIST_HEAD(xacthead, ftxlate_action) actions; /* list of actions */
2176
2117
  int ftfil_init; /* ftfil initialized? */
2177
2118
  char *filter_fname;
2178
2119
  int flags;
 
2120
  struct ftvar *ftvar;
2179
2121
};
2180
2122
 
2181
2123
/* area of struct generic to v1, v5, v6, v7 formats */
2799
2741
void ftrec_compute_mask(struct ftipmask *m, u_int32 src, u_int32 dst, int
2800
2742
  byte_order);
2801
2743
 
 
2744
/* ftvar */
 
2745
struct ftvar_entry {
 
2746
  FT_SLIST_ENTRY(ftvar_entry) chain; /* list */
 
2747
  char *name, *val;
 
2748
};
 
2749
 
 
2750
struct ftvar { 
 
2751
   FT_SLIST_HEAD(ftvarhead, ftvar_entry) entries; /* variables */
 
2752
};
 
2753
   
2802
2754
 
2803
2755
/* ftchash_ */
2804
2756
struct ftchash *ftchash_new(int h_size, int d_size, int key_size,
2824
2776
int ftsym_findbyval(struct ftsym *ftsym, u_int32 val, char **name);
2825
2777
 
2826
2778
/* fttag */
2827
 
int fttag_load(struct fttag *fttag, char *fname);
 
2779
int fttag_load(struct fttag *fttag, struct ftvar *ftvar, char *fname);
2828
2780
void fttag_free(struct fttag *fttag);
2829
2781
int fttag_def_eval(struct fttag_def *ftd, struct fts3rec_v1005 *rec_out);
2830
2782
struct fttag_def *fttag_def_find(struct fttag *fttag, char *name);
2831
2783
 
2832
2784
/* ftxlate */
2833
 
int ftxlate_load(struct ftxlate *ftxlate, char *fname);
 
2785
int ftxlate_load(struct ftxlate *ftxlate, struct ftvar *ftvar, char *fname);
2834
2786
void ftxlate_free(struct ftxlate *ftxlate);
2835
2787
int ftxlate_def_eval(struct ftxlate_def *ftd, char *rec,
2836
2788
  struct fts3rec_offsets *fo);
2842
2794
int ftfil_def_eval(struct ftfil_def *active_def,
2843
2795
  char *rec, struct fts3rec_offsets *fo);
2844
2796
void ftfil_free(struct ftfil *ftfil);
2845
 
int ftfil_load(struct ftfil *ftfil, char *fname);
 
2797
int ftfil_load(struct ftfil *ftfil, struct ftvar *ftvar, char *fname);
2846
2798
int ftfil_def_test_xfields(struct ftfil_def *active_def, u_int64 test);
2847
2799
 
2848
2800
 
2929
2881
  int ftfil_init; /* ftfil initialized? */
2930
2882
  int ftmask_init; /* ftmask initialized? */
2931
2883
  char *tag_fname, *filter_fname, *mask_fname;
2932
 
  struct ftvar *ftvar; /* variable bindings */
 
2884
  struct ftvar *ftvar;
2933
2885
};
2934
2886
 
2935
2887
/* ftstat */
2936
 
int ftstat_load(struct ftstat *ftstat, char *fname);
2937
 
void ftstat_setvarbind(struct ftstat *ftstat, struct ftvar *ftvar);
 
2888
int ftstat_load(struct ftstat *ftstat, struct ftvar *ftvar, char *fname);
2938
2889
void ftstat_free(struct ftstat *ftstat);
2939
2890
struct ftstat_def *ftstat_def_find(struct ftstat *ftstat, char *name);
2940
2891
int ftstat_def_test_xfields(struct ftstat_def *active_def, u_int64 test);
2945
2896
int ftstat_def_dump(struct ftio *ftio, struct ftstat_def *active_def);
2946
2897
int ftstat_def_free(struct ftstat_def *active_def);
2947
2898
int ftstat_def_reset(struct ftstat_def *active_def);
 
2899
void ftstat_list_reports(FILE *out);
2948
2900
 
2949
2901
/* fttag */
2950
2902
struct fttag_action {
2977
2929
  char *name;
2978
2930
};
2979
2931
 
2980
 
struct ftvar_entry {
2981
 
  FT_SLIST_ENTRY(ftvar_entry) chain; /* list */
2982
 
  char *name, *val;
2983
 
};
2984
 
 
2985
 
struct ftvar { 
2986
 
   FT_SLIST_HEAD(ftvarhead, ftvar_entry) entries; /* variables */
2987
 
};
2988
 
   
2989
2932
int ftvar_new(struct ftvar *ftvar);
2990
2933
void ftvar_free(struct ftvar *ftvar);
2991
2934
int ftvar_set(struct ftvar *ftvar, char *name, char *val);