Commit b27d4c0f authored by 's avatar
Browse files

Logging Mechanism Updated. Now MAPI supports logging to files and syslog.

In order to log messages to syslog, mapid and/or mapicommd should be executed
with the flag -s (mapid -s and/or mapicommd -s). 
Two different types of messages are sent to syslog, debug messages and
general information messages. In /usr/local/etc/mapi/mapi.conf the syslog
level can be configured.

syslog_level=0 : Log only general information and not debugging messages
syslog_level=1 : Log general information plus debugging information (debug messages are printed to stdout and syslog)
syslog_level=2 : Log general information plus debugging information (debug messages are printed only to syslog)

The default level is 2 (temporary the default level is 1).

In order to log debug messages and general information messages to separate log files,
syslog daemon must be configured as follows:

File /etc/syslog.conf should have the following two entries:

local1.info;local1.!=debug				/var/tmp/info.syslog
local1.debug;local1.!=info				/var/tmp/debug.syslog

/var/tmp/info.syslog & /var/tmp/debug.syslog are indicative names of files, where debug and information messages are appended.
The /var/tmp/info.syslog & /var/tmp/debug.syslog files must exist before the syslogd daemon re-reads the /etc/syslog.conf
configuration file, in order for the syslogd daemon to log messages to these files. To create these files, issue the following commands:

touch /var/tmp/info.syslog
touch /var/tmp/debug.syslog

Then issue the following command to force the syslogd daemon to re-read its configuration file: kill -HUP <syslogd's process id>

Define DEBUG is default enabled. In the future mapi configuration will have an extra flag (--enable-debug), thus a MAPI
user might select if MAPI prints debug messages or no.


