56#define HttpTrace_doRequestMask 0x01
57#define HttpTrace_doRequestHeadersMask 0x02
58#define HttpTrace_doResponseHeadersMask 0x04
59#define HttpTrace_doResponseBodyMask 0x08
60#define HttpTrace_doHttp11StateMask 0x10
61#define HttpTrace_doReqBufOverflowMask 0x20
142 static void vprintf(
int prio,
const char* fmt, va_list argList);
149 static void printf(
int prio,
const char* fmt, ...);
157 static void write(
int prio,
const char* buf,
int len = -1);
326BA_API
U8 HttpTrace_getTraceCmds(
void);
328#define HttpTrace_isRequestSet() \
329 (HttpTrace_getTraceCmds() & HttpTrace_doRequestMask ? TRUE : FALSE)
331#define HttpTrace_isRequestHeadersSet() \
332 (HttpTrace_getTraceCmds() & HttpTrace_doRequestHeadersMask ? TRUE : FALSE)
334#define HttpTrace_isResponseHeadersSet() \
335 (HttpTrace_getTraceCmds() & HttpTrace_doResponseHeadersMask ? TRUE : FALSE)
337#define HttpTrace_isResponseBodySet() \
338 (HttpTrace_getTraceCmds() & HttpTrace_doResponseBodyMask ? TRUE : FALSE)
340#define HttpTrace_isHttp11StateSet() \
341 (HttpTrace_getTraceCmds() & HttpTrace_doHttp11StateMask ? TRUE : FALSE)
346#define TRPR(data) HttpTrace_TRPR data
347BA_API
void HttpTrace_TRPR(
const char* fmt, ...);
352#define HttpTrace_doRequest() \
353 (HttpTrace_get()->traceCmds & HttpTrace_doRequestMask)
354#define HttpTrace_doRequestHeaders() \
355 (HttpTrace_get()->traceCmds & HttpTrace_doRequestHeadersMask)
356#define HttpTrace_doResponseHeaders() \
357 (HttpTrace_get()->traceCmds & HttpTrace_doResponseHeadersMask)
358#define HttpTrace_doResponseBody() \
359 (HttpTrace_get()->traceCmds & HttpTrace_doResponseBodyMask)
360#define HttpTrace_doHttp11State() \
361 (HttpTrace_get()->traceCmds & HttpTrace_doHttp11StateMask)
362#define HttpTrace_doReqBufOverflow() \
363 (HttpTrace_get()->traceCmds & HttpTrace_doReqBufOverflowMask)
BA_API BufPrint * HttpTrace_getWriter(void)
Get and lock the trace BufPrint object.
#define HttpTrace_isRequestHeadersSet()
Definition: HttpTrace.h:331
BA_API int HttpTrace_setBufSize(int size)
Set trace buffer size.
#define HttpTrace_isResponseBodySet()
Definition: HttpTrace.h:337
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:71
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:334
#define HttpTrace_isHttp11StateSet()
Definition: HttpTrace.h:340
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:328
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:89
U8 BaBool
Boolean stored in an unsigned byte; FALSE is zero and TRUE is one.
Definition: GenPrimT.h:118
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:431
BufPrint * operator->()
Definition: HttpTrace.h:458
void release()
Release the trace if not already released.
Definition: HttpTrace.h:442
HttpTraceWriteLock()
Attempt to acquire the trace writer; conversion returns NULL if disabled.
Definition: HttpTrace.h:433
void lock()
Lock the trace if not already locked.
Definition: HttpTrace.h:447
~HttpTraceWriteLock()
Release any held writer lock.
Definition: HttpTrace.h:437
Buffered diagnostic output and optional HTTP protocol tracing.
Definition: HttpTrace.h:93
static bool isResponseBodySet()
Returns true if response-body tracing is enabled.
Definition: HttpTrace.h:416
static void printf(int prio, const char *fmt,...)
Write data to the trace buffer.
Definition: HttpTrace.h:377
static int setPrio(int prio)
Set the trace message priority filter.
Definition: HttpTrace.h:370
static void flush()
Force a flush on data in trace buffer; i.e., call the flush callback.
Definition: HttpTrace.h:404
static void releaseWriter(void)
Release a writer lock obtained by a successful getWriter call.
Definition: HttpTrace.h:388
static void setResponseHeaders(bool cmd)
If enabled, the web-server dumps the content of the response header to the trace buffer.
Definition: HttpTrace.h:394
static void setHttp11State(bool cmd)
If enabled, prints the status for each active client connection of the internal "HTTP 1....
Definition: HttpTrace.h:398
static BufPrint * getWriter()
Get and lock the trace BufPrint object.
Definition: HttpTrace.h:386
static void setFLushCallback(HttpTrace_Flush fcb)
The HTTP_TRACE compile time macro adds the trace library to the Barracuda library,...
Definition: HttpTrace.h:373
static int setBufSize(int size)
Set trace buffer size.
Definition: HttpTrace.h:402
static bool isHttp11StateSet()
Returns true if HTTP/1.1 connection-state tracing is enabled.
Definition: HttpTrace.h:419
static void write(int prio, const char *buf, int len=-1)
Write data to the trace buffer.
Definition: HttpTrace.h:383
static void vprintf(int prio, const char *fmt, va_list argList)
Write data to the trace buffer.
Definition: HttpTrace.h:375
static bool isRequestSet()
Returns true if request-line tracing is enabled.
Definition: HttpTrace.h:407
static bool isResponseHeadersSet()
Returns true if response-header tracing is enabled.
Definition: HttpTrace.h:413
static bool isRequestHeadersSet()
Returns true if request-header tracing is enabled.
Definition: HttpTrace.h:410
static void setResponseBody(bool cmd)
If enabled, the web-server dumps the content of the response body to the trace buffer.
Definition: HttpTrace.h:396
static void setRequest(bool cmd)
Enable or disable request-line tracing.
Definition: HttpTrace.h:390
static void setRequestHeaders(bool cmd)
If enabled, the web-server dumps the content of the request header to the trace buffer.
Definition: HttpTrace.h:392
static void setReqBufOverflow(bool cmd)
Report when an HTTP request exceeds the configured request buffer.
Definition: HttpTrace.h:400