| 1 |
#define PERL_constant_NOTFOUND 1 |
| 2 |
#define PERL_constant_NOTDEF 2 |
| 3 |
#define PERL_constant_ISIV 3 |
| 4 |
#define PERL_constant_ISNO 4 |
| 5 |
#define PERL_constant_ISNV 5 |
| 6 |
#define PERL_constant_ISPV 6 |
| 7 |
#define PERL_constant_ISPVN 7 |
| 8 |
#define PERL_constant_ISSV 8 |
| 9 |
#define PERL_constant_ISUNDEF 9 |
| 10 |
#define PERL_constant_ISUV 10 |
| 11 |
#define PERL_constant_ISYES 11 |
| 12 |
|
| 13 |
#ifndef NVTYPE |
| 14 |
typedef double NV; /* 5.6 and later define NVTYPE, and typedef NV to it. */ |
| 15 |
#endif |
| 16 |
#ifndef aTHX_ |
| 17 |
#define aTHX_ /* 5.6 or later define this for threading support. */ |
| 18 |
#endif |
| 19 |
#ifndef pTHX_ |
| 20 |
#define pTHX_ /* 5.6 or later define this for threading support. */ |
| 21 |
#endif |
| 22 |
|
| 23 |
static int |
| 24 |
constant_25 (pTHX_ const char *name, IV *iv_return) { |
| 25 |
/* When generated this function returned values for the list of names given |
| 26 |
here. However, subsequent manual editing may have added or removed some. |
| 27 |
NETSNMPTRAPD_AUTH_HANDLER NETSNMPTRAPD_HANDLER_FAIL |
| 28 |
NETSNMPTRAPD_POST_HANDLER */ |
| 29 |
/* Offset 15 gives the best switch position. */ |
| 30 |
switch (name[15]) { |
| 31 |
case 'N': |
| 32 |
if (memEQ(name, "NETSNMPTRAPD_HANDLER_FAIL", 25)) { |
| 33 |
/* ^ */ |
| 34 |
#ifdef NETSNMPTRAPD_HANDLER_FAIL |
| 35 |
*iv_return = NETSNMPTRAPD_HANDLER_FAIL; |
| 36 |
return PERL_constant_ISIV; |
| 37 |
#else |
| 38 |
return PERL_constant_NOTDEF; |
| 39 |
#endif |
| 40 |
} |
| 41 |
break; |
| 42 |
case 'S': |
| 43 |
if (memEQ(name, "NETSNMPTRAPD_POST_HANDLER", 25)) { |
| 44 |
/* ^ */ |
| 45 |
#ifdef NETSNMPTRAPD_POST_HANDLER |
| 46 |
*iv_return = NETSNMPTRAPD_POST_HANDLER; |
| 47 |
return PERL_constant_ISIV; |
| 48 |
#else |
| 49 |
return PERL_constant_NOTDEF; |
| 50 |
#endif |
| 51 |
} |
| 52 |
break; |
| 53 |
case 'T': |
| 54 |
if (memEQ(name, "NETSNMPTRAPD_AUTH_HANDLER", 25)) { |
| 55 |
/* ^ */ |
| 56 |
#ifdef NETSNMPTRAPD_AUTH_HANDLER |
| 57 |
*iv_return = NETSNMPTRAPD_AUTH_HANDLER; |
| 58 |
return PERL_constant_ISIV; |
| 59 |
#else |
| 60 |
return PERL_constant_NOTDEF; |
| 61 |
#endif |
| 62 |
} |
| 63 |
break; |
| 64 |
} |
| 65 |
return PERL_constant_NOTFOUND; |
| 66 |
} |
| 67 |
|
| 68 |
static int |
| 69 |
constant (pTHX_ const char *name, STRLEN len, IV *iv_return) { |
| 70 |
/* Initially switch on the length of the name. */ |
| 71 |
/* When generated this function returned values for the list of names given |
| 72 |
in this section of perl code. Rather than manually editing these functions |
| 73 |
to add or remove constants, which would result in this comment and section |
| 74 |
of code becoming inaccurate, we recommend that you edit this section of |
| 75 |
code, and use it to regenerate a new set of constant functions which you |
| 76 |
then use to replace the originals. |
| 77 |
|
| 78 |
Regenerate these constant functions by feeding this entire source file to |
| 79 |
perl -x |
| 80 |
|
| 81 |
#!/usr/bin/perl -w |
| 82 |
use ExtUtils::Constant qw (constant_types C_constant XS_constant); |
| 83 |
|
| 84 |
my $types = {map {($_, 1)} qw(IV)}; |
| 85 |
my @names = (qw(NETSNMPTRAPD_AUTH_HANDLER NETSNMPTRAPD_HANDLER_BREAK |
| 86 |
NETSNMPTRAPD_HANDLER_FAIL NETSNMPTRAPD_HANDLER_FINISH |
| 87 |
NETSNMPTRAPD_HANDLER_OK NETSNMPTRAPD_POST_HANDLER |
| 88 |
NETSNMPTRAPD_PRE_HANDLER)); |
| 89 |
|
| 90 |
print constant_types(); # macro defs |
| 91 |
foreach (C_constant ("NetSNMP::TrapReceiver", 'constant', 'IV', $types, undef, 3, @names) ) { |
| 92 |
print $_, "\n"; # C constant subs |
| 93 |
} |
| 94 |
print "#### XS Section:\n"; |
| 95 |
print XS_constant ("NetSNMP::TrapReceiver", $types); |
| 96 |
__END__ |
| 97 |
*/ |
| 98 |
|
| 99 |
switch (len) { |
| 100 |
case 23: |
| 101 |
if (memEQ(name, "NETSNMPTRAPD_HANDLER_OK", 23)) { |
| 102 |
#ifdef NETSNMPTRAPD_HANDLER_OK |
| 103 |
*iv_return = NETSNMPTRAPD_HANDLER_OK; |
| 104 |
return PERL_constant_ISIV; |
| 105 |
#else |
| 106 |
return PERL_constant_NOTDEF; |
| 107 |
#endif |
| 108 |
} |
| 109 |
break; |
| 110 |
case 24: |
| 111 |
if (memEQ(name, "NETSNMPTRAPD_PRE_HANDLER", 24)) { |
| 112 |
#ifdef NETSNMPTRAPD_PRE_HANDLER |
| 113 |
*iv_return = NETSNMPTRAPD_PRE_HANDLER; |
| 114 |
return PERL_constant_ISIV; |
| 115 |
#else |
| 116 |
return PERL_constant_NOTDEF; |
| 117 |
#endif |
| 118 |
} |
| 119 |
break; |
| 120 |
case 25: |
| 121 |
return constant_25 (aTHX_ name, iv_return); |
| 122 |
break; |
| 123 |
case 26: |
| 124 |
if (memEQ(name, "NETSNMPTRAPD_HANDLER_BREAK", 26)) { |
| 125 |
#ifdef NETSNMPTRAPD_HANDLER_BREAK |
| 126 |
*iv_return = NETSNMPTRAPD_HANDLER_BREAK; |
| 127 |
return PERL_constant_ISIV; |
| 128 |
#else |
| 129 |
return PERL_constant_NOTDEF; |
| 130 |
#endif |
| 131 |
} |
| 132 |
break; |
| 133 |
case 27: |
| 134 |
if (memEQ(name, "NETSNMPTRAPD_HANDLER_FINISH", 27)) { |
| 135 |
#ifdef NETSNMPTRAPD_HANDLER_FINISH |
| 136 |
*iv_return = NETSNMPTRAPD_HANDLER_FINISH; |
| 137 |
return PERL_constant_ISIV; |
| 138 |
#else |
| 139 |
return PERL_constant_NOTDEF; |
| 140 |
#endif |
| 141 |
} |
| 142 |
break; |
| 143 |
} |
| 144 |
return PERL_constant_NOTFOUND; |
| 145 |
} |
| 146 |
|