]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MEDIUM: shctx: separate ssl and shctx
authorWilliam Lallemand <wlallemand@haproxy.com>
Mon, 30 Oct 2017 19:08:51 +0000 (20:08 +0100)
committerWilly Tarreau <w@1wt.eu>
Tue, 31 Oct 2017 02:49:40 +0000 (03:49 +0100)
commit4f45bb9c461f462290b77bf2511badb7a4453c0a
tree49f3f94154b97002d0b3000ebab8e19439f80fb4
parented0b5ad1aaca4312d26d1e54e9acb8e4f474ab42
MEDIUM: shctx: separate ssl and shctx

This patch reorganize the shctx API in a generic storage API, separating
the shared SSL session handling from its core.

The shctx API only handles the generic data part, it does not know what
kind of data you use with it.

A shared_context is a storage structure allocated in a shared memory,
allowing its usage in a multithread or a multiprocess context.

The structure use 2 linked list, one containing the available blocks,
and another for the hot locked blocks. At initialization the available
list is filled with <maxblocks> blocks of size <blocksize>. An <extra>
space is initialized outside the list in case you need some specific
storage.

+-----------------------+--------+--------+--------+--------+----
| struct shared_context | extra  | block1 | block2 | block3 | ...
+-----------------------+--------+--------+--------+--------+----
                                 <--------  maxblocks  --------->
                                            * blocksize

The API allows to store content on several linked blocks. For example,
if you allocated blocks of 16 bytes, and you want to store an object of
60 bytes, the object will be allocated in a row of 4 blocks.

The API was made for LRU usage, each time you get an object, it pushes
the object at the end of the list. When it needs more space, it discards

The functions name have been renamed in a more logical way, the part
regarding shctx have been prefixed by shctx_ and the functions for the
shared ssl session cache have been prefixed by sh_ssl_sess_.
include/proto/shctx.h
include/proto/ssl_sock.h
include/types/shctx.h
include/types/ssl_sock.h
src/shctx.c
src/ssl_sock.c