Changeset 35 in cheroxy for trunk/include


Ignore:
Timestamp:
11/20/12 19:06:30 (11 years ago)
Author:
cheese
Message:

#1 add debugging message

Location:
trunk/include
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/CRXException.h

    r24 r35  
    1212#endif
    1313
    14 #define CRX_ERROR(__CODE,__FMT,...)                                         \
     14#ifdef _DEBUG
     15#include <stdio.h>
     16#include <ctype.h>
     17#define CRX_DEBUG_TRACE(FMT, ...)                                                   \
     18    do{                                                                             \
     19        fprintf(stderr,"[DEBUG][%s %s(%d)] ",__FILE__,__func__,__LINE__);           \
     20        fprintf(stderr,FMT,##__VA_ARGS__);                                          \
     21}while(0)
     22#define CRX_DEBUG_TRACE_BIN(__VAL,__LEN,FMT,...)                                    \
     23    CRX_DEBUG_TRACE(FMT,##__VA_ARGS__);                                             \
     24    do{                                                                             \
     25        int __i, __j;                                                               \
     26        unsigned char * __U_V = (unsigned char *)__VAL;                             \
     27        for (__i=0 ; __i<__LEN; __i+=16)                                            \
     28        {                                                                           \
     29            fprintf(stderr, "[DEBUG][%s %s(%d)] ",__FILE__,__func__,__LINE__);      \
     30            fprintf(stderr, "%06x : ", __i);                                        \
     31            for (__j=0 ; __j<16 ; __j++)                                            \
     32            {                                                                       \
     33                if (__i+__j < __LEN)                                                \
     34                    fprintf(stderr, "%02x ", __U_V[__i+__j]);                       \
     35                else                                                                \
     36                    fprintf(stderr, "   ");                                         \
     37            }                                                                       \
     38            fprintf(stderr," ");                                                    \
     39            for (__j=0 ; __j<16 ; __j++)                                            \
     40            {                                                                       \
     41                if (__i+__j < __LEN)                                                \
     42                    fprintf(stderr,"%c",                                            \
     43                            ' ' <= __U_V[__i+__j] && __U_V[__i+__j] <= '~' ? __U_V[__i+__j] : '.');     \
     44            }                                                                       \
     45            fprintf(stderr,"\n");                                                   \
     46        }                                                                           \
     47    }while(0)
     48#endif
     49
     50#define CRX_ERROR_SET(__CODE,__FMT,...)                                     \
    1551    do {                                                                    \
    16         SetErrorCode (__CODE);                                          \
     52        SetErrorCode (__CODE);                                              \
    1753        SetErrorMessage (__FILE__,__func__,__LINE__,__FMT,##__VA_ARGS__);   \
    1854    } while (0)
    1955
    20 #define CRX_ERROR_ADD(__MESSAGE)                                            \
     56#define CRX_ADD_SUBCLASS_ERROR(__SUB_CLASS)                                 \
    2157    do {                                                                    \
    22         AddMessage (__MESSAGE);                                             \
     58        AddMessage (__SUB_CLASS.GetErrorMessage ().c_str ());               \
    2359    } while (0)
    2460
  • trunk/include/CRXProxy.h

    r28 r35  
    6565
    6666    void    SetHttpResponse             (const char * aHttpResponse);
    67     char *  GetHttpResponse             (char       * aBuffer,
     67    char *  GetHttpResponseHeader       (char       * aBuffer,
    6868                                         const int  aBufferSize) const;
    69     int     GetHttpResponseLength       (void) const;
     69    int     GetHttpResponseHeaderLength (void) const;
     70    char *  GetHttpResponseBody         (char       * aBuffer,
     71                                         const int  aBufferSize) const;
     72    int     GetHttpResponseBodyLength   (void) const;
    7073   
    7174    int     ReceiveRequest              (void);
Note: See TracChangeset for help on using the changeset viewer.