| OLD | NEW |
| (Empty) |
| 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 | |
| 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | |
| 4 /* | |
| 5 * pkix_pl_httpdefaultclient.h | |
| 6 * | |
| 7 * HTTPDefaultClient Object Type Definition | |
| 8 * | |
| 9 */ | |
| 10 | |
| 11 #ifndef _PKIX_PL_HTTPDEFAULTCLIENT_H | |
| 12 #define _PKIX_PL_HTTPDEFAULTCLIENT_H | |
| 13 | |
| 14 #include "pkix_pl_common.h" | |
| 15 | |
| 16 #ifdef __cplusplus | |
| 17 extern "C" { | |
| 18 #endif | |
| 19 | |
| 20 #define HTTP_DATA_BUFSIZE 4096 | |
| 21 #define HTTP_HEADER_BUFSIZE 1024 | |
| 22 #define HTTP_MIN_AVAILABLE_BUFFER_SIZE 512 | |
| 23 | |
| 24 typedef enum { | |
| 25 HTTP_NOT_CONNECTED, | |
| 26 HTTP_CONNECT_PENDING, | |
| 27 HTTP_CONNECTED, | |
| 28 HTTP_SEND_PENDING, | |
| 29 HTTP_RECV_HDR, | |
| 30 HTTP_RECV_HDR_PENDING, | |
| 31 HTTP_RECV_BODY, | |
| 32 HTTP_RECV_BODY_PENDING, | |
| 33 HTTP_COMPLETE, | |
| 34 HTTP_ERROR | |
| 35 } HttpConnectStatus; | |
| 36 | |
| 37 typedef enum { | |
| 38 HTTP_POST_METHOD, | |
| 39 HTTP_GET_METHOD | |
| 40 } HttpMethod; | |
| 41 | |
| 42 struct PKIX_PL_HttpDefaultClientStruct { | |
| 43 HttpConnectStatus connectStatus; | |
| 44 PRUint16 portnum; | |
| 45 PRIntervalTime timeout; | |
| 46 PKIX_UInt32 bytesToWrite; | |
| 47 PKIX_UInt32 send_http_data_len; | |
| 48 PKIX_UInt32 rcv_http_data_len; | |
| 49 PKIX_UInt32 capacity; | |
| 50 PKIX_UInt32 filledupBytes; | |
| 51 PKIX_UInt32 responseCode; | |
| 52 PKIX_UInt32 maxResponseLen; | |
| 53 PKIX_UInt32 GETLen; | |
| 54 PKIX_UInt32 POSTLen; | |
| 55 PRUint32 *pRcv_http_data_len; | |
| 56 PRPollDesc pollDesc; | |
| 57 void *callbackList; /* cast this to (PKIX_PL_Socket_Callback *) */ | |
| 58 char *GETBuf; | |
| 59 char *POSTBuf; | |
| 60 char *rcvBuf; | |
| 61 char *host; | |
| 62 char *path; | |
| 63 char *rcvContentType; | |
| 64 void *rcvHeaders; | |
| 65 HttpMethod send_http_method; | |
| 66 const char *send_http_content_type; | |
| 67 const char *send_http_data; | |
| 68 PRUint16 *rcv_http_response_code; | |
| 69 const char **rcv_http_content_type; | |
| 70 const char **rcv_http_headers; | |
| 71 const char **rcv_http_data; | |
| 72 PKIX_PL_Socket *socket; | |
| 73 void *plContext; | |
| 74 }; | |
| 75 | |
| 76 /* see source file for function documentation */ | |
| 77 | |
| 78 PKIX_Error *pkix_pl_HttpDefaultClient_RegisterSelf(void *plContext); | |
| 79 | |
| 80 SECStatus | |
| 81 pkix_pl_HttpDefaultClient_CreateSessionFcn( | |
| 82 const char *host, | |
| 83 PRUint16 portnum, | |
| 84 SEC_HTTP_SERVER_SESSION *pSession); | |
| 85 | |
| 86 SECStatus | |
| 87 pkix_pl_HttpDefaultClient_KeepAliveSessionFcn( | |
| 88 SEC_HTTP_SERVER_SESSION session, | |
| 89 PRPollDesc **pPollDesc); | |
| 90 | |
| 91 SECStatus | |
| 92 pkix_pl_HttpDefaultClient_FreeSessionFcn( | |
| 93 SEC_HTTP_SERVER_SESSION session); | |
| 94 | |
| 95 SECStatus | |
| 96 pkix_pl_HttpDefaultClient_RequestCreateFcn( | |
| 97 SEC_HTTP_SERVER_SESSION session, | |
| 98 const char *http_protocol_variant, /* usually "http" */ | |
| 99 const char *path_and_query_string, | |
| 100 const char *http_request_method, | |
| 101 const PRIntervalTime timeout, | |
| 102 SEC_HTTP_REQUEST_SESSION *pRequest); | |
| 103 | |
| 104 SECStatus | |
| 105 pkix_pl_HttpDefaultClient_SetPostDataFcn( | |
| 106 SEC_HTTP_REQUEST_SESSION request, | |
| 107 const char *http_data, | |
| 108 const PRUint32 http_data_len, | |
| 109 const char *http_content_type); | |
| 110 | |
| 111 SECStatus | |
| 112 pkix_pl_HttpDefaultClient_AddHeaderFcn( | |
| 113 SEC_HTTP_REQUEST_SESSION request, | |
| 114 const char *http_header_name, | |
| 115 const char *http_header_value); | |
| 116 | |
| 117 SECStatus | |
| 118 pkix_pl_HttpDefaultClient_TrySendAndReceiveFcn( | |
| 119 SEC_HTTP_REQUEST_SESSION request, | |
| 120 PRPollDesc **pPollDesc, | |
| 121 PRUint16 *http_response_code, | |
| 122 const char **http_response_content_type, | |
| 123 const char **http_response_headers, | |
| 124 const char **http_response_data, | |
| 125 PRUint32 *http_response_data_len); | |
| 126 | |
| 127 SECStatus | |
| 128 pkix_pl_HttpDefaultClient_CancelFcn( | |
| 129 SEC_HTTP_REQUEST_SESSION request); | |
| 130 | |
| 131 SECStatus | |
| 132 pkix_pl_HttpDefaultClient_FreeFcn( | |
| 133 SEC_HTTP_REQUEST_SESSION request); | |
| 134 | |
| 135 #ifdef __cplusplus | |
| 136 } | |
| 137 #endif | |
| 138 | |
| 139 #endif /* _PKIX_PL_HTTPDEFAULTCLIENT_H */ | |
| OLD | NEW |