debug.h

Go to the documentation of this file.
00001 
00008 #define DEBUG_MAIN 1    //1 HABILITA  TODOS OS DEBUGS,0 DESABILITA.
00009 
00010 #define DEBUG_ENTER_DEF 0       //1 HABILITA PARA MOSTRAR ERROS DE DEBUG_ENTER E DEBUG_EXIT
00011 #define DEBUG_CLI_T 0           //1 HABILITAR PARA MOSTRAR ERROS DEDEBUG_CLI
00012 #define DEBUG_ERROR_T 0         //1 HABILITAR PARA MOSTRAR ERROS DEDEBUG_ERROR
00013 #define DEBUG_INFO_T 0
00014 #define DEBUG_SOCK_T 0
00015 #define DEBUG_HTTP_T 1 //mostrar configuraĆ§Ć£o de debug do web server
00016 #define DEBUG_FTP_T 0
00017 #define DEBUG_SFT_T 0
00018 
00019 #define OUT_UART 1
00020 #define OUT_TELNET 1
00021 
00022 #ifndef DEBUG_H_
00023 #define DEBUG_H_
00024 
00025 
00026 typedef enum {COMMAND_NOT_FOUND =0, TRY_AGAYN, INVALID_DATA,EXEC_COMMAND_ERROR} msg_error;
00027 
00028 static const char* error_cli[]=
00029 {
00030                 "COMMAND NOT FOUND",
00031                 "TRY AGAIN",
00032                 "DADOS INVALIDOS",
00033                 "ERRO NA EXECUCAO DO COMANDO",
00034 };
00035 
00040 #define DEBUG_SFT(msg) \
00041         do { \
00042                 if (DEBUG_MAIN) \
00043                 if (DEBUG_SFT_T) \
00044                         printf("\n%s - %s(%d) FTP report: %s\n", __FILE__, __FUNCTION__, __LINE__, msg); \
00045         } while(0)
00046 
00051 #define DEBUG_FTP(msg) \
00052         do { \
00053                 if (DEBUG_MAIN) \
00054                 if (DEBUG_FTP_T) \
00055                         printf("\n%s - %s(%d) FTP report: %s\n", __FILE__, __FUNCTION__, __LINE__, msg); \
00056         } while(0)
00057 
00062 #define DEBUG_HTTP(msg) \
00063         do { \
00064                 if (DEBUG_MAIN) \
00065                 if (DEBUG_HTTP_T) \
00066                         printf("\n%s - %s(%d) HTTP report: %s\n", __FILE__, __FUNCTION__, __LINE__, msg); \
00067         } while(0)
00068 
00073 #define DEBUG_ERROR(msg) \
00074         do { \
00075                 if (DEBUG_MAIN) \
00076                 if (DEBUG_ERROR_T) \
00077                         printf("\n%s - %s(%d) error: %s\n", __FILE__, __FUNCTION__, __LINE__, error_cli[msg]); \
00078         } while(0)
00079 
00084 #define DEBUG_INFO(msg) \
00085         do { \
00086                 if (DEBUG_MAIN) \
00087                 if (DEBUG_INFO_T) \
00088                         printf("%s - %s(%d) action: %s\n", __FILE__, __FUNCTION__, __LINE__, msg); \
00089         } while(0)
00090 
00095 #define DEBUG_CLI(msg) \
00096         do { \
00097                 if (DEBUG_MAIN) \
00098                 if (DEBUG_CLI_T) \
00099                         printf("%s - %s(%d) action: %s\n", __FILE__, __FUNCTION__, __LINE__, msg); \
00100         } while(0)
00101 
00106 #define DEBUG_SOCK_INFO(msg) \
00107                 do { \
00108                         if (DEBUG_MAIN) \
00109                         if (DEBUG_SOCK_T) \
00110                                 printf("%s - %s(%d) action: %s\n", __FILE__, __FUNCTION__, __LINE__, msg); \
00111                 } while(0)
00112 
00117 #define DEBUG_ENTER \
00118         do { \
00119                 if (DEBUG_MAIN) \
00120                 if (DEBUG_ENTER_DEF) \
00121                         printf("%s - %s(%d): Entering\n", __FILE__, __FUNCTION__, __LINE__); \
00122         } while(0)
00123 
00128 #define DEBUG_EXIT \
00129         do { \
00130                 if (DEBUG_MAIN) \
00131                 if (DEBUG_ENTER_DEF) \
00132                         printf("%s - %s(%d): Exiting\n", __FILE__, __FUNCTION__, __LINE__); \
00133         } while(0)
00134 
00135 
00136 void debug_cli(char *data);
00137 void debug_func(char *data);
00138 void PRT_ERROR(msg_error erro);
00139 
00140 #endif          //DEBUG_H_