pkt_log.h 1.2 KB

1234567891011121314151617181920212223242526272829
  1. /*
  2. * Shared raw-packet hex dump for the RX and TX single callpoints
  3. * (main.c's rx_work_handler, tx_queue.c's process_item) - one place logs
  4. * raw on-air bytes, in or out, same as main.c's dispatch is the one
  5. * place that logs "a frame was received" and tx_queue is the one place
  6. * that logs "a frame was sent". Packet consumers (beacon_rx, cbf,
  7. * payload_rx, ...) never log raw bytes themselves.
  8. *
  9. * Its own log module/level (LOG_LEVEL_PKT_LOG, see log_levels.h) is
  10. * deliberately separate from LOG_LEVEL_MAIN/LOG_LEVEL_TX_QUEUE: flipping
  11. * it to DBG traces every raw frame crossing the radio without also
  12. * pulling in main.c's or tx_queue.c's own unrelated DBG tracing, and
  13. * vice versa.
  14. */
  15. #ifndef PKT_LOG_H_
  16. #define PKT_LOG_H_
  17. #include <stddef.h>
  18. #include <stdint.h>
  19. /* Logs buf[0..len) as a single-line, no-delimiter hex dump (greps/diffs
  20. * as one token), tagged with label (e.g. "RX raw", "TX raw"). len must
  21. * not exceed FRAME_MAX_LEN (see frame.h) - every caller today already
  22. * enforces that on its own buffer before this point. Compiles out
  23. * entirely unless LOG_LEVEL_PKT_LOG is LOG_LEVEL_DBG.
  24. */
  25. void pkt_log_raw(const char *label, const uint8_t *buf, size_t len);
  26. #endif /* PKT_LOG_H_ */