GCC Code Coverage Report
Directory: ../ Exec Total Coverage
File: /home/iojs/build/workspace/node-test-commit-linux-coverage/nodes/benchmark/out/../src/node_constants.cc Lines: 309 309 100.0 %
Date: 2017-06-14 Branches: 6 12 50.0 %

Line Branch Exec Source
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
#include "node_constants.h"
23
#include "env.h"
24
#include "env-inl.h"
25
26
#include "uv.h"
27
#include "zlib.h"
28
29
#include <errno.h>
30
#if !defined(_MSC_VER)
31
#include <unistd.h>
32
#endif
33
#include <fcntl.h>
34
#include <signal.h>
35
#include <sys/types.h>
36
#include <sys/stat.h>
37
#include <limits>
38
39
#if HAVE_OPENSSL
40
# include <openssl/ec.h>
41
# include <openssl/ssl.h>
42
# ifndef OPENSSL_NO_ENGINE
43
#  include <openssl/engine.h>
44
# endif  // !OPENSSL_NO_ENGINE
45
#endif
46
47
namespace node {
48
49
using v8::Local;
50
using v8::Object;
51
52
#if HAVE_OPENSSL
53
const char* default_cipher_list = DEFAULT_CIPHER_LIST_CORE;
54
#endif
55
56
namespace {
57
58
2401
void DefineErrnoConstants(Local<Object> target) {
59
#ifdef E2BIG
60
7203
  NODE_DEFINE_CONSTANT(target, E2BIG);
61
#endif
62
63
#ifdef EACCES
64
7203
  NODE_DEFINE_CONSTANT(target, EACCES);
65
#endif
66
67
#ifdef EADDRINUSE
68
7203
  NODE_DEFINE_CONSTANT(target, EADDRINUSE);
69
#endif
70
71
#ifdef EADDRNOTAVAIL
72
7203
  NODE_DEFINE_CONSTANT(target, EADDRNOTAVAIL);
73
#endif
74
75
#ifdef EAFNOSUPPORT
76
7203
  NODE_DEFINE_CONSTANT(target, EAFNOSUPPORT);
77
#endif
78
79
#ifdef EAGAIN
80
7203
  NODE_DEFINE_CONSTANT(target, EAGAIN);
81
#endif
82
83
#ifdef EALREADY
84
7203
  NODE_DEFINE_CONSTANT(target, EALREADY);
85
#endif
86
87
#ifdef EBADF
88
7203
  NODE_DEFINE_CONSTANT(target, EBADF);
89
#endif
90
91
#ifdef EBADMSG
92
7203
  NODE_DEFINE_CONSTANT(target, EBADMSG);
93
#endif
94
95
#ifdef EBUSY
96
7203
  NODE_DEFINE_CONSTANT(target, EBUSY);
97
#endif
98
99
#ifdef ECANCELED
100
7203
  NODE_DEFINE_CONSTANT(target, ECANCELED);
101
#endif
102
103
#ifdef ECHILD
104
7203
  NODE_DEFINE_CONSTANT(target, ECHILD);
105
#endif
106
107
#ifdef ECONNABORTED
108
7203
  NODE_DEFINE_CONSTANT(target, ECONNABORTED);
109
#endif
110
111
#ifdef ECONNREFUSED
112
7203
  NODE_DEFINE_CONSTANT(target, ECONNREFUSED);
113
#endif
114
115
#ifdef ECONNRESET
116
7203
  NODE_DEFINE_CONSTANT(target, ECONNRESET);
117
#endif
118
119
#ifdef EDEADLK
120
7203
  NODE_DEFINE_CONSTANT(target, EDEADLK);
121
#endif
122
123
#ifdef EDESTADDRREQ
124
7203
  NODE_DEFINE_CONSTANT(target, EDESTADDRREQ);
125
#endif
126
127
#ifdef EDOM
128
7203
  NODE_DEFINE_CONSTANT(target, EDOM);
129
#endif
130
131
#ifdef EDQUOT
132
7203
  NODE_DEFINE_CONSTANT(target, EDQUOT);
133
#endif
134
135
#ifdef EEXIST
136
7203
  NODE_DEFINE_CONSTANT(target, EEXIST);
137
#endif
138
139
#ifdef EFAULT
140
7203
  NODE_DEFINE_CONSTANT(target, EFAULT);
141
#endif
142
143
#ifdef EFBIG
144
7203
  NODE_DEFINE_CONSTANT(target, EFBIG);
145
#endif
146
147
#ifdef EHOSTUNREACH
148
7203
  NODE_DEFINE_CONSTANT(target, EHOSTUNREACH);
149
#endif
150
151
#ifdef EIDRM
152
7203
  NODE_DEFINE_CONSTANT(target, EIDRM);
153
#endif
154
155
#ifdef EILSEQ
156
7203
  NODE_DEFINE_CONSTANT(target, EILSEQ);
157
#endif
158
159
#ifdef EINPROGRESS
160
7203
  NODE_DEFINE_CONSTANT(target, EINPROGRESS);
161
#endif
162
163
#ifdef EINTR
164
7203
  NODE_DEFINE_CONSTANT(target, EINTR);
165
#endif
166
167
#ifdef EINVAL
168
7203
  NODE_DEFINE_CONSTANT(target, EINVAL);
169
#endif
170
171
#ifdef EIO
172
7203
  NODE_DEFINE_CONSTANT(target, EIO);
173
#endif
174
175
#ifdef EISCONN
176
7203
  NODE_DEFINE_CONSTANT(target, EISCONN);
177
#endif
178
179
#ifdef EISDIR
180
7203
  NODE_DEFINE_CONSTANT(target, EISDIR);
181
#endif
182
183
#ifdef ELOOP
184
7203
  NODE_DEFINE_CONSTANT(target, ELOOP);
185
#endif
186
187
#ifdef EMFILE
188
7203
  NODE_DEFINE_CONSTANT(target, EMFILE);
189
#endif
190
191
#ifdef EMLINK
192
7203
  NODE_DEFINE_CONSTANT(target, EMLINK);
193
#endif
194
195
#ifdef EMSGSIZE
196
7203
  NODE_DEFINE_CONSTANT(target, EMSGSIZE);
197
#endif
198
199
#ifdef EMULTIHOP
200
7203
  NODE_DEFINE_CONSTANT(target, EMULTIHOP);
201
#endif
202
203
#ifdef ENAMETOOLONG
204
7203
  NODE_DEFINE_CONSTANT(target, ENAMETOOLONG);
205
#endif
206
207
#ifdef ENETDOWN
208
7203
  NODE_DEFINE_CONSTANT(target, ENETDOWN);
209
#endif
210
211
#ifdef ENETRESET
212
7203
  NODE_DEFINE_CONSTANT(target, ENETRESET);
213
#endif
214
215
#ifdef ENETUNREACH
216
7203
  NODE_DEFINE_CONSTANT(target, ENETUNREACH);
217
#endif
218
219
#ifdef ENFILE
220
7203
  NODE_DEFINE_CONSTANT(target, ENFILE);
221
#endif
222
223
#ifdef ENOBUFS
224
7203
  NODE_DEFINE_CONSTANT(target, ENOBUFS);
225
#endif
226
227
#ifdef ENODATA
228
7203
  NODE_DEFINE_CONSTANT(target, ENODATA);
229
#endif
230
231
#ifdef ENODEV
232
7203
  NODE_DEFINE_CONSTANT(target, ENODEV);
233
#endif
234
235
#ifdef ENOENT
236
7203
  NODE_DEFINE_CONSTANT(target, ENOENT);
237
#endif
238
239
#ifdef ENOEXEC
240
7203
  NODE_DEFINE_CONSTANT(target, ENOEXEC);
241
#endif
242
243
#ifdef ENOLCK
244
7203
  NODE_DEFINE_CONSTANT(target, ENOLCK);
245
#endif
246
247
#ifdef ENOLINK
248
7203
  NODE_DEFINE_CONSTANT(target, ENOLINK);
249
#endif
250
251
#ifdef ENOMEM
252
7203
  NODE_DEFINE_CONSTANT(target, ENOMEM);
253
#endif
254
255
#ifdef ENOMSG
256
7203
  NODE_DEFINE_CONSTANT(target, ENOMSG);
257
#endif
258
259
#ifdef ENOPROTOOPT
260
7203
  NODE_DEFINE_CONSTANT(target, ENOPROTOOPT);
261
#endif
262
263
#ifdef ENOSPC
264
7203
  NODE_DEFINE_CONSTANT(target, ENOSPC);
265
#endif
266
267
#ifdef ENOSR
268
7203
  NODE_DEFINE_CONSTANT(target, ENOSR);
269
#endif
270
271
#ifdef ENOSTR
272
7203
  NODE_DEFINE_CONSTANT(target, ENOSTR);
273
#endif
274
275
#ifdef ENOSYS
276
7203
  NODE_DEFINE_CONSTANT(target, ENOSYS);
277
#endif
278
279
#ifdef ENOTCONN
280
7203
  NODE_DEFINE_CONSTANT(target, ENOTCONN);
281
#endif
282
283
#ifdef ENOTDIR
284
7203
  NODE_DEFINE_CONSTANT(target, ENOTDIR);
285
#endif
286
287
#ifdef ENOTEMPTY
288
7203
  NODE_DEFINE_CONSTANT(target, ENOTEMPTY);
289
#endif
290
291
#ifdef ENOTSOCK
292
7203
  NODE_DEFINE_CONSTANT(target, ENOTSOCK);
293
#endif
294
295
#ifdef ENOTSUP
296
7203
  NODE_DEFINE_CONSTANT(target, ENOTSUP);
297
#endif
298
299
#ifdef ENOTTY
300
7203
  NODE_DEFINE_CONSTANT(target, ENOTTY);
301
#endif
302
303
#ifdef ENXIO
304
7203
  NODE_DEFINE_CONSTANT(target, ENXIO);
305
#endif
306
307
#ifdef EOPNOTSUPP
308
7203
  NODE_DEFINE_CONSTANT(target, EOPNOTSUPP);
309
#endif
310
311
#ifdef EOVERFLOW
312
7203
  NODE_DEFINE_CONSTANT(target, EOVERFLOW);
313
#endif
314
315
#ifdef EPERM
316
7203
  NODE_DEFINE_CONSTANT(target, EPERM);
317
#endif
318
319
#ifdef EPIPE
320
7203
  NODE_DEFINE_CONSTANT(target, EPIPE);
321
#endif
322
323
#ifdef EPROTO
324
7203
  NODE_DEFINE_CONSTANT(target, EPROTO);
325
#endif
326
327
#ifdef EPROTONOSUPPORT
328
7203
  NODE_DEFINE_CONSTANT(target, EPROTONOSUPPORT);
329
#endif
330
331
#ifdef EPROTOTYPE
332
7203
  NODE_DEFINE_CONSTANT(target, EPROTOTYPE);
333
#endif
334
335
#ifdef ERANGE
336
7203
  NODE_DEFINE_CONSTANT(target, ERANGE);
337
#endif
338
339
#ifdef EROFS
340
7203
  NODE_DEFINE_CONSTANT(target, EROFS);
341
#endif
342
343
#ifdef ESPIPE
344
7203
  NODE_DEFINE_CONSTANT(target, ESPIPE);
345
#endif
346
347
#ifdef ESRCH
348
7203
  NODE_DEFINE_CONSTANT(target, ESRCH);
349
#endif
350
351
#ifdef ESTALE
352
7203
  NODE_DEFINE_CONSTANT(target, ESTALE);
353
#endif
354
355
#ifdef ETIME
356
7203
  NODE_DEFINE_CONSTANT(target, ETIME);
357
#endif
358
359
#ifdef ETIMEDOUT
360
7203
  NODE_DEFINE_CONSTANT(target, ETIMEDOUT);
361
#endif
362
363
#ifdef ETXTBSY
364
7203
  NODE_DEFINE_CONSTANT(target, ETXTBSY);
365
#endif
366
367
#ifdef EWOULDBLOCK
368
7203
  NODE_DEFINE_CONSTANT(target, EWOULDBLOCK);
369
#endif
370
371
#ifdef EXDEV
372
7203
  NODE_DEFINE_CONSTANT(target, EXDEV);
373
#endif
374
2401
}
375
376
2401
void DefineWindowsErrorConstants(Local<Object> target) {
377
#ifdef WSAEINTR
378
  NODE_DEFINE_CONSTANT(target, WSAEINTR);
379
#endif
380
381
#ifdef WSAEBADF
382
  NODE_DEFINE_CONSTANT(target, WSAEBADF);
383
#endif
384
385
#ifdef WSAEACCES
386
  NODE_DEFINE_CONSTANT(target, WSAEACCES);
387
#endif
388
389
#ifdef WSAEFAULT
390
  NODE_DEFINE_CONSTANT(target, WSAEFAULT);
391
#endif
392
393
#ifdef WSAEINVAL
394
  NODE_DEFINE_CONSTANT(target, WSAEINVAL);
395
#endif
396
397
#ifdef WSAEMFILE
398
  NODE_DEFINE_CONSTANT(target, WSAEMFILE);
399
#endif
400
401
#ifdef WSAEWOULDBLOCK
402
  NODE_DEFINE_CONSTANT(target, WSAEWOULDBLOCK);
403
#endif
404
405
#ifdef WSAEINPROGRESS
406
  NODE_DEFINE_CONSTANT(target, WSAEINPROGRESS);
407
#endif
408
409
#ifdef WSAEALREADY
410
  NODE_DEFINE_CONSTANT(target, WSAEALREADY);
411
#endif
412
413
#ifdef WSAENOTSOCK
414
  NODE_DEFINE_CONSTANT(target, WSAENOTSOCK);
415
#endif
416
417
#ifdef WSAEDESTADDRREQ
418
  NODE_DEFINE_CONSTANT(target, WSAEDESTADDRREQ);
419
#endif
420
421
#ifdef WSAEMSGSIZE
422
  NODE_DEFINE_CONSTANT(target, WSAEMSGSIZE);
423
#endif
424
425
#ifdef WSAEPROTOTYPE
426
  NODE_DEFINE_CONSTANT(target, WSAEPROTOTYPE);
427
#endif
428
429
#ifdef WSAENOPROTOOPT
430
  NODE_DEFINE_CONSTANT(target, WSAENOPROTOOPT);
431
#endif
432
433
#ifdef WSAEPROTONOSUPPORT
434
  NODE_DEFINE_CONSTANT(target, WSAEPROTONOSUPPORT);
435
#endif
436
437
#ifdef WSAESOCKTNOSUPPORT
438
  NODE_DEFINE_CONSTANT(target, WSAESOCKTNOSUPPORT);
439
#endif
440
441
#ifdef WSAEOPNOTSUPP
442
  NODE_DEFINE_CONSTANT(target, WSAEOPNOTSUPP);
443
#endif
444
445
#ifdef WSAEPFNOSUPPORT
446
  NODE_DEFINE_CONSTANT(target, WSAEPFNOSUPPORT);
447
#endif
448
449
#ifdef WSAEAFNOSUPPORT
450
  NODE_DEFINE_CONSTANT(target, WSAEAFNOSUPPORT);
451
#endif
452
453
#ifdef WSAEADDRINUSE
454
  NODE_DEFINE_CONSTANT(target, WSAEADDRINUSE);
455
#endif
456
457
#ifdef WSAEADDRNOTAVAIL
458
  NODE_DEFINE_CONSTANT(target, WSAEADDRNOTAVAIL);
459
#endif
460
461
#ifdef WSAENETDOWN
462
  NODE_DEFINE_CONSTANT(target, WSAENETDOWN);
463
#endif
464
465
#ifdef WSAENETUNREACH
466
  NODE_DEFINE_CONSTANT(target, WSAENETUNREACH);
467
#endif
468
469
#ifdef WSAENETRESET
470
  NODE_DEFINE_CONSTANT(target, WSAENETRESET);
471
#endif
472
473
#ifdef WSAECONNABORTED
474
  NODE_DEFINE_CONSTANT(target, WSAECONNABORTED);
475
#endif
476
477
#ifdef WSAECONNRESET
478
  NODE_DEFINE_CONSTANT(target, WSAECONNRESET);
479
#endif
480
481
#ifdef WSAENOBUFS
482
  NODE_DEFINE_CONSTANT(target, WSAENOBUFS);
483
#endif
484
485
#ifdef WSAEISCONN
486
  NODE_DEFINE_CONSTANT(target, WSAEISCONN);
487
#endif
488
489
#ifdef WSAENOTCONN
490
  NODE_DEFINE_CONSTANT(target, WSAENOTCONN);
491
#endif
492
493
#ifdef WSAESHUTDOWN
494
  NODE_DEFINE_CONSTANT(target, WSAESHUTDOWN);
495
#endif
496
497
#ifdef WSAETOOMANYREFS
498
  NODE_DEFINE_CONSTANT(target, WSAETOOMANYREFS);
499
#endif
500
501
#ifdef WSAETIMEDOUT
502
  NODE_DEFINE_CONSTANT(target, WSAETIMEDOUT);
503
#endif
504
505
#ifdef WSAECONNREFUSED
506
  NODE_DEFINE_CONSTANT(target, WSAECONNREFUSED);
507
#endif
508
509
#ifdef WSAELOOP
510
  NODE_DEFINE_CONSTANT(target, WSAELOOP);
511
#endif
512
513
#ifdef WSAENAMETOOLONG
514
  NODE_DEFINE_CONSTANT(target, WSAENAMETOOLONG);
515
#endif
516
517
#ifdef WSAEHOSTDOWN
518
  NODE_DEFINE_CONSTANT(target, WSAEHOSTDOWN);
519
#endif
520
521
#ifdef WSAEHOSTUNREACH
522
  NODE_DEFINE_CONSTANT(target, WSAEHOSTUNREACH);
523
#endif
524
525
#ifdef WSAENOTEMPTY
526
  NODE_DEFINE_CONSTANT(target, WSAENOTEMPTY);
527
#endif
528
529
#ifdef WSAEPROCLIM
530
  NODE_DEFINE_CONSTANT(target, WSAEPROCLIM);
531
#endif
532
533
#ifdef WSAEUSERS
534
  NODE_DEFINE_CONSTANT(target, WSAEUSERS);
535
#endif
536
537
#ifdef WSAEDQUOT
538
  NODE_DEFINE_CONSTANT(target, WSAEDQUOT);
539
#endif
540
541
#ifdef WSAESTALE
542
  NODE_DEFINE_CONSTANT(target, WSAESTALE);
543
#endif
544
545
#ifdef WSAEREMOTE
546
  NODE_DEFINE_CONSTANT(target, WSAEREMOTE);
547
#endif
548
549
#ifdef WSASYSNOTREADY
550
  NODE_DEFINE_CONSTANT(target, WSASYSNOTREADY);
551
#endif
552
553
#ifdef WSAVERNOTSUPPORTED
554
  NODE_DEFINE_CONSTANT(target, WSAVERNOTSUPPORTED);
555
#endif
556
557
#ifdef WSANOTINITIALISED
558
  NODE_DEFINE_CONSTANT(target, WSANOTINITIALISED);
559
#endif
560
561
#ifdef WSAEDISCON
562
  NODE_DEFINE_CONSTANT(target, WSAEDISCON);
563
#endif
564
565
#ifdef WSAENOMORE
566
  NODE_DEFINE_CONSTANT(target, WSAENOMORE);
567
#endif
568
569
#ifdef WSAECANCELLED
570
  NODE_DEFINE_CONSTANT(target, WSAECANCELLED);
571
#endif
572
573
#ifdef WSAEINVALIDPROCTABLE
574
  NODE_DEFINE_CONSTANT(target, WSAEINVALIDPROCTABLE);
575
#endif
576
577
#ifdef WSAEINVALIDPROVIDER
578
  NODE_DEFINE_CONSTANT(target, WSAEINVALIDPROVIDER);
579
#endif
580
581
#ifdef WSAEPROVIDERFAILEDINIT
582
  NODE_DEFINE_CONSTANT(target, WSAEPROVIDERFAILEDINIT);
583
#endif
584
585
#ifdef WSASYSCALLFAILURE
586
  NODE_DEFINE_CONSTANT(target, WSASYSCALLFAILURE);
587
#endif
588
589
#ifdef WSASERVICE_NOT_FOUND
590
  NODE_DEFINE_CONSTANT(target, WSASERVICE_NOT_FOUND);
591
#endif
592
593
#ifdef WSATYPE_NOT_FOUND
594
  NODE_DEFINE_CONSTANT(target, WSATYPE_NOT_FOUND);
595
#endif
596
597
#ifdef WSA_E_NO_MORE
598
  NODE_DEFINE_CONSTANT(target, WSA_E_NO_MORE);
599
#endif
600
601
#ifdef WSA_E_CANCELLED
602
  NODE_DEFINE_CONSTANT(target, WSA_E_CANCELLED);
603
#endif
604
605
#ifdef WSAEREFUSED
606
  NODE_DEFINE_CONSTANT(target, WSAEREFUSED);
607
#endif
608
2401
}
609
610
2401
void DefineSignalConstants(Local<Object> target) {
611
#ifdef SIGHUP
612
7203
  NODE_DEFINE_CONSTANT(target, SIGHUP);
613
#endif
614
615
#ifdef SIGINT
616
7203
  NODE_DEFINE_CONSTANT(target, SIGINT);
617
#endif
618
619
#ifdef SIGQUIT
620
7203
  NODE_DEFINE_CONSTANT(target, SIGQUIT);
621
#endif
622
623
#ifdef SIGILL
624
7203
  NODE_DEFINE_CONSTANT(target, SIGILL);
625
#endif
626
627
#ifdef SIGTRAP
628
7203
  NODE_DEFINE_CONSTANT(target, SIGTRAP);
629
#endif
630
631
#ifdef SIGABRT
632
7203
  NODE_DEFINE_CONSTANT(target, SIGABRT);
633
#endif
634
635
#ifdef SIGIOT
636
7203
  NODE_DEFINE_CONSTANT(target, SIGIOT);
637
#endif
638
639
#ifdef SIGBUS
640
7203
  NODE_DEFINE_CONSTANT(target, SIGBUS);
641
#endif
642
643
#ifdef SIGFPE
644
7203
  NODE_DEFINE_CONSTANT(target, SIGFPE);
645
#endif
646
647
#ifdef SIGKILL
648
7203
  NODE_DEFINE_CONSTANT(target, SIGKILL);
649
#endif
650
651
#ifdef SIGUSR1
652
7203
  NODE_DEFINE_CONSTANT(target, SIGUSR1);
653
#endif
654
655
#ifdef SIGSEGV
656
7203
  NODE_DEFINE_CONSTANT(target, SIGSEGV);
657
#endif
658
659
#ifdef SIGUSR2
660
7203
  NODE_DEFINE_CONSTANT(target, SIGUSR2);
661
#endif
662
663
#ifdef SIGPIPE
664
7203
  NODE_DEFINE_CONSTANT(target, SIGPIPE);
665
#endif
666
667
#ifdef SIGALRM
668
7203
  NODE_DEFINE_CONSTANT(target, SIGALRM);
669
#endif
670
671
7203
  NODE_DEFINE_CONSTANT(target, SIGTERM);
672
673
#ifdef SIGCHLD
674
7203
  NODE_DEFINE_CONSTANT(target, SIGCHLD);
675
#endif
676
677
#ifdef SIGSTKFLT
678
7203
  NODE_DEFINE_CONSTANT(target, SIGSTKFLT);
679
#endif
680
681
682
#ifdef SIGCONT
683
7203
  NODE_DEFINE_CONSTANT(target, SIGCONT);
684
#endif
685
686
#ifdef SIGSTOP
687
7203
  NODE_DEFINE_CONSTANT(target, SIGSTOP);
688
#endif
689
690
#ifdef SIGTSTP
691
7203
  NODE_DEFINE_CONSTANT(target, SIGTSTP);
692
#endif
693
694
#ifdef SIGBREAK
695
  NODE_DEFINE_CONSTANT(target, SIGBREAK);
696
#endif
697
698
#ifdef SIGTTIN
699
7203
  NODE_DEFINE_CONSTANT(target, SIGTTIN);
700
#endif
701
702
#ifdef SIGTTOU
703
7203
  NODE_DEFINE_CONSTANT(target, SIGTTOU);
704
#endif
705
706
#ifdef SIGURG
707
7203
  NODE_DEFINE_CONSTANT(target, SIGURG);
708
#endif
709
710
#ifdef SIGXCPU
711
7203
  NODE_DEFINE_CONSTANT(target, SIGXCPU);
712
#endif
713
714
#ifdef SIGXFSZ
715
7203
  NODE_DEFINE_CONSTANT(target, SIGXFSZ);
716
#endif
717
718
#ifdef SIGVTALRM
719
7203
  NODE_DEFINE_CONSTANT(target, SIGVTALRM);
720
#endif
721
722
#ifdef SIGPROF
723
7203
  NODE_DEFINE_CONSTANT(target, SIGPROF);
724
#endif
725
726
#ifdef SIGWINCH
727
7203
  NODE_DEFINE_CONSTANT(target, SIGWINCH);
728
#endif
729
730
#ifdef SIGIO
731
7203
  NODE_DEFINE_CONSTANT(target, SIGIO);
732
#endif
733
734
#ifdef SIGPOLL
735
7203
  NODE_DEFINE_CONSTANT(target, SIGPOLL);
736
#endif
737
738
#ifdef SIGLOST
739
  NODE_DEFINE_CONSTANT(target, SIGLOST);
740
#endif
741
742
#ifdef SIGPWR
743
7203
  NODE_DEFINE_CONSTANT(target, SIGPWR);
744
#endif
745
746
#ifdef SIGINFO
747
  NODE_DEFINE_CONSTANT(target, SIGINFO);
748
#endif
749
750
#ifdef SIGSYS
751
7203
  NODE_DEFINE_CONSTANT(target, SIGSYS);
752
#endif
753
754
#ifdef SIGUNUSED
755
7203
  NODE_DEFINE_CONSTANT(target, SIGUNUSED);
756
#endif
757
2401
}
758
759
2401
void DefineOpenSSLConstants(Local<Object> target) {
760
#ifdef SSL_OP_ALL
761
7203
    NODE_DEFINE_CONSTANT(target, SSL_OP_ALL);
762
#endif
763
764
#ifdef SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION
765
7203
    NODE_DEFINE_CONSTANT(target, SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION);
766
#endif
767
768
#ifdef SSL_OP_CIPHER_SERVER_PREFERENCE
769
7203
    NODE_DEFINE_CONSTANT(target, SSL_OP_CIPHER_SERVER_PREFERENCE);
770
#endif
771
772
#ifdef SSL_OP_CISCO_ANYCONNECT
773
7203
    NODE_DEFINE_CONSTANT(target, SSL_OP_CISCO_ANYCONNECT);
774
#endif
775
776
#ifdef SSL_OP_COOKIE_EXCHANGE
777
7203
    NODE_DEFINE_CONSTANT(target, SSL_OP_COOKIE_EXCHANGE);
778
#endif
779
780
#ifdef SSL_OP_CRYPTOPRO_TLSEXT_BUG
781
7203
    NODE_DEFINE_CONSTANT(target, SSL_OP_CRYPTOPRO_TLSEXT_BUG);
782
#endif
783
784
#ifdef SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS
785
7203
    NODE_DEFINE_CONSTANT(target, SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS);
786
#endif
787
788
#ifdef SSL_OP_EPHEMERAL_RSA
789
7203
    NODE_DEFINE_CONSTANT(target, SSL_OP_EPHEMERAL_RSA);
790
#endif
791
792
#ifdef SSL_OP_LEGACY_SERVER_CONNECT
793
7203
    NODE_DEFINE_CONSTANT(target, SSL_OP_LEGACY_SERVER_CONNECT);
794
#endif
795
796
#ifdef SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER
797
7203
    NODE_DEFINE_CONSTANT(target, SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER);
798
#endif
799
800
#ifdef SSL_OP_MICROSOFT_SESS_ID_BUG
801
7203
    NODE_DEFINE_CONSTANT(target, SSL_OP_MICROSOFT_SESS_ID_BUG);
802
#endif
803
804
#ifdef SSL_OP_MSIE_SSLV2_RSA_PADDING
805
7203
    NODE_DEFINE_CONSTANT(target, SSL_OP_MSIE_SSLV2_RSA_PADDING);
806
#endif
807
808
#ifdef SSL_OP_NETSCAPE_CA_DN_BUG
809
7203
    NODE_DEFINE_CONSTANT(target, SSL_OP_NETSCAPE_CA_DN_BUG);
810
#endif
811
812
#ifdef SSL_OP_NETSCAPE_CHALLENGE_BUG
813
7203
    NODE_DEFINE_CONSTANT(target, SSL_OP_NETSCAPE_CHALLENGE_BUG);
814
#endif
815
816
#ifdef SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG
817
7203
    NODE_DEFINE_CONSTANT(target, SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG);
818
#endif
819
820
#ifdef SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG
821
7203
    NODE_DEFINE_CONSTANT(target, SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG);
822
#endif
823
824
#ifdef SSL_OP_NO_COMPRESSION
825
7203
    NODE_DEFINE_CONSTANT(target, SSL_OP_NO_COMPRESSION);
826
#endif
827
828
#ifdef SSL_OP_NO_QUERY_MTU
829
7203
    NODE_DEFINE_CONSTANT(target, SSL_OP_NO_QUERY_MTU);
830
#endif
831
832
#ifdef SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION
833
7203
    NODE_DEFINE_CONSTANT(target, SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION);
834
#endif
835
836
#ifdef SSL_OP_NO_SSLv2
837
7203
    NODE_DEFINE_CONSTANT(target, SSL_OP_NO_SSLv2);
838
#endif
839
840
#ifdef SSL_OP_NO_SSLv3
841
7203
    NODE_DEFINE_CONSTANT(target, SSL_OP_NO_SSLv3);
842
#endif
843
844
#ifdef SSL_OP_NO_TICKET
845
7203
    NODE_DEFINE_CONSTANT(target, SSL_OP_NO_TICKET);
846
#endif
847
848
#ifdef SSL_OP_NO_TLSv1
849
7203
    NODE_DEFINE_CONSTANT(target, SSL_OP_NO_TLSv1);
850
#endif
851
852
#ifdef SSL_OP_NO_TLSv1_1
853
7203
    NODE_DEFINE_CONSTANT(target, SSL_OP_NO_TLSv1_1);
854
#endif
855
856
#ifdef SSL_OP_NO_TLSv1_2
857
7203
    NODE_DEFINE_CONSTANT(target, SSL_OP_NO_TLSv1_2);
858
#endif
859
860
#ifdef SSL_OP_PKCS1_CHECK_1
861
7203
    NODE_DEFINE_CONSTANT(target, SSL_OP_PKCS1_CHECK_1);
862
#endif
863
864
#ifdef SSL_OP_PKCS1_CHECK_2
865
7203
    NODE_DEFINE_CONSTANT(target, SSL_OP_PKCS1_CHECK_2);
866
#endif
867
868
#ifdef SSL_OP_SINGLE_DH_USE
869
7203
    NODE_DEFINE_CONSTANT(target, SSL_OP_SINGLE_DH_USE);
870
#endif
871
872
#ifdef SSL_OP_SINGLE_ECDH_USE
873
7203
    NODE_DEFINE_CONSTANT(target, SSL_OP_SINGLE_ECDH_USE);
874
#endif
875
876
#ifdef SSL_OP_SSLEAY_080_CLIENT_DH_BUG
877
7203
    NODE_DEFINE_CONSTANT(target, SSL_OP_SSLEAY_080_CLIENT_DH_BUG);
878
#endif
879
880
#ifdef SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG
881
7203
    NODE_DEFINE_CONSTANT(target, SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG);
882
#endif
883
884
#ifdef SSL_OP_TLS_BLOCK_PADDING_BUG
885
7203
    NODE_DEFINE_CONSTANT(target, SSL_OP_TLS_BLOCK_PADDING_BUG);
886
#endif
887
888
#ifdef SSL_OP_TLS_D5_BUG
889
7203
    NODE_DEFINE_CONSTANT(target, SSL_OP_TLS_D5_BUG);
890
#endif
891
892
#ifdef SSL_OP_TLS_ROLLBACK_BUG
893
7203
    NODE_DEFINE_CONSTANT(target, SSL_OP_TLS_ROLLBACK_BUG);
894
#endif
895
896
# ifndef OPENSSL_NO_ENGINE
897
898
# ifdef ENGINE_METHOD_RSA
899
7203
    NODE_DEFINE_CONSTANT(target, ENGINE_METHOD_RSA);
900
# endif
901
902
# ifdef ENGINE_METHOD_DSA
903
7203
    NODE_DEFINE_CONSTANT(target, ENGINE_METHOD_DSA);
904
# endif
905
906
# ifdef ENGINE_METHOD_DH
907
7203
    NODE_DEFINE_CONSTANT(target, ENGINE_METHOD_DH);
908
# endif
909
910
# ifdef ENGINE_METHOD_RAND
911
7203
    NODE_DEFINE_CONSTANT(target, ENGINE_METHOD_RAND);
912
# endif
913
914
# ifdef ENGINE_METHOD_ECDH
915
7203
    NODE_DEFINE_CONSTANT(target, ENGINE_METHOD_ECDH);
916
# endif
917
918
# ifdef ENGINE_METHOD_ECDSA
919
7203
    NODE_DEFINE_CONSTANT(target, ENGINE_METHOD_ECDSA);
920
# endif
921
922
# ifdef ENGINE_METHOD_CIPHERS
923
7203
    NODE_DEFINE_CONSTANT(target, ENGINE_METHOD_CIPHERS);
924
# endif
925
926
# ifdef ENGINE_METHOD_DIGESTS
927
7203
    NODE_DEFINE_CONSTANT(target, ENGINE_METHOD_DIGESTS);
928
# endif
929
930
# ifdef ENGINE_METHOD_STORE
931
7203
    NODE_DEFINE_CONSTANT(target, ENGINE_METHOD_STORE);
932
# endif
933
934
# ifdef ENGINE_METHOD_PKEY_METHS
935
7203
    NODE_DEFINE_CONSTANT(target, ENGINE_METHOD_PKEY_METHS);
936
# endif
937
938
# ifdef ENGINE_METHOD_PKEY_ASN1_METHS
939
7203
    NODE_DEFINE_CONSTANT(target, ENGINE_METHOD_PKEY_ASN1_METHS);
940
# endif
941
942
# ifdef ENGINE_METHOD_ALL
943
7203
    NODE_DEFINE_CONSTANT(target, ENGINE_METHOD_ALL);
944
# endif
945
946
# ifdef ENGINE_METHOD_NONE
947
7203
    NODE_DEFINE_CONSTANT(target, ENGINE_METHOD_NONE);
948
# endif
949
950
# endif  // !OPENSSL_NO_ENGINE
951
952
#ifdef DH_CHECK_P_NOT_SAFE_PRIME
953
7203
    NODE_DEFINE_CONSTANT(target, DH_CHECK_P_NOT_SAFE_PRIME);
954
#endif
955
956
#ifdef DH_CHECK_P_NOT_PRIME
957
7203
    NODE_DEFINE_CONSTANT(target, DH_CHECK_P_NOT_PRIME);
958
#endif
959
960
#ifdef DH_UNABLE_TO_CHECK_GENERATOR
961
7203
    NODE_DEFINE_CONSTANT(target, DH_UNABLE_TO_CHECK_GENERATOR);
962
#endif
963
964
#ifdef DH_NOT_SUITABLE_GENERATOR
965
7203
    NODE_DEFINE_CONSTANT(target, DH_NOT_SUITABLE_GENERATOR);
966
#endif
967
968
#ifndef OPENSSL_NO_NEXTPROTONEG
969
#define NPN_ENABLED 1
970
7203
    NODE_DEFINE_CONSTANT(target, NPN_ENABLED);
971
#endif
972
973
#ifdef TLSEXT_TYPE_application_layer_protocol_negotiation
974
#define ALPN_ENABLED 1
975
7203
    NODE_DEFINE_CONSTANT(target, ALPN_ENABLED);
976
#endif
977
978
#ifdef RSA_PKCS1_PADDING
979
7203
    NODE_DEFINE_CONSTANT(target, RSA_PKCS1_PADDING);
980
#endif
981
982
#ifdef RSA_SSLV23_PADDING
983
7203
    NODE_DEFINE_CONSTANT(target, RSA_SSLV23_PADDING);
984
#endif
985
986
#ifdef RSA_NO_PADDING
987
7203
    NODE_DEFINE_CONSTANT(target, RSA_NO_PADDING);
988
#endif
989
990
#ifdef RSA_PKCS1_OAEP_PADDING
991
7203
    NODE_DEFINE_CONSTANT(target, RSA_PKCS1_OAEP_PADDING);
992
#endif
993
994
#ifdef RSA_X931_PADDING
995
7203
    NODE_DEFINE_CONSTANT(target, RSA_X931_PADDING);
996
#endif
997
998
#ifdef RSA_PKCS1_PSS_PADDING
999
7203
    NODE_DEFINE_CONSTANT(target, RSA_PKCS1_PSS_PADDING);
1000
#endif
1001
1002
#ifdef RSA_PSS_SALTLEN_DIGEST
1003
7203
    NODE_DEFINE_CONSTANT(target, RSA_PSS_SALTLEN_DIGEST);
1004
#endif
1005
1006
#ifdef RSA_PSS_SALTLEN_MAX_SIGN
1007
7203
    NODE_DEFINE_CONSTANT(target, RSA_PSS_SALTLEN_MAX_SIGN);
1008
#endif
1009
1010
#ifdef RSA_PSS_SALTLEN_AUTO
1011
7203
    NODE_DEFINE_CONSTANT(target, RSA_PSS_SALTLEN_AUTO);
1012
#endif
1013
1014
#if HAVE_OPENSSL
1015
  // NOTE: These are not defines
1016
7203
  NODE_DEFINE_CONSTANT(target, POINT_CONVERSION_COMPRESSED);
1017
1018
7203
  NODE_DEFINE_CONSTANT(target, POINT_CONVERSION_UNCOMPRESSED);
1019
1020
7203
  NODE_DEFINE_CONSTANT(target, POINT_CONVERSION_HYBRID);
1021
#endif
1022
2401
}
1023
1024
2401
void DefineSystemConstants(Local<Object> target) {
1025
  // file access modes
1026
7203
  NODE_DEFINE_CONSTANT(target, O_RDONLY);
1027
7203
  NODE_DEFINE_CONSTANT(target, O_WRONLY);
1028
7203
  NODE_DEFINE_CONSTANT(target, O_RDWR);
1029
1030
7203
  NODE_DEFINE_CONSTANT(target, S_IFMT);
1031
7203
  NODE_DEFINE_CONSTANT(target, S_IFREG);
1032
7203
  NODE_DEFINE_CONSTANT(target, S_IFDIR);
1033
7203
  NODE_DEFINE_CONSTANT(target, S_IFCHR);
1034
#ifdef S_IFBLK
1035
7203
  NODE_DEFINE_CONSTANT(target, S_IFBLK);
1036
#endif
1037
1038
#ifdef S_IFIFO
1039
7203
  NODE_DEFINE_CONSTANT(target, S_IFIFO);
1040
#endif
1041
1042
#ifdef S_IFLNK
1043
7203
  NODE_DEFINE_CONSTANT(target, S_IFLNK);
1044
#endif
1045
1046
#ifdef S_IFSOCK
1047
7203
  NODE_DEFINE_CONSTANT(target, S_IFSOCK);
1048
#endif
1049
1050
#ifdef O_CREAT
1051
7203
  NODE_DEFINE_CONSTANT(target, O_CREAT);
1052
#endif
1053
1054
#ifdef O_EXCL
1055
7203
  NODE_DEFINE_CONSTANT(target, O_EXCL);
1056
#endif
1057
1058
#ifdef O_NOCTTY
1059
7203
  NODE_DEFINE_CONSTANT(target, O_NOCTTY);
1060
#endif
1061
1062
#ifdef O_TRUNC
1063
7203
  NODE_DEFINE_CONSTANT(target, O_TRUNC);
1064
#endif
1065
1066
#ifdef O_APPEND
1067
7203
  NODE_DEFINE_CONSTANT(target, O_APPEND);
1068
#endif
1069
1070
#ifdef O_DIRECTORY
1071
7203
  NODE_DEFINE_CONSTANT(target, O_DIRECTORY);
1072
#endif
1073
1074
#ifdef O_EXCL
1075
7203
  NODE_DEFINE_CONSTANT(target, O_EXCL);
1076
#endif
1077
1078
#ifdef O_NOATIME
1079
7203
  NODE_DEFINE_CONSTANT(target, O_NOATIME);
1080
#endif
1081
1082
#ifdef O_NOFOLLOW
1083
7203
  NODE_DEFINE_CONSTANT(target, O_NOFOLLOW);
1084
#endif
1085
1086
#ifdef O_SYNC
1087
7203
  NODE_DEFINE_CONSTANT(target, O_SYNC);
1088
#endif
1089
1090
#ifdef O_SYMLINK
1091
  NODE_DEFINE_CONSTANT(target, O_SYMLINK);
1092
#endif
1093
1094
#ifdef O_DIRECT
1095
7203
  NODE_DEFINE_CONSTANT(target, O_DIRECT);
1096
#endif
1097
1098
#ifdef O_NONBLOCK
1099
7203
  NODE_DEFINE_CONSTANT(target, O_NONBLOCK);
1100
#endif
1101
1102
#ifdef S_IRWXU
1103
7203
  NODE_DEFINE_CONSTANT(target, S_IRWXU);
1104
#endif
1105
1106
#ifdef S_IRUSR
1107
7203
  NODE_DEFINE_CONSTANT(target, S_IRUSR);
1108
#endif
1109
1110
#ifdef S_IWUSR
1111
7203
  NODE_DEFINE_CONSTANT(target, S_IWUSR);
1112
#endif
1113
1114
#ifdef S_IXUSR
1115
7203
  NODE_DEFINE_CONSTANT(target, S_IXUSR);
1116
#endif
1117
1118
#ifdef S_IRWXG
1119
7203
  NODE_DEFINE_CONSTANT(target, S_IRWXG);
1120
#endif
1121
1122
#ifdef S_IRGRP
1123
7203
  NODE_DEFINE_CONSTANT(target, S_IRGRP);
1124
#endif
1125
1126
#ifdef S_IWGRP
1127
7203
  NODE_DEFINE_CONSTANT(target, S_IWGRP);
1128
#endif
1129
1130
#ifdef S_IXGRP
1131
7203
  NODE_DEFINE_CONSTANT(target, S_IXGRP);
1132
#endif
1133
1134
#ifdef S_IRWXO
1135
7203
  NODE_DEFINE_CONSTANT(target, S_IRWXO);
1136
#endif
1137
1138
#ifdef S_IROTH
1139
7203
  NODE_DEFINE_CONSTANT(target, S_IROTH);
1140
#endif
1141
1142
#ifdef S_IWOTH
1143
7203
  NODE_DEFINE_CONSTANT(target, S_IWOTH);
1144
#endif
1145
1146
#ifdef S_IXOTH
1147
7203
  NODE_DEFINE_CONSTANT(target, S_IXOTH);
1148
#endif
1149
1150
#ifdef F_OK
1151
7203
  NODE_DEFINE_CONSTANT(target, F_OK);
1152
#endif
1153
1154
#ifdef R_OK
1155
7203
  NODE_DEFINE_CONSTANT(target, R_OK);
1156
#endif
1157
1158
#ifdef W_OK
1159
7203
  NODE_DEFINE_CONSTANT(target, W_OK);
1160
#endif
1161
1162
#ifdef X_OK
1163
7203
  NODE_DEFINE_CONSTANT(target, X_OK);
1164
#endif
1165
2401
}
1166
1167
2401
void DefineUVConstants(Local<Object> target) {
1168
7203
  NODE_DEFINE_CONSTANT(target, UV_UDP_REUSEADDR);
1169
2401
}
1170
1171
2401
void DefineCryptoConstants(Local<Object> target) {
1172
#if HAVE_OPENSSL
1173
9604
  NODE_DEFINE_STRING_CONSTANT(target,
1174
                              "defaultCoreCipherList",
1175
                              DEFAULT_CIPHER_LIST_CORE);
1176
9604
  NODE_DEFINE_STRING_CONSTANT(target,
1177
                              "defaultCipherList",
1178
                              default_cipher_list);
1179
#endif
1180
2401
}
1181
1182
2401
void DefineZlibConstants(Local<Object> target) {
1183
7203
  NODE_DEFINE_CONSTANT(target, Z_NO_FLUSH);
1184
7203
  NODE_DEFINE_CONSTANT(target, Z_PARTIAL_FLUSH);
1185
7203
  NODE_DEFINE_CONSTANT(target, Z_SYNC_FLUSH);
1186
7203
  NODE_DEFINE_CONSTANT(target, Z_FULL_FLUSH);
1187
7203
  NODE_DEFINE_CONSTANT(target, Z_FINISH);
1188
7203
  NODE_DEFINE_CONSTANT(target, Z_BLOCK);
1189
1190
  // return/error codes
1191
7203
  NODE_DEFINE_CONSTANT(target, Z_OK);
1192
7203
  NODE_DEFINE_CONSTANT(target, Z_STREAM_END);
1193
7203
  NODE_DEFINE_CONSTANT(target, Z_NEED_DICT);
1194
7203
  NODE_DEFINE_CONSTANT(target, Z_ERRNO);
1195
7203
  NODE_DEFINE_CONSTANT(target, Z_STREAM_ERROR);
1196
7203
  NODE_DEFINE_CONSTANT(target, Z_DATA_ERROR);
1197
7203
  NODE_DEFINE_CONSTANT(target, Z_MEM_ERROR);
1198
7203
  NODE_DEFINE_CONSTANT(target, Z_BUF_ERROR);
1199
7203
  NODE_DEFINE_CONSTANT(target, Z_VERSION_ERROR);
1200
1201
7203
  NODE_DEFINE_CONSTANT(target, Z_NO_COMPRESSION);
1202
7203
  NODE_DEFINE_CONSTANT(target, Z_BEST_SPEED);
1203
7203
  NODE_DEFINE_CONSTANT(target, Z_BEST_COMPRESSION);
1204
7203
  NODE_DEFINE_CONSTANT(target, Z_DEFAULT_COMPRESSION);
1205
7203
  NODE_DEFINE_CONSTANT(target, Z_FILTERED);
1206
7203
  NODE_DEFINE_CONSTANT(target, Z_HUFFMAN_ONLY);
1207
7203
  NODE_DEFINE_CONSTANT(target, Z_RLE);
1208
7203
  NODE_DEFINE_CONSTANT(target, Z_FIXED);
1209
7203
  NODE_DEFINE_CONSTANT(target, Z_DEFAULT_STRATEGY);
1210
7203
  NODE_DEFINE_CONSTANT(target, ZLIB_VERNUM);
1211
1212
  enum node_zlib_mode {
1213
    NONE,
1214
    DEFLATE,
1215
    INFLATE,
1216
    GZIP,
1217
    GUNZIP,
1218
    DEFLATERAW,
1219
    INFLATERAW,
1220
    UNZIP
1221
  };
1222
1223
7203
  NODE_DEFINE_CONSTANT(target, DEFLATE);
1224
7203
  NODE_DEFINE_CONSTANT(target, INFLATE);
1225
7203
  NODE_DEFINE_CONSTANT(target, GZIP);
1226
7203
  NODE_DEFINE_CONSTANT(target, GUNZIP);
1227
7203
  NODE_DEFINE_CONSTANT(target, DEFLATERAW);
1228
7203
  NODE_DEFINE_CONSTANT(target, INFLATERAW);
1229
7203
  NODE_DEFINE_CONSTANT(target, UNZIP);
1230
1231
7203
  NODE_DEFINE_CONSTANT(target, Z_MIN_WINDOWBITS);
1232
7203
  NODE_DEFINE_CONSTANT(target, Z_MAX_WINDOWBITS);
1233
7203
  NODE_DEFINE_CONSTANT(target, Z_DEFAULT_WINDOWBITS);
1234
7203
  NODE_DEFINE_CONSTANT(target, Z_MIN_CHUNK);
1235
7203
  NODE_DEFINE_CONSTANT(target, Z_MAX_CHUNK);
1236
7203
  NODE_DEFINE_CONSTANT(target, Z_DEFAULT_CHUNK);
1237
7203
  NODE_DEFINE_CONSTANT(target, Z_MIN_MEMLEVEL);
1238
7203
  NODE_DEFINE_CONSTANT(target, Z_MAX_MEMLEVEL);
1239
7203
  NODE_DEFINE_CONSTANT(target, Z_DEFAULT_MEMLEVEL);
1240
7203
  NODE_DEFINE_CONSTANT(target, Z_MIN_LEVEL);
1241
7203
  NODE_DEFINE_CONSTANT(target, Z_MAX_LEVEL);
1242
7203
  NODE_DEFINE_CONSTANT(target, Z_DEFAULT_LEVEL);
1243
2401
}
1244
1245
}  // anonymous namespace
1246
1247
2401
void DefineConstants(v8::Isolate* isolate, Local<Object> target) {
1248
2401
  Environment* env = Environment::GetCurrent(isolate);
1249
1250
2401
  Local<Object> os_constants = Object::New(isolate);
1251
9604
  CHECK(os_constants->SetPrototype(env->context(),
1252
                                   Null(env->isolate())).FromJust());
1253
1254
2401
  Local<Object> err_constants = Object::New(isolate);
1255
9604
  CHECK(err_constants->SetPrototype(env->context(),
1256
                                    Null(env->isolate())).FromJust());
1257
1258
2401
  Local<Object> sig_constants = Object::New(isolate);
1259
9604
  CHECK(sig_constants->SetPrototype(env->context(),
1260
                                    Null(env->isolate())).FromJust());
1261
1262
2401
  Local<Object> fs_constants = Object::New(isolate);
1263
9604
  CHECK(fs_constants->SetPrototype(env->context(),
1264
                                   Null(env->isolate())).FromJust());
1265
1266
2401
  Local<Object> crypto_constants = Object::New(isolate);
1267
9604
  CHECK(crypto_constants->SetPrototype(env->context(),
1268
                                       Null(env->isolate())).FromJust());
1269
1270
2401
  Local<Object> zlib_constants = Object::New(isolate);
1271
9604
  CHECK(zlib_constants->SetPrototype(env->context(),
1272
                                     Null(env->isolate())).FromJust());
1273
1274
2401
  DefineErrnoConstants(err_constants);
1275
2401
  DefineWindowsErrorConstants(err_constants);
1276
2401
  DefineSignalConstants(sig_constants);
1277
2401
  DefineUVConstants(os_constants);
1278
2401
  DefineSystemConstants(fs_constants);
1279
2401
  DefineOpenSSLConstants(crypto_constants);
1280
2401
  DefineCryptoConstants(crypto_constants);
1281
2401
  DefineZlibConstants(zlib_constants);
1282
1283
4802
  os_constants->Set(OneByteString(isolate, "errno"), err_constants);
1284
4802
  os_constants->Set(OneByteString(isolate, "signals"), sig_constants);
1285
4802
  target->Set(OneByteString(isolate, "os"), os_constants);
1286
4802
  target->Set(OneByteString(isolate, "fs"), fs_constants);
1287
4802
  target->Set(OneByteString(isolate, "crypto"), crypto_constants);
1288
4802
  target->Set(OneByteString(isolate, "zlib"), zlib_constants);
1289
2401
}
1290
1291
}  // namespace node