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