50#if BA_ENABLE_HTTP_TRACE
58#define HttpTrace_doRequestMask 0x01
59#define HttpTrace_doRequestHeadersMask 0x02
60#define HttpTrace_doResponseHeadersMask 0x04
61#define HttpTrace_doResponseBodyMask 0x08
62#define HttpTrace_doHttp11StateMask 0x10
63#define HttpTrace_doReqBufOverflowMask 0x20
144 static void vprintf(
int prio,
const char* fmt, va_list argList);
151 static void printf(
int prio,
const char* fmt, ...);
159 static void write(
int prio,
const char* buf,
int len = -1);
338BA_API
U8 HttpTrace_getTraceCmds(
void);
340#define HttpTrace_isRequestSet() \
341 (HttpTrace_getTraceCmds() & HttpTrace_doRequestMask ? TRUE : FALSE)
343#define HttpTrace_isRequestHeadersSet() \
344 (HttpTrace_getTraceCmds() & HttpTrace_doRequestHeadersMask ? TRUE : FALSE)
346#define HttpTrace_isResponseHeadersSet() \
347 (HttpTrace_getTraceCmds() & HttpTrace_doResponseHeadersMask ? TRUE : FALSE)
349#define HttpTrace_isResponseBodySet() \
350 (HttpTrace_getTraceCmds() & HttpTrace_doResponseBodyMask ? TRUE : FALSE)
352#define HttpTrace_isHttp11StateSet() \
353 (HttpTrace_getTraceCmds() & HttpTrace_doHttp11StateMask ? TRUE : FALSE)
358#define TRPR(data) HttpTrace_TRPR data
359BA_API
void HttpTrace_TRPR(
const char* fmt, ...);
364#define HttpTrace_doRequest() \
365 (HttpTrace_get()->traceCmds & HttpTrace_doRequestMask)
366#define HttpTrace_doRequestHeaders() \
367 (HttpTrace_get()->traceCmds & HttpTrace_doRequestHeadersMask)
368#define HttpTrace_doResponseHeaders() \
369 (HttpTrace_get()->traceCmds & HttpTrace_doResponseHeadersMask)
370#define HttpTrace_doResponseBody() \
371 (HttpTrace_get()->traceCmds & HttpTrace_doResponseBodyMask)
372#define HttpTrace_doHttp11State() \
373 (HttpTrace_get()->traceCmds & HttpTrace_doHttp11StateMask)
374#define HttpTrace_doReqBufOverflow() \
375 (HttpTrace_get()->traceCmds & HttpTrace_doReqBufOverflowMask)
BA_API BufPrint * HttpTrace_getWriter(void)
Get and lock the trace BufPrint object.
#define HttpTrace_isRequestHeadersSet()
Definition: HttpTrace.h:343
BA_API int HttpTrace_setBufSize(int size)
Set trace buffer size.
#define HttpTrace_isResponseBodySet()
Definition: HttpTrace.h:349
BA_API void HttpTrace_setResponseBody(BaBool cmd)
If enabled, the web-server dumps the content of the response body to the trace buffer.
BA_API void HttpTrace_setHttp11State(BaBool cmd)
If enabled, prints the status for each active client connection of the internal "HTTP 1....
BA_API void HttpTrace_write(int prio, const char *buf, int len)
Write data to the trace buffer.
BA_API void HttpTrace_releaseWriter(void)
Release a writer lock obtained by a successful getWriter call.
struct HttpTrace HttpTrace
Buffered diagnostic output and optional HTTP protocol tracing.
void(* HttpTrace_Flush)(char *buf, int bufLen)
Consume buffered trace output synchronously.
Definition: HttpTrace.h:73
BA_API void HttpTrace_flush(void)
Force a flush on data in trace buffer; i.e., call the flush callback.
BA_API HttpTrace_Flush HttpTrace_getFLushCallback(void)
BA_API void HttpTrace_setReqBufOverflow(BaBool cmd)
Report when an HTTP request exceeds the configured request buffer.
BA_API int HttpTrace_setPrio(int prio)
Set the trace message priority filter.
BA_API void HttpTrace_setRequestHeaders(BaBool cmd)
If enabled, the web-server dumps the content of the request header to the trace buffer.
BA_API void HttpTrace_setFLushCallback(HttpTrace_Flush fcb)
The HTTP_TRACE compile time macro adds the trace library to the Barracuda library,...
BA_API void HttpTrace_close(void)
Release the trace buffer and disable output without flushing pending bytes.
BA_API void HttpTrace_setRequest(BaBool cmd)
Enable or disable request-line tracing.
#define HttpTrace_isResponseHeadersSet()
Definition: HttpTrace.h:346
#define HttpTrace_isHttp11StateSet()
Definition: HttpTrace.h:352
BA_API void HttpTrace_printf(int prio, const char *fmt,...)
Write data to the trace buffer.
BA_API void HttpTrace_setResponseHeaders(BaBool cmd)
If enabled, the web-server dumps the content of the response header to the trace buffer.
#define HttpTrace_isRequestSet()
Definition: HttpTrace.h:340
BA_API void HttpTrace_vprintf(int prio, const char *fmt, va_list argList)
Write data to the trace buffer.
uint8_t U8
Unsigned 8-bit integer.
Definition: GenPrimT.h:92
U8 BaBool
Boolean stored in an unsigned byte; FALSE is zero and TRUE is one.
Definition: GenPrimT.h:121
The BufPrint class, which implements a compact printf-style formatter, is a base class used by severa...
Definition: BufPrint.h:132
HttpTraceWriteLock is a C++ class that makes it easier to lock the trace by using method HttpTrace::g...
Definition: HttpTrace.h:443
BufPrint * operator->()
Definition: HttpTrace.h:470
void release()
Release the trace if not already released.
Definition: HttpTrace.h:454
HttpTraceWriteLock()
Attempt to acquire the trace writer; conversion returns NULL if disabled.
Definition: HttpTrace.h:445
void lock()
Lock the trace if not already locked.
Definition: HttpTrace.h:459
~HttpTraceWriteLock()
Release any held writer lock.
Definition: HttpTrace.h:449
Buffered diagnostic output and optional HTTP protocol tracing.
Definition: HttpTrace.h:95
static bool isResponseBodySet()
Returns true if response-body tracing is enabled.
Definition: HttpTrace.h:428
static void printf(int prio, const char *fmt,...)
Write data to the trace buffer.
Definition: HttpTrace.h:389
static int setPrio(int prio)
Set the trace message priority filter.
Definition: HttpTrace.h:382
static void flush()
Force a flush on data in trace buffer; i.e., call the flush callback.
Definition: HttpTrace.h:416
static void releaseWriter(void)
Release a writer lock obtained by a successful getWriter call.
Definition: HttpTrace.h:400
static void setResponseHeaders(bool cmd)
If enabled, the web-server dumps the content of the response header to the trace buffer.
Definition: HttpTrace.h:406
static void setHttp11State(bool cmd)
If enabled, prints the status for each active client connection of the internal "HTTP 1....
Definition: HttpTrace.h:410
static BufPrint * getWriter()
Get and lock the trace BufPrint object.
Definition: HttpTrace.h:398
static void setFLushCallback(HttpTrace_Flush fcb)
The HTTP_TRACE compile time macro adds the trace library to the Barracuda library,...
Definition: HttpTrace.h:385
static int setBufSize(int size)
Set trace buffer size.
Definition: HttpTrace.h:414
static bool isHttp11StateSet()
Returns true if HTTP/1.1 connection-state tracing is enabled.
Definition: HttpTrace.h:431
static void write(int prio, const char *buf, int len=-1)
Write data to the trace buffer.
Definition: HttpTrace.h:395
static void vprintf(int prio, const char *fmt, va_list argList)
Write data to the trace buffer.
Definition: HttpTrace.h:387
static bool isRequestSet()
Returns true if request-line tracing is enabled.
Definition: HttpTrace.h:419
static bool isResponseHeadersSet()
Returns true if response-header tracing is enabled.
Definition: HttpTrace.h:425
static bool isRequestHeadersSet()
Returns true if request-header tracing is enabled.
Definition: HttpTrace.h:422
static void setResponseBody(bool cmd)
If enabled, the web-server dumps the content of the response body to the trace buffer.
Definition: HttpTrace.h:408
static void setRequest(bool cmd)
Enable or disable request-line tracing.
Definition: HttpTrace.h:402
static void setRequestHeaders(bool cmd)
If enabled, the web-server dumps the content of the request header to the trace buffer.
Definition: HttpTrace.h:404
static void setReqBufOverflow(bool cmd)
Report when an HTTP request exceeds the configured request buffer.
Definition: HttpTrace.h:412