diff options
Diffstat (limited to 'src/lib/connection_info.c')
-rw-r--r-- | src/lib/connection_info.c | 60 |
1 files changed, 59 insertions, 1 deletions
diff --git a/src/lib/connection_info.c b/src/lib/connection_info.c index a4337679..88055fa4 100644 --- a/src/lib/connection_info.c +++ b/src/lib/connection_info.c | |||
@@ -46,7 +46,65 @@ MHD_connection_get_information_sz (struct MHD_Connection *connection, | |||
46 | union MHD_ConnectionInformation *return_value, | 46 | union MHD_ConnectionInformation *return_value, |
47 | size_t return_value_size) | 47 | size_t return_value_size) |
48 | { | 48 | { |
49 | return MHD_NO; /* FIXME: not yet implemented */ | 49 | #define CHECK_SIZE(type) if (sizeof(type) < return_value_size) \ |
50 | return MHD_NO | ||
51 | |||
52 | switch (info_type) | ||
53 | { | ||
54 | #ifdef HTTPS_SUPPORT | ||
55 | case MHD_CONNECTION_INFORMATION_CIPHER_ALGO: | ||
56 | CHECK_SIZE (int); | ||
57 | if (NULL == connection->tls_cs) | ||
58 | return MHD_NO; | ||
59 | // return_value->cipher_algorithm | ||
60 | // = gnutls_cipher_get (connection->tls_session); | ||
61 | return MHD_NO; // FIXME: to be implemented | ||
62 | case MHD_CONNECTION_INFORMATION_PROTOCOL: | ||
63 | CHECK_SIZE (int); | ||
64 | if (NULL == connection->tls_cs) | ||
65 | return MHD_NO; | ||
66 | //return_value->protocol | ||
67 | // = gnutls_protocol_get_version (connection->tls_session); | ||
68 | return MHD_NO; // FIXME: to be implemented | ||
69 | case MHD_CONNECTION_INFORMATION_GNUTLS_SESSION: | ||
70 | CHECK_SIZE (void *); | ||
71 | if (NULL == connection->tls_cs) | ||
72 | return MHD_NO; | ||
73 | // return_value->tls_session = connection->tls_session; | ||
74 | return MHD_NO; // FIXME: to be implemented | ||
75 | #endif /* HTTPS_SUPPORT */ | ||
76 | case MHD_CONNECTION_INFORMATION_CLIENT_ADDRESS: | ||
77 | CHECK_SIZE (struct sockaddr *); | ||
78 | return_value->client_addr | ||
79 | = (const struct sockaddr *) &connection->addr; | ||
80 | return MHD_YES; | ||
81 | case MHD_CONNECTION_INFORMATION_DAEMON: | ||
82 | CHECK_SIZE (struct MHD_Daemon *); | ||
83 | return_value->daemon = connection->daemon; | ||
84 | return MHD_YES; | ||
85 | case MHD_CONNECTION_INFORMATION_CONNECTION_FD: | ||
86 | CHECK_SIZE (MHD_socket); | ||
87 | return_value->connect_fd = connection->socket_fd; | ||
88 | return MHD_YES; | ||
89 | case MHD_CONNECTION_INFORMATION_SOCKET_CONTEXT: | ||
90 | CHECK_SIZE (void **); | ||
91 | return_value->socket_context = &connection->socket_context; | ||
92 | return MHD_YES; | ||
93 | case MHD_CONNECTION_INFORMATION_CONNECTION_SUSPENDED: | ||
94 | CHECK_SIZE (enum MHD_Bool); | ||
95 | return_value->suspended | ||
96 | = connection->suspended ? MHD_YES : MHD_NO; | ||
97 | return MHD_YES; | ||
98 | case MHD_CONNECTION_INFORMATION_CONNECTION_TIMEOUT: | ||
99 | CHECK_SIZE (unsigned int); | ||
100 | return_value->connection_timeout | ||
101 | = (unsigned int) connection->connection_timeout; | ||
102 | return MHD_YES; | ||
103 | default: | ||
104 | return MHD_NO; | ||
105 | } | ||
106 | |||
107 | #undef CHECK_SIZE | ||
50 | } | 108 | } |
51 | 109 | ||
52 | /* end of connection_info.c */ | 110 | /* end of connection_info.c */ |