diff options
author | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2017-06-05 20:39:26 +0300 |
---|---|---|
committer | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2017-06-05 22:09:53 +0300 |
commit | 243e8fcd6054e4c0d2964b0d4b29e0c15861498d (patch) | |
tree | 3a65f86811ce466d2e88a45cfba43bb0fd06732e /src/microhttpd/internal.h | |
parent | 1b71798df8b8341b894dfc6223d01bd1cb8e83bd (diff) | |
download | libmicrohttpd-243e8fcd6054e4c0d2964b0d4b29e0c15861498d.tar.gz libmicrohttpd-243e8fcd6054e4c0d2964b0d4b29e0c15861498d.zip |
Used separate 'state' for TLS layer (independent of state of HTTP process)
Diffstat (limited to 'src/microhttpd/internal.h')
-rw-r--r-- | src/microhttpd/internal.h | 36 |
1 files changed, 24 insertions, 12 deletions
diff --git a/src/microhttpd/internal.h b/src/microhttpd/internal.h index 72a8f7f9..be0eb424 100644 --- a/src/microhttpd/internal.h +++ b/src/microhttpd/internal.h | |||
@@ -510,27 +510,34 @@ enum MHD_CONNECTION_STATE | |||
510 | */ | 510 | */ |
511 | MHD_CONNECTION_IN_CLEANUP = MHD_CONNECTION_CLOSED + 1, | 511 | MHD_CONNECTION_IN_CLEANUP = MHD_CONNECTION_CLOSED + 1, |
512 | 512 | ||
513 | /* | ||
514 | * SSL/TLS connection states | ||
515 | */ | ||
516 | |||
517 | /** | ||
518 | * The initial connection state for all secure connectoins | ||
519 | * Handshake messages will be processed in this state & while | ||
520 | * in the #MHD_TLS_HELLO_REQUEST state | ||
521 | */ | ||
522 | MHD_TLS_CONNECTION_INIT = MHD_CONNECTION_IN_CLEANUP + 1, | ||
523 | |||
524 | #ifdef UPGRADE_SUPPORT | 513 | #ifdef UPGRADE_SUPPORT |
525 | /** | 514 | /** |
526 | * Connection was "upgraded" and socket is now under the | 515 | * Connection was "upgraded" and socket is now under the |
527 | * control of the application. | 516 | * control of the application. |
528 | */ | 517 | */ |
529 | MHD_CONNECTION_UPGRADE = MHD_TLS_CONNECTION_INIT + 1, | 518 | MHD_CONNECTION_UPGRADE |
530 | #endif /* UPGRADE_SUPPORT */ | 519 | #endif /* UPGRADE_SUPPORT */ |
531 | 520 | ||
532 | }; | 521 | }; |
533 | 522 | ||
523 | |||
524 | /** | ||
525 | * States of TLS transport layer. | ||
526 | */ | ||
527 | enum MHD_TLS_CONN_STATE | ||
528 | { | ||
529 | MHD_TLS_CONN_NO_TLS = 0, /**< Not a TLS connection (plain socket). */ | ||
530 | MHD_TLS_CONN_INIT, /**< TLS connection is not established yet. */ | ||
531 | MHD_TLS_CONN_HANDSHAKING, /**< TLS is in handshake process. */ | ||
532 | MHD_TLS_CONN_CONNECTED, /**< TLS is established. */ | ||
533 | MHD_TLS_CONN_WR_CLOSING, /**< Closing WR side of TLS layer. */ | ||
534 | MHD_TLS_CONN_WR_CLOSED, /**< WR side of TLS layer is closed. */ | ||
535 | MHD_TLS_CONN_TLS_CLOSING, /**< TLS session is terminating. */ | ||
536 | MHD_TLS_CONN_TLS_CLOSED, /**< TLS session is terminated. */ | ||
537 | MHD_TLS_CONN_TLS_FAILED, /**< TLS session failed. */ | ||
538 | MHD_TLS_CONN_INVALID_STATE/**< Sentinel. Not a valid value. */ | ||
539 | }; | ||
540 | |||
534 | /** | 541 | /** |
535 | * Should all state transitions be printed to stderr? | 542 | * Should all state transitions be printed to stderr? |
536 | */ | 543 | */ |
@@ -973,6 +980,11 @@ struct MHD_Connection | |||
973 | int cipher; | 980 | int cipher; |
974 | 981 | ||
975 | /** | 982 | /** |
983 | * State of connection's TLS layer | ||
984 | */ | ||
985 | enum MHD_TLS_CONN_STATE tls_state; | ||
986 | |||
987 | /** | ||
976 | * Could it be that we are ready to read due to TLS buffers | 988 | * Could it be that we are ready to read due to TLS buffers |
977 | * even though the socket is not? | 989 | * even though the socket is not? |
978 | */ | 990 | */ |