Revision 24, 2.8 KB
(checked in by andreu, 16 years ago)
|
aggregation feature first E2E step : collect to rrdfiles
|
-
Property svn:eol-style set to
native
|
Rev | Line | |
---|
[2] | 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 | |
---|
[8] | 26 | #define _GNU_SOURCE |
---|
| 27 | |
---|
[2] | 28 | #include <unistd.h> |
---|
| 29 | #include <stdio.h> |
---|
| 30 | #include <string.h> |
---|
| 31 | #include <stdlib.h> |
---|
| 32 | #include <syslog.h> |
---|
| 33 | #include <sys/types.h> |
---|
| 34 | #include <sys/socket.h> |
---|
| 35 | #include <netinet/in.h> |
---|
| 36 | #include <time.h> |
---|
| 37 | #include <errno.h> |
---|
| 38 | #include <sys/ipc.h> |
---|
| 39 | #include <sys/shm.h> |
---|
| 40 | #include <sys/sem.h> |
---|
| 41 | #include <ctype.h> |
---|
| 42 | #include <netdb.h> |
---|
| 43 | #include <net/if.h> |
---|
| 44 | #include <sys/ioctl.h> |
---|
| 45 | #include <arpa/inet.h> |
---|
| 46 | #include <signal.h> |
---|
| 47 | #include <setjmp.h> |
---|
| 48 | |
---|
| 49 | #include "routers_mgmt.h" |
---|
| 50 | #include "fields_mgmt.h" |
---|
| 51 | #include "routers_mgmt.h" |
---|
| 52 | #include "tplflset_mgmt.h" |
---|
| 53 | #include "fields_mgmt.h" |
---|
| 54 | #include "headers_mgmt.h" |
---|
| 55 | #include "V9Header_mgmt.h" |
---|
| 56 | #include "template.h" |
---|
| 57 | #include "dataFlowSet.h" |
---|
| 58 | #include "get_conf.h" |
---|
| 59 | #include "rules_mgmt.h" |
---|
| 60 | #include "msg_mgmt.h" |
---|
[18] | 61 | |
---|
[2] | 62 | |
---|
| 63 | |
---|
| 64 | #define SOCKET_BUFFER_SIZE 1500 |
---|
| 65 | |
---|
| 66 | #define RECEPTION_ADDRESS "" |
---|
[8] | 67 | #define RECEPTION_PORT 9999 |
---|
[2] | 68 | |
---|
[18] | 69 | #define TIME_OUT 300 |
---|
[2] | 70 | |
---|
| 71 | #define ROUTER_INDEX_MAX 70 |
---|
| 72 | #define FIELD_TYPE_NUMBER 89 |
---|
| 73 | #define MAX_RULES_PER_FIELD 10 |
---|
| 74 | |
---|
[20] | 75 | #ifdef CRIHAN |
---|
[19] | 76 | #define OUTPUT_IP "/tmp/ipflow" |
---|
| 77 | #define EXTENSION ".txt" |
---|
| 78 | #define OUTPUT_MPLS "/tmp/mplsflow" |
---|
| 79 | #define MAX_IP_OUTPUT_FILES 3 |
---|
| 80 | #define MAX_MPLS_OUTPUT_FILES 3 |
---|
| 81 | #define IP_TIME_THRESHOLD 60 |
---|
| 82 | #define MPLS_TIME_THRESHOLD 60 |
---|
[20] | 83 | #endif |
---|
[23] | 84 | |
---|
[22] | 85 | #define MAX_IP_FLOW 10000 |
---|
| 86 | #define MAX_MPLS_FLOW 200 |
---|
[18] | 87 | |
---|
[24] | 88 | #define SHMSIZE 3000000 |
---|
[23] | 89 | |
---|
[24] | 90 | #define STEP 5 |
---|
[23] | 91 | |
---|
[24] | 92 | struct SHMForAgg { |
---|
| 93 | unsigned short currentTable; |
---|
| 94 | unsigned short readed; |
---|
| 95 | unsigned short v4PrefixNb; |
---|
| 96 | struct PrefixV4 prefixV4Tab[2][MAX_IPV4_PREFIX]; |
---|
| 97 | |
---|
| 98 | }; |
---|
| 99 | |
---|
| 100 | |
---|
[2] | 101 | void setCache(RulesPtr); |
---|
| 102 | void initCache(); |
---|
| 103 | void waitingRoom(); |
---|
[8] | 104 | void initRule(); |
---|
| 105 | void sigusr1Mgmt(int); |
---|
| 106 | void sendMyPid(int); |
---|
| 107 | void sendReadRulesSignal(int); |
---|
[2] | 108 | void initStream(); |
---|
| 109 | void catchAlarm(int); |
---|
| 110 | int socketLoop(); |
---|
| 111 | short initSocket(); |
---|
| 112 | short socketReading(); |
---|
| 113 | short getFlow(short); |
---|
| 114 | short checkFlow(short); |
---|
| 115 | void showAllTplFlSet(); |
---|
[23] | 116 | void writeAllTplFlSet(); |
---|