OpenSL d2iSLSESION(3openssl)
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
getsessioncb() (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 allocate the
memory and call i2dSLSESION() again.
OpenSL-0.9.8 Last change: Oct 11 2005 1
OpenSL d2iSLSESION(3openssl)
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, 0
is returned and no operation is performed.
SEE ALSO
ssl(3), SLSESIONfree(3), SLCTXsesssetgetcb(3)
OpenSL-0.9.8 Last change: Oct 11 2005 2
|