Copyright © 2001 - 2007 SILC Project SILC Project Website | SILC Toolkit Reference Manual Index

SILC Toolkit Reference Manual SILC Core Library SILC Authentication Interface SILC Message Interface SILC Channel Interface SILC Command Interface SILC Notify Interface SILC Status Types SILC Modes SILC ID Interface SILC Argument Interface SILC Attributes Interface Packet Protocol Interface SILC Public Key Payload Interface SILC Utility Library Basic Types and Definitions Data Buffer Interface Data Buffer Format Interface Hash Table Interface Memory Allocation Interface Data Stack (memory pool) Interface Finite State Machine Interface Thread Interface Mutual Exclusion Lock Interface Condition Variable Interface Atomic Operations Interface Network (TCP and UDP) Interface Scheduler Interface Asynchronous Operation Interface Abstract Stream Interface Socket Stream Interface File Descriptor Stream Interface File Utility Functions String Utility Interface Snprintf Interface UTF-8 String Interface Stringprep Interface Utility Functions List Interface Dynamic List Interface MIME Interface Time Utility Functions Logging Interface Config File Interface SILC Key Repository Library SILC SKR Interface SILC ASN.1 Library SILC ASN.1 Interface SILC BER interface SILC Client Library Using SILC Client Library Tutorial Arguments for command_reply Client Operation SilcStatus Error Arguments in command_reply Client Operation Arguments for notify Client Operation Unicode and UTF-8 Strings in Client Library Client Library Interface Reference Client Entry Interface Reference SILC Key Exchange Library SILC SKE Interface SILC Connection Authentication Interface SILC VCard Library SILC VCard Interface SILC SFTP Library SILC SFTP Interface SFTP Filesystems Interface SILC HTTP Library SILC HTTP Server Interface SILC HTTP PHP Translator SILC Crypto Library Introduction to SILC RNG SILC RNG Interface SILC Cipher API SILC PKCS API SILC Public Key API SILC PKCS #1 API SILC Hash Interface SILC HMAC Interface SILC Application Utility Library SILC Application Utilities SILC ID Cache Interface SILC Math Library SILC MP Interface SILC Math Interface Resource Links SILC Project Website SILC Protocol Documentation SILC White Paper SILC FAQs
Function silc_asn1_decode SYNOPSIS
        SilcBool silc_asn1_decode(SilcAsn1 asn1, SilcBuffer src, ...);
DESCRIPTION
        Decodes the ASN.1 encoded buffer `src' by the ASN.1 types sent
        as argument.  The ASN.1 types sent as argument must be found from
        the `src' for this function to decode successfully.

        The memory allocated for the results are allocated from `asn1' and
        they become invalid if `asn1' becomes invalid.  Next (second) call
        to this function does NOT invalidate the previous results.  However,
        third call to this function does invalidate the results of the first
        call but not second.  On the other hand, fourth call invalidates
        the results of the second call but not third, fifth call invalidates
        the results of the third call but not fourth, and so on.  This allows
        efficient decoding, when silc_asn1_decode must be called multiple times
        to decode all data, without new memory allocations.  However, caller
        must be cautios and understand that the every second call invalidates
        the results of every second previous results.

        If the SILC_ASN1_OPTS macro with SILC_ASN1_ALLOC option is given then
        all results are dynamically allocated and caller must free them by
        itself. Alternatively if SILC_ASN1_ACCUMUL is given then memory is
        accumulated from `asn1' for results and they are freed only when the
        silc_asn1_free or silc_asn1_uninit is called.  Next calls to the
        silc_asn1_decode will NOT invalidate the old results, but will
        accumulate more memory for new results.  If the SILC_ASN1_OPTS is not
        given at all then the default allocation method (decribed above)
        applies.

        If caller needs to store the results even after `asn1' becomes invalid
        then call must either use SILC_ASN1_ALLOC option or duplicate the
        results by itself.
EXAMPLE
        SilcBool bool_val, foo;
        unsigned char *string, string2;
        SilcUInt32 string_len, string2_len;

        silc_asn1_decode(asn1, tree,
                         SILC_ASN1_SEQUENCE,
                           SILC_ASN1_BOOLEAN(&bool_val),
                           SILC_ASN1_OCTET_STRING(&string, &string_len),
                           SILC_ASN1_SEQUENCE_T(0, 2),
                             SILC_ASN1_BOOLEAN_T(SILC_ASN1_EXPLICIT, 100, &foo),
                           SILC_ASN1_END,
                           SILC_ASN1_OCTET_STRING_T(0, 1, &str2, &str2_len),
                         SILC_ASN1_END, SILC_ASN1_END);
ASN.1 Interface SilcAsn1 SilcAsn1Struct SilcAsn1Options SilcAsn1Tag silc_asn1_alloc silc_asn1_free silc_asn1_init silc_asn1_uninit silc_asn1_encode silc_asn1_decode SILC_ASN1_OPTS SILC_ASN1_ANY SILC_ASN1_ANY_PRIMITIVE SILC_ASN1_SEQUENCE SILC_ASN1_SET SILC_ASN1_SEQUENCE_OF SILC_ASN1_SET_OF SILC_ASN1_CHOICE SILC_ASN1_BOOLEAN SILC_ASN1_INT SILC_ASN1_SHORT_INT SILC_ASN1_ENUM SILC_ASN1_BIT_STRING SILC_ASN1_NULL SILC_ASN1_OID SILC_ASN1_OCTET_STRING SILC_ASN1_UTF8_STRING SILC_ASN1_NUMERIC_STRING SILC_ASN1_PRINTABLE_STRING SILC_ASN1_TELETEX_STRING SILC_ASN1_IA5_STRING SILC_ASN1_VISIBLE_STRING SILC_ASN1_UNIVERSAL_STRING SILC_ASN1_BMP_STRING SILC_ASN1_UNRESTRICTED_STRING SILC_ASN1_GENERAL_STRING SILC_ASN1_UTC_TIME SILC_ASN1_GEN_TIME SILC_ASN1_END

Copyright © 2001 - 2007 SILC Project SILC Project Website | SILC Toolkit Reference Manual Index