root/trunk/src/rules_mgmt.h @ 6

Revision 2, 2.8 KB (checked in by andreu, 17 years ago)

First RENETCOL CVS Integration

  • Property svn:eol-style set to native
Line 
1/*
2 * File: rules_mgmt.h
3 *
4 * Authors: ANDREU François-Xavier
5 *
6 * Copyright (C) 2005 GIP RENATER
7 */
8
9/*  This file is part of renetcol.
10 *
11 *  renetcol is free software; you can redistribute it and/or modify
12 *  it under the terms of the GNU General Public License as published by
13 *  the Free Software Foundation; either version 2 of the License, or
14 *  (at your option) any later version.
15 *
16 *  renetcol is distributed in the hope that it will be useful,
17 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
18 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19 *  GNU General Public License for more details.
20 *
21 *  You should have received a copy of the GNU General Public License
22 *  along with renetcol; if not, write to the Free Software
23 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
24 */
25#ifndef RULES_MGMT_H
26#define RULES_MGMT_H
27
28#include <unistd.h>
29#include <stdio.h>
30#include <string.h>
31#include <time.h>
32#include <stdlib.h>
33#include <errno.h>
34#include <sys/ioctl.h>
35#include <sys/types.h>
36#include <sys/socket.h>
37#include <netinet/in.h>
38#include <arpa/inet.h>
39#include <netdb.h>
40#include <linux/types.h>
41#include "remote_output.h"
42#include "fields_mgmt.h"
43
44typedef struct Values * ValuesPtr;
45typedef struct Values {
46  unsigned short valueLength;
47  union storage {
48    unsigned char cvalue;  /* 1 */
49    unsigned short svalue; /* 2 */
50    unsigned long lvalue;  /* 4 */
51    uint32_t tabAdd6[4];   /* 16 */
52  } stor;
53  ValuesPtr next;
54} ValuesType;
55
56typedef struct RuleDef * RuleDefPtr;
57typedef struct RuleDef {
58  unsigned short fieldType;
59  ValuesPtr value;
60  unsigned short check;
61  unsigned short operator; /* 0:>, 1:<, 2:= */
62  RuleDefPtr next;
63  RuleDefPtr prev;
64} RuleDefType;
65
66typedef struct Rules * RulesPtr;
67typedef struct Rules {
68  char * ruleName;
69  unsigned short id;
70  unsigned short type;
71  struct tm begin;
72  struct tm end;
73  unsigned short aggEnabled;
74  RuleDefPtr def;
75  FieldPtr fieldToRecord;
76  RemoteHostPtr host;
77  FilePtr fileName;
78  DbPtr db;
79  RulesPtr next;
80  RulesPtr prev;
81} RulesType;
82
83void printRuleDef(RuleDefPtr);
84void printRule(RulesPtr);
85unsigned short getNewId(RulesPtr);
86void freeValue(ValuesPtr);
87void freeRuleDef(RuleDefPtr);
88void freeRule(RulesPtr);
89RulesPtr delRule(RulesPtr, RulesPtr);
90RulesPtr getRules(RulesPtr, char*);
91RulesPtr getLightRules(RulesPtr, char *);
92FilePtr addFileDef(FilePtr, char *, char *);
93RemoteHostPtr addRemoteHostDef(RemoteHostPtr, char *, char *);
94DbPtr addDataBase(DbPtr, char *, char *);
95RuleDefPtr addRuleDef(RuleDefPtr, char *);
96FieldPtr addFields(FieldPtr, char *);
97ValuesPtr addValue(ValuesPtr, unsigned short, char *);
98ValuesPtr addAddress(ValuesPtr, unsigned short, char *);
99ValuesPtr addV6Address(ValuesPtr, unsigned short, char *);
100ValuesPtr addCValue(ValuesPtr, unsigned short, char *);
101
102#endif /* RULES_MGMT_H */
Note: See TracBrowser for help on using the browser.