diff options
Diffstat (limited to 'src/lib/internal.h')
-rw-r--r-- | src/lib/internal.h | 123 |
1 files changed, 90 insertions, 33 deletions
diff --git a/src/lib/internal.h b/src/lib/internal.h index 7829efc4..4c3ceddc 100644 --- a/src/lib/internal.h +++ b/src/lib/internal.h | |||
@@ -33,6 +33,7 @@ | |||
33 | #include "microhttpd_tls.h" | 33 | #include "microhttpd_tls.h" |
34 | #include "mhd_assert.h" | 34 | #include "mhd_assert.h" |
35 | #include "mhd_compat.h" | 35 | #include "mhd_compat.h" |
36 | #include "mhd_mono_clock.h" | ||
36 | #include "memorypool.h" | 37 | #include "memorypool.h" |
37 | 38 | ||
38 | #ifdef HTTPS_SUPPORT | 39 | #ifdef HTTPS_SUPPORT |
@@ -748,34 +749,6 @@ struct MHD_Connection | |||
748 | struct MHD_Request request; | 749 | struct MHD_Request request; |
749 | 750 | ||
750 | /** | 751 | /** |
751 | * Is the connection suspended? | ||
752 | */ | ||
753 | bool suspended; | ||
754 | |||
755 | /** | ||
756 | * Is the connection wanting to resume? | ||
757 | */ | ||
758 | bool resuming; | ||
759 | |||
760 | /** | ||
761 | * Set to `true` if the thread has been joined. | ||
762 | */ | ||
763 | bool thread_joined; | ||
764 | |||
765 | /** | ||
766 | * true if #socket_fd is non-blocking, false otherwise. | ||
767 | */ | ||
768 | bool sk_nonblck; | ||
769 | |||
770 | /** | ||
771 | * Has this socket been closed for reading (i.e. other side closed | ||
772 | * the connection)? If so, we must completely close the connection | ||
773 | * once we are done sending our response (and stop trying to read | ||
774 | * from this socket). | ||
775 | */ | ||
776 | bool read_closed; | ||
777 | |||
778 | /** | ||
779 | * Length of the foreign address. | 752 | * Length of the foreign address. |
780 | */ | 753 | */ |
781 | socklen_t addr_len; | 754 | socklen_t addr_len; |
@@ -799,7 +772,6 @@ struct MHD_Connection | |||
799 | */ | 772 | */ |
800 | MHD_socket socket_fd; | 773 | MHD_socket socket_fd; |
801 | 774 | ||
802 | |||
803 | #ifdef EPOLL_SUPPORT | 775 | #ifdef EPOLL_SUPPORT |
804 | /** | 776 | /** |
805 | * What is the state of this socket in relation to epoll? | 777 | * What is the state of this socket in relation to epoll? |
@@ -807,11 +779,35 @@ struct MHD_Connection | |||
807 | enum MHD_EpollState epoll_state; | 779 | enum MHD_EpollState epoll_state; |
808 | #endif | 780 | #endif |
809 | 781 | ||
810 | 782 | /** | |
811 | }; | 783 | * Is the connection suspended? |
784 | */ | ||
785 | bool suspended; | ||
812 | 786 | ||
787 | /** | ||
788 | * Is the connection wanting to resume? | ||
789 | */ | ||
790 | bool resuming; | ||
813 | 791 | ||
792 | /** | ||
793 | * Set to `true` if the thread has been joined. | ||
794 | */ | ||
795 | bool thread_joined; | ||
796 | |||
797 | /** | ||
798 | * true if #socket_fd is non-blocking, false otherwise. | ||
799 | */ | ||
800 | bool sk_nonblck; | ||
814 | 801 | ||
802 | /** | ||
803 | * Has this socket been closed for reading (i.e. other side closed | ||
804 | * the connection)? If so, we must completely close the connection | ||
805 | * once we are done sending our response (and stop trying to read | ||
806 | * from this socket). | ||
807 | */ | ||
808 | bool read_closed; | ||
809 | |||
810 | }; | ||
815 | 811 | ||
816 | 812 | ||
817 | /** | 813 | /** |
@@ -1002,6 +998,35 @@ struct MHD_Daemon | |||
1002 | #endif /* UPGRADE_SUPPORT */ | 998 | #endif /* UPGRADE_SUPPORT */ |
1003 | #endif /* EPOLL_SUPPORT */ | 999 | #endif /* EPOLL_SUPPORT */ |
1004 | 1000 | ||
1001 | #ifdef DAUTH_SUPPORT | ||
1002 | |||
1003 | /** | ||
1004 | * Character array of random values. | ||
1005 | */ | ||
1006 | const char *digest_auth_random; | ||
1007 | |||
1008 | /** | ||
1009 | * An array that contains the map nonce-nc. | ||
1010 | */ | ||
1011 | struct MHD_NonceNc *nnc; | ||
1012 | |||
1013 | /** | ||
1014 | * A rw-lock for synchronizing access to @e nnc. | ||
1015 | */ | ||
1016 | MHD_mutex_ nnc_lock; | ||
1017 | |||
1018 | /** | ||
1019 | * Size of `digest_auth_random. | ||
1020 | */ | ||
1021 | size_t digest_auth_rand_size; | ||
1022 | |||
1023 | /** | ||
1024 | * Size of the nonce-nc array. | ||
1025 | */ | ||
1026 | unsigned int nonce_nc_size; | ||
1027 | |||
1028 | #endif | ||
1029 | |||
1005 | /** | 1030 | /** |
1006 | * Socket address to bind to for the listen socket. | 1031 | * Socket address to bind to for the listen socket. |
1007 | */ | 1032 | */ |
@@ -1024,9 +1049,13 @@ struct MHD_Daemon | |||
1024 | */ | 1049 | */ |
1025 | size_t listen_sa_len; | 1050 | size_t listen_sa_len; |
1026 | 1051 | ||
1052 | /** | ||
1053 | * Default size of the per-connection memory pool. | ||
1054 | */ | ||
1055 | #define POOL_SIZE_DEFAULT (32 * 1024) | ||
1027 | /** | 1056 | /** |
1028 | * Buffer size to use for each connection. Default | 1057 | * Buffer size to use for each connection. Default |
1029 | * is #MHD_POOL_SIZE_DEFAULT. | 1058 | * is #POOL_SIZE_DEFAULT. |
1030 | */ | 1059 | */ |
1031 | size_t connection_memory_limit_b; | 1060 | size_t connection_memory_limit_b; |
1032 | 1061 | ||
@@ -1108,7 +1137,7 @@ struct MHD_Daemon | |||
1108 | /** | 1137 | /** |
1109 | * Default timeout in seconds for idle connections. | 1138 | * Default timeout in seconds for idle connections. |
1110 | */ | 1139 | */ |
1111 | unsigned int connection_default_timeout_s; | 1140 | time_t connection_default_timeout; |
1112 | 1141 | ||
1113 | /** | 1142 | /** |
1114 | * Listen socket we should use, MHD_INVALID_SOCKET means | 1143 | * Listen socket we should use, MHD_INVALID_SOCKET means |
@@ -1116,6 +1145,34 @@ struct MHD_Daemon | |||
1116 | */ | 1145 | */ |
1117 | MHD_socket listen_socket; | 1146 | MHD_socket listen_socket; |
1118 | 1147 | ||
1148 | #ifdef EPOLL_SUPPORT | ||
1149 | /** | ||
1150 | * File descriptor associated with our epoll loop. | ||
1151 | */ | ||
1152 | int epoll_fd; | ||
1153 | |||
1154 | /** | ||
1155 | * true if the listen socket is in the 'epoll' set, | ||
1156 | * false if not. | ||
1157 | */ | ||
1158 | bool listen_socket_in_epoll; | ||
1159 | |||
1160 | #if defined(HTTPS_SUPPORT) && defined(UPGRADE_SUPPORT) | ||
1161 | /** | ||
1162 | * File descriptor associated with the #run_epoll_for_upgrade() loop. | ||
1163 | * Only available if #MHD_USE_HTTPS_EPOLL_UPGRADE is set. | ||
1164 | */ | ||
1165 | int epoll_upgrade_fd; | ||
1166 | |||
1167 | /** | ||
1168 | * true if @e epoll_upgrade_fd is in the 'epoll' set, | ||
1169 | * false if not. | ||
1170 | */ | ||
1171 | bool upgrade_fd_in_epoll; | ||
1172 | #endif /* HTTPS_SUPPORT && UPGRADE_SUPPORT */ | ||
1173 | |||
1174 | #endif | ||
1175 | |||
1119 | /** | 1176 | /** |
1120 | * Inter-thread communication channel. | 1177 | * Inter-thread communication channel. |
1121 | */ | 1178 | */ |