git-svn-id: file:///home/svn/mapi/trunk@1292 8d5bb341-7cf1-0310-8cf6-ba355fef3186
parent 67a8a848
...@@ -3,8 +3,8 @@ drvpath=@DATADIR@ ...@@ -3,8 +3,8 @@ drvpath=@DATADIR@
libs=@MAPI_FUNC_LIBS@ libs=@MAPI_FUNC_LIBS@
debug=2
dimapi_port=2233 dimapi_port=2233
syslog_level=1
logfile= logfile=
[driver] [driver]
......
...@@ -41,7 +41,9 @@ common/libflist.la \ ...@@ -41,7 +41,9 @@ common/libflist.la \
common/libmapiipc.la \ common/libmapiipc.la \
common/libparseconf.la \ common/libparseconf.la \
common/libprintfstring.la -lpthread -ldl \ common/libprintfstring.la -lpthread -ldl \
common/libdevgroupdb.la common/libdevgroupdb.la \
common/libdebug.la \
common/liblog.la
mapid_SOURCES = mapid.c mapid.h mapidevices.h debug.h mapid_SOURCES = mapid.c mapid.h mapidevices.h debug.h
if BINARY_DIMAPI if BINARY_DIMAPI
...@@ -53,7 +55,9 @@ common/libflist.la \ ...@@ -53,7 +55,9 @@ common/libflist.la \
common/libparseconf.la \ common/libparseconf.la \
common/libprintfstring.la \ common/libprintfstring.la \
common/libdevgroupdb.la \ common/libdevgroupdb.la \
lib/libmapi.la -lpthread lib/libmapi.la -lpthread \
common/libdebug.la \
common/liblog.la
mapicommd_SOURCES = mapicommd.c mapicommd_SOURCES = mapicommd.c
endif endif
......
...@@ -9,6 +9,7 @@ anonflib_la_LDFLAGS = -module ...@@ -9,6 +9,7 @@ anonflib_la_LDFLAGS = -module
anonflib_la_LIBADD = \ anonflib_la_LIBADD = \
../common/libflist.la \ ../common/libflist.la \
../common/libmapiipc.la \ ../common/libmapiipc.la \
../common/libdebug.la \
../common/libfhelp.la -lm @PCRELIB@ ../common/libfhelp.la -lm @PCRELIB@
anonflib_la_SOURCES = \ anonflib_la_SOURCES = \
aes.c aes.h \ aes.c aes.h \
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include <ctype.h> #include <ctype.h>
#include <mapi.h> #include <mapi.h>
#include "anonymization.h" #include "anonymization.h"
#include "debug.h"
#define TIMEBUF_SIZE 26 #define TIMEBUF_SIZE 26
#define C_OFFSET 49 #define C_OFFSET 49
...@@ -211,7 +212,7 @@ void PrintIPPkt(FILE * fp, MAPI_UNUSED int type, mapipacket * p) ...@@ -211,7 +212,7 @@ void PrintIPPkt(FILE * fp, MAPI_UNUSED int type, mapipacket * p)
} }
if(!p) { if(!p) {
printf("PACKET=NULLLLLLLLLLLLLLLLL\n"); DEBUG_CMD(Debug_Message("PACKET is NULL"));
return; return;
} }
...@@ -745,7 +746,7 @@ void PrintNetData(FILE * fp, u_char * start, const int len) ...@@ -745,7 +746,7 @@ void PrintNetData(FILE * fp, u_char * start, const int len)
if(start == NULL) if(start == NULL)
{ {
printf("Got NULL ptr in PrintNetData()\n"); DEBUG_CMD(Debug_Message("Got NULL ptr in PrintNetData()"));
return; return;
} }
...@@ -753,8 +754,8 @@ void PrintNetData(FILE * fp, u_char * start, const int len) ...@@ -753,8 +754,8 @@ void PrintNetData(FILE * fp, u_char * start, const int len)
if(len > 65535) if(len > 65535)
{ {
printf("Got bogus buffer length (%d) for PrintNetData, defaulting to 16 bytes!\n", len); DEBUG_CMD(Debug_Message("Got bogus buffer length (%d) for PrintNetData, defaulting to 16 bytes!", len));
dbuf_size = (FRAME_SIZE + 8) + (FRAME_SIZE + 8) + 1; dbuf_size = (FRAME_SIZE + 8) + (FRAME_SIZE + 8) + 1;
/* dbuf_size = 66 + 67; */ /* dbuf_size = 66 + 67; */
end = (char*) (start + 15); end = (char*) (start + 15);
......
...@@ -43,12 +43,11 @@ char *mapidflib_get_libname() { ...@@ -43,12 +43,11 @@ char *mapidflib_get_libname() {
__attribute__ ((constructor)) __attribute__ ((constructor))
void init () void init ()
{ {
DEBUG_CMD(printf ("Library anonflib loaded\n")); printf("Library anonflib loaded\n");
} }
__attribute__ ((destructor)) __attribute__ ((destructor))
void fini () void fini ()
{ {
DEBUG_CMD(printf ("Library anonflib unloaded\n")); printf("Library anonflib unloaded\n");
} }
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include "prefix_preserving_map.h" #include "prefix_preserving_map.h"
#include "../extraflib/cooking.h" #include "../extraflib/cooking.h"
#include "mapi_errors.h" #include "mapi_errors.h"
#include "debug.h"
#include "names.h" #include "names.h"
extern char *anonnames[]; extern char *anonnames[];
...@@ -246,29 +247,29 @@ int unmarshalBuffer(int function,char *buffer,struct unmarshal_data *data) { ...@@ -246,29 +247,29 @@ int unmarshalBuffer(int function,char *buffer,struct unmarshal_data *data) {
*pos='\0'; *pos='\0';
num_of_matches=atoi(tmpbuf); num_of_matches=atoi(tmpbuf);
tmpbuf=pos+1; tmpbuf=pos+1;
printf(">>>>>>> REGEXP: %s %d\n",regexp,num_of_matches); DEBUG_CMD(Debug_Message(">>>>>>> REGEXP: %s %d", regexp, num_of_matches));
replaceVector=(char **)malloc(num_of_matches*sizeof(char *)); replaceVector=(char **)malloc(num_of_matches*sizeof(char *));
memset(replaceVector,0,num_of_matches*sizeof(char *)); memset(replaceVector,0,num_of_matches*sizeof(char *));
for(i=0;i<(num_of_matches-1);i++) { for(i=0;i<(num_of_matches-1);i++) {
pos=strchr(tmpbuf,','); pos=strchr(tmpbuf,',');
if(pos==NULL) { if(pos==NULL) {
printf("!!!!\n"); DEBUG_CMD(Debug_Message("pos is NULL !"));
return 0; return 0;
} }
*pos='\0'; *pos='\0';
printf("REPLACE VECTOR[%d]=%s\n",i,tmpbuf); DEBUG_CMD(Debug_Message("REPLACE VECTOR[%d]=%s", i, tmpbuf));
if(strcmp(tmpbuf,"NULL")!=0) if(strcmp(tmpbuf,"NULL")!=0)
replaceVector[i]=(char *)strdup(tmpbuf); replaceVector[i]=(char *)strdup(tmpbuf);
tmpbuf=pos+1; tmpbuf=pos+1;
} }
printf("REPLACE VECTOR[%d]=%s\n",i,tmpbuf); DEBUG_CMD(Debug_Message("REPLACE VECTOR[%d]=%s", i, tmpbuf));
if(strcmp(tmpbuf,"NULL")!=0) if(strcmp(tmpbuf,"NULL")!=0)
replaceVector[i]=(char *)strdup(tmpbuf); replaceVector[i]=(char *)strdup(tmpbuf);
break; break;
default: default:
printf("UNKNOWN FUNCTION\n"); DEBUG_CMD(Debug_Message("UNKNOWN FUNCTION"));
return 0; return 0;
} }
...@@ -297,18 +298,18 @@ int unmarshalBuffer(int function,char *buffer,struct unmarshal_data *data) { ...@@ -297,18 +298,18 @@ int unmarshalBuffer(int function,char *buffer,struct unmarshal_data *data) {
int can_field_be_applied_to_function(int anonymization_function,int field) { int can_field_be_applied_to_function(int anonymization_function,int field) {
if((anonymization_function==PREFIX_PRESERVING || anonymization_function==PREFIX_PRESERVING_MAP) && field!=SRC_IP && field!=DST_IP) { if((anonymization_function==PREFIX_PRESERVING || anonymization_function==PREFIX_PRESERVING_MAP) && field!=SRC_IP && field!=DST_IP) {
printf("PREFIX_PRESERVING can only be applied to IP addresses\n"); DEBUG_CMD(Debug_Message("PREFIX_PRESERVING can only be applied to IP addresses"));
return 0; return 0;
} }
if((anonymization_function==MAP ||anonymization_function==MAP_DISTRIBUTION) && (field<CHECKSUM || field>CODE || field==OPTIONS || field==TCP_OPTIONS)) { if((anonymization_function==MAP ||anonymization_function==MAP_DISTRIBUTION) && (field<CHECKSUM || field>CODE || field==OPTIONS || field==TCP_OPTIONS)) {
printf("MAP/MAP_DISTRIBUTION can only be applied to IP,TCP,UDP and ICMP headers (except IP and TCP options\n"); DEBUG_CMD(Debug_Message("MAP/MAP_DISTRIBUTION can only be applied to IP,TCP,UDP and ICMP headers (except IP and TCP options)"));
return 0; return 0;
} }
if(anonymization_function==STRIP && (field!=PAYLOAD) && (field!=OPTIONS) && (field!=TCP_OPTIONS) && ((field<=BASE_HTTP_DEFS) if(anonymization_function==STRIP && (field!=PAYLOAD) && (field!=OPTIONS) && (field!=TCP_OPTIONS) && ((field<=BASE_HTTP_DEFS)
|| (field>=END_HTTP_DEFS)) && ((field<=BASE_FTP_DEFS) || (field>=END_FTP_DEFS))) { || (field>=END_HTTP_DEFS)) && ((field<=BASE_FTP_DEFS) || (field>=END_FTP_DEFS))) {
printf("STRIP can only be applied to IP and TCP options, PAYLOAD and all HTTP, FTP headers\n"); DEBUG_CMD(Debug_Message("STRIP can only be applied to IP and TCP options, PAYLOAD and all HTTP, FTP headers"));
return 0; return 0;
} }
...@@ -318,18 +319,18 @@ int can_field_be_applied_to_function(int anonymization_function,int field) { ...@@ -318,18 +319,18 @@ int can_field_be_applied_to_function(int anonymization_function,int field) {
}*/ }*/
if(anonymization_function==REPLACE && (field>=CHECKSUM && field<=CODE)) { if(anonymization_function==REPLACE && (field>=CHECKSUM && field<=CODE)) {
printf("REPLACE cannot be performed on headers\n"); DEBUG_CMD(Debug_Message("REPLACE cannot be performed on headers"));
return 0; return 0;
} }
if(anonymization_function==CHECKSUM_ADJUST && field!=CHECKSUM) { if(anonymization_function==CHECKSUM_ADJUST && field!=CHECKSUM) {
printf("CHECKSUM_ADJUST can only be applied to CHECKSUM field\n"); DEBUG_CMD(Debug_Message("CHECKSUM_ADJUST can only be applied to CHECKSUM field"));
return 0; return 0;
} }
if(field == FIELD_VERSION || field == IHL) if(field == FIELD_VERSION || field == IHL)
{ {
printf("Anonymization of IP fields Version & Internet Header Length is not supported to maintain usability of anonymized data.\n"); DEBUG_CMD(Debug_Message("Anonymization of IP fields Version & Internet Header Length is not supported to maintain usability of anonymized data."));
return(0); return(0);
} }
...@@ -405,22 +406,22 @@ static int anonymize_instance(mapidflib_function_instance_t *instance, ...@@ -405,22 +406,22 @@ static int anonymize_instance(mapidflib_function_instance_t *instance,
} }
if(anonymization_function<UNCHANGED || anonymization_function>REGEXP) { if(anonymization_function<UNCHANGED || anonymization_function>REGEXP) {
printf("UNKNOWN FUNCTION\n"); DEBUG_CMD(Debug_Message("UNKNOWN FUNCTION"));
return MFUNCT_INVALID_ARGUMENT_3; return MFUNCT_INVALID_ARGUMENT_3;
} }
if(!can_field_be_applied_to_protocol(protocol,field_description)) { if(!can_field_be_applied_to_protocol(protocol,field_description)) {
printf("FIELD CANNOT BE APPLIED TO SPECIFIC PROTOCOL\n"); DEBUG_CMD(Debug_Message("FIELD CANNOT BE APPLIED TO SPECIFIC PROTOCOL"));
return MFUNCT_INVALID_ARGUMENT_2; return MFUNCT_INVALID_ARGUMENT_2;
} }
if(!can_field_be_applied_to_function(anonymization_function,field_description)) { if(!can_field_be_applied_to_function(anonymization_function,field_description)) {
printf("FIELD CANNOT BE APPLIED TO SPECIFIC FUNCTION\n"); DEBUG_CMD(Debug_Message("FIELD CANNOT BE APPLIED TO SPECIFIC FUNCTION"));
return MFUNCT_INVALID_ARGUMENT_2; return MFUNCT_INVALID_ARGUMENT_2;
} }
if(marshalledBuffer!=NULL && unmarshalBuffer(anonymization_function,marshalledBuffer,NULL)==0) { if(marshalledBuffer!=NULL && unmarshalBuffer(anonymization_function,marshalledBuffer,NULL)==0) {
printf("UNMARSHALLING FAILED\n"); DEBUG_CMD(Debug_Message("UNMARSHALLING FAILED"));
return MFUNCT_INVALID_ARGUMENT_4; return MFUNCT_INVALID_ARGUMENT_4;
} }
...@@ -486,7 +487,7 @@ static int anonymize_init(mapidflib_function_instance_t *instance, MAPI_UNUSED i ...@@ -486,7 +487,7 @@ static int anonymize_init(mapidflib_function_instance_t *instance, MAPI_UNUSED i
default: default:
unmarshaled=(struct unmarshal_data *)malloc(sizeof(struct unmarshal_data)); unmarshaled=(struct unmarshal_data *)malloc(sizeof(struct unmarshal_data));
if(unmarshalBuffer(anonymization_function,marshalledBuffer,unmarshaled)==0) { if(unmarshalBuffer(anonymization_function,marshalledBuffer,unmarshaled)==0) {
printf("UNMARSHALLING FAILED\n"); DEBUG_CMD(Debug_Message("UNMARSHALLING FAILED"));
return -1; return -1;
} }
...@@ -551,7 +552,7 @@ void anonymize_field(int protocol, int field, int function,mapipacket *packet,st ...@@ -551,7 +552,7 @@ void anonymize_field(int protocol, int field, int function,mapipacket *packet,st
int i; int i;
if(!packet) { if(!packet) {
printf("WARNING: NULL packet\n"); DEBUG_CMD(Debug_Message("WARNING: NULL packet"));
return; return;
} }
...@@ -1029,7 +1030,7 @@ void apply_function_to_field(int function,int protocol,int field,unsigned char * ...@@ -1029,7 +1030,7 @@ void apply_function_to_field(int function,int protocol,int field,unsigned char *
aes_hash(field_pointer,len,(unsigned char *)AES_keys,params->padding_behavior,packet); aes_hash(field_pointer,len,(unsigned char *)AES_keys,params->padding_behavior,packet);
break; break;
default: default:
printf("Fatal Error!\n"); DEBUG_CMD(Debug_Message("Fatal Error!"));
exit(0); exit(0);
} }
break; break;
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include <ctype.h> #include <ctype.h>
#include "anonymization.h" #include "anonymization.h"
#include "debug.h"
char *http_keywords[]= char *http_keywords[]=
{"HTTP Version","Method","URI","User-Agent","Accept","Accept-Charset","Accept-Encoding", {"HTTP Version","Method","URI","User-Agent","Accept","Accept-Charset","Accept-Encoding",
...@@ -196,7 +197,7 @@ int pipeline_http_decode(unsigned char *payload,unsigned int dsize,struct httphe ...@@ -196,7 +197,7 @@ int pipeline_http_decode(unsigned char *payload,unsigned int dsize,struct httphe
space_finder++; space_finder++;
if(space_finder==end_of_first_line) { if(space_finder==end_of_first_line) {
fprintf(stderr,"Invalid first line of HTTP request\n"); DEBUG_CMD(Debug_Message("Invalid first line of HTTP request"));
return -1; return -1;
} }
h->http_type=HTTP_REQUEST; h->http_type=HTTP_REQUEST;
...@@ -212,7 +213,7 @@ int pipeline_http_decode(unsigned char *payload,unsigned int dsize,struct httphe ...@@ -212,7 +213,7 @@ int pipeline_http_decode(unsigned char *payload,unsigned int dsize,struct httphe
space_finder++; space_finder++;
if(space_finder==end_of_first_line) { if(space_finder==end_of_first_line) {
fprintf(stderr,"Invalid first line of HTTP request. Protocol missing!\n"); DEBUG_CMD(Debug_Message("Invalid first line of HTTP request. Protocol missing!"));
return -1; return -1;
} }
......
...@@ -3,10 +3,11 @@ ...@@ -3,10 +3,11 @@
#endif #endif
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include "prefix_preserving_map.h"
#include <time.h> #include <time.h>
#include <netinet/in.h> #include <netinet/in.h>
#include <strings.h> #include <strings.h>
#include "prefix_preserving_map.h"
#include "debug.h"
int bi_ffs(u_long value); int bi_ffs(u_long value);
void hide_addr(unsigned char *raw_addr); void hide_addr(unsigned char *raw_addr);
...@@ -80,7 +81,7 @@ static node_p newnode(void) ...@@ -80,7 +81,7 @@ static node_p newnode(void)
node = (node_p) malloc(sizeof *node); node = (node_p) malloc(sizeof *node);
if (node == 0) { if (node == 0) {
fprintf(stderr, "malloc failed %s:%d\n", __FILE__, __LINE__); DEBUG_CMD(Debug_Message("malloc failed"));
exit(2); exit(2);
} }
return node; return node;
...@@ -211,7 +212,7 @@ u_long lookup(u_long input, nodehdr_p hdr) ...@@ -211,7 +212,7 @@ u_long lookup(u_long input, nodehdr_p hdr)
node = hdr->head; /* non-zero, 'cause lookup_init() already called */ node = hdr->head; /* non-zero, 'cause lookup_init() already called */
if (hdr->head == 0) { /* (but...) */ if (hdr->head == 0) { /* (but...) */
fprintf(stderr, "unexpected zero head %s:%d\n", __FILE__, __LINE__); DEBUG_CMD(Debug_Message("unexpected zero head"));
} }
while (node) { while (node) {
...@@ -234,7 +235,7 @@ u_long lookup(u_long input, nodehdr_p hdr) ...@@ -234,7 +235,7 @@ u_long lookup(u_long input, nodehdr_p hdr)
} }
/* ??? should not occur! */ /* ??? should not occur! */
fprintf(stderr, "unexpected loop termination %s:%d\n", __FILE__, __LINE__); DEBUG_CMD(Debug_Message("unexpected loop termination"));
exit(1); exit(1);
} }
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include "mapidevices.h" #include "mapidevices.h"
#include "mapid.h" #include "mapid.h"
#include "fhelp.h" #include "fhelp.h"
#include "debug.h"
#include "mapiipc.h" #include "mapiipc.h"
#include "anonymization.h" #include "anonymization.h"
...@@ -45,7 +46,7 @@ void rebuild_fragments(mapidflib_function_instance_t *instance,flist_t *list,uns ...@@ -45,7 +46,7 @@ void rebuild_fragments(mapidflib_function_instance_t *instance,flist_t *list,uns
flist_node_t *node = NULL, *temp_node = NULL; flist_node_t *node = NULL, *temp_node = NULL;
if(!list) { if(!list) {
fprintf(stderr,"No list report in rebuild_fragments\n"); DEBUG_CMD(Debug_Message("No list report in rebuild_fragments"));
return; return;
} }
...@@ -53,9 +54,8 @@ void rebuild_fragments(mapidflib_function_instance_t *instance,flist_t *list,uns ...@@ -53,9 +54,8 @@ void rebuild_fragments(mapidflib_function_instance_t *instance,flist_t *list,uns
//fprintf(stderr,"No payload report in rebuild_fragments\n"); //fprintf(stderr,"No payload report in rebuild_fragments\n");
return; return;
} }
DEBUG_CMD(Debug_Message("in rebuild_fragments before getting headers"));
printf("in rebuild_fragments before getting headers\n");
// get data from large payload // get data from large payload
eth = (ether_header*)payload; eth = (ether_header*)payload;
...@@ -72,7 +72,7 @@ void rebuild_fragments(mapidflib_function_instance_t *instance,flist_t *list,uns ...@@ -72,7 +72,7 @@ void rebuild_fragments(mapidflib_function_instance_t *instance,flist_t *list,uns
// finished getting data // finished getting data
printf("in rebuild_fragments after getting headers\n"); DEBUG_CMD(Debug_Message("in rebuild_fragments after getting headers"));
// get remainder functions from the list // get remainder functions from the list
pthread_spin_lock(&instance->hwinfo->gflist->lock); pthread_spin_lock(&instance->hwinfo->gflist->lock);
...@@ -107,7 +107,7 @@ void rebuild_fragments(mapidflib_function_instance_t *instance,flist_t *list,uns ...@@ -107,7 +107,7 @@ void rebuild_fragments(mapidflib_function_instance_t *instance,flist_t *list,uns
/* /*
printf("packet data caplen %d wlen %d\n", pkthdr.caplen, pkthdr.len); printf("packet data caplen %d wlen %d\n", pkthdr.caplen, pkthdr.len);
*/ */
printf("instance->hwinfo->cap_length %d\n", instance->hwinfo->cap_length); DEBUG_CMD(Debug_Message("instance->hwinfo->cap_length %d", instance->hwinfo->cap_length));
//decode_packet(instance->hwinfo->link_type,instance->hwinfo->cap_length,&pkthdr,(unsigned char *)(data->header),&frag_decoded); //decode_packet(instance->hwinfo->link_type,instance->hwinfo->cap_length,&pkthdr,(unsigned char *)(data->header),&frag_decoded);
decode_packet(instance->hwinfo->link_type,data->caplen,&pkthdr,(unsigned char *)(data->header),&frag_decoded); decode_packet(instance->hwinfo->link_type,data->caplen,&pkthdr,(unsigned char *)(data->header),&frag_decoded);
// decode_packet(instance->hwinfo->link_type,instance->hwinfo->cap_length,&pkthdr,payload,&frag_decoded); // decode_packet(instance->hwinfo->link_type,instance->hwinfo->cap_length,&pkthdr,payload,&frag_decoded);
...@@ -164,7 +164,7 @@ void rebuild_fragments(mapidflib_function_instance_t *instance,flist_t *list,uns ...@@ -164,7 +164,7 @@ void rebuild_fragments(mapidflib_function_instance_t *instance,flist_t *list,uns
while(temp_node != NULL) { while(temp_node != NULL) {
traverse = flist_data(temp_node); traverse = flist_data(temp_node);
printf("calling function %s pkthdr.caplen %d\n", traverse->instance->def->name, pkthdr.caplen); DEBUG_CMD(Debug_Message("calling function %s pkthdr.caplen %d", traverse->instance->def->name, pkthdr.caplen));
traverse->instance->def->process(traverse->instance, frag_decoded.pkt, frag_decoded.pkt, &new_header); traverse->instance->def->process(traverse->instance, frag_decoded.pkt, frag_decoded.pkt, &new_header);
temp_node = flist_next(temp_node); temp_node = flist_next(temp_node);
...@@ -183,8 +183,8 @@ void rebuild_fragments(mapidflib_function_instance_t *instance,flist_t *list,uns ...@@ -183,8 +183,8 @@ void rebuild_fragments(mapidflib_function_instance_t *instance,flist_t *list,uns
if((large_payload_size-p_offset)>0) { if((large_payload_size-p_offset)>0) {
data=(struct headers_data *)prev->data; data=(struct headers_data *)prev->data;
data->caplen=data->wlen=data->caplen+large_payload_size-p_offset; data->caplen=data->wlen=data->caplen+large_payload_size-p_offset;
fprintf(stderr,"I have %d flow headers and there are %d bytes remaining \n",cnt,large_payload_size-p_offset); DEBUG_CMD(Debug_Message("I have %d flow headers and there are %d bytes remaining", cnt, large_payload_size-p_offset));
fprintf(stderr,"new data caplen: %d\n",data->caplen); DEBUG_CMD(Debug_Message("new data caplen: %d", data->caplen));
pkthdr.caplen=data->caplen; pkthdr.caplen=data->caplen;
pkthdr.len=data->wlen; pkthdr.len=data->wlen;
...@@ -206,7 +206,7 @@ void rebuild_fragments(mapidflib_function_instance_t *instance,flist_t *list,uns ...@@ -206,7 +206,7 @@ void rebuild_fragments(mapidflib_function_instance_t *instance,flist_t *list,uns
} }
else { else {
printf("in here setting it in zero\n"); DEBUG_CMD(Debug_Message("in here setting it in zero"));
mapihdr->caplen = 0; mapihdr->caplen = 0;
return; return;
} }
......
## Process this file with automake to produce Makefile.in ## Process this file with automake to produce Makefile.in
AM_CPPFLAGS = -I$(srcdir)/.. -I$(srcdir)/../lib -I$(srcdir)/../drivers @SSLINC@ -D_GNU_SOURCE -D_THREAD_SAFE AM_CPPFLAGS = -I$(srcdir)/.. -I$(srcdir)/../lib -I$(srcdir)/../drivers @SSLINC@ -D_GNU_SOURCE -D_THREAD_SAFE
noinst_LTLIBRARIES = libflist.la libfhelp.la libmapiipc.la libparseconf.la libprintfstring.la libmapilibhandler.la libmsearch.la libacsmx2.la libcbuf.la libdevgroupdb.la noinst_LTLIBRARIES = libflist.la libfhelp.la libmapiipc.la libparseconf.la libprintfstring.la libmapilibhandler.la libmsearch.la libacsmx2.la libcbuf.la libdevgroupdb.la libdebug.la liblog.la
libflist_la_SOURCES = flist.c flist.h libflist_la_SOURCES = flist.c flist.h
libflist_la_DEPENDENCIES = mapi_errors.h libflist_la_DEPENDENCIES = mapi_errors.h
libfhelp_la_SOURCES = fhelp.c fhelp.h libfhelp_la_SOURCES = fhelp.c fhelp.h
...@@ -14,6 +14,8 @@ libmsearch_la_SOURCES = mstring.c mstring.h ...@@ -14,6 +14,8 @@ libmsearch_la_SOURCES = mstring.c mstring.h
libacsmx2_la_SOURCES = acsmx2.c acsmx2.h libacsmx2_la_SOURCES = acsmx2.c acsmx2.h
libcbuf_la_SOURCES = cbuf.c cbuf.h kernel_memory.h libcbuf_la_SOURCES = cbuf.c cbuf.h kernel_memory.h
libdevgroupdb_la_SOURCES = devgroupdb.c devgroupdb.h libdevgroupdb_la_SOURCES = devgroupdb.c devgroupdb.h
libdebug_la_SOURCES = debug.c debug.h
liblog_la_SOURCES = log.c log.h
noinst_HEADERS = mapidflib.h mapi_errors.h noinst_HEADERS = mapidflib.h mapi_errors.h
......
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <syslog.h>
#include "debug.h"
#ifdef DEBUG
char *debug_message_file = NULL; // filename information
int debug_message_line = 0; // line number information
void debug_message(char *fmt, ...){
char buf[STD_BUF + 1];
va_list ap;
int len;