src: deduplicate CHECK_EQ/CHECK_NE macros
[platform/upstream/nodejs.git] / src / node_win32_etw_provider.h
1 // Copyright Joyent, Inc. and other Node contributors.
2 //
3 // Permission is hereby granted, free of charge, to any person obtaining a
4 // copy of this software and associated documentation files (the
5 // "Software"), to deal in the Software without restriction, including
6 // without limitation the rights to use, copy, modify, merge, publish,
7 // distribute, sublicense, and/or sell copies of the Software, and to permit
8 // persons to whom the Software is furnished to do so, subject to the
9 // following conditions:
10 //
11 // The above copyright notice and this permission notice shall be included
12 // in all copies or substantial portions of the Software.
13 //
14 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
17 // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
18 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
19 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20 // USE OR OTHER DEALINGS IN THE SOFTWARE.
21
22 #ifndef SRC_NODE_WIN32_ETW_PROVIDER_H_
23 #define SRC_NODE_WIN32_ETW_PROVIDER_H_
24
25 #include "node_dtrace.h"
26 #include <evntprov.h>
27
28 namespace node {
29
30 #if defined(_MSC_VER)
31 # define INLINE __forceinline
32 #else
33 # define INLINE inline
34 #endif
35
36 typedef ULONG (NTAPI *EventRegisterFunc)(
37   LPCGUID ProviderId,
38   PENABLECALLBACK EnableCallback,
39   PVOID CallbackContext,
40   PREGHANDLE RegHandle
41 );
42
43 typedef ULONG (NTAPI *EventUnregisterFunc)(
44   REGHANDLE RegHandle
45 );
46
47 typedef ULONG (NTAPI *EventWriteFunc)(
48   REGHANDLE RegHandle,
49   PCEVENT_DESCRIPTOR EventDescriptor,
50   ULONG UserDataCount,
51   PEVENT_DATA_DESCRIPTOR UserData
52 );
53
54 void init_etw();
55 void shutdown_etw();
56
57 INLINE void NODE_HTTP_SERVER_REQUEST(node_dtrace_http_server_request_t* req,
58   node_dtrace_connection_t* conn, const char *remote, int port,
59   const char *method, const char *url, int fd);
60 INLINE void NODE_HTTP_SERVER_RESPONSE(node_dtrace_connection_t* conn,
61   const char *remote, int port, int fd);
62 INLINE void NODE_HTTP_CLIENT_REQUEST(node_dtrace_http_client_request_t* req,
63   node_dtrace_connection_t* conn, const char *remote, int port,
64   const char *method, const char *url, int fd);
65 INLINE void NODE_HTTP_CLIENT_RESPONSE(node_dtrace_connection_t* conn,
66   const char *remote, int port, int fd);
67 INLINE void NODE_NET_SERVER_CONNECTION(node_dtrace_connection_t* conn,
68   const char *remote, int port, int fd);
69 INLINE void NODE_NET_STREAM_END(node_dtrace_connection_t* conn,
70   const char *remote, int port, int fd);
71 INLINE void NODE_GC_START(v8::GCType type, v8::GCCallbackFlags flags);
72 INLINE void NODE_GC_DONE(v8::GCType type, v8::GCCallbackFlags flags);
73 INLINE void NODE_V8SYMBOL_REMOVE(const void* addr1, const void* addr2);
74 INLINE void NODE_V8SYMBOL_MOVE(const void* addr1, const void* addr2);
75 INLINE void NODE_V8SYMBOL_RESET();
76 INLINE void NODE_V8SYMBOL_ADD(LPCSTR symbol,
77                               int symbol_len,
78                               const void* addr1,
79                               int len);
80
81 INLINE bool NODE_HTTP_SERVER_REQUEST_ENABLED();
82 INLINE bool NODE_HTTP_SERVER_RESPONSE_ENABLED();
83 INLINE bool NODE_HTTP_CLIENT_REQUEST_ENABLED();
84 INLINE bool NODE_HTTP_CLIENT_RESPONSE_ENABLED();
85 INLINE bool NODE_NET_SERVER_CONNECTION_ENABLED();
86 INLINE bool NODE_NET_STREAM_END_ENABLED();
87 INLINE bool NODE_NET_SOCKET_READ_ENABLED();
88 INLINE bool NODE_NET_SOCKET_WRITE_ENABLED();
89 INLINE bool NODE_V8SYMBOL_ENABLED();
90
91 #define NODE_NET_SOCKET_READ(arg0, arg1)
92 #define NODE_NET_SOCKET_WRITE(arg0, arg1)
93 }  // namespace node
94
95 #endif  // SRC_NODE_WIN32_ETW_PROVIDER_H_