"Fossies" - the Fresh Open Source Software Archive

Member "hitch-1.5.2/src/shctx.h" (26 Nov 2019, 1821 Bytes) of package /linux/www/hitch-1.5.2.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "shctx.h" see the Fossies "Dox" file reference documentation and the last Fossies "Diffs" side-by-side code changes report: 1.5.0_vs_1.5.1.

    1 /*
    2  * shctx.h
    3  *
    4  * Copyright (C) 2011 EXCELIANCE
    5  *
    6  * Author: Emeric Brun - emeric@exceliance.fr
    7  *
    8  */
    9 
   10 #ifndef SHCTX_H
   11 #define SHCTX_H
   12 
   13 #include <openssl/ssl.h>
   14 #include <stdint.h>
   15 
   16 #ifndef SHSESS_MAX_FOOTER_LEN
   17 #  define SHSESS_MAX_FOOTER_LEN sizeof(uint32_t) + EVP_MAX_MD_SIZE
   18 #endif 
   19 
   20 #ifndef SHSESS_MAX_DATA_LEN
   21 #  define SHSESS_MAX_DATA_LEN 512
   22 #endif
   23 
   24 #define SHSESS_MAX_ENCODED_LEN \
   25     SSL_MAX_SSL_SESSION_ID_LENGTH + \
   26     SHSESS_MAX_DATA_LEN + \
   27     SHSESS_MAX_FOOTER_LEN
   28 
   29 typedef void (shsess_new_f)(unsigned char *sess, unsigned len, long cdate);
   30 
   31 /* Callback called on a new session event:
   32  *
   33  * sess contains the sessionid zeros padded to SSL_MAX_SSL_SESSION_ID_LENGTH
   34  * followed by ASN1 session encoding.
   35  *
   36  * len is set to SSL_MAX_SSL_SESSION_ID_LENGTH + ASN1 session length
   37  * len is always less than SSL_MAX_SSL_SESSION_ID_LENGTH + SHSESS_MAX_DATA_LEN.
   38  * Remaining Bytes from len to SHSESS_MAX_ENCODED_LEN can be used to add a footer.
   39  *
   40  * cdate is the creation date timestamp.
   41  */ 
   42 void shsess_set_new_cbk(shsess_new_f *cb);
   43 
   44 /* Add a session into the cache, 
   45  * sess contains the sessionid zeros padded to SSL_MAX_SSL_SESSION_ID_LENGTH
   46  * followed by ASN1 session encoding.
   47  *
   48  * len is set to SSL_MAX_SSL_SESSION_ID_LENGTH + ASN1 data length.
   49  *            if len greater than SHSESS_MAX_ENCODED_LEN, session is not added.
   50  *
   51  * if cdate not 0, on get events session creation date will be reset to cdate */
   52 void shctx_sess_add(const unsigned char *sess, unsigned len, long cdate);
   53 
   54 /* Init shared memory context if not allocated and set SSL context callbacks
   55  * size is the max number of stored session 
   56  * Returns: -1 on alloc failure, size if performs context alloc, and 0 if just
   57  * perform callbacks registration */
   58 int shared_context_init(SSL_CTX *ctx, int size);
   59 
   60 #endif /* SHCTX_H */