root/trunk/src/rules_mgmt.h @ 54

Revision 53, 2.9 KB (checked in by andreu, 15 years ago)

new function addLValue in rules_mgmt.c

  • Property svn:eol-style set to native
Line 
1/*
2 * File: rules_mgmt.h
3 *
4 * Authors: ANDREU Francois-Xavier
5 *
6 * Copyright (C) 2005 2006 2007 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  unsigned short mask;
54  ValuesPtr next;
55} ValuesType;
56
57typedef struct RuleDef * RuleDefPtr;
58typedef struct RuleDef {
59  unsigned short fieldType;
60  ValuesPtr value;
61  unsigned short check;
62  unsigned short operator; /* 0:>, 1:<, 2:= */
63  RuleDefPtr next;
64  RuleDefPtr prev;
65} RuleDefType;
66
67typedef struct Rules * RulesPtr;
68typedef struct Rules {
69  char * ruleName;
70  unsigned short id;
71  unsigned short type;
72  struct tm begin;
73  struct tm end;
74  unsigned short aggEnabled;
75  RuleDefPtr def;
76  FieldPtr fieldToRecord;
77  RemoteHostPtr host;
78  FilePtr fileName;
79  DbPtr db;
80  RulesPtr next;
81  RulesPtr prev;
82} RulesType;
83
84void printRuleDef(RuleDefPtr);
85void printRule(RulesPtr);
86unsigned short getNewId(RulesPtr);
87void freeValue(ValuesPtr);
88void freeRuleDef(RuleDefPtr);
89void freeRule(RulesPtr);
90RulesPtr delRule(RulesPtr, RulesPtr);
91RulesPtr getRules(RulesPtr, char*);
92RulesPtr getLightRules(RulesPtr, char *);
93FilePtr addFileDef(FilePtr, char *, char *);
94RemoteHostPtr addRemoteHostDef(RemoteHostPtr, char *, char *);
95DbPtr addDataBase(DbPtr, char *, char *);
96RuleDefPtr addRuleDef(RuleDefPtr, char *);
97FieldPtr addFields(FieldPtr, char *);
98ValuesPtr addValue(ValuesPtr, unsigned short, char *);
99ValuesPtr addLValue(ValuesPtr, unsigned short, char *);
100ValuesPtr addAddress(ValuesPtr, unsigned short, char *);
101ValuesPtr addV6Address(ValuesPtr, unsigned short, char *);
102ValuesPtr addCValue(ValuesPtr, unsigned short, char *);
103
104#endif /* RULES_MGMT_H */
Note: See TracBrowser for help on using the browser.