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.22 by root, Sat Apr 20 14:50:08 2019 UTC vs.
Revision 1.23 by root, Sat Apr 20 14:53:29 2019 UTC

76level of user-friendlyness. 76level of user-friendlyness.
77 77
78=head2 EXPORT TAGS AND CONSTANTS 78=head2 EXPORT TAGS AND CONSTANTS
79 79
80By default this module doesn't export any symbols, but if you don't want 80By default this module doesn't export any symbols, but if you don't want
81to break your keyboard, editor or eyesigh with extreemly long names, I 81to break your keyboard, editor or eyesight with extremely long names, I
82recommend importing the C<:all> tag. Still, you can selectively import 82recommend importing the C<:all> tag. Still, you can selectively import
83things. 83things.
84 84
85=over 85=over
86 86
87=item C<:all> 87=item C<:all>
88 88
89All of the below. Really. Rcommended for at least first steps, or if you 89All of the below. Really. Recommended for at least first steps, or if you
90don't care about a few kilobytes of wasted memory (and namespace). 90don't care about a few kilobytes of wasted memory (and namespace).
91 91
92=item C<:const> 92=item C<:const>
93 93
94All of the stricly ASN.1-related constants defined by this module, the 94All of the strictly ASN.1-related constants defined by this module, the
95same as C<:const_asn :const_index>. Notably, this does not contain 95same as C<:const_asn :const_index>. Notably, this does not contain
96C<:const_ber_type> and C<:const_snmp>. 96C<:const_ber_type> and C<:const_snmp>.
97 97
98A good set to get everything you need to decode and match BER data would be 98A good set to get everything you need to decode and match BER data would be
99C<:decode :const>. 99C<:decode :const>.
104 104
105 BER_CLASS BER_TAG BER_CONSTRUCTED BER_DATA 105 BER_CLASS BER_TAG BER_CONSTRUCTED BER_DATA
106 106
107=item C<:const_asn> 107=item C<:const_asn>
108 108
109ASN class values (these are C<0>, C<1>, C<2> and C<3>, reespectively - 109ASN class values (these are C<0>, C<1>, C<2> and C<3>, respectively -
110exactly thw two topmost bits from the identifdier octet shifted 6 bits to 110exactly thw two topmost bits from the identifier octet shifted 6 bits to
111the right): 111the right):
112 112
113 ASN_UNIVERSAL ASN_APPLICATION ASN_CONTEXT ASN_PRIVATE 113 ASN_UNIVERSAL ASN_APPLICATION ASN_CONTEXT ASN_PRIVATE
114 114
115ASN tag values (some of which are aliases, such as C<ASN_OID>). Their 115ASN tag values (some of which are aliases, such as C<ASN_OID>). Their
169and also have a flag that says whether a value consists of subvalues (is 169and also have a flag that says whether a value consists of subvalues (is
170"constructed") or not (is "primitive"). 170"constructed") or not (is "primitive").
171 171
172Tags are simple integers, and ASN.1 defines a somewhat weird assortment of 172Tags are simple integers, and ASN.1 defines a somewhat weird assortment of
173those - for example, you have 32 bit signed integers and 16(!) different 173those - for example, you have 32 bit signed integers and 16(!) different
174string types, but there is no unsigned32 type for example. Different 174string types, but there is no Unsigned32 type for example. Different
175applications work around this in different ways, for example, SNMP defines 175applications work around this in different ways, for example, SNMP defines
176application-specific Gauge32, Counter32 and Unsigned32, which are mapped 176application-specific Gauge32, Counter32 and Unsigned32, which are mapped
177to two different tags: you can distinguish between Counter32 and the 177to two different tags: you can distinguish between Counter32 and the
178others, but not between Gause32 and Unsigned32, without the ASN.1 schema. 178others, but not between Gause32 and Unsigned32, without the ASN.1 schema.
179 179
183 183
184This module represents every BER value as a 4-element tuple (actually an 184This module represents every BER value as a 4-element tuple (actually an
185array-reference): 185array-reference):
186 186
187 [CLASS, TAG, CONSTRUCTED, DATA] 187 [CLASS, TAG, CONSTRUCTED, DATA]
188
189For example:
190
191 [ASN_UNIVERSAL, ASN_INTEGER32, 0, 177] # the integer 177
192 [ASN_UNIVERSAL, ASN_OCTET_STRING, 0, "john"] # the string "john"
193 [ASN_UNIVERSAL, ASN_OID, 0, "1.3.6.133"] # some OID
194 [ASN_UNIVERSAL, ASN_SEQUENCE, 1, [ [ASN_UNIVERSAL... # a sequencE
188 195
189To avoid non-descriptive hardcoded array index numbers, this module 196To avoid non-descriptive hardcoded array index numbers, this module
190defines symbolic constants to access these members: C<BER_CLASS>, 197defines symbolic constants to access these members: C<BER_CLASS>,
191C<BER_TAG>, C<BER_CONSTRUCTED> and C<BER_DATA>. 198C<BER_TAG>, C<BER_CONSTRUCTED> and C<BER_DATA>.
192 199

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines