NewMadeleine

Documentation

« back to PM2 home.
nm_trace.h
Go to the documentation of this file.
1/*
2 * NewMadeleine
3 * Copyright (C) 2014-2025 (see AUTHORS file)
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or (at
8 * your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
14 */
15
16#ifndef NM_TRACE_H
17#define NM_TRACE_H
18
24typedef int nm_trace_event_t;
25
26/* ** global events */
27
28#define NM_TRACE_EVENT_CONNECT ((nm_trace_event_t)0x0100)
29#define NM_TRACE_EVENT_DISCONNECT ((nm_trace_event_t)0x0101)
30#define NM_TRACE_EVENT_CLOCK_SYNCHRONIZE ((nm_trace_event_t)0x0102)
32/* ** core-level pack events */
33
34#define NM_TRACE_EVENT_VAR_N_PACKS ((nm_trace_event_t)0x0200)
35#define NM_TRACE_EVENT_VAR_N_UNPACKS ((nm_trace_event_t)0x0201)
37#define NM_TRACE_EVENT_CORE_PACK_SUBMIT ((nm_trace_event_t)0x0211)
38#define NM_TRACE_EVENT_CORE_PACK_FLUSH ((nm_trace_event_t)0x0212)
39#define NM_TRACE_EVENT_CORE_PACK_RDV ((nm_trace_event_t)0x0213)
40#define NM_TRACE_EVENT_CORE_PACK_RTR ((nm_trace_event_t)0x0214)
41#define NM_TRACE_EVENT_CORE_PACK_IN_PW ((nm_trace_event_t)0x0215)
42#define NM_TRACE_EVENT_CORE_PACK_PW_POSTED ((nm_trace_event_t)0x0216)
43#define NM_TRACE_EVENT_CORE_PACK_COMPLETED ((nm_trace_event_t)0x0217)
44
45#define NM_TRACE_EVENT_CORE_UNPACK_SUBMIT ((nm_trace_event_t)0x0221)
46#define NM_TRACE_EVENT_CORE_UNPACK_RDV ((nm_trace_event_t)0x0222)
47#define NM_TRACE_EVENT_CORE_UNPACK_RTR ((nm_trace_event_t)0x0223)
48#define NM_TRACE_EVENT_CORE_UNPACK_MATCH_FIRST ((nm_trace_event_t)0x0224)
49#define NM_TRACE_EVENT_CORE_UNPACK_MATCH_LAST ((nm_trace_event_t)0x0225)
50#define NM_TRACE_EVENT_CORE_UNPACK_COMPLETED ((nm_trace_event_t)0x0226)
51
52/* ** packet-wrapper progression- scope: driver */
53
54#define NM_TRACE_EVENT_PW_SEND_POST ((nm_trace_event_t)0x0411)
55#define NM_TRACE_EVENT_PW_SEND_POLL ((nm_trace_event_t)0x0412)
56#define NM_TRACE_EVENT_PW_SEND_COMPLETE ((nm_trace_event_t)0x0413)
57#define NM_TRACE_EVENT_PW_SEND_DESTROY ((nm_trace_event_t)0x0414)
58#define NM_TRACE_EVENT_PW_RECV_PENDING ((nm_trace_event_t)0x0421)
59#define NM_TRACE_EVENT_PW_RECV_POST ((nm_trace_event_t)0x0422)
60#define NM_TRACE_EVENT_PW_RECV_POLL ((nm_trace_event_t)0x0423)
61#define NM_TRACE_EVENT_PW_RECV_COMPLETE ((nm_trace_event_t)0x0424)
62#define NM_TRACE_EVENT_PW_RECV_DESTROY ((nm_trace_event_t)0x0425)
64/* ** Core task states */
65#define NM_TRACE_STATE_CORE_NONE ((nm_trace_event_t)0x0800)
66#define NM_TRACE_STATE_CORE_STRATEGY ((nm_trace_event_t)0x0801)
67#define NM_TRACE_STATE_CORE_POLLING ((nm_trace_event_t)0x0802)
68#define NM_TRACE_STATE_CORE_TASK_FLUSH ((nm_trace_event_t)0x0803)
69#define NM_TRACE_STATE_CORE_DISPATCHING ((nm_trace_event_t)0x0804)
70#define NM_TRACE_STATE_CORE_UNPACK_NEXT ((nm_trace_event_t)0x0805)
71#define NM_TRACE_STATE_CORE_COMPLETED_PW ((nm_trace_event_t)0x0806)
72#define NM_TRACE_STATE_CORE_PACK_SUBMIT ((nm_trace_event_t)0x0807)
73#define NM_TRACE_STATE_CORE_HANDLER ((nm_trace_event_t)0x0808)
74
75/* ** filters */
76
77#define NM_TRACE_FILTER_GLOBAL 0x0100
78#define NM_TRACE_FILTER_PACK 0x0200
79#define NM_TRACE_FILTER_DRIVER 0x0400
80#define NM_TRACE_FILTER_CORE 0x0800
81#define NM_TRACE_FILTER_LINK 0x1000
82#define NM_TRACE_FILTER_ALL 0xFF00
83
84#define NM_TRACE_FILTER_PW_SEND 0x0410
85#define NM_TRACE_FILTER_PW_RECV 0x0420
86
87#ifdef NMAD_TRACE
88
89__PUK_SYM_INTERNAL
90void nm_trace_init(nm_core_t p_core);
91
92__PUK_SYM_INTERNAL
93void nm_trace_exit(nm_core_t p_core);
94
95void nm_trace_var(nm_trace_event_t event, int value, struct nm_gate_s*p_gate, struct nm_drv_s*p_drv);
96void nm_trace_state(nm_trace_event_t event, struct nm_gate_s*p_gate, struct nm_drv_s*p_drv);
97void nm_trace_event(nm_trace_event_t event, void*value, struct nm_gate_s*p_gate, struct nm_drv_s*p_drv,
99
100#else /* NMAD_TRACE */
101
102static inline void nm_trace_var(nm_trace_event_t event, int value, struct nm_gate_s*p_gate, struct nm_drv_s*p_drv)
103{
104}
105static inline void nm_trace_state(nm_trace_event_t event, struct nm_gate_s*p_gate, struct nm_drv_s*p_drv)
106{
107}
108static inline void nm_trace_event(nm_trace_event_t event, void*value, struct nm_gate_s*p_gate, struct nm_drv_s*p_drv,
110{
111}
112
113#endif /* NMAD_TRACE */
114
115#endif /* NM_TRACE_H */
static nm_gate_t p_gate
uint16_t len
chunk len
Definition nm_headers.h:0
nm_seq_t seq
sequence number
Definition nm_headers.h:2
static void nm_trace_var(nm_trace_event_t event, int value, struct nm_gate_s *p_gate, struct nm_drv_s *p_drv)
Definition nm_trace.h:102
int nm_trace_event_t
Definition nm_trace.h:24
static void nm_trace_state(nm_trace_event_t event, struct nm_gate_s *p_gate, struct nm_drv_s *p_drv)
Definition nm_trace.h:105
static void nm_trace_event(nm_trace_event_t event, void *value, struct nm_gate_s *p_gate, struct nm_drv_s *p_drv, nm_core_tag_t core_tag, nm_seq_t seq, nm_len_t len)
Definition nm_trace.h:108
uint64_t nm_len_t
data length used by nmad
Definition nm_types.h:68
uint32_t nm_seq_t
Sequence number for packets on a given gate/tag.
Definition nm_types.h:102
An internal tag.
Core NewMadeleine structure.
Definition nm_core.h:43
a driver.
Definition nm_drv.h:35
Connection to another process.
Definition nm_gate.h:104