| OLD | NEW |
| 1 /* This Source Code Form is subject to the terms of the Mozilla Public | 1 /* This Source Code Form is subject to the terms of the Mozilla Public |
| 2 * License, v. 2.0. If a copy of the MPL was not distributed with this | 2 * License, v. 2.0. If a copy of the MPL was not distributed with this |
| 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
| 4 | 4 |
| 5 /* | 5 /* |
| 6 * Public header for exported OCSP types. | 6 * Public header for exported OCSP types. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 #ifndef _OCSPT_H_ | 9 #ifndef _OCSPT_H_ |
| 10 #define _OCSPT_H_ | 10 #define _OCSPT_H_ |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 * DefaultHttpClient), populates an SEC_HttpClientFcnStruct, uses it to | 39 * DefaultHttpClient), populates an SEC_HttpClientFcnStruct, uses it to |
| 40 * register his client, and waits for his functions to be called. | 40 * register his client, and waits for his functions to be called. |
| 41 * | 41 * |
| 42 * For future expandability, the SEC_HttpClientFcnStruct is defined as a | 42 * For future expandability, the SEC_HttpClientFcnStruct is defined as a |
| 43 * union, with the version field acting as a selector. The proposed | 43 * union, with the version field acting as a selector. The proposed |
| 44 * initial version of the structure is given following the definition | 44 * initial version of the structure is given following the definition |
| 45 * of the union. The HttpClientState structure is implementation- | 45 * of the union. The HttpClientState structure is implementation- |
| 46 * dependent, and should be opaque to the user. | 46 * dependent, and should be opaque to the user. |
| 47 */ | 47 */ |
| 48 | 48 |
| 49 typedef void * SEC_HTTP_SERVER_SESSION; | 49 typedef void *SEC_HTTP_SERVER_SESSION; |
| 50 typedef void * SEC_HTTP_REQUEST_SESSION; | 50 typedef void *SEC_HTTP_REQUEST_SESSION; |
| 51 | 51 |
| 52 /* | 52 /* |
| 53 * This function creates a SEC_HTTP_SERVER_SESSION object. The implementer of a | 53 * This function creates a SEC_HTTP_SERVER_SESSION object. The implementer of a |
| 54 * specific HttpClient will allocate the necessary space, when this | 54 * specific HttpClient will allocate the necessary space, when this |
| 55 * function is called, and will free it when the corresponding FreeFcn | 55 * function is called, and will free it when the corresponding FreeFcn |
| 56 * is called. The SEC_HTTP_SERVER_SESSION object is passed, as an opaque object, | 56 * is called. The SEC_HTTP_SERVER_SESSION object is passed, as an opaque object, |
| 57 * to subsequent calls. | 57 * to subsequent calls. |
| 58 * | 58 * |
| 59 * If the function returns SECSuccess, the returned SEC_HTTP_SERVER_SESSION | 59 * If the function returns SECSuccess, the returned SEC_HTTP_SERVER_SESSION |
| 60 * must be cleaned up with a call to SEC_HttpServer_FreeSession, | 60 * must be cleaned up with a call to SEC_HttpServer_FreeSession, |
| 61 * after processing is finished. | 61 * after processing is finished. |
| 62 */ | 62 */ |
| 63 typedef SECStatus (*SEC_HttpServer_CreateSessionFcn)( | 63 typedef SECStatus (*SEC_HttpServer_CreateSessionFcn)( |
| 64 const char *host, | 64 const char *host, |
| 65 PRUint16 portnum, | 65 PRUint16 portnum, |
| 66 SEC_HTTP_SERVER_SESSION *pSession); | 66 SEC_HTTP_SERVER_SESSION *pSession); |
| 67 | 67 |
| 68 /* | 68 /* |
| 69 * This function is called to allow the implementation to attempt to keep | 69 * This function is called to allow the implementation to attempt to keep |
| 70 * the connection alive. Depending on the underlying platform, it might | 70 * the connection alive. Depending on the underlying platform, it might |
| 71 * immediately return SECSuccess without having performed any operations. | 71 * immediately return SECSuccess without having performed any operations. |
| 72 * (If a connection has not been kept alive, a subsequent call to | 72 * (If a connection has not been kept alive, a subsequent call to |
| 73 * SEC_HttpRequest_TrySendAndReceiveFcn should reopen the connection | 73 * SEC_HttpRequest_TrySendAndReceiveFcn should reopen the connection |
| 74 * automatically.) | 74 * automatically.) |
| 75 * | 75 * |
| 76 * If the connection uses nonblocking I/O, this function may return | 76 * If the connection uses nonblocking I/O, this function may return |
| 77 * SECWouldBlock and store a nonzero value at "pPollDesc". In that case | 77 * SECWouldBlock and store a nonzero value at "pPollDesc". In that case |
| 78 * the caller may wait on the poll descriptor, and should call this function | 78 * the caller may wait on the poll descriptor, and should call this function |
| 79 * again until SECSuccess (and a zero value at "pPollDesc") is obtained. | 79 * again until SECSuccess (and a zero value at "pPollDesc") is obtained. |
| 80 */ | 80 */ |
| 81 typedef SECStatus (*SEC_HttpServer_KeepAliveSessionFcn)( | 81 typedef SECStatus (*SEC_HttpServer_KeepAliveSessionFcn)( |
| 82 SEC_HTTP_SERVER_SESSION session, | 82 SEC_HTTP_SERVER_SESSION session, |
| 83 PRPollDesc **pPollDesc); | 83 PRPollDesc **pPollDesc); |
| 84 | 84 |
| 85 /* | 85 /* |
| 86 * This function frees the client SEC_HTTP_SERVER_SESSION object, closes all | 86 * This function frees the client SEC_HTTP_SERVER_SESSION object, closes all |
| 87 * SEC_HTTP_REQUEST_SESSIONs created for that server, discards all partial resul
ts, | 87 * SEC_HTTP_REQUEST_SESSIONs created for that server, discards all partial resul
ts, |
| 88 * frees any memory that was allocated by the client, and invalidates any | 88 * frees any memory that was allocated by the client, and invalidates any |
| 89 * response pointers that might have been returned by prior server or request | 89 * response pointers that might have been returned by prior server or request |
| 90 * functions. | 90 * functions. |
| 91 */ | 91 */ |
| 92 typedef SECStatus (*SEC_HttpServer_FreeSessionFcn)( | 92 typedef SECStatus (*SEC_HttpServer_FreeSessionFcn)( |
| 93 SEC_HTTP_SERVER_SESSION session); | 93 SEC_HTTP_SERVER_SESSION session); |
| 94 | 94 |
| 95 /* | 95 /* |
| 96 * This function creates a SEC_HTTP_REQUEST_SESSION object. The implementer of a | 96 * This function creates a SEC_HTTP_REQUEST_SESSION object. The implementer of a |
| 97 * specific HttpClient will allocate the necessary space, when this | 97 * specific HttpClient will allocate the necessary space, when this |
| 98 * function is called, and will free it when the corresponding FreeFcn | 98 * function is called, and will free it when the corresponding FreeFcn |
| 99 * is called. The SEC_HTTP_REQUEST_SESSION object is passed, as an opaque object
, | 99 * is called. The SEC_HTTP_REQUEST_SESSION object is passed, as an opaque object
, |
| 100 * to subsequent calls. | 100 * to subsequent calls. |
| 101 * | 101 * |
| 102 * An implementation that does not support the requested protocol variant | 102 * An implementation that does not support the requested protocol variant |
| 103 * (usually "http", but could eventually allow "https") or request method | 103 * (usually "http", but could eventually allow "https") or request method |
| 104 * should return SECFailure. | 104 * should return SECFailure. |
| 105 * | 105 * |
| 106 * Timeout values may include the constants PR_INTERVAL_NO_TIMEOUT (wait | 106 * Timeout values may include the constants PR_INTERVAL_NO_TIMEOUT (wait |
| 107 * forever) or PR_INTERVAL_NO_WAIT (nonblocking I/O). | 107 * forever) or PR_INTERVAL_NO_WAIT (nonblocking I/O). |
| 108 * | 108 * |
| 109 * If the function returns SECSuccess, the returned SEC_HTTP_REQUEST_SESSION | 109 * If the function returns SECSuccess, the returned SEC_HTTP_REQUEST_SESSION |
| 110 * must be cleaned up with a call to SEC_HttpRequest_FreeSession, | 110 * must be cleaned up with a call to SEC_HttpRequest_FreeSession, |
| 111 * after processing is finished. | 111 * after processing is finished. |
| 112 */ | 112 */ |
| 113 typedef SECStatus (*SEC_HttpRequest_CreateFcn)( | 113 typedef SECStatus (*SEC_HttpRequest_CreateFcn)( |
| 114 SEC_HTTP_SERVER_SESSION session, | 114 SEC_HTTP_SERVER_SESSION session, |
| 115 const char *http_protocol_variant, /* usually "http" */ | 115 const char *http_protocol_variant, /* usually "http" */ |
| 116 const char *path_and_query_string, | 116 const char *path_and_query_string, |
| 117 const char *http_request_method, | 117 const char *http_request_method, |
| 118 const PRIntervalTime timeout, | 118 const PRIntervalTime timeout, |
| 119 SEC_HTTP_REQUEST_SESSION *pRequest); | 119 SEC_HTTP_REQUEST_SESSION *pRequest); |
| 120 | 120 |
| 121 /* | 121 /* |
| 122 * This function sets data to be sent to the server for an HTTP request | 122 * This function sets data to be sent to the server for an HTTP request |
| 123 * of http_request_method == POST. If a particular implementation | 123 * of http_request_method == POST. If a particular implementation |
| 124 * supports it, the details for the POST request can be set by calling | 124 * supports it, the details for the POST request can be set by calling |
| 125 * this function, prior to activating the request with TrySendAndReceiveFcn. | 125 * this function, prior to activating the request with TrySendAndReceiveFcn. |
| 126 * | 126 * |
| 127 * An implementation that does not support the POST method should | 127 * An implementation that does not support the POST method should |
| 128 * implement a SetPostDataFcn function that returns immediately. | 128 * implement a SetPostDataFcn function that returns immediately. |
| 129 * | 129 * |
| 130 * Setting http_content_type is optional, the parameter may | 130 * Setting http_content_type is optional, the parameter may |
| 131 * by NULL or the empty string. | 131 * by NULL or the empty string. |
| 132 */ | 132 */ |
| 133 typedef SECStatus (*SEC_HttpRequest_SetPostDataFcn)( | 133 typedef SECStatus (*SEC_HttpRequest_SetPostDataFcn)( |
| 134 SEC_HTTP_REQUEST_SESSION request, | 134 SEC_HTTP_REQUEST_SESSION request, |
| 135 const char *http_data, | 135 const char *http_data, |
| 136 const PRUint32 http_data_len, | 136 const PRUint32 http_data_len, |
| 137 const char *http_content_type); | 137 const char *http_content_type); |
| 138 | 138 |
| 139 /* | 139 /* |
| 140 * This function sets an additional HTTP protocol request header. | 140 * This function sets an additional HTTP protocol request header. |
| 141 * If a particular implementation supports it, one or multiple headers | 141 * If a particular implementation supports it, one or multiple headers |
| 142 * can be added to the request by calling this function once or multiple | 142 * can be added to the request by calling this function once or multiple |
| 143 * times, prior to activating the request with TryFcn. | 143 * times, prior to activating the request with TryFcn. |
| 144 * | 144 * |
| 145 * An implementation that does not support setting additional headers | 145 * An implementation that does not support setting additional headers |
| 146 * should implement an AddRequestHeaderFcn function that returns immediately. | 146 * should implement an AddRequestHeaderFcn function that returns immediately. |
| 147 */ | 147 */ |
| 148 typedef SECStatus (*SEC_HttpRequest_AddHeaderFcn)( | 148 typedef SECStatus (*SEC_HttpRequest_AddHeaderFcn)( |
| 149 SEC_HTTP_REQUEST_SESSION request, | 149 SEC_HTTP_REQUEST_SESSION request, |
| 150 const char *http_header_name, | 150 const char *http_header_name, |
| 151 const char *http_header_value); | 151 const char *http_header_value); |
| 152 | 152 |
| 153 /* | 153 /* |
| 154 * This function initiates or continues an HTTP request. After | 154 * This function initiates or continues an HTTP request. After |
| 155 * parameters have been set with the Create function and, optionally, | 155 * parameters have been set with the Create function and, optionally, |
| 156 * modified or enhanced with the AddParams function, this call creates | 156 * modified or enhanced with the AddParams function, this call creates |
| 157 * the socket connection and initiates the communication. | 157 * the socket connection and initiates the communication. |
| 158 * | 158 * |
| 159 * If a timeout value of zero is specified, indicating non-blocking | 159 * If a timeout value of zero is specified, indicating non-blocking |
| 160 * I/O, the client creates a non-blocking socket, and returns a status | 160 * I/O, the client creates a non-blocking socket, and returns a status |
| 161 * of SECWouldBlock and a non-NULL PRPollDesc if the operation is not | 161 * of SECWouldBlock and a non-NULL PRPollDesc if the operation is not |
| (...skipping 11 matching lines...) Expand all Loading... |
| 173 * An input value of zero means, the caller will accept any response len. | 173 * An input value of zero means, the caller will accept any response len. |
| 174 * A different input value indicates the maximum response value acceptable | 174 * A different input value indicates the maximum response value acceptable |
| 175 * to the caller. | 175 * to the caller. |
| 176 * If data is successfully read and the size is acceptable to the caller, | 176 * If data is successfully read and the size is acceptable to the caller, |
| 177 * the function will return SECSuccess and set http_response_data_len to | 177 * the function will return SECSuccess and set http_response_data_len to |
| 178 * the size of the block returned in http_response_data. | 178 * the size of the block returned in http_response_data. |
| 179 * If the data read from the http server is larger than the acceptable | 179 * If the data read from the http server is larger than the acceptable |
| 180 * size, the function will return SECFailure. | 180 * size, the function will return SECFailure. |
| 181 * http_response_data_len will be set to a value different from zero to | 181 * http_response_data_len will be set to a value different from zero to |
| 182 * indicate the reason of the failure. | 182 * indicate the reason of the failure. |
| 183 * An out value of "0" means, the failure was unrelated to the | 183 * An out value of "0" means, the failure was unrelated to the |
| 184 * acceptable size. | 184 * acceptable size. |
| 185 * An out value of "1" means, the result data is larger than the | 185 * An out value of "1" means, the result data is larger than the |
| 186 * accpeptable size, but the real size is not yet known to the http client | 186 * accpeptable size, but the real size is not yet known to the http client |
| 187 * implementation and it stopped retrieving it, | 187 * implementation and it stopped retrieving it, |
| 188 * Any other out value combined with a return value of SECFailure | 188 * Any other out value combined with a return value of SECFailure |
| 189 * will indicate the actual size of the server data. | 189 * will indicate the actual size of the server data. |
| 190 * | 190 * |
| 191 * The caller is permitted to provide NULL values for any of the | 191 * The caller is permitted to provide NULL values for any of the |
| 192 * http_response arguments, indicating the caller is not interested in | 192 * http_response arguments, indicating the caller is not interested in |
| 193 * those values. If the caller does provide an address, the HttpClient | 193 * those values. If the caller does provide an address, the HttpClient |
| 194 * stores at that address a pointer to the corresponding argument, at | 194 * stores at that address a pointer to the corresponding argument, at |
| 195 * the completion of the operation. | 195 * the completion of the operation. |
| 196 * | 196 * |
| 197 * All returned pointers will be owned by the the HttpClient | 197 * All returned pointers will be owned by the the HttpClient |
| 198 * implementation and will remain valid until the call to | 198 * implementation and will remain valid until the call to |
| 199 * SEC_HttpRequest_FreeFcn. | 199 * SEC_HttpRequest_FreeFcn. |
| 200 */ | 200 */ |
| 201 typedef SECStatus (*SEC_HttpRequest_TrySendAndReceiveFcn)( | 201 typedef SECStatus (*SEC_HttpRequest_TrySendAndReceiveFcn)( |
| 202 SEC_HTTP_REQUEST_SESSION request, | 202 SEC_HTTP_REQUEST_SESSION request, |
| 203 PRPollDesc **pPollDesc, | 203 PRPollDesc **pPollDesc, |
| 204 PRUint16 *http_response_code, | 204 PRUint16 *http_response_code, |
| 205 const char **http_response_content_type, | 205 const char **http_response_content_type, |
| 206 const char **http_response_headers, | 206 const char **http_response_headers, |
| 207 const char **http_response_data, | 207 const char **http_response_data, |
| 208 PRUint32 *http_response_data_len); | 208 PRUint32 *http_response_data_len); |
| 209 | 209 |
| 210 /* | 210 /* |
| 211 * Calling CancelFcn asks for premature termination of the request. | 211 * Calling CancelFcn asks for premature termination of the request. |
| 212 * | 212 * |
| 213 * Future calls to SEC_HttpRequest_TrySendAndReceive should | 213 * Future calls to SEC_HttpRequest_TrySendAndReceive should |
| 214 * by avoided, but in this case the HttpClient implementation | 214 * by avoided, but in this case the HttpClient implementation |
| 215 * is expected to return immediately with SECFailure. | 215 * is expected to return immediately with SECFailure. |
| 216 * | 216 * |
| 217 * After calling CancelFcn, a separate call to SEC_HttpRequest_FreeFcn | 217 * After calling CancelFcn, a separate call to SEC_HttpRequest_FreeFcn |
| 218 * is still necessary to free resources. | 218 * is still necessary to free resources. |
| 219 */ | 219 */ |
| 220 typedef SECStatus (*SEC_HttpRequest_CancelFcn)( | 220 typedef SECStatus (*SEC_HttpRequest_CancelFcn)( |
| 221 SEC_HTTP_REQUEST_SESSION request); | 221 SEC_HTTP_REQUEST_SESSION request); |
| 222 | 222 |
| 223 /* | 223 /* |
| 224 * Before calling this function, it must be assured the request | 224 * Before calling this function, it must be assured the request |
| 225 * has been completed, i.e. either SEC_HttpRequest_TrySendAndReceiveFcn has | 225 * has been completed, i.e. either SEC_HttpRequest_TrySendAndReceiveFcn has |
| 226 * returned SECSuccess, or the request has been canceled with | 226 * returned SECSuccess, or the request has been canceled with |
| 227 * a call to SEC_HttpRequest_CancelFcn. | 227 * a call to SEC_HttpRequest_CancelFcn. |
| 228 * | 228 * |
| 229 * This function frees the client state object, closes all sockets, | 229 * This function frees the client state object, closes all sockets, |
| 230 * discards all partial results, frees any memory that was allocated | 230 * discards all partial results, frees any memory that was allocated |
| 231 * by the client, and invalidates all response pointers that might | 231 * by the client, and invalidates all response pointers that might |
| 232 * have been returned by SEC_HttpRequest_TrySendAndReceiveFcn | 232 * have been returned by SEC_HttpRequest_TrySendAndReceiveFcn |
| 233 */ | 233 */ |
| 234 typedef SECStatus (*SEC_HttpRequest_FreeFcn)( | 234 typedef SECStatus (*SEC_HttpRequest_FreeFcn)( |
| 235 SEC_HTTP_REQUEST_SESSION request); | 235 SEC_HTTP_REQUEST_SESSION request); |
| 236 | 236 |
| 237 typedef struct SEC_HttpClientFcnV1Struct { | 237 typedef struct SEC_HttpClientFcnV1Struct { |
| 238 SEC_HttpServer_CreateSessionFcn createSessionFcn; | 238 SEC_HttpServer_CreateSessionFcn createSessionFcn; |
| 239 SEC_HttpServer_KeepAliveSessionFcn keepAliveSessionFcn; | 239 SEC_HttpServer_KeepAliveSessionFcn keepAliveSessionFcn; |
| 240 SEC_HttpServer_FreeSessionFcn freeSessionFcn; | 240 SEC_HttpServer_FreeSessionFcn freeSessionFcn; |
| 241 SEC_HttpRequest_CreateFcn createFcn; | 241 SEC_HttpRequest_CreateFcn createFcn; |
| 242 SEC_HttpRequest_SetPostDataFcn setPostDataFcn; | 242 SEC_HttpRequest_SetPostDataFcn setPostDataFcn; |
| 243 SEC_HttpRequest_AddHeaderFcn addHeaderFcn; | 243 SEC_HttpRequest_AddHeaderFcn addHeaderFcn; |
| 244 SEC_HttpRequest_TrySendAndReceiveFcn trySendAndReceiveFcn; | 244 SEC_HttpRequest_TrySendAndReceiveFcn trySendAndReceiveFcn; |
| 245 SEC_HttpRequest_CancelFcn cancelFcn; | 245 SEC_HttpRequest_CancelFcn cancelFcn; |
| 246 SEC_HttpRequest_FreeFcn freeFcn; | 246 SEC_HttpRequest_FreeFcn freeFcn; |
| 247 } SEC_HttpClientFcnV1; | 247 } SEC_HttpClientFcnV1; |
| 248 | 248 |
| 249 typedef struct SEC_HttpClientFcnStruct { | 249 typedef struct SEC_HttpClientFcnStruct { |
| 250 PRInt16 version; | 250 PRInt16 version; |
| 251 union { | 251 union { |
| 252 SEC_HttpClientFcnV1 ftable1; | 252 SEC_HttpClientFcnV1 ftable1; |
| 253 /* SEC_HttpClientFcnV2 ftable2; */ | 253 /* SEC_HttpClientFcnV2 ftable2; */ |
| 254 /* ... */ | 254 /* ... */ |
| 255 } fcnTable; | 255 } fcnTable; |
| 256 } SEC_HttpClientFcn; | 256 } SEC_HttpClientFcn; |
| 257 | 257 |
| 258 /* | 258 /* |
| 259 * ocspMode_FailureIsVerificationFailure: | 259 * ocspMode_FailureIsVerificationFailure: |
| 260 * This is the classic behaviour of NSS. | 260 * This is the classic behaviour of NSS. |
| 261 * Any OCSP failure is a verification failure (classic mode, default). | 261 * Any OCSP failure is a verification failure (classic mode, default). |
| 262 * Without a good response, OCSP networking will be retried each time | 262 * Without a good response, OCSP networking will be retried each time |
| 263 * it is required for verifying a cert. | 263 * it is required for verifying a cert. |
| 264 * | 264 * |
| 265 * ocspMode_FailureIsNotAVerificationFailure: | 265 * ocspMode_FailureIsNotAVerificationFailure: |
| (...skipping 20 matching lines...) Expand all Loading... |
| 286 * byName [1] EXPLICIT Name, | 286 * byName [1] EXPLICIT Name, |
| 287 * byKey [2] EXPLICIT KeyHash } | 287 * byKey [2] EXPLICIT KeyHash } |
| 288 * | 288 * |
| 289 * Because it is CHOICE, the type of identification used and the | 289 * Because it is CHOICE, the type of identification used and the |
| 290 * identification itself are actually encoded together. To represent | 290 * identification itself are actually encoded together. To represent |
| 291 * this same information internally, we explicitly define a type and | 291 * this same information internally, we explicitly define a type and |
| 292 * save it, along with the value, into a data structure. | 292 * save it, along with the value, into a data structure. |
| 293 */ | 293 */ |
| 294 | 294 |
| 295 typedef enum { | 295 typedef enum { |
| 296 ocspResponderID_other = -1,»» /* unknown kind of responderID */ | 296 ocspResponderID_other = -1, /* unknown kind of responderID */ |
| 297 ocspResponderID_byName = 1, | 297 ocspResponderID_byName = 1, |
| 298 ocspResponderID_byKey = 2 | 298 ocspResponderID_byKey = 2 |
| 299 } CERTOCSPResponderIDType; | 299 } CERTOCSPResponderIDType; |
| 300 | 300 |
| 301 #endif /* _OCSPT_H_ */ | 301 #endif /* _OCSPT_H_ */ |
| OLD | NEW |