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)
31#define NM_TRACE_EVENT_BUFFER_BEGIN ((nm_trace_event_t)0x0103)
32#define NM_TRACE_EVENT_BUFFER_END ((nm_trace_event_t)0x0104)
34/* ** core-level pack events */
35
36#define NM_TRACE_EVENT_VAR_N_PACKS ((nm_trace_event_t)0x0200)
37#define NM_TRACE_EVENT_VAR_N_UNPACKS ((nm_trace_event_t)0x0201)
39#define NM_TRACE_EVENT_CORE_PACK_SUBMIT ((nm_trace_event_t)0x0211)
40#define NM_TRACE_EVENT_CORE_PACK_FLUSH ((nm_trace_event_t)0x0212)
41#define NM_TRACE_EVENT_CORE_PACK_RDV ((nm_trace_event_t)0x0213)
42#define NM_TRACE_EVENT_CORE_PACK_RTR ((nm_trace_event_t)0x0214)
43#define NM_TRACE_EVENT_CORE_PACK_IN_PW ((nm_trace_event_t)0x0215)
44#define NM_TRACE_EVENT_CORE_PACK_PW_POSTED ((nm_trace_event_t)0x0216)
45#define NM_TRACE_EVENT_CORE_PACK_COMPLETED ((nm_trace_event_t)0x0217)
46
47#define NM_TRACE_EVENT_CORE_UNPACK_SUBMIT ((nm_trace_event_t)0x0221)
48#define NM_TRACE_EVENT_CORE_UNPACK_RDV ((nm_trace_event_t)0x0222)
49#define NM_TRACE_EVENT_CORE_UNPACK_RTR ((nm_trace_event_t)0x0223)
50#define NM_TRACE_EVENT_CORE_UNPACK_MATCH_FIRST ((nm_trace_event_t)0x0224)
51#define NM_TRACE_EVENT_CORE_UNPACK_MATCH_LAST ((nm_trace_event_t)0x0225)
52#define NM_TRACE_EVENT_CORE_UNPACK_COMPLETED ((nm_trace_event_t)0x0226)
53
54/* ** packet-wrapper progression- scope: driver */
55
56#define NM_TRACE_EVENT_PW_SEND_PENDING ((nm_trace_event_t)0x0411)
57#define NM_TRACE_EVENT_PW_SEND_POST ((nm_trace_event_t)0x0412)
58#define NM_TRACE_EVENT_PW_SEND_POLL ((nm_trace_event_t)0x0413)
59#define NM_TRACE_EVENT_PW_SEND_STANDBY ((nm_trace_event_t)0x0414)
60#define NM_TRACE_EVENT_PW_SEND_COMPLETE ((nm_trace_event_t)0x0415)
61#define NM_TRACE_EVENT_PW_SEND_DESTROY ((nm_trace_event_t)0x0416)
63#define NM_TRACE_EVENT_PW_RECV_PENDING ((nm_trace_event_t)0x0421)
64#define NM_TRACE_EVENT_PW_RECV_PROBE_ANY ((nm_trace_event_t)0x0422)
65#define NM_TRACE_EVENT_PW_RECV_POST ((nm_trace_event_t)0x0423)
66#define NM_TRACE_EVENT_PW_RECV_POLL ((nm_trace_event_t)0x0424)
67#define NM_TRACE_EVENT_PW_RECV_STANDBY ((nm_trace_event_t)0x0425)
68#define NM_TRACE_EVENT_PW_RECV_COMPLETE ((nm_trace_event_t)0x0426)
69#define NM_TRACE_EVENT_PW_RECV_DESTROY ((nm_trace_event_t)0x0427)
71/* ** Core task states */
72#define NM_TRACE_STATE_CORE_NONE ((nm_trace_event_t)0x0800)
73#define NM_TRACE_STATE_CORE_STRATEGY ((nm_trace_event_t)0x0801)
74#define NM_TRACE_STATE_CORE_POLLING ((nm_trace_event_t)0x0802)
75#define NM_TRACE_STATE_CORE_TASK_FLUSH ((nm_trace_event_t)0x0803)
76#define NM_TRACE_STATE_CORE_DISPATCHING ((nm_trace_event_t)0x0804)
77#define NM_TRACE_STATE_CORE_UNPACK_NEXT ((nm_trace_event_t)0x0805)
78#define NM_TRACE_STATE_CORE_COMPLETED_PW ((nm_trace_event_t)0x0806)
79#define NM_TRACE_STATE_CORE_PACK_SUBMIT ((nm_trace_event_t)0x0807)
80#define NM_TRACE_STATE_CORE_HANDLER ((nm_trace_event_t)0x0808)
81
82/* ** filters */
83
84#define NM_TRACE_FILTER_GLOBAL 0x0100
85#define NM_TRACE_FILTER_PACK 0x0200
86#define NM_TRACE_FILTER_DRIVER 0x0400
87#define NM_TRACE_FILTER_CORE 0x0800
88#define NM_TRACE_FILTER_LINK 0x1000
89#define NM_TRACE_FILTER_ALL 0xFF00
90
91#define NM_TRACE_FILTER_PW_SEND 0x0410
92#define NM_TRACE_FILTER_PW_RECV 0x0420
93
94#ifdef NMAD_TRACE
95
96__PUK_SYM_INTERNAL
97void nm_trace_init(nm_core_t p_core);
98
99__PUK_SYM_INTERNAL
100void nm_trace_exit(nm_core_t p_core);
101
102void nm_trace_var(nm_trace_event_t event, int value, struct nm_gate_s*p_gate, struct nm_drv_s*p_drv);
103void nm_trace_state(nm_trace_event_t event, struct nm_gate_s*p_gate, struct nm_drv_s*p_drv);
104void nm_trace_event(nm_trace_event_t event, void*value, struct nm_gate_s*p_gate, struct nm_drv_s*p_drv,
106
107void nm_trace_stop(void);
108
109#else /* NMAD_TRACE */
110
111static inline void nm_trace_var(nm_trace_event_t event, int value, struct nm_gate_s*p_gate, struct nm_drv_s*p_drv)
112{
113}
114static inline void nm_trace_state(nm_trace_event_t event, struct nm_gate_s*p_gate, struct nm_drv_s*p_drv)
115{
116}
117static inline void nm_trace_event(nm_trace_event_t event, void*value, struct nm_gate_s*p_gate, struct nm_drv_s*p_drv,
119{
120}
121static inline void nm_trace_stop(void)
122{
123}
124
125#endif /* NMAD_TRACE */
126
127#endif /* NM_TRACE_H */
typedefNM_EXTERN_C_BEGIN struct nm_core * nm_core_t
nm_len_t len
Definition nm_data.h:1007
static nm_gate_t p_gate
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:111
int nm_trace_event_t
Definition nm_trace.h:24
static void nm_trace_stop(void)
Definition nm_trace.h:121
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:114
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:117
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:108
An internal tag.
a driver.
Definition nm_drv.h:35
Connection to another process.
Definition nm_gate.h:109