Welcome to mirror list, hosted at ThFree Co, Russian Federation.

HTTPClientCommon.h « HTTP_Client « ZenLib « ZenLib « thirdparty « src - github.com/mpc-hc/mpc-hc.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 9c6c36b243675ef12b69709b3c472e3a657d0211 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120

///////////////////////////////////////////////////////////////////////////////
//
// Module Name:
//   CmsiHTTPClientCommon.h
//
// Abstract: Coomon structs and types for the HTTP protocol API
// Author:  Eitan Michaelso
// Version:  1.0
//
///////////////////////////////////////////////////////////////////////////////

#ifndef _HTTPCLIENT_PROTOCOL_H_
#define _HTTPCLIENT_PROTOCOL_H_

#ifdef __cplusplus
extern "C" {
#endif

    // Global default sizes
#define HTTP_CLIENT_MAX_URL_LENGTH          512         // Maximum length for an HTTP Url parameter

    // HTTP Session flags (Public flags)
#define HTTP_CLIENT_FLAG_KEEP_ALIVE         0x00000001 // Set the keep alive header
#define HTTP_CLIENT_FLAG_SEND_CHUNKED       0x00000002 // The outgoing should chunked
#define HTTP_CLIENT_FLAG_NO_CACHE           0x00000004 // Set the no cache header
#define HTTP_CLIENT_FLAG_ASYNC              0x00000008 // Currently not implemented

    // HTTP status internal flags
#define HTTP_CLIENT_STATE_PRE_INIT          0x00000000  // Starting stage
#define HTTP_CLIENT_STATE_INIT              0x00000001  // API was initialized (memory was allocated)
#define HTTP_CLIENT_STATE_URL_PARSED        0x00000002  // Url was parsed
#define HTTP_CLIENT_STATE_HOST_CONNECTED    0x00000004  // HEAD verb was sent
#define HTTP_CLIENT_STATE_HEAD_SENT         0x00000008  // Post verb was sent
#define HTTP_CLIENT_STATE_POST_SENT         0x00000010  // HTTP requet was sent
#define HTTP_CLIENT_STATE_REQUEST_SENT      0x00000020  // HTTP request was sent
#define HTTP_CLIENT_STATE_HEADERS_RECIVED   0x00000040  // Headers ware recived from the server
#define HTTP_CLIENT_STATE_HEADERS_PARSED    0x00000080  // HTTP headers ware parsed
#define HTTP_CLIENT_STATE_HEADERS_OK        0x00000100  // Headers  status was OK

    // HTTP Return codes
#define HTTP_CLIENT_SUCCESS                 0 // HTTP Success status

#define HTTP_CLIENT_UNKNOWN_ERROR           1 // Unknown error
#define HTTP_CLIENT_ERROR_INVALID_HANDLE    2  // an Invalid handle or possible bad pointer was passed to a function
#define HTTP_CLIENT_ERROR_NO_MEMORY         3  // Buffer too small or a failure while in memory allocation
#define HTTP_CLIENT_ERROR_SOCKET_INVALID    4  // an attempt to use an invalid socket handle was made
#define HTTP_CLIENT_ERROR_SOCKET_CANT_SET   5  // Can't send socket parameters
#define HTTP_CLIENT_ERROR_SOCKET_RESOLVE    6  // Error while resolving host name
#define HTTP_CLIENT_ERROR_SOCKET_CONNECT    7  // Error while connecting to the remote server
#define HTTP_CLIENT_ERROR_SOCKET_TIME_OUT   8  // socket time out error
#define HTTP_CLIENT_ERROR_SOCKET_RECV       9  // Error while receiving data
#define HTTP_CLIENT_ERROR_SOCKET_SEND       10 // Error while sending data
#define HTTP_CLIENT_ERROR_HEADER_RECV       11 // Error while receiving the remote HTTP headers
#define HTTP_CLIENT_ERROR_HEADER_NOT_FOUND  12 // Could not find element within header
#define HTTP_CLIENT_ERROR_HEADER_BIG_CLUE   13 // The headers search clue was too large for the internal API buffer
#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
#define HTTP_CLIENT_ERROR_CHUNK_TOO_BIG     15 // The HTTP chunk token that was received from the server was too big and possibly wrong
#define HTTP_CLIENT_ERROR_AUTH_HOST         16 // Could not authenticate with the remote host
#define HTTP_CLIENT_ERROR_AUTH_PROXY        17 // Could not authenticate with the remote proxy
#define HTTP_CLIENT_ERROR_BAD_VERB          18 // Bad or not supported HTTP verb was passed to a function
#define HTTP_CLIENT_ERROR_LONG_INPUT        19 // a function received a parameter that was too large
#define HTTP_CLIENT_ERROR_BAD_STATE         20 // The session state prevents the current function from proceeding
#define HTTP_CLIENT_ERROR_CHUNK             21 // Could not parse the chunk length while in chunked transfer
#define HTTP_CLIENT_ERROR_BAD_URL           22 // Could not parse curtail elements from the URL (such as the host name, HTTP prefix act')
#define HTTP_CLIENT_ERROR_BAD_HEADER        23 // Could not detect key elements in the received headers
#define HTTP_CLIENT_ERROR_BUFFER_RSIZE      24 // Error while attempting to resize a buffer
#define HTTP_CLIENT_ERROR_BAD_AUTH          25 // Authentication schema is not supported
#define HTTP_CLIENT_ERROR_AUTH_MISMATCH     26 // The selected authentication schema does not match the server response
#define HTTP_CLIENT_ERROR_NO_DIGEST_TOKEN   27 // an element was missing while parsing the digest authentication challenge
#define HTTP_CLIENT_ERROR_NO_DIGEST_ALG     28 // Digest algorithem could be MD5 or MD5-sess other types are not supported
#define HTTP_CLIENT_ERROR_SOCKET_BIND         29 // Binding error
#define HTTP_CLIENT_ERROR_TLS_NEGO            30 // Tls negotiation error
#define HTTP_CLIENT_ERROR_NOT_IMPLEMENTED   64 // Feature is not (yet) implemented
#define HTTP_CLIENT_EOS                     1000        // HTTP end of stream message

    ///////////////////////////////////////////////////////////////////////////////
    //
    // Section      : HTTP API structures
    // Last updated : 01/09/2005
    //
    ///////////////////////////////////////////////////////////////////////////////

    // HTTP Supported authentication methods
    typedef enum _HTTP_AUTH_SCHEMA
    {
        AuthSchemaNone      = 0,
        AuthSchemaBasic,
        AuthSchemaDigest,
        AuthSchemaKerberos,
        AuthNotSupported

    } HTTP_AUTH_SCHEMA;

    // HTTP supported verbs
    typedef enum _HTTP_VERB
    {
        VerbGet             = 0,
        VerbHead,
        VerbPost,
        VerbNotSupported
        // Note: others verb such as connect and put are currently not supported

    } HTTP_VERB;

    // Data structure that the caller can request at any time that will include some information regarding the session
    typedef struct _HTTP_CLIENT
    {
        UINT32        HTTPStatusCode;                 // HTTP Status code (200 OK)
        UINT32          RequestBodyLengthSent;          // Total bytes sent (body only)
        UINT32          ResponseBodyLengthReceived;     // Total bytes received (body only)
        UINT32          TotalResponseBodyLength;        // as extracted from the “content-length" header
        UINT32        HttpState;
    } HTTP_CLIENT;

#ifdef __cplusplus
}
#endif

#endif // _HTTPCLIENT_PROTOCOL_H_