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

Comparing Convert-BER-XS/XS.pm (file contents):
Revision 1.33 by root, Sat Apr 20 17:23:21 2019 UTC vs.
Revision 1.34 by root, Sat Apr 20 18:38:33 2019 UTC

141 141
142=item C<:decode> 142=item C<:decode>
143 143
144C<ber_decode> and the match helper functions: 144C<ber_decode> and the match helper functions:
145 145
146 ber_decode ber-decode_prefix
146 ber_decode ber_is ber_is_seq ber_is_int ber_is_oid 147 ber_is ber_is_seq ber_is_int ber_is_oid
147 148
148=item C<:encode> 149=item C<:encode>
149 150
150C<ber_encode> and the construction helper functions: 151C<ber_encode> and the construction helper functions:
151 152
152 ber_encode ber_int 153 ber_encode
154 ber_int
153 155
154=back 156=back
155 157
156=head2 ASN.1/BER/DER/... BASICS 158=head2 ASN.1/BER/DER/... BASICS
157 159
253 255
254=head2 DECODING AND ENCODING 256=head2 DECODING AND ENCODING
255 257
256=over 258=over
257 259
258=item $tuple = ber_decoded $bindata[, $profile] 260=item $tuple = ber_decode $bindata[, $profile]
259 261
260Decodes binary BER data in C<$bindata> and returns the resulting BER 262Decodes binary BER data in C<$bindata> and returns the resulting BER
261tuple. Croaks on any decoding error, so the returned C<$tuple> is always 263tuple. Croaks on any decoding error, so the returned C<$tuple> is always
262valid. 264valid.
263 265
275 $tuple = ber_decode $data; 277 $tuple = ber_decode $data;
276 278
277Example: as above, but use the provided SNMP profile. 279Example: as above, but use the provided SNMP profile.
278 280
279 $tuple = ber_encode $data, $Convert::BER::XS::SNMP_PROFILE; 281 $tuple = ber_encode $data, $Convert::BER::XS::SNMP_PROFILE;
282
283=item ($tuple, $bytes) = ber_decode_prefix $bindata[, $profile]
284
285Works like C<ber_decode>, except it doesn't croak when there is data after
286the BER data, but instead returns the decoded value and the number of
287bytes it decoded.
288
289This is useful when you have BER data at the start of a buffer and other
290data after, and you need to find the length.
291
292Also, since BER is self-delimited, this can be used to decode multiple BER
293values joined together.
280 294
281=item $bindata = ber_encode $tuple[, $profile] 295=item $bindata = ber_encode $tuple[, $profile]
282 296
283Encodes the BER tuple into a BER/DER data structure. AS with 297Encodes the BER tuple into a BER/DER data structure. AS with
284Cyber_decode>, an optional profile can be given. 298Cyber_decode>, an optional profile can be given.
422 const_snmp => [qw( 436 const_snmp => [qw(
423 SNMP_IPADDRESS SNMP_COUNTER32 SNMP_GAUGE32 SNMP_UNSIGNED32 437 SNMP_IPADDRESS SNMP_COUNTER32 SNMP_GAUGE32 SNMP_UNSIGNED32
424 SNMP_TIMETICKS SNMP_OPAQUE SNMP_COUNTER64 438 SNMP_TIMETICKS SNMP_OPAQUE SNMP_COUNTER64
425 )], 439 )],
426 decode => [qw( 440 decode => [qw(
427 ber_decode 441 ber_decode ber_decode_prefix
428 ber_is ber_is_seq ber_is_int ber_is_oid 442 ber_is ber_is_seq ber_is_int ber_is_oid
429 )], 443 )],
430 encode => [qw( 444 encode => [qw(
431 ber_encode 445 ber_encode
432 ber_int 446 ber_int

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines