42#include <HttpServer.h>
54#define HttpTrace_doRequestMask 0x01
55#define HttpTrace_doRequestHeadersMask 0x02
56#define HttpTrace_doResponseHeadersMask 0x04
57#define HttpTrace_doResponseBodyMask 0x08
58#define HttpTrace_doHttp11StateMask 0x10
59#define HttpTrace_doReqBufOverflowMask 0x20
62typedef void (*HttpTrace_Flush)(
char* buf,
int bufLen);
172 static void vprintf(
int prio,
const char* fmt, va_list argList);
179 static void printf(
int prio,
const char* fmt, ...);
186 static void write(
int prio,
const char* buf,
int len = -1);
285 static bool isRequestSet();
286 static bool isRequestHeadersSet();
287 static bool isResponseHeadersSet();
288 static bool isResponseBodySet();
289 static bool isHttp11StateSet();
305BA_API
int HttpTrace_setPrio(
int prio);
306BA_API
void HttpTrace_setFLushCallback(HttpTrace_Flush fcb);
307BA_API HttpTrace_Flush HttpTrace_getFLushCallback(
void);
308BA_API
void HttpTrace_vprintf(
int prio,
const char* fmt, va_list argList);
309BA_API
void HttpTrace_printf(
int prio,
const char* fmt, ...);
310BA_API
void HttpTrace_write(
int prio,
const char* buf,
int len);
311BA_API
void HttpTrace_flush(
void);
313BA_API
void HttpTrace_setRequest(BaBool cmd);
314BA_API
void HttpTrace_setRequestHeaders(BaBool cmd);
315BA_API
void HttpTrace_setResponseHeaders(BaBool cmd);
316BA_API
void HttpTrace_setResponseBody(BaBool cmd);
317BA_API
void HttpTrace_setHttp11State(BaBool cmd);
318BA_API
void HttpTrace_setReqBufOverflow(BaBool cmd);
319BA_API
int HttpTrace_setBufSize(
int size);
320BA_API
void HttpTrace_close(
void);
323BA_API U8 HttpTrace_getTraceCmds(
void);
324#define HttpTrace_isRequestSet() \
325 (HttpTrace_getTraceCmds() & HttpTrace_doRequestMask ? TRUE : FALSE)
326#define HttpTrace_isRequestHeadersSet() \
327 (HttpTrace_getTraceCmds() & HttpTrace_doRequestHeadersMask ? TRUE : FALSE)
328#define HttpTrace_isResponseHeadersSet() \
329 (HttpTrace_getTraceCmds() & HttpTrace_doResponseHeadersMask ? TRUE : FALSE)
330#define HttpTrace_isResponseBodySet() \
331 (HttpTrace_getTraceCmds() & HttpTrace_doResponseBodyMask ? TRUE : FALSE)
332#define HttpTrace_isHttp11StateSet() \
333 (HttpTrace_getTraceCmds() & HttpTrace_doHttp11StateMask ? TRUE : FALSE)
338#define TRPR(data) HttpTrace_TRPR data
339BA_API
void HttpTrace_TRPR(
const char* fmt, ...);
344#define HttpTrace_doRequest() \
345 (HttpTrace_get()->traceCmds & HttpTrace_doRequestMask)
346#define HttpTrace_doRequestHeaders() \
347 (HttpTrace_get()->traceCmds & HttpTrace_doRequestHeadersMask)
348#define HttpTrace_doResponseHeaders() \
349 (HttpTrace_get()->traceCmds & HttpTrace_doResponseHeadersMask)
350#define HttpTrace_doResponseBody() \
351 (HttpTrace_get()->traceCmds & HttpTrace_doResponseBodyMask)
352#define HttpTrace_doHttp11State() \
353 (HttpTrace_get()->traceCmds & HttpTrace_doHttp11StateMask)
354#define HttpTrace_doReqBufOverflow() \
355 (HttpTrace_get()->traceCmds & HttpTrace_doReqBufOverflowMask)
356BA_API
BufPrint* HttpTrace_getWriter(
void);
357BA_API
void HttpTrace_releaseWriter(
void);
361 return HttpTrace_setPrio(prio);
364 HttpTrace_setFLushCallback(fcb); }
366 HttpTrace_vprintf(prio, fmt, argList); }
370 HttpTrace_vprintf(prio, fmt, varg);
374 HttpTrace_write(prio, buf, len); }
377 return HttpTrace_getWriter(); }
379 HttpTrace_releaseWriter(); }
381 HttpTrace_setRequest(cmd); }
383 HttpTrace_setRequestHeaders(cmd); }
385 HttpTrace_setResponseHeaders(cmd); }
387 HttpTrace_setResponseBody(cmd); }
389 HttpTrace_setHttp11State(cmd); }
391 HttpTrace_setReqBufOverflow(cmd); }
393 return HttpTrace_setBufSize(size); }
397inline bool HttpTrace::isRequestSet() {
398 return HttpTrace_isRequestSet() ? true :
false;
400inline bool HttpTrace::isRequestHeadersSet() {
401 return HttpTrace_isRequestHeadersSet() ? true :
false;
403inline bool HttpTrace::isResponseHeadersSet() {
404 return HttpTrace_isResponseHeadersSet() ? true :
false;
406inline bool HttpTrace::isResponseBodySet() {
407 return HttpTrace_isResponseBodySet() ? true :
false;
409inline bool HttpTrace::isHttp11StateSet() {
410 return HttpTrace_isHttp11StateSet() ? true :
false;
423 _bufPrint = HttpTrace_getWriter();
431 if(_bufPrint) {_bufPrint=0; HttpTrace_releaseWriter(); }
436 if(!_bufPrint) {_bufPrint = HttpTrace_getWriter(); }
The BufPrint class, which implements an ANSI compatible printf method, is a base class used by severa...
Definition: BufPrint.h:122
HttpTraceWriteLock is a C++ class that makes it easier to lock the trace by using method HttpTrace::g...
Definition: HttpTrace.h:421
BufPrint * operator->()
Operator that makes it possible to do myLock->printf("hi");.
Definition: HttpTrace.h:445
void release()
Release the trace if not already released.
Definition: HttpTrace.h:430
void lock()
Lock the trace if not already locked.
Definition: HttpTrace.h:435
Trace the communication between a client and the server.
Definition: HttpTrace.h:124
static void printf(int prio, const char *fmt,...)
Write data to the trace buffer.
Definition: HttpTrace.h:367
static int setPrio(int prio)
Set the trace message priority filter.
Definition: HttpTrace.h:360
static void flush()
Force a flush on data in trace buffer; i.e., call the flush callback.
Definition: HttpTrace.h:394
static void releaseWriter(void)
Release the trace.
Definition: HttpTrace.h:378
static void setResponseHeaders(bool cmd)
If enabled, the web-server dumps the content of the response header to the trace buffer.
Definition: HttpTrace.h:384
static void setHttp11State(bool cmd)
If enabled, prints the status for each active client connection of the internal "HTTP 1....
Definition: HttpTrace.h:388
static BufPrint * getWriter()
Get and lock the trace BufPrint object.
Definition: HttpTrace.h:376
static void setFLushCallback(HttpTrace_Flush fcb)
The HTTP_TRACE compile time macro adds the trace library to the Barracuda library,...
Definition: HttpTrace.h:363
static int setBufSize(int size)
Set trace buffer.
Definition: HttpTrace.h:392
static void write(int prio, const char *buf, int len=-1)
Write data to the trace buffer.
Definition: HttpTrace.h:373
static void vprintf(int prio, const char *fmt, va_list argList)
Write data to the trace buffer.
Definition: HttpTrace.h:365
static void setResponseBody(bool cmd)
If enabled, the web-server dumps the content of the response body to the trace buffer.
Definition: HttpTrace.h:386
static void setRequest(bool cmd)
If enabled, the web-server prints the first line in the request header to the trace buffer.
Definition: HttpTrace.h:380
static void setRequestHeaders(bool cmd)
If enabled, the web-server dumps the content of the request header to the trace buffer.
Definition: HttpTrace.h:382
static void setReqBufOverflow(bool cmd)
Prints "ReqBufOverflow" if enabled and the HttpRequest buffer overflows.
Definition: HttpTrace.h:390