Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 83 lines (70 sloc) 2.768 kb
55048cd @ry Update copyright headers
ry authored
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
068b733 @ry Land Cantrill's DTrace patch
ry authored
22 #ifndef NODE_DTRACE_H_
23 #define NODE_DTRACE_H_
24
ff4a9d3 @bnoordhuis core: use proper #include directives
bnoordhuis authored
25 #include "node.h"
26 #include "v8.h"
068b733 @ry Land Cantrill's DTrace patch
ry authored
27
28 extern "C" {
29
e142fe2 @davepacheco DTrace probes: support X-Forwarded-For
davepacheco authored
30 /*
31 * The following structures are passed directly to DTrace when probes are fired.
32 * Translators in node.d translate these structures into the corresponding D
33 * structures, taking care of dealing with the user process data model (32-bit
34 * or 64-bit) and structure versions (see node_dtrace_http_server_request_t
35 * below).
36 */
37
068b733 @ry Land Cantrill's DTrace patch
ry authored
38 typedef struct {
39 int32_t fd;
40 int32_t port;
41 char *remote;
e9257b8 @ry New DTrace probes from CA team
ry authored
42 int32_t buffered;
068b733 @ry Land Cantrill's DTrace patch
ry authored
43 } node_dtrace_connection_t;
44
45 typedef struct {
46 char *url;
47 char *method;
e142fe2 @davepacheco DTrace probes: support X-Forwarded-For
davepacheco authored
48 } node_dtrace_http_client_request_t;
49
50 /*
51 * The original version of this structure contained only a url and method, just
52 * like the client request above. To add the new forwardedFor field, the
53 * structure layout was changed to begin with an integer version. The
54 * translator knows whether it's looking at an old- or new-version structure
55 * based on whether the version field's value is a reasonable pointer (i.e.
56 * address greater than 4K). No doubt this is filthy, but there's not much else
57 * we can do, and it works reliably.
58 *
59 * This version of the structure also contains padding that should be zeroed out
60 * by the consumer so that future versions of the translator can simply check if
61 * a field is present by checking it against NULL.
62 */
63 typedef struct {
64 union {
65 uint32_t version;
66 uintptr_t unused; /* for compat. with old 64-bit struct */
67 } _un;
68 char *url;
69 char *method;
70 char *forwardedFor;
71 char *_pad[8];
72 } node_dtrace_http_server_request_t;
068b733 @ry Land Cantrill's DTrace patch
ry authored
73
74 }
75
76 namespace node {
77
78 void InitDTrace(v8::Handle<v8::Object> target);
79
80 }
81
82 #endif
Something went wrong with that request. Please try again.