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: 321 321 100.0 %
Date: 2017-12-18 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
3348
void DefineErrnoConstants(Local<Object> target) {
61
#ifdef E2BIG
62
10044
  NODE_DEFINE_CONSTANT(target, E2BIG);
63
#endif
64
65
#ifdef EACCES
66
10044
  NODE_DEFINE_CONSTANT(target, EACCES);
67
#endif
68
69
#ifdef EADDRINUSE
70
10044
  NODE_DEFINE_CONSTANT(target, EADDRINUSE);
71
#endif
72
73
#ifdef EADDRNOTAVAIL
74
10044
  NODE_DEFINE_CONSTANT(target, EADDRNOTAVAIL);
75
#endif
76
77
#ifdef EAFNOSUPPORT
78
10044
  NODE_DEFINE_CONSTANT(target, EAFNOSUPPORT);
79
#endif
80
81
#ifdef EAGAIN
82
10044
  NODE_DEFINE_CONSTANT(target, EAGAIN);
83
#endif
84
85
#ifdef EALREADY
86
10044
  NODE_DEFINE_CONSTANT(target, EALREADY);
87
#endif
88
89
#ifdef EBADF
90
10044
  NODE_DEFINE_CONSTANT(target, EBADF);
91
#endif
92
93
#ifdef EBADMSG
94
10044
  NODE_DEFINE_CONSTANT(target, EBADMSG);
95
#endif
96
97
#ifdef EBUSY
98
10044
  NODE_DEFINE_CONSTANT(target, EBUSY);
99
#endif
100
101
#ifdef ECANCELED
102
10044
  NODE_DEFINE_CONSTANT(target, ECANCELED);
103
#endif
104
105
#ifdef ECHILD
106
10044
  NODE_DEFINE_CONSTANT(target, ECHILD);
107
#endif
108
109
#ifdef ECONNABORTED
110
10044
  NODE_DEFINE_CONSTANT(target, ECONNABORTED);
111
#endif
112
113
#ifdef ECONNREFUSED
114
10044
  NODE_DEFINE_CONSTANT(target, ECONNREFUSED);
115
#endif
116
117
#ifdef ECONNRESET
118
10044
  NODE_DEFINE_CONSTANT(target, ECONNRESET);
119
#endif
120
121
#ifdef EDEADLK
122
10044
  NODE_DEFINE_CONSTANT(target, EDEADLK);
123
#endif
124
125
#ifdef EDESTADDRREQ
126
10044
  NODE_DEFINE_CONSTANT(target, EDESTADDRREQ);
127
#endif
128
129
#ifdef EDOM
130
10044
  NODE_DEFINE_CONSTANT(target, EDOM);
131
#endif
132
133
#ifdef EDQUOT
134
10044
  NODE_DEFINE_CONSTANT(target, EDQUOT);
135
#endif
136
137
#ifdef EEXIST
138
10044
  NODE_DEFINE_CONSTANT(target, EEXIST);
139
#endif
140
141
#ifdef EFAULT
142
10044
  NODE_DEFINE_CONSTANT(target, EFAULT);
143
#endif
144
145
#ifdef EFBIG
146
10044
  NODE_DEFINE_CONSTANT(target, EFBIG);
147
#endif
148
149
#ifdef EHOSTUNREACH
150
10044
  NODE_DEFINE_CONSTANT(target, EHOSTUNREACH);
151
#endif
152
153
#ifdef EIDRM
154
10044
  NODE_DEFINE_CONSTANT(target, EIDRM);
155
#endif
156
157
#ifdef EILSEQ
158
10044
  NODE_DEFINE_CONSTANT(target, EILSEQ);
159
#endif
160
161
#ifdef EINPROGRESS
162
10044
  NODE_DEFINE_CONSTANT(target, EINPROGRESS);
163
#endif
164
165
#ifdef EINTR
166
10044
  NODE_DEFINE_CONSTANT(target, EINTR);
167
#endif
168
169
#ifdef EINVAL
170
10044
  NODE_DEFINE_CONSTANT(target, EINVAL);
171
#endif
172
173
#ifdef EIO
174
10044
  NODE_DEFINE_CONSTANT(target, EIO);
175
#endif
176
177
#ifdef EISCONN
178
10044
  NODE_DEFINE_CONSTANT(target, EISCONN);
179
#endif
180
181
#ifdef EISDIR
182
10044
  NODE_DEFINE_CONSTANT(target, EISDIR);
183
#endif
184
185
#ifdef ELOOP
186
10044
  NODE_DEFINE_CONSTANT(target, ELOOP);
187
#endif
188
189
#ifdef EMFILE
190
10044
  NODE_DEFINE_CONSTANT(target, EMFILE);
191
#endif
192
193
#ifdef EMLINK
194
10044
  NODE_DEFINE_CONSTANT(target, EMLINK);
195
#endif
196
197
#ifdef EMSGSIZE
198
10044
  NODE_DEFINE_CONSTANT(target, EMSGSIZE);
199
#endif
200
201
#ifdef EMULTIHOP
202
10044
  NODE_DEFINE_CONSTANT(target, EMULTIHOP);
203
#endif
204
205
#ifdef ENAMETOOLONG
206
10044
  NODE_DEFINE_CONSTANT(target, ENAMETOOLONG);
207
#endif
208
209
#ifdef ENETDOWN
210
10044
  NODE_DEFINE_CONSTANT(target, ENETDOWN);
211
#endif
212
213
#ifdef ENETRESET
214
10044
  NODE_DEFINE_CONSTANT(target, ENETRESET);
215
#endif
216
217
#ifdef ENETUNREACH
218
10044
  NODE_DEFINE_CONSTANT(target, ENETUNREACH);
219
#endif
220
221
#ifdef ENFILE
222
10044
  NODE_DEFINE_CONSTANT(target, ENFILE);
223
#endif
224
225
#ifdef ENOBUFS
226
10044
  NODE_DEFINE_CONSTANT(target, ENOBUFS);
227
#endif
228
229
#ifdef ENODATA
230
10044
  NODE_DEFINE_CONSTANT(target, ENODATA);
231
#endif
232
233
#ifdef ENODEV
234
10044
  NODE_DEFINE_CONSTANT(target, ENODEV);
235
#endif
236
237
#ifdef ENOENT
238
10044
  NODE_DEFINE_CONSTANT(target, ENOENT);
239
#endif
240
241
#ifdef ENOEXEC
242
10044
  NODE_DEFINE_CONSTANT(target, ENOEXEC);
243
#endif
244
245
#ifdef ENOLCK
246
10044
  NODE_DEFINE_CONSTANT(target, ENOLCK);
247
#endif
248
249
#ifdef ENOLINK
250
10044
  NODE_DEFINE_CONSTANT(target, ENOLINK);
251
#endif
252
253
#ifdef ENOMEM
254
10044
  NODE_DEFINE_CONSTANT(target, ENOMEM);
255
#endif
256
257
#ifdef ENOMSG
258
10044
  NODE_DEFINE_CONSTANT(target, ENOMSG);
259
#endif
260
261
#ifdef ENOPROTOOPT
262
10044
  NODE_DEFINE_CONSTANT(target, ENOPROTOOPT);
263
#endif
264
265
#ifdef ENOSPC
266
10044
  NODE_DEFINE_CONSTANT(target, ENOSPC);
267
#endif
268
269
#ifdef ENOSR
270
10044
  NODE_DEFINE_CONSTANT(target, ENOSR);
271
#endif
272
273
#ifdef ENOSTR
274
10044
  NODE_DEFINE_CONSTANT(target, ENOSTR);
275
#endif
276
277
#ifdef ENOSYS
278
10044
  NODE_DEFINE_CONSTANT(target, ENOSYS);
279
#endif
280
281
#ifdef ENOTCONN
282
10044
  NODE_DEFINE_CONSTANT(target, ENOTCONN);
283
#endif
284
285
#ifdef ENOTDIR
286
10044
  NODE_DEFINE_CONSTANT(target, ENOTDIR);
287
#endif
288
289
#ifdef ENOTEMPTY
290
10044
  NODE_DEFINE_CONSTANT(target, ENOTEMPTY);
291
#endif
292
293
#ifdef ENOTSOCK
294
10044
  NODE_DEFINE_CONSTANT(target, ENOTSOCK);
295
#endif
296
297
#ifdef ENOTSUP
298
10044
  NODE_DEFINE_CONSTANT(target, ENOTSUP);
299
#endif
300
301
#ifdef ENOTTY
302
10044
  NODE_DEFINE_CONSTANT(target, ENOTTY);
303
#endif
304
305
#ifdef ENXIO
306
10044
  NODE_DEFINE_CONSTANT(target, ENXIO);
307
#endif
308
309
#ifdef EOPNOTSUPP
310
10044
  NODE_DEFINE_CONSTANT(target, EOPNOTSUPP);
311
#endif
312
313
#ifdef EOVERFLOW
314
10044
  NODE_DEFINE_CONSTANT(target, EOVERFLOW);
315
#endif
316
317
#ifdef EPERM
318
10044
  NODE_DEFINE_CONSTANT(target, EPERM);
319
#endif
320
321
#ifdef EPIPE
322
10044
  NODE_DEFINE_CONSTANT(target, EPIPE);
323
#endif
324
325
#ifdef EPROTO
326
10044
  NODE_DEFINE_CONSTANT(target, EPROTO);
327
#endif
328
329
#ifdef EPROTONOSUPPORT
330
10044
  NODE_DEFINE_CONSTANT(target, EPROTONOSUPPORT);
331
#endif
332
333
#ifdef EPROTOTYPE
334
10044
  NODE_DEFINE_CONSTANT(target, EPROTOTYPE);
335
#endif
336
337
#ifdef ERANGE
338
10044
  NODE_DEFINE_CONSTANT(target, ERANGE);
339
#endif
340
341
#ifdef EROFS
342
10044
  NODE_DEFINE_CONSTANT(target, EROFS);
343
#endif
344
345
#ifdef ESPIPE
346
10044
  NODE_DEFINE_CONSTANT(target, ESPIPE);
347
#endif
348
349
#ifdef ESRCH
350
10044
  NODE_DEFINE_CONSTANT(target, ESRCH);
351
#endif
352
353
#ifdef ESTALE
354
10044
  NODE_DEFINE_CONSTANT(target, ESTALE);
355
#endif
356
357
#ifdef ETIME
358
10044
  NODE_DEFINE_CONSTANT(target, ETIME);
359
#endif
360
361
#ifdef ETIMEDOUT
362
10044
  NODE_DEFINE_CONSTANT(target, ETIMEDOUT);
363
#endif
364
365
#ifdef ETXTBSY
366
10044
  NODE_DEFINE_CONSTANT(target, ETXTBSY);
367
#endif
368
369
#ifdef EWOULDBLOCK
370
10044
  NODE_DEFINE_CONSTANT(target, EWOULDBLOCK);
371
#endif
372
373
#ifdef EXDEV
374
10044
  NODE_DEFINE_CONSTANT(target, EXDEV);
375
#endif
376
3348
}
377
378
3348
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
3348
}
611
612
3348
void DefineSignalConstants(Local<Object> target) {
613
#ifdef SIGHUP
614
10044
  NODE_DEFINE_CONSTANT(target, SIGHUP);
615
#endif
616
617
#ifdef SIGINT
618
10044
  NODE_DEFINE_CONSTANT(target, SIGINT);
619
#endif
620
621
#ifdef SIGQUIT
622
10044
  NODE_DEFINE_CONSTANT(target, SIGQUIT);
623
#endif
624
625
#ifdef SIGILL
626
10044
  NODE_DEFINE_CONSTANT(target, SIGILL);
627
#endif
628
629
#ifdef SIGTRAP
630
10044
  NODE_DEFINE_CONSTANT(target, SIGTRAP);
631
#endif
632
633
#ifdef SIGABRT
634
10044
  NODE_DEFINE_CONSTANT(target, SIGABRT);
635
#endif
636
637
#ifdef SIGIOT
638
10044
  NODE_DEFINE_CONSTANT(target, SIGIOT);
639
#endif
640
641
#ifdef SIGBUS
642
10044
  NODE_DEFINE_CONSTANT(target, SIGBUS);
643
#endif
644
645
#ifdef SIGFPE
646
10044
  NODE_DEFINE_CONSTANT(target, SIGFPE);
647
#endif
648
649
#ifdef SIGKILL
650
10044
  NODE_DEFINE_CONSTANT(target, SIGKILL);
651
#endif
652
653
#ifdef SIGUSR1
654
10044
  NODE_DEFINE_CONSTANT(target, SIGUSR1);
655
#endif
656
657
#ifdef SIGSEGV
658
10044
  NODE_DEFINE_CONSTANT(target, SIGSEGV);
659
#endif
660
661
#ifdef SIGUSR2
662
10044
  NODE_DEFINE_CONSTANT(target, SIGUSR2);
663
#endif
664
665
#ifdef SIGPIPE
666
10044
  NODE_DEFINE_CONSTANT(target, SIGPIPE);
667
#endif
668
669
#ifdef SIGALRM
670
10044
  NODE_DEFINE_CONSTANT(target, SIGALRM);
671
#endif
672
673
10044
  NODE_DEFINE_CONSTANT(target, SIGTERM);
674
675
#ifdef SIGCHLD
676
10044
  NODE_DEFINE_CONSTANT(target, SIGCHLD);
677
#endif
678
679
#ifdef SIGSTKFLT
680
10044
  NODE_DEFINE_CONSTANT(target, SIGSTKFLT);
681
#endif
682
683
684
#ifdef SIGCONT
685
10044
  NODE_DEFINE_CONSTANT(target, SIGCONT);
686
#endif
687
688
#ifdef SIGSTOP
689
10044
  NODE_DEFINE_CONSTANT(target, SIGSTOP);
690
#endif
691
692
#ifdef SIGTSTP
693
10044
  NODE_DEFINE_CONSTANT(target, SIGTSTP);
694
#endif
695
696
#ifdef SIGBREAK
697
  NODE_DEFINE_CONSTANT(target, SIGBREAK);
698
#endif
699
700
#ifdef SIGTTIN
701
10044
  NODE_DEFINE_CONSTANT(target, SIGTTIN);
702
#endif
703
704
#ifdef SIGTTOU
705
10044
  NODE_DEFINE_CONSTANT(target, SIGTTOU);
706
#endif
707
708
#ifdef SIGURG
709
10044
  NODE_DEFINE_CONSTANT(target, SIGURG);
710
#endif
711
712
#ifdef SIGXCPU
713
10044
  NODE_DEFINE_CONSTANT(target, SIGXCPU);
714
#endif
715
716
#ifdef SIGXFSZ
717
10044
  NODE_DEFINE_CONSTANT(target, SIGXFSZ);
718
#endif
719
720
#ifdef SIGVTALRM
721
10044
  NODE_DEFINE_CONSTANT(target, SIGVTALRM);
722
#endif
723
724
#ifdef SIGPROF
725
10044
  NODE_DEFINE_CONSTANT(target, SIGPROF);
726
#endif
727
728
#ifdef SIGWINCH
729
10044
  NODE_DEFINE_CONSTANT(target, SIGWINCH);
730
#endif
731
732
#ifdef SIGIO
733
10044
  NODE_DEFINE_CONSTANT(target, SIGIO);
734
#endif
735
736
#ifdef SIGPOLL
737
10044
  NODE_DEFINE_CONSTANT(target, SIGPOLL);
738
#endif
739
740
#ifdef SIGLOST
741
  NODE_DEFINE_CONSTANT(target, SIGLOST);
742
#endif
743
744
#ifdef SIGPWR
745
10044
  NODE_DEFINE_CONSTANT(target, SIGPWR);
746
#endif
747
748
#ifdef SIGINFO
749
  NODE_DEFINE_CONSTANT(target, SIGINFO);
750
#endif
751
752
#ifdef SIGSYS
753
10044
  NODE_DEFINE_CONSTANT(target, SIGSYS);
754
#endif
755
756
#ifdef SIGUNUSED
757
10044
  NODE_DEFINE_CONSTANT(target, SIGUNUSED);
758
#endif
759
3348
}
760
761
3348
void DefineOpenSSLConstants(Local<Object> target) {
762
#ifdef OPENSSL_VERSION_NUMBER
763
10044
    NODE_DEFINE_CONSTANT(target, OPENSSL_VERSION_NUMBER);
764
#endif
765
766
#ifdef SSL_OP_ALL
767
10044
    NODE_DEFINE_CONSTANT(target, SSL_OP_ALL);
768
#endif
769
770
#ifdef SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION
771
10044
    NODE_DEFINE_CONSTANT(target, SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION);
772
#endif
773
774
#ifdef SSL_OP_CIPHER_SERVER_PREFERENCE
775
10044
    NODE_DEFINE_CONSTANT(target, SSL_OP_CIPHER_SERVER_PREFERENCE);
776
#endif
777
778
#ifdef SSL_OP_CISCO_ANYCONNECT
779
10044
    NODE_DEFINE_CONSTANT(target, SSL_OP_CISCO_ANYCONNECT);
780
#endif
781
782
#ifdef SSL_OP_COOKIE_EXCHANGE
783
10044
    NODE_DEFINE_CONSTANT(target, SSL_OP_COOKIE_EXCHANGE);
784
#endif
785
786
#ifdef SSL_OP_CRYPTOPRO_TLSEXT_BUG
787
10044
    NODE_DEFINE_CONSTANT(target, SSL_OP_CRYPTOPRO_TLSEXT_BUG);
788
#endif
789
790
#ifdef SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS
791
10044
    NODE_DEFINE_CONSTANT(target, SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS);
792
#endif
793
794
#ifdef SSL_OP_EPHEMERAL_RSA
795
10044
    NODE_DEFINE_CONSTANT(target, SSL_OP_EPHEMERAL_RSA);
796
#endif
797
798
#ifdef SSL_OP_LEGACY_SERVER_CONNECT
799
10044
    NODE_DEFINE_CONSTANT(target, SSL_OP_LEGACY_SERVER_CONNECT);
800
#endif
801
802
#ifdef SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER
803
10044
    NODE_DEFINE_CONSTANT(target, SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER);
804
#endif
805
806
#ifdef SSL_OP_MICROSOFT_SESS_ID_BUG
807
10044
    NODE_DEFINE_CONSTANT(target, SSL_OP_MICROSOFT_SESS_ID_BUG);
808
#endif
809
810
#ifdef SSL_OP_MSIE_SSLV2_RSA_PADDING
811
10044
    NODE_DEFINE_CONSTANT(target, SSL_OP_MSIE_SSLV2_RSA_PADDING);
812
#endif
813
814
#ifdef SSL_OP_NETSCAPE_CA_DN_BUG
815
10044
    NODE_DEFINE_CONSTANT(target, SSL_OP_NETSCAPE_CA_DN_BUG);
816
#endif
817
818
#ifdef SSL_OP_NETSCAPE_CHALLENGE_BUG
819
10044
    NODE_DEFINE_CONSTANT(target, SSL_OP_NETSCAPE_CHALLENGE_BUG);
820
#endif
821
822
#ifdef SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG
823
10044
    NODE_DEFINE_CONSTANT(target, SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG);
824
#endif
825
826
#ifdef SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG
827
10044
    NODE_DEFINE_CONSTANT(target, SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG);
828
#endif
829
830
#ifdef SSL_OP_NO_COMPRESSION
831
10044
    NODE_DEFINE_CONSTANT(target, SSL_OP_NO_COMPRESSION);
832
#endif
833
834
#ifdef SSL_OP_NO_QUERY_MTU
835
10044
    NODE_DEFINE_CONSTANT(target, SSL_OP_NO_QUERY_MTU);
836
#endif
837
838
#ifdef SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION
839
10044
    NODE_DEFINE_CONSTANT(target, SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION);
840
#endif
841
842
#ifdef SSL_OP_NO_SSLv2
843
10044
    NODE_DEFINE_CONSTANT(target, SSL_OP_NO_SSLv2);
844
#endif
845
846
#ifdef SSL_OP_NO_SSLv3
847
10044
    NODE_DEFINE_CONSTANT(target, SSL_OP_NO_SSLv3);
848
#endif
849
850
#ifdef SSL_OP_NO_TICKET
851
10044
    NODE_DEFINE_CONSTANT(target, SSL_OP_NO_TICKET);
852
#endif
853
854
#ifdef SSL_OP_NO_TLSv1
855
10044
    NODE_DEFINE_CONSTANT(target, SSL_OP_NO_TLSv1);
856
#endif
857
858
#ifdef SSL_OP_NO_TLSv1_1
859
10044
    NODE_DEFINE_CONSTANT(target, SSL_OP_NO_TLSv1_1);
860
#endif
861
862
#ifdef SSL_OP_NO_TLSv1_2
863
10044
    NODE_DEFINE_CONSTANT(target, SSL_OP_NO_TLSv1_2);
864
#endif
865
866
#ifdef SSL_OP_PKCS1_CHECK_1
867
10044
    NODE_DEFINE_CONSTANT(target, SSL_OP_PKCS1_CHECK_1);
868
#endif
869
870
#ifdef SSL_OP_PKCS1_CHECK_2
871
10044
    NODE_DEFINE_CONSTANT(target, SSL_OP_PKCS1_CHECK_2);
872
#endif
873
874
#ifdef SSL_OP_SINGLE_DH_USE
875
10044
    NODE_DEFINE_CONSTANT(target, SSL_OP_SINGLE_DH_USE);
876
#endif
877
878
#ifdef SSL_OP_SINGLE_ECDH_USE
879
10044
    NODE_DEFINE_CONSTANT(target, SSL_OP_SINGLE_ECDH_USE);
880
#endif
881
882
#ifdef SSL_OP_SSLEAY_080_CLIENT_DH_BUG
883
10044
    NODE_DEFINE_CONSTANT(target, SSL_OP_SSLEAY_080_CLIENT_DH_BUG);
884
#endif
885
886
#ifdef SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG
887
10044
    NODE_DEFINE_CONSTANT(target, SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG);
888
#endif
889
890
#ifdef SSL_OP_TLS_BLOCK_PADDING_BUG
891
10044
    NODE_DEFINE_CONSTANT(target, SSL_OP_TLS_BLOCK_PADDING_BUG);
892
#endif
893
894
#ifdef SSL_OP_TLS_D5_BUG
895
10044
    NODE_DEFINE_CONSTANT(target, SSL_OP_TLS_D5_BUG);
896
#endif
897
898
#ifdef SSL_OP_TLS_ROLLBACK_BUG
899
10044
    NODE_DEFINE_CONSTANT(target, SSL_OP_TLS_ROLLBACK_BUG);
900
#endif
901
902
# ifndef OPENSSL_NO_ENGINE
903
904
# ifdef ENGINE_METHOD_RSA
905
10044
    NODE_DEFINE_CONSTANT(target, ENGINE_METHOD_RSA);
906
# endif
907
908
# ifdef ENGINE_METHOD_DSA
909
10044
    NODE_DEFINE_CONSTANT(target, ENGINE_METHOD_DSA);
910
# endif
911
912
# ifdef ENGINE_METHOD_DH
913
10044
    NODE_DEFINE_CONSTANT(target, ENGINE_METHOD_DH);
914
# endif
915
916
# ifdef ENGINE_METHOD_RAND
917
10044
    NODE_DEFINE_CONSTANT(target, ENGINE_METHOD_RAND);
918
# endif
919
920
# ifdef ENGINE_METHOD_ECDH
921
10044
    NODE_DEFINE_CONSTANT(target, ENGINE_METHOD_ECDH);
922
# endif
923
924
# ifdef ENGINE_METHOD_ECDSA
925
10044
    NODE_DEFINE_CONSTANT(target, ENGINE_METHOD_ECDSA);
926
# endif
927
928
# ifdef ENGINE_METHOD_CIPHERS
929
10044
    NODE_DEFINE_CONSTANT(target, ENGINE_METHOD_CIPHERS);
930
# endif
931
932
# ifdef ENGINE_METHOD_DIGESTS
933
10044
    NODE_DEFINE_CONSTANT(target, ENGINE_METHOD_DIGESTS);
934
# endif
935
936
# ifdef ENGINE_METHOD_STORE
937
10044
    NODE_DEFINE_CONSTANT(target, ENGINE_METHOD_STORE);
938
# endif
939
940
# ifdef ENGINE_METHOD_PKEY_METHS
941
10044
    NODE_DEFINE_CONSTANT(target, ENGINE_METHOD_PKEY_METHS);
942
# endif
943
944
# ifdef ENGINE_METHOD_PKEY_ASN1_METHS
945
10044
    NODE_DEFINE_CONSTANT(target, ENGINE_METHOD_PKEY_ASN1_METHS);
946
# endif
947
948
# ifdef ENGINE_METHOD_ALL
949
10044
    NODE_DEFINE_CONSTANT(target, ENGINE_METHOD_ALL);
950
# endif
951
952
# ifdef ENGINE_METHOD_NONE
953
10044
    NODE_DEFINE_CONSTANT(target, ENGINE_METHOD_NONE);
954
# endif
955
956
# endif  // !OPENSSL_NO_ENGINE
957
958
#ifdef DH_CHECK_P_NOT_SAFE_PRIME
959
10044
    NODE_DEFINE_CONSTANT(target, DH_CHECK_P_NOT_SAFE_PRIME);
960
#endif
961
962
#ifdef DH_CHECK_P_NOT_PRIME
963
10044
    NODE_DEFINE_CONSTANT(target, DH_CHECK_P_NOT_PRIME);
964
#endif
965
966
#ifdef DH_UNABLE_TO_CHECK_GENERATOR
967
10044
    NODE_DEFINE_CONSTANT(target, DH_UNABLE_TO_CHECK_GENERATOR);
968
#endif
969
970
#ifdef DH_NOT_SUITABLE_GENERATOR
971
10044
    NODE_DEFINE_CONSTANT(target, DH_NOT_SUITABLE_GENERATOR);
972
#endif
973
974
#ifndef OPENSSL_NO_NEXTPROTONEG
975
#define NPN_ENABLED 1
976
10044
    NODE_DEFINE_CONSTANT(target, NPN_ENABLED);
977
#endif
978
979
#ifdef TLSEXT_TYPE_application_layer_protocol_negotiation
980
#define ALPN_ENABLED 1
981
10044
    NODE_DEFINE_CONSTANT(target, ALPN_ENABLED);
982
#endif
983
984
#ifdef RSA_PKCS1_PADDING
985
10044
    NODE_DEFINE_CONSTANT(target, RSA_PKCS1_PADDING);
986
#endif
987
988
#ifdef RSA_SSLV23_PADDING
989
10044
    NODE_DEFINE_CONSTANT(target, RSA_SSLV23_PADDING);
990
#endif
991
992
#ifdef RSA_NO_PADDING
993
10044
    NODE_DEFINE_CONSTANT(target, RSA_NO_PADDING);
994
#endif
995
996
#ifdef RSA_PKCS1_OAEP_PADDING
997
10044
    NODE_DEFINE_CONSTANT(target, RSA_PKCS1_OAEP_PADDING);
998
#endif
999
1000
#ifdef RSA_X931_PADDING
1001
10044
    NODE_DEFINE_CONSTANT(target, RSA_X931_PADDING);
1002
#endif
1003
1004
#ifdef RSA_PKCS1_PSS_PADDING
1005
10044
    NODE_DEFINE_CONSTANT(target, RSA_PKCS1_PSS_PADDING);
1006
#endif
1007
1008
#ifdef RSA_PSS_SALTLEN_DIGEST
1009
10044
    NODE_DEFINE_CONSTANT(target, RSA_PSS_SALTLEN_DIGEST);
1010
#endif
1011
1012
#ifdef RSA_PSS_SALTLEN_MAX_SIGN
1013
10044
    NODE_DEFINE_CONSTANT(target, RSA_PSS_SALTLEN_MAX_SIGN);
1014
#endif
1015
1016
#ifdef RSA_PSS_SALTLEN_AUTO
1017
10044
    NODE_DEFINE_CONSTANT(target, RSA_PSS_SALTLEN_AUTO);
1018
#endif
1019
1020
#if HAVE_OPENSSL
1021
  // NOTE: These are not defines
1022
10044
  NODE_DEFINE_CONSTANT(target, POINT_CONVERSION_COMPRESSED);
1023
1024
10044
  NODE_DEFINE_CONSTANT(target, POINT_CONVERSION_UNCOMPRESSED);
1025
1026
10044
  NODE_DEFINE_CONSTANT(target, POINT_CONVERSION_HYBRID);
1027
#endif
1028
3348
}
1029
1030
3348
void DefineSystemConstants(Local<Object> target) {
1031
  // file access modes
1032
10044
  NODE_DEFINE_CONSTANT(target, O_RDONLY);
1033
10044
  NODE_DEFINE_CONSTANT(target, O_WRONLY);
1034
10044
  NODE_DEFINE_CONSTANT(target, O_RDWR);
1035
1036
10044
  NODE_DEFINE_CONSTANT(target, S_IFMT);
1037
10044
  NODE_DEFINE_CONSTANT(target, S_IFREG);
1038
10044
  NODE_DEFINE_CONSTANT(target, S_IFDIR);
1039
10044
  NODE_DEFINE_CONSTANT(target, S_IFCHR);
1040
#ifdef S_IFBLK
1041
10044
  NODE_DEFINE_CONSTANT(target, S_IFBLK);
1042
#endif
1043
1044
#ifdef S_IFIFO
1045
10044
  NODE_DEFINE_CONSTANT(target, S_IFIFO);
1046
#endif
1047
1048
#ifdef S_IFLNK
1049
10044
  NODE_DEFINE_CONSTANT(target, S_IFLNK);
1050
#endif
1051
1052
#ifdef S_IFSOCK
1053
10044
  NODE_DEFINE_CONSTANT(target, S_IFSOCK);
1054
#endif
1055
1056
#ifdef O_CREAT
1057
10044
  NODE_DEFINE_CONSTANT(target, O_CREAT);
1058
#endif
1059
1060
#ifdef O_EXCL
1061
10044
  NODE_DEFINE_CONSTANT(target, O_EXCL);
1062
#endif
1063
1064
#ifdef O_NOCTTY
1065
10044
  NODE_DEFINE_CONSTANT(target, O_NOCTTY);
1066
#endif
1067
1068
#ifdef O_TRUNC
1069
10044
  NODE_DEFINE_CONSTANT(target, O_TRUNC);
1070
#endif
1071
1072
#ifdef O_APPEND
1073
10044
  NODE_DEFINE_CONSTANT(target, O_APPEND);
1074
#endif
1075
1076
#ifdef O_DIRECTORY
1077
10044
  NODE_DEFINE_CONSTANT(target, O_DIRECTORY);
1078
#endif
1079
1080
#ifdef O_EXCL
1081
10044
  NODE_DEFINE_CONSTANT(target, O_EXCL);
1082
#endif
1083
1084
#ifdef O_NOATIME
1085
10044
  NODE_DEFINE_CONSTANT(target, O_NOATIME);
1086
#endif
1087
1088
#ifdef O_NOFOLLOW
1089
10044
  NODE_DEFINE_CONSTANT(target, O_NOFOLLOW);
1090
#endif
1091
1092
#ifdef O_SYNC
1093
10044
  NODE_DEFINE_CONSTANT(target, O_SYNC);
1094
#endif
1095
1096
#ifdef O_DSYNC
1097
10044
  NODE_DEFINE_CONSTANT(target, O_DSYNC);
1098
#endif
1099
1100
1101
#ifdef O_SYMLINK
1102
  NODE_DEFINE_CONSTANT(target, O_SYMLINK);
1103
#endif
1104
1105
#ifdef O_DIRECT
1106
10044
  NODE_DEFINE_CONSTANT(target, O_DIRECT);
1107
#endif
1108
1109
#ifdef O_NONBLOCK
1110
10044
  NODE_DEFINE_CONSTANT(target, O_NONBLOCK);
1111
#endif
1112
1113
#ifdef S_IRWXU
1114
10044
  NODE_DEFINE_CONSTANT(target, S_IRWXU);
1115
#endif
1116
1117
#ifdef S_IRUSR
1118
10044
  NODE_DEFINE_CONSTANT(target, S_IRUSR);
1119
#endif
1120
1121
#ifdef S_IWUSR
1122
10044
  NODE_DEFINE_CONSTANT(target, S_IWUSR);
1123
#endif
1124
1125
#ifdef S_IXUSR
1126
10044
  NODE_DEFINE_CONSTANT(target, S_IXUSR);
1127
#endif
1128
1129
#ifdef S_IRWXG
1130
10044
  NODE_DEFINE_CONSTANT(target, S_IRWXG);
1131
#endif
1132
1133
#ifdef S_IRGRP
1134
10044
  NODE_DEFINE_CONSTANT(target, S_IRGRP);
1135
#endif
1136
1137
#ifdef S_IWGRP
1138
10044
  NODE_DEFINE_CONSTANT(target, S_IWGRP);
1139
#endif
1140
1141
#ifdef S_IXGRP
1142
10044
  NODE_DEFINE_CONSTANT(target, S_IXGRP);
1143
#endif
1144
1145
#ifdef S_IRWXO
1146
10044
  NODE_DEFINE_CONSTANT(target, S_IRWXO);
1147
#endif
1148
1149
#ifdef S_IROTH
1150
10044
  NODE_DEFINE_CONSTANT(target, S_IROTH);
1151
#endif
1152
1153
#ifdef S_IWOTH
1154
10044
  NODE_DEFINE_CONSTANT(target, S_IWOTH);
1155
#endif
1156
1157
#ifdef S_IXOTH
1158
10044
  NODE_DEFINE_CONSTANT(target, S_IXOTH);
1159
#endif
1160
1161
#ifdef F_OK
1162
10044
  NODE_DEFINE_CONSTANT(target, F_OK);
1163
#endif
1164
1165
#ifdef R_OK
1166
10044
  NODE_DEFINE_CONSTANT(target, R_OK);
1167
#endif
1168
1169
#ifdef W_OK
1170
10044
  NODE_DEFINE_CONSTANT(target, W_OK);
1171
#endif
1172
1173
#ifdef X_OK
1174
10044
  NODE_DEFINE_CONSTANT(target, X_OK);
1175
#endif
1176
3348
}
1177
1178
3348
void DefineCryptoConstants(Local<Object> target) {
1179
#if HAVE_OPENSSL
1180
13392
  NODE_DEFINE_STRING_CONSTANT(target,
1181
                              "defaultCoreCipherList",
1182
                              DEFAULT_CIPHER_LIST_CORE);
1183
13392
  NODE_DEFINE_STRING_CONSTANT(target,
1184
                              "defaultCipherList",
1185
                              default_cipher_list);
1186
#endif
1187
10044
  NODE_DEFINE_CONSTANT(target, INT_MAX);
1188
3348
}
1189
1190
3348
void DefineZlibConstants(Local<Object> target) {
1191
10044
  NODE_DEFINE_CONSTANT(target, Z_NO_FLUSH);
1192
10044
  NODE_DEFINE_CONSTANT(target, Z_PARTIAL_FLUSH);
1193
10044
  NODE_DEFINE_CONSTANT(target, Z_SYNC_FLUSH);
1194
10044
  NODE_DEFINE_CONSTANT(target, Z_FULL_FLUSH);
1195
10044
  NODE_DEFINE_CONSTANT(target, Z_FINISH);
1196
10044
  NODE_DEFINE_CONSTANT(target, Z_BLOCK);
1197
1198
  // return/error codes
1199
10044
  NODE_DEFINE_CONSTANT(target, Z_OK);
1200
10044
  NODE_DEFINE_CONSTANT(target, Z_STREAM_END);
1201
10044
  NODE_DEFINE_CONSTANT(target, Z_NEED_DICT);
1202
10044
  NODE_DEFINE_CONSTANT(target, Z_ERRNO);
1203
10044
  NODE_DEFINE_CONSTANT(target, Z_STREAM_ERROR);
1204
10044
  NODE_DEFINE_CONSTANT(target, Z_DATA_ERROR);
1205
10044
  NODE_DEFINE_CONSTANT(target, Z_MEM_ERROR);
1206
10044
  NODE_DEFINE_CONSTANT(target, Z_BUF_ERROR);
1207
10044
  NODE_DEFINE_CONSTANT(target, Z_VERSION_ERROR);
1208
1209
10044
  NODE_DEFINE_CONSTANT(target, Z_NO_COMPRESSION);
1210
10044
  NODE_DEFINE_CONSTANT(target, Z_BEST_SPEED);
1211
10044
  NODE_DEFINE_CONSTANT(target, Z_BEST_COMPRESSION);
1212
10044
  NODE_DEFINE_CONSTANT(target, Z_DEFAULT_COMPRESSION);
1213
10044
  NODE_DEFINE_CONSTANT(target, Z_FILTERED);
1214
10044
  NODE_DEFINE_CONSTANT(target, Z_HUFFMAN_ONLY);
1215
10044
  NODE_DEFINE_CONSTANT(target, Z_RLE);
1216
10044
  NODE_DEFINE_CONSTANT(target, Z_FIXED);
1217
10044
  NODE_DEFINE_CONSTANT(target, Z_DEFAULT_STRATEGY);
1218
10044
  NODE_DEFINE_CONSTANT(target, ZLIB_VERNUM);
1219
1220
  enum node_zlib_mode {
1221
    NONE,
1222
    DEFLATE,
1223
    INFLATE,
1224
    GZIP,
1225
    GUNZIP,
1226
    DEFLATERAW,
1227
    INFLATERAW,
1228
    UNZIP
1229
  };
1230
1231
10044
  NODE_DEFINE_CONSTANT(target, DEFLATE);
1232
10044
  NODE_DEFINE_CONSTANT(target, INFLATE);
1233
10044
  NODE_DEFINE_CONSTANT(target, GZIP);
1234
10044
  NODE_DEFINE_CONSTANT(target, GUNZIP);
1235
10044
  NODE_DEFINE_CONSTANT(target, DEFLATERAW);
1236
10044
  NODE_DEFINE_CONSTANT(target, INFLATERAW);
1237
10044
  NODE_DEFINE_CONSTANT(target, UNZIP);
1238
1239
10044
  NODE_DEFINE_CONSTANT(target, Z_MIN_WINDOWBITS);
1240
10044
  NODE_DEFINE_CONSTANT(target, Z_MAX_WINDOWBITS);
1241
10044
  NODE_DEFINE_CONSTANT(target, Z_DEFAULT_WINDOWBITS);
1242
10044
  NODE_DEFINE_CONSTANT(target, Z_MIN_CHUNK);
1243
10044
  NODE_DEFINE_CONSTANT(target, Z_MAX_CHUNK);
1244
10044
  NODE_DEFINE_CONSTANT(target, Z_DEFAULT_CHUNK);
1245
10044
  NODE_DEFINE_CONSTANT(target, Z_MIN_MEMLEVEL);
1246
10044
  NODE_DEFINE_CONSTANT(target, Z_MAX_MEMLEVEL);
1247
10044
  NODE_DEFINE_CONSTANT(target, Z_DEFAULT_MEMLEVEL);
1248
10044
  NODE_DEFINE_CONSTANT(target, Z_MIN_LEVEL);
1249
10044
  NODE_DEFINE_CONSTANT(target, Z_MAX_LEVEL);
1250
10044
  NODE_DEFINE_CONSTANT(target, Z_DEFAULT_LEVEL);
1251
3348
}
1252
1253
3348
void DefineDLOpenConstants(Local<Object> target) {
1254
#ifdef RTLD_LAZY
1255
10044
  NODE_DEFINE_CONSTANT(target, RTLD_LAZY);
1256
#endif
1257
1258
#ifdef RTLD_NOW
1259
10044
  NODE_DEFINE_CONSTANT(target, RTLD_NOW);
1260
#endif
1261
1262
#ifdef RTLD_GLOBAL
1263
10044
  NODE_DEFINE_CONSTANT(target, RTLD_GLOBAL);
1264
#endif
1265
1266
#ifdef RTLD_LOCAL
1267
10044
  NODE_DEFINE_CONSTANT(target, RTLD_LOCAL);
1268
#endif
1269
1270
#ifdef RTLD_DEEPBIND
1271
10044
  NODE_DEFINE_CONSTANT(target, RTLD_DEEPBIND);
1272
#endif
1273
3348
}
1274
1275
}  // anonymous namespace
1276
1277
3348
void DefineConstants(v8::Isolate* isolate, Local<Object> target) {
1278
3348
  Environment* env = Environment::GetCurrent(isolate);
1279
1280
3348
  Local<Object> os_constants = Object::New(isolate);
1281
13392
  CHECK(os_constants->SetPrototype(env->context(),
1282
                                   Null(env->isolate())).FromJust());
1283
1284
3348
  Local<Object> err_constants = Object::New(isolate);
1285
13392
  CHECK(err_constants->SetPrototype(env->context(),
1286
                                    Null(env->isolate())).FromJust());
1287
1288
3348
  Local<Object> sig_constants = Object::New(isolate);
1289
13392
  CHECK(sig_constants->SetPrototype(env->context(),
1290
                                    Null(env->isolate())).FromJust());
1291
1292
3348
  Local<Object> fs_constants = Object::New(isolate);
1293
13392
  CHECK(fs_constants->SetPrototype(env->context(),
1294
                                   Null(env->isolate())).FromJust());
1295
1296
3348
  Local<Object> crypto_constants = Object::New(isolate);
1297
13392
  CHECK(crypto_constants->SetPrototype(env->context(),
1298
                                       Null(env->isolate())).FromJust());
1299
1300
3348
  Local<Object> zlib_constants = Object::New(isolate);
1301
13392
  CHECK(zlib_constants->SetPrototype(env->context(),
1302
                                     Null(env->isolate())).FromJust());
1303
1304
3348
  Local<Object> dlopen_constants = Object::New(isolate);
1305
13392
  CHECK(dlopen_constants->SetPrototype(env->context(),
1306
                                       Null(env->isolate())).FromJust());
1307
1308
3348
  DefineErrnoConstants(err_constants);
1309
3348
  DefineWindowsErrorConstants(err_constants);
1310
3348
  DefineSignalConstants(sig_constants);
1311
3348
  DefineSystemConstants(fs_constants);
1312
3348
  DefineOpenSSLConstants(crypto_constants);
1313
3348
  DefineCryptoConstants(crypto_constants);
1314
3348
  DefineZlibConstants(zlib_constants);
1315
3348
  DefineDLOpenConstants(dlopen_constants);
1316
1317
  // Define libuv constants.
1318
10044
  NODE_DEFINE_CONSTANT(os_constants, UV_UDP_REUSEADDR);
1319
10044
  NODE_DEFINE_CONSTANT(fs_constants, UV_FS_COPYFILE_EXCL);
1320
1321
6696
  os_constants->Set(OneByteString(isolate, "dlopen"), dlopen_constants);
1322
6696
  os_constants->Set(OneByteString(isolate, "errno"), err_constants);
1323
6696
  os_constants->Set(OneByteString(isolate, "signals"), sig_constants);
1324
6696
  target->Set(OneByteString(isolate, "os"), os_constants);
1325
6696
  target->Set(OneByteString(isolate, "fs"), fs_constants);
1326
6696
  target->Set(OneByteString(isolate, "crypto"), crypto_constants);
1327
6696
  target->Set(OneByteString(isolate, "zlib"), zlib_constants);
1328
3348
}
1329
1330
}  // namespace node