Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
att
GitHub Repository: att/ast
Path: blob/master/src/cmd/dsslib/netflow/flowlib.h
1810 views
1
/***********************************************************************
2
* *
3
* This software is part of the ast package *
4
* Copyright (c) 2002-2011 AT&T Intellectual Property *
5
* and is licensed under the *
6
* Eclipse Public License, Version 1.0 *
7
* by AT&T Intellectual Property *
8
* *
9
* A copy of the License is available at *
10
* http://www.eclipse.org/org/documents/epl-v10.html *
11
* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
12
* *
13
* Information and Software Systems Research *
14
* AT&T Research *
15
* Florham Park NJ *
16
* *
17
* Glenn Fowler <[email protected]> *
18
* *
19
***********************************************************************/
20
#pragma prototyped
21
/*
22
* netflow private definitions
23
*
24
* Glenn Fowler
25
* AT&T Research
26
*/
27
28
#ifndef _NETFLOWLIB_H_
29
#define _NETFLOWLIB_H_ 1
30
31
#include <dsslib.h>
32
#include <netflow.h>
33
#include <ip6.h>
34
35
#define NETFLOW_NULL 0
36
#define NETFLOW_NUMBER 1
37
#define NETFLOW_BUFFER 2
38
39
typedef struct Netflow_field_s
40
{
41
unsigned short offset;
42
unsigned short size;
43
unsigned short type;
44
unsigned short set;
45
} Netflow_field_t;
46
47
typedef struct Netflow_template_s Netflow_template_t;
48
49
struct Netflow_template_s
50
{
51
Netflow_template_t* next;
52
unsigned int id;
53
unsigned int elements;
54
unsigned int size;
55
unsigned int set;
56
unsigned int options;
57
Netflow_field_t field[NETFLOW_TEMPLATE+1];
58
};
59
60
typedef struct Netflow_method_s /* flow method state */
61
{
62
Sfio_t* tmp;
63
Cxtype_t* type_ipv4addr;
64
Cxtype_t* type_ipv4prefix;
65
Cxtype_t* type_ipv6addr;
66
Cxtype_t* type_ipv6prefix;
67
Netflow_template_t* base;
68
Netflow_template_t* templates;
69
} Netflow_method_t;
70
71
typedef struct Netflow_file_s /* flow file state */
72
{
73
Netflow_t record;
74
Nftime_t boot;
75
Sfio_t* tmp;
76
Netflow_template_t* templates;
77
Netflow_template_t* template;
78
unsigned char* data;
79
unsigned char* last;
80
size_t next;
81
size_t count;
82
unsigned int version;
83
} Netflow_file_t;
84
85
#define NS ((Nftime_t)1000000000)
86
#define US ((Nftime_t)1000000)
87
#define MS ((Nftime_t)1000)
88
89
#define netflow_first_format (&netflow_fixed_format)
90
#define netflow_dump_next (&netflow_dumpv9_format)
91
#define netflow_dumpv9_next (&netflow_tool_format)
92
#define netflow_fixed_next (&netflow_dump_format)
93
#define netflow_tool_next (&netflow_flat_format)
94
#define netflow_flat_next 0
95
96
#define netflow_method _dss_netflow_method
97
#define netflow_formats _dss_netflow_formats
98
#define netflow_dump_format _dss_flow_dump_format
99
#define netflow_dumpv9_format _dss_flow_dumpv9_format
100
#define netflow_fixed_format _dss_flow_fixed_format
101
#define netflow_flat_format _dss_flow_flat_format
102
#define netflow_tool_format _dss_flow_tool_format
103
104
extern Dssformat_t* netflow_formats;
105
extern Dssformat_t netflow_dump_format;
106
extern Dssformat_t netflow_dumpv9_format;
107
extern Dssformat_t netflow_fixed_format;
108
extern Dssformat_t netflow_flat_format;
109
extern Dssformat_t netflow_tool_format;
110
111
#endif
112
113