NETWORK ATTACKS FRAMEWORK  1.0.0
A NETwork Attacks framework. Making network attacks impact evaluation easier!
NA_debug_aodv.h
Go to the documentation of this file.
00001 /*****************************************************************************
00002  *
00003  * Copyright (C) 2001 Uppsala University & Ericsson AB.
00004  *
00005  * This program is free software; you can redistribute it and/or modify
00006  * it under the terms of the GNU General Public License as published by
00007  * the Free Software Foundation; either version 2 of the License, or
00008  * (at your option) any later version.
00009  *
00010  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU General Public License
00016  * along with this program; if not, write to the Free Software
00017  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018  *
00019  * Authors: Erik Nordstr�m, <erik.nordstrom@it.uu.se>
00020  *
00021  *****************************************************************************/
00022 #ifndef NA_DEBUG_H
00023 #define NA_DEBUG_H
00024 
00025 #include <stdio.h>
00026 #if defined(_WIN32) || defined(__WIN32__) || defined(WIN32) || defined(__CYGWIN__) || defined(_WIN64)
00027 #define LOG_DEBUG 0
00028 #define LOG_NOTICE 0
00029 #define LOG_ERR 0
00030 #define LOG_WARNING 0
00031 #define LOG_INFO 0
00032 #else
00033 #include <syslog.h>
00034 #endif
00035 
00036 
00037 #ifndef NS_PORT
00038 extern int debug;
00039 #endif
00040 
00041 #ifndef NS_NO_DECLARATIONS
00042 void log_init();
00043 void log_cleanup();
00044 
00045 const char *packet_type(unsigned int type);
00046 void alog(int type, int errnum, const char *function, const char *format, ...);
00047 void log_pkt_fields(AODV_msg * msg);
00048 void print_rt_table(void *arg);
00049 void log_rt_table_init();
00050 char *ip_to_str(struct in_addr addr);
00051 #ifdef NS_PORT
00052 void write_to_log_file(char *msg, int len);
00053 char *devs_ip_to_str();
00054 char *rreq_flags_to_str(RREQ * rreq);
00055 char *rrep_flags_to_str(RREP * rrep);
00056 char *rt_flags_to_str(u_int16_t flags);
00057 const char *state_to_str(u_int8_t state);
00058 #endif
00059 #endif              /* NS_NO_DECLARATIONS */
00060 
00061 #ifndef NS_NO_GLOBALS
00062 
00063 
00064 #ifdef DEBUG
00065 #define WANT_DEBUGMODE
00066 #undef DEBUG    // as we'll redefine it below
00067 #endif
00068 
00069 #ifdef _MSC_VER
00070 // MSVC does not support variadic macros
00071 #define DEBUG   
00072 #else
00073 #ifdef WANT_DEBUGMODE
00074 #define DEBUG(l, s, args...)   alog(l, s, __FUNCTION__, ## args)
00075 // #define DEBUG(l, i,s, args...) syslog(l, strcpy  s, ## args)
00076 #else
00077 #define DEBUG(l, s, args...)
00078 #endif
00079 #endif
00080 
00081 #endif              /* NS_NO_GLOBALS */
00082 
00083 #endif              /* _DEBUG_H */
00084 
 All Classes Files Functions Variables Typedefs Enumerator Defines