Commit 6ba56a31 authored by 's avatar
Browse files

Removed str2anonid() to names.c (will be used by VOd too)

Moved definition of anonnames[] outside names.h (people really shouldn't declare variables in header files..)

Modified Makefile accordingly.



git-svn-id: file:///home/svn/mapi/trunk@517 8d5bb341-7cf1-0310-8cf6-ba355fef3186
parent 3b897a4c
......@@ -8,10 +8,13 @@ TARGETS= anonlib.so
all: $(TARGETS)
anonlib.o: anonlib.c ../mapidflib.h ../mapi.h
gcc $(CFLAGS) -c $<
anonlib.so: anonlib.o anonymize.o uncook.o ../mapiipc.o ../flist.o ../fhelp.o decoders.o anon_snort_decode.o anon_print_packet.o anon_checksums.o anon_prefix_preserving.o md5.o sha1.o sha256.o anonymization_functions.o prefix_preserving_map.o print_packet.o crc32.o des.o aes.o pcre/libpcre.a
anonlib.so: names.o anonlib.o anonymize.o uncook.o ../mapiipc.o ../flist.o ../fhelp.o decoders.o anon_snort_decode.o anon_print_packet.o anon_checksums.o anon_prefix_preserving.o md5.o sha1.o sha256.o anonymization_functions.o prefix_preserving_map.o print_packet.o crc32.o des.o aes.o pcre/libpcre.a
gcc $(CFLAGS) -shared -o $@ $^ -lfl -lrt -lpcap -lm -L../ -L. $(LIB_DIR)
cp $@ ..
names.o: names.h names.c
gcc $(CFLAGS) -c names.c
anonymize.o: anonymization.h anonymize.c
gcc $(CFLAGS) -c anonymize.c
......
......@@ -14,7 +14,9 @@
#include "mapiipc.h"
#include "anonymization.h"
#include "../stdlib/cooking.h"
#include "names.h"
extern char *anonnames[];
struct anonymize_data {
int protocol;
......@@ -283,16 +285,6 @@ int can_field_be_applied_to_function(int anonymization_function,int field) {
}
int str2anonid(char *name) {
int i=0;
for(i=0;anonnames[i]!=NULL;i++) {
if(strcmp(anonnames[i],name)==0) {
return i;
}
}
return 0;
}
static int anonymize_instance(mapidflib_function_instance_t *instance,
MAPI_UNUSED int fd,
......
#include "names.h"
char *anonnames[] = {
"UNCHANGED",
"IP",
"TCP",
"UDP",
"ICMP",
"HTTP",
"FTP",
"UNCHANGED",
"MAP",
"MAP_DISTRIBUTION",
"STRIP",
"RANDOM",
"HASHED",
"PATTERN_FILL",
"ZERO",
"REPLACE",
"PREFIX_PRESERVING",
"PREFIX_PRESERVING_MAP",
"CHECKSUM_ADJUST",
"FILENAME_RANDOM",
"REGEXP",
"PAD_WITH_ZERO",
"STRIP_REST",
"SHA",
"MD5",
"CRC32",
"SHA_2",
"TRIPLEDES",
"AES",
"DES",
"BASE_FIELD_DEFS",
"PAYLOAD", //common to all protocols
"CHECKSUM",
"SRC_IP",
"DST_IP",
"TTL",
"TOS",
"ID",
"VERSION",
"OPTIONS",
"PACKET_LENGTH",
"IP_PROTO",
"IHL",
"FRAGMENT_OFFSET",
"SRC_PORT",
"DST_PORT",
"SEQUENCE_NUMBER",
"OFFSET_AND_RESERVED",
"ACK_NUMBER",
"FLAGS",
"URGENT_POINTER",
"WINDOW",
"TCP_OPTIONS",
"UDP_DATAGRAM_LENGTH",
"TYPE",
"CODE",
"BASE_HTTP_DEFS", //the number of first definition for HTTP
"HTTP_VERSION",
"METHOD",
"URI",
"USER_AGENT",
"ACCEPT",
"ACCEPT_CHARSET",
"ACCEPT_ENCODING",
"ACCEPT_LANGUAGE",
"ACCEPT_RANGES",
"AGE",
"ALLOW",
"AUTHORIZATION",
"CACHE_CONTROL",
"CONNECTION_TYPE",
"CONTENT_TYPE",
"CONTENT_LENGTH",
"CONTENT_LOCATION",
"CONTENT_MD5",
"CONTENT_RANGE",
"COOKIE",
"ETAG",
"EXPECT",
"EXPIRES",
"FROM",
"HOST",
"IF_MATCH",
"IF_MODIFIED_SINCE",
"IF_NONE_MATCH",
"IF_RANGE",
"IF_UNMODIFIED_SINCE",
"LAST_MODIFIED",
"MAX_FORWRDS",
"PRAGMA",
"PROXY_AUTHENTICATE",
"PROXY_AUTHORIZATION",
"RANGE",
"REFERRER",
"RETRY_AFTER",
"SET_COOKIE",
"SERVER",
"TE",
"TRAILER",
"TRANSFER_ENCODING",
"UPGRADE",
"VIA",
"WARNING",
"WWW_AUTHENTICATE",
"X_POWERED_BY",
"RESPONSE_CODE",
"RESP_CODE_DESCR",
"VARY",
"DATE",
"CONTENT_ENCODING",
"KEEP_ALIVE",
"LOCATION",
"CONTENT_LANGUAGE",
"DERIVED_FROM",
"ALLOWED",
"MIME_VERSION",
"TITLE",
"REFRESH",
"HTTP_PAYLOAD", //for internal use
"END_HTTP_DEFS",
"BASE_FTP_DEFS",
"USER", //has arg
"PASS", //has arg
"ACCT", //has arg
"FTP_TYPE", //has arg
"STRU",
"MODE",
"CWD", //has arg
"PWD", //no arg
"CDUP", //no arg
"PASV", //no arg
"RETR", //has arg
"REST",
"PORT",
"LIST", //no arg
"NLST", //yes/no arg
"QUIT", //no arg
"SYST", //no arg
"STAT",
"HELP",
"NOOP",
"STOR",
"APPE",
"STOU",
"ALLO",
"MKD", //has arg
"RMD", //has arg
"DELE", //has arg
"RNFR",
"RNTO",
"SITE", //has arg
"FTP_RESPONSE_CODE",
"FTP_RESPONSE_ARG",
"END_FTP_DEFS",
"END_FIELD_DEFS",
"GAUSSIAN",
"UNIFORM",
NULL
};
int str2anonid(char *name) {
int i=0;
for(i=0;anonnames[i]!=NULL;i++) {
if(strcmp(anonnames[i],name)==0) {
return i;
}
}
return 0;
}
char *anonnames[] = {
"UNCHANGED",
"IP",
"TCP",
"UDP",
"ICMP",
"HTTP",
"FTP",
"UNCHANGED",
"MAP",
"MAP_DISTRIBUTION",
"STRIP",
"RANDOM",
"HASHED",
"PATTERN_FILL",
"ZERO",
"REPLACE",
"PREFIX_PRESERVING",
"PREFIX_PRESERVING_MAP",
"CHECKSUM_ADJUST",
"FILENAME_RANDOM",
"REGEXP",
"PAD_WITH_ZERO",
"STRIP_REST",
"SHA",
"MD5",
"CRC32",
"SHA_2",
"TRIPLEDES",
"AES",
"DES",
"BASE_FIELD_DEFS",
"PAYLOAD", //common to all protocols
"CHECKSUM",
"SRC_IP",
"DST_IP",
"TTL",
"TOS",
"ID",
"VERSION",
"OPTIONS",
"PACKET_LENGTH",
"IP_PROTO",
"IHL",
"FRAGMENT_OFFSET",
"SRC_PORT",
"DST_PORT",
"SEQUENCE_NUMBER",
"OFFSET_AND_RESERVED",
"ACK_NUMBER",
"FLAGS",
"URGENT_POINTER",
"WINDOW",
"TCP_OPTIONS",
"UDP_DATAGRAM_LENGTH",
"TYPE",
"CODE",
"BASE_HTTP_DEFS", //the number of first definition for HTTP
"HTTP_VERSION",
"METHOD",
"URI",
"USER_AGENT",
"ACCEPT",
"ACCEPT_CHARSET",
"ACCEPT_ENCODING",
"ACCEPT_LANGUAGE",
"ACCEPT_RANGES",
"AGE",
"ALLOW",
"AUTHORIZATION",
"CACHE_CONTROL",
"CONNECTION_TYPE",
"CONTENT_TYPE",
"CONTENT_LENGTH",
"CONTENT_LOCATION",
"CONTENT_MD5",
"CONTENT_RANGE",
"COOKIE",
"ETAG",
"EXPECT",
"EXPIRES",
"FROM",
"HOST",
"IF_MATCH",
"IF_MODIFIED_SINCE",
"IF_NONE_MATCH",
"IF_RANGE",
"IF_UNMODIFIED_SINCE",
"LAST_MODIFIED",
"MAX_FORWRDS",
"PRAGMA",
"PROXY_AUTHENTICATE",
"PROXY_AUTHORIZATION",
"RANGE",
"REFERRER",
"RETRY_AFTER",
"SET_COOKIE",
"SERVER",
"TE",
"TRAILER",
"TRANSFER_ENCODING",
"UPGRADE",
"VIA",
"WARNING",
"WWW_AUTHENTICATE",
"X_POWERED_BY",
"RESPONSE_CODE",
"RESP_CODE_DESCR",
"VARY",
"DATE",
"CONTENT_ENCODING",
"KEEP_ALIVE",
"LOCATION",
"CONTENT_LANGUAGE",
"DERIVED_FROM",
"ALLOWED",
"MIME_VERSION",
"TITLE",
"REFRESH",
"HTTP_PAYLOAD", //for internal use
"END_HTTP_DEFS",
"BASE_FTP_DEFS",
"USER", //has arg
"PASS", //has arg
"ACCT", //has arg
"FTP_TYPE", //has arg
"STRU",
"MODE",
"CWD", //has arg
"PWD", //no arg
"CDUP", //no arg
"PASV", //no arg
"RETR", //has arg
"REST",
"PORT",
"LIST", //no arg
"NLST", //yes/no arg
"QUIT", //no arg
"SYST", //no arg
"STAT",
"HELP",
"NOOP",
"STOR",
"APPE",
"STOU",
"ALLO",
"MKD", //has arg
"RMD", //has arg
"DELE", //has arg
"RNFR",
"RNTO",
"SITE", //has arg
"FTP_RESPONSE_CODE",
"FTP_RESPONSE_ARG",
"END_FTP_DEFS",
"END_FIELD_DEFS",
"GAUSSIAN",
"UNIFORM",
NULL
};
#ifndef ANON_NAMES_H
#define ANON_NAMES_H
#include <stdlib.h>
#include <string.h>
int str2anonid(char *);
#endif
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment