ZenLib

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List
- File Members

HTTPClientCommon.h
Go to the documentation of this file.
1
2 ///////////////////////////////////////////////////////////////////////////////
3 //
4 // Module Name:
5 // CmsiHTTPClientCommon.h
6 //
7 // Abstract: Coomon structs and types for the HTTP protocol API
8 // Author: Eitan Michaelso
9 // Version: 1.0
10 //
11 ///////////////////////////////////////////////////////////////////////////////
12
13 #ifndef _HTTPCLIENT_PROTOCOL_H_
14 #define _HTTPCLIENT_PROTOCOL_H_
15
16 #ifdef __cplusplus
17 extern "C" {
18 #endif
19
20 // Global default sizes
21 #define HTTP_CLIENT_MAX_URL_LENGTH 512 // Maximum length for an HTTP Url parameter
22
23 // HTTP Session flags (Public flags)
24 #define HTTP_CLIENT_FLAG_KEEP_ALIVE 0x00000001 // Set the keep alive header
25 #define HTTP_CLIENT_FLAG_SEND_CHUNKED 0x00000002 // The outgoing should chunked
26 #define HTTP_CLIENT_FLAG_NO_CACHE 0x00000004 // Set the no cache header
27 #define HTTP_CLIENT_FLAG_ASYNC 0x00000008 // Currently not implemented
28
29 // HTTP status internal flags
30 #define HTTP_CLIENT_STATE_PRE_INIT 0x00000000 // Starting stage
31 #define HTTP_CLIENT_STATE_INIT 0x00000001 // API was initialized (memory was allocated)
32 #define HTTP_CLIENT_STATE_URL_PARSED 0x00000002 // Url was parsed
33 #define HTTP_CLIENT_STATE_HOST_CONNECTED 0x00000004 // HEAD verb was sent
34 #define HTTP_CLIENT_STATE_HEAD_SENT 0x00000008 // Post verb was sent
35 #define HTTP_CLIENT_STATE_POST_SENT 0x00000010 // HTTP requet was sent
36 #define HTTP_CLIENT_STATE_REQUEST_SENT 0x00000020 // HTTP request was sent
37 #define HTTP_CLIENT_STATE_HEADERS_RECIVED 0x00000040 // Headers ware recived from the server
38 #define HTTP_CLIENT_STATE_HEADERS_PARSED 0x00000080 // HTTP headers ware parsed
39 #define HTTP_CLIENT_STATE_HEADERS_OK 0x00000100 // Headers status was OK
40
41 // HTTP Return codes
42 #define HTTP_CLIENT_SUCCESS 0 // HTTP Success status
43
44 #define HTTP_CLIENT_UNKNOWN_ERROR 1 // Unknown error
45 #define HTTP_CLIENT_ERROR_INVALID_HANDLE 2 // an Invalid handle or possible bad pointer was passed to a function
46 #define HTTP_CLIENT_ERROR_NO_MEMORY 3 // Buffer too small or a failure while in memory allocation
47 #define HTTP_CLIENT_ERROR_SOCKET_INVALID 4 // an attempt to use an invalid socket handle was made
48 #define HTTP_CLIENT_ERROR_SOCKET_CANT_SET 5 // Can't send socket parameters
49 #define HTTP_CLIENT_ERROR_SOCKET_RESOLVE 6 // Error while resolving host name
50 #define HTTP_CLIENT_ERROR_SOCKET_CONNECT 7 // Error while connecting to the remote server
51 #define HTTP_CLIENT_ERROR_SOCKET_TIME_OUT 8 // socket time out error
52 #define HTTP_CLIENT_ERROR_SOCKET_RECV 9 // Error while receiving data
53 #define HTTP_CLIENT_ERROR_SOCKET_SEND 10 // Error while sending data
54 #define HTTP_CLIENT_ERROR_HEADER_RECV 11 // Error while receiving the remote HTTP headers
55 #define HTTP_CLIENT_ERROR_HEADER_NOT_FOUND 12 // Could not find element within header
56 #define HTTP_CLIENT_ERROR_HEADER_BIG_CLUE 13 // The headers search clue was too large for the internal API buffer
57 #define HTTP_CLIENT_ERROR_HEADER_NO_LENGTH 14 // No content length was specified for the outgoing data. the caller should specify chunking mode in the session creation
58 #define HTTP_CLIENT_ERROR_CHUNK_TOO_BIG 15 // The HTTP chunk token that was received from the server was too big and possibly wrong
59 #define HTTP_CLIENT_ERROR_AUTH_HOST 16 // Could not authenticate with the remote host
60 #define HTTP_CLIENT_ERROR_AUTH_PROXY 17 // Could not authenticate with the remote proxy
61 #define HTTP_CLIENT_ERROR_BAD_VERB 18 // Bad or not supported HTTP verb was passed to a function
62 #define HTTP_CLIENT_ERROR_LONG_INPUT 19 // a function received a parameter that was too large
63 #define HTTP_CLIENT_ERROR_BAD_STATE 20 // The session state prevents the current function from proceeding
64 #define HTTP_CLIENT_ERROR_CHUNK 21 // Could not parse the chunk length while in chunked transfer
65 #define HTTP_CLIENT_ERROR_BAD_URL 22 // Could not parse curtail elements from the URL (such as the host name, HTTP prefix act')
66 #define HTTP_CLIENT_ERROR_BAD_HEADER 23 // Could not detect key elements in the received headers
67 #define HTTP_CLIENT_ERROR_BUFFER_RSIZE 24 // Error while attempting to resize a buffer
68 #define HTTP_CLIENT_ERROR_BAD_AUTH 25 // Authentication schema is not supported
69 #define HTTP_CLIENT_ERROR_AUTH_MISMATCH 26 // The selected authentication schema does not match the server response
70 #define HTTP_CLIENT_ERROR_NO_DIGEST_TOKEN 27 // an element was missing while parsing the digest authentication challenge
71 #define HTTP_CLIENT_ERROR_NO_DIGEST_ALG 28 // Digest algorithem could be MD5 or MD5-sess other types are not supported
72 #define HTTP_CLIENT_ERROR_SOCKET_BIND 29 // Binding error
73 #define HTTP_CLIENT_ERROR_TLS_NEGO 30 // Tls negotiation error
74 #define HTTP_CLIENT_ERROR_NOT_IMPLEMENTED 64 // Feature is not (yet) implemented
75 #define HTTP_CLIENT_EOS 1000 // HTTP end of stream message
76
77 ///////////////////////////////////////////////////////////////////////////////
78 //
79 // Section : HTTP API structures
80 // Last updated : 01/09/2005
81 //
82 ///////////////////////////////////////////////////////////////////////////////
83
84 // HTTP Supported authentication methods
85 typedef enum _HTTP_AUTH_SCHEMA
86 {
87 AuthSchemaNone = 0,
88 AuthSchemaBasic,
89 AuthSchemaDigest,
90 AuthSchemaKerberos,
91 AuthNotSupported
92
93 } HTTP_AUTH_SCHEMA;
94
95 // HTTP supported verbs
96 typedef enum _HTTP_VERB
97 {
98 VerbGet = 0,
99 VerbHead,
100 VerbPost,
101 VerbNotSupported
102 // Note: others verb such as connect and put are currently not supported
103
104 } HTTP_VERB;
105
106 // Data structure that the caller can request at any time that will include some information regarding the session
107 typedef struct _HTTP_CLIENT
108 {
109 UINT32 HTTPStatusCode; // HTTP Status code (200 OK)
110 UINT32 RequestBodyLengthSent; // Total bytes sent (body only)
111 UINT32 ResponseBodyLengthReceived; // Total bytes received (body only)
112 UINT32 TotalResponseBodyLength; // as extracted from the “content-length" header
113 UINT32 HttpState;
114 } HTTP_CLIENT;
115
116 #ifdef __cplusplus
117 }
118 #endif
119
120 #endif // _HTTPCLIENT_PROTOCOL_H_
HTTP_CLIENT
struct _HTTP_CLIENT HTTP_CLIENT
AuthNotSupported
Definition: HTTPClientCommon.h:91
_HTTP_CLIENT::HttpState
UINT32 HttpState
Definition: HTTPClientCommon.h:113
_HTTP_CLIENT::RequestBodyLengthSent
UINT32 RequestBodyLengthSent
Definition: HTTPClientCommon.h:110
VerbHead
Definition: HTTPClientCommon.h:99
VerbNotSupported
Definition: HTTPClientCommon.h:101
AuthSchemaBasic
Definition: HTTPClientCommon.h:88
_HTTP_AUTH_SCHEMA
_HTTP_AUTH_SCHEMA
Definition: HTTPClientCommon.h:85
_HTTP_CLIENT
Definition: HTTPClientCommon.h:107
VerbPost
Definition: HTTPClientCommon.h:100
AuthSchemaKerberos
Definition: HTTPClientCommon.h:90
HTTP_AUTH_SCHEMA
enum _HTTP_AUTH_SCHEMA HTTP_AUTH_SCHEMA
AuthSchemaNone
Definition: HTTPClientCommon.h:87
UINT32
unsigned int UINT32
Definition: HTTPClientWrapper.h:31
_HTTP_CLIENT::TotalResponseBodyLength
UINT32 TotalResponseBodyLength
Definition: HTTPClientCommon.h:112
AuthSchemaDigest
Definition: HTTPClientCommon.h:89
_HTTP_VERB
_HTTP_VERB
Definition: HTTPClientCommon.h:96
_HTTP_CLIENT::ResponseBodyLengthReceived
UINT32 ResponseBodyLengthReceived
Definition: HTTPClientCommon.h:111
HTTP_VERB
enum _HTTP_VERB HTTP_VERB
VerbGet
Definition: HTTPClientCommon.h:98
_HTTP_CLIENT::HTTPStatusCode
UINT32 HTTPStatusCode
Definition: HTTPClientCommon.h:109