Node.js
v8.x
Node.js is a JavaScript runtime built on Chrome's V8 JavaScript engine
node_dtrace.h
Go to the documentation of this file.
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_DTRACE_H_
23
#define SRC_NODE_DTRACE_H_
24
25
#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
26
27
#include "
node.h
"
28
#include "v8.h"
29
#include "
env.h
"
30
31
extern
"C"
{
32
/*
33
* The following structures are passed directly to DTrace when probes are fired.
34
* Translators in node.d translate these structures into the corresponding D
35
* structures, taking care of dealing with the user process data model (32-bit
36
* or 64-bit) and structure versions (see node_dtrace_http_server_request_t
37
* below).
38
*/
39
40
typedef
struct
{
41
int32_t fd;
42
int32_t port;
43
char
* remote;
44
int32_t buffered;
45
}
node_dtrace_connection_t
;
46
47
typedef
struct
{
48
char
* url;
49
char
*
method
;
50
}
node_dtrace_http_client_request_t
;
51
52
/*
53
* The original version of this structure contained only a url and method, just
54
* like the client request above. To add the new forwardedFor field, the
55
* structure layout was changed to begin with an integer version. The
56
* translator knows whether it's looking at an old- or new-version structure
57
* based on whether the version field's value is a reasonable pointer (i.e.
58
* address greater than 4K). No doubt this is filthy, but there's not much else
59
* we can do, and it works reliably.
60
*
61
* This version of the structure also contains padding that should be zeroed out
62
* by the consumer so that future versions of the translator can simply check if
63
* a field is present by checking it against nullptr.
64
*/
65
typedef
struct
{
66
union
{
67
uint32_t version;
68
uintptr_t unused;
/* for compat. with old 64-bit struct */
69
} _un;
70
char
* url;
71
char
*
method
;
72
char
*
forwardedFor
;
73
char
* _pad[8];
74
}
node_dtrace_http_server_request_t
;
75
76
}
// extern "C"
77
78
namespace
node
{
79
80
void
InitDTrace
(Environment* env, v8::Local<v8::Object> target);
81
82
}
// namespace node
83
84
#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
85
86
#endif // SRC_NODE_DTRACE_H_
node.h
env.h
node::InitDTrace
void InitDTrace(Environment *env, Local< Object > target)
Definition:
node_dtrace.cc:261
node_dtrace_http_client_request_t
Definition:
node.d:71
node_dtrace_http_server_request_t
Definition:
node.d:98
node_dtrace_connection_t
Definition:
node.d:31
forwardedFor
forwardedFor
Definition:
node.d:212
node
Definition:
async-wrap.cc:62
method
method
Definition:
node.d:195
src
node_dtrace.h
Generated on Fri Sep 15 2017 12:56:44 for Node.js by
1.8.13