lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Wed, Mar 18, 2009 at 3:24 PM, Thomas Harning Jr. <harningt@gmail.com> wrote:
> On Mon, Feb 23, 2009 at 10:19 AM, Jerome Vuarand
> <jerome.vuarand@gmail.com> wrote:
>> I'm using Roberto Ierusalimschy's struct library in some of my
>> projects. I have a build system that automatically downloads it from
>> the struct website [1] and patch it on the fly for my needs. I noticed
>> that the file changed recently, and my patches fail to apply. This is
>> not a big concern, I can update them. What I'd like to know is if you
>> plan to do a formal (versionned) release anytime soon. Otherwise is
>> there another stable url where I could retrieve older versions ?
> Having a versioned struct library w/ changelogs would be nice...
> I also noticed the docs no longer match the code...  struct.size has
> been removed.
>
> Also... I have made some additional patches to support BER-style
> encoded number and tags.
>
> Attached is a patch to the latest struct.c out there for the following:
>  * Add 't' for encoding ASN.1 tag values
>   * Accepts an integer as the whole representation of the tag
> (includes class, constructed or not, and tag-value)
>  * Add 'G' and 'g' for encoding ASN.1 BER lengths
>   * 'G' expects a number after it to specify the minimum size
>   * 'g' uses a number > 0 after it to specify the required size (too
> large results in error)
>  * NOTE: t, G, and g ignore endian-ness as ASN.1 is supposed to be
> endian agnostic
>  * Correct spelling in main comment
>  * Re-add b_size   (with the added elements, t, g0 and G  are marked
> to have an undefined size)
>  * Removes alignment usage of 's' value - didn't think that this was a
> correct implementation...
>
>
> If there are any alterations to these that would be
> important/useful... please let me know.
>
> If there is any credit assigned anywhere, please assign it to:
> Thomas Harning Jr <thomas.harning@trustbearer.com> - TrustBearer Labs
> since this patchwork was performed during employment for them.
I forgot to add the change that used a signed version of 'optsize' to
handle the minimum length that 'G' uses.  I don't expect option sizes
of things to wrap around the signed/unsigned range....

-- 
Thomas Harning Jr.

Attachment: struct_add_ber.patch
Description: Binary data