d2iSLSESION(3) OpenSL d2iSLSESION(3)
NAME
d2iSLSESION, i2dSLSESION - convert SLSESION object from/to
ASN1 representation
SYNOPSIS
#include
SLSESION *d2iSLSESION(SLSESION **a, const unsigned char **pp, long length);
int i2dSLSESION(SLSESION *in, unsigned char **pp);
DESCRIPTION
d2iSLSESION() transforms the external ASN1 representation of an
SL/TLS session, stored as binary data at location pp with length
length, into an SLSESION object.
i2dSLSESION() transforms the SLSESION object in into the ASN1
representation and stores it into the memory location pointed to by pp.
The length of the resulting ASN1 representation is returned. If pp is
the NUL pointer, only the length is calculated and returned.
NOTES
The SLSESION object is built from several malloc()ed parts, it can
therefore not be moved, copied or stored directly. In order to store
session data on disk or into a database, it must be transformed into a
binary ASN1 representation.
When using d2iSLSESION(), the SLSESION object is automatically
allocated. The reference count is 1, so that the session must be
explicitly removed using SLSESIONfree(3), unless the SLSESION
object is completely taken over, when being called inside the getses-
sioncb() (see SLCTXsesssetgetcb(3)).
SLSESION objects keep internal link information about the session
cache list, when being inserted into one SLCTX object's session
cache. One SLSESION object, regardless of its reference count, must
therefore only be used with one SLCTX object (and the SL objects
created from this SLCTX object).
When using i2dSLSESION(), the memory location pointed to by pp must
be large enough to hold the binary representation of the session. There
is no known limit on the size of the created ASN1 representation, so
the necessary amount of space should be obtained by first calling
i2dSLSESION() with pp==NUL, and obtain the size needed, then allo-
cate the memory and call i2dSLSESION() again.
RETURN VALUES
d2iSLSESION() returns a pointer to the newly allocated SLSESION
object. In case of failure the NUL-pointer is returned and the error
message can be retrieved from the error stack.
i2dSLSESION() returns the size of the ASN1 representation in bytes.
When the session is not valid, 00 is returned and no operation is per-
formed.
SEE ALSO
ssl(3), SLSESIONfree(3), SLCTXsesssetgetcb(3)
0.9.7i 2005-03-30 d2iSLSESION(3)
|