ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/Convert-BER-XS/XS.xs
(Generate patch)

Comparing Convert-BER-XS/XS.xs (file contents):
Revision 1.20 by root, Sat Apr 20 17:04:35 2019 UTC vs.
Revision 1.22 by root, Sat Apr 20 18:38:33 2019 UTC

58 ASN_CLASS_SHIFT = 6, 58 ASN_CLASS_SHIFT = 6,
59 59
60 // ASN_APPLICATION SNMP 60 // ASN_APPLICATION SNMP
61 SNMP_IPADDRESS = 0x00, 61 SNMP_IPADDRESS = 0x00,
62 SNMP_COUNTER32 = 0x01, 62 SNMP_COUNTER32 = 0x01,
63 SNMP_GAUGE32 = 0x02,
63 SNMP_UNSIGNED32 = 0x02, 64 SNMP_UNSIGNED32 = 0x02,
64 SNMP_TIMETICKS = 0x03, 65 SNMP_TIMETICKS = 0x03,
65 SNMP_OPAQUE = 0x04, 66 SNMP_OPAQUE = 0x04,
66 SNMP_COUNTER64 = 0x06, 67 SNMP_COUNTER64 = 0x06,
67}; 68};
1069 const_iv (BER_TYPE_IPADDRESS) 1070 const_iv (BER_TYPE_IPADDRESS)
1070 const_iv (BER_TYPE_CROAK) 1071 const_iv (BER_TYPE_CROAK)
1071 1072
1072 const_iv (SNMP_IPADDRESS) 1073 const_iv (SNMP_IPADDRESS)
1073 const_iv (SNMP_COUNTER32) 1074 const_iv (SNMP_COUNTER32)
1075 const_iv (SNMP_GAUGE32)
1074 const_iv (SNMP_UNSIGNED32) 1076 const_iv (SNMP_UNSIGNED32)
1075 const_iv (SNMP_TIMETICKS) 1077 const_iv (SNMP_TIMETICKS)
1076 const_iv (SNMP_OPAQUE) 1078 const_iv (SNMP_OPAQUE)
1077 const_iv (SNMP_COUNTER64) 1079 const_iv (SNMP_COUNTER64)
1078 }; 1080 };
1079 1081
1080 for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ > const_iv; civ--) 1082 for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ > const_iv; civ--)
1081 newCONSTSUB (stash, (char *)civ[-1].name, newSViv (civ[-1].iv)); 1083 newCONSTSUB (stash, (char *)civ[-1].name, newSViv (civ[-1].iv));
1082} 1084}
1083 1085
1084SV * 1086void
1085ber_decode (SV *ber, SV *profile = &PL_sv_undef) 1087ber_decode (SV *ber, SV *profile = &PL_sv_undef)
1088 ALIAS:
1089 ber_decode_prefix = 1
1086 CODE: 1090 PPCODE:
1087{ 1091{
1088 cur_profile = SvPROFILE (profile); 1092 cur_profile = SvPROFILE (profile);
1089 STRLEN len; 1093 STRLEN len;
1090 buf = (U8 *)SvPVbyte (ber, len); 1094 buf = (U8 *)SvPVbyte (ber, len);
1091 cur = buf; 1095 cur = buf;
1092 end = buf + len; 1096 end = buf + len;
1093 1097
1094 RETVAL = decode_ber (); 1098 SV *tuple = decode_ber ();
1099
1100 EXTEND (SP, 2);
1101 PUSHs (sv_2mortal (tuple));
1102
1103 if (ix)
1104 PUSHs (sv_2mortal (newSViv (cur - buf)));
1105 else if (cur != end)
1106 error ("trailing garbage after BER data");
1095} 1107}
1096 OUTPUT: RETVAL
1097 1108
1098void 1109void
1099ber_is (SV *tuple, SV *klass = &PL_sv_undef, SV *tag = &PL_sv_undef, SV *flags = &PL_sv_undef, SV *data = &PL_sv_undef) 1110ber_is (SV *tuple, SV *klass = &PL_sv_undef, SV *tag = &PL_sv_undef, SV *flags = &PL_sv_undef, SV *data = &PL_sv_undef)
1100 PPCODE: 1111 PPCODE:
1101{ 1112{

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines