doom3-gpl
Doom 3 GPL source release
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
neo
curl
lib
http_chunks.h
Go to the documentation of this file.
1
#ifndef __HTTP_CHUNKS_H
2
#define __HTTP_CHUNKS_H
3
/***************************************************************************
4
* _ _ ____ _
5
* Project ___| | | | _ \| |
6
* / __| | | | |_) | |
7
* | (__| |_| | _ <| |___
8
* \___|\___/|_| \_\_____|
9
*
10
* Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al.
11
*
12
* This software is licensed as described in the file COPYING, which
13
* you should have received as part of this distribution. The terms
14
* are also available at http://curl.haxx.se/docs/copyright.html.
15
*
16
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
17
* copies of the Software, and permit persons to whom the Software is
18
* furnished to do so, under the terms of the COPYING file.
19
*
20
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
21
* KIND, either express or implied.
22
*
23
* $Id: http_chunks.h,v 1.11 2004/03/04 15:25:06 bagder Exp $
24
***************************************************************************/
25
/*
26
* The longest possible hexadecimal number we support in a chunked transfer.
27
* Weird enough, RFC2616 doesn't set a maximum size! Since we use strtoul()
28
* to convert it, we "only" support 2^32 bytes chunk data.
29
*/
30
#define MAXNUM_SIZE 16
31
32
typedef
enum
{
33
CHUNK_FIRST
,
/* never use */
34
35
/* In this we await and buffer all hexadecimal digits until we get one
36
that isn't a hexadecimal digit. When done, we go POSTHEX */
37
CHUNK_HEX
,
38
39
/* We have received the hexadecimal digit and we eat all characters until
40
we get a CRLF pair. When we see a CR we go to the CR state. */
41
CHUNK_POSTHEX
,
42
43
/* A single CR has been found and we should get a LF right away in this
44
state or we go back to POSTHEX. When LF is received, we go to DATA.
45
If the size given was zero, we set state to STOP and return. */
46
CHUNK_CR
,
47
48
/* We eat the amount of data specified. When done, we move on to the
49
POST_CR state. */
50
CHUNK_DATA
,
51
52
/* POSTCR should get a CR and nothing else, then move to POSTLF */
53
CHUNK_POSTCR
,
54
55
/* POSTLF should get a LF and nothing else, then move back to HEX as
56
the CRLF combination marks the end of a chunk */
57
CHUNK_POSTLF
,
58
59
/* This is mainly used to really mark that we're out of the game.
60
NOTE: that there's a 'dataleft' field in the struct that will tell how
61
many bytes that were not passed to the client in the end of the last
62
buffer! */
63
CHUNK_STOP
,
64
65
CHUNK_LAST
/* never use */
66
}
ChunkyState
;
67
68
typedef
enum
{
69
CHUNKE_STOP
= -1,
70
CHUNKE_OK
= 0,
71
CHUNKE_TOO_LONG_HEX
= 1,
72
CHUNKE_ILLEGAL_HEX
,
73
CHUNKE_BAD_CHUNK
,
74
CHUNKE_WRITE_ERROR
,
75
CHUNKE_STATE_ERROR
,
76
CHUNKE_BAD_ENCODING
,
77
CHUNKE_LAST
78
}
CHUNKcode
;
79
80
struct
Curl_chunker
{
81
char
hexbuffer
[
MAXNUM_SIZE
+ 1];
82
int
hexindex
;
83
ChunkyState
state
;
84
size_t
datasize
;
85
size_t
dataleft
;
/* untouched data amount at the end of the last buffer */
86
};
87
88
#endif
CHUNKE_OK
Definition:
http_chunks.h:70
CHUNKE_ILLEGAL_HEX
Definition:
http_chunks.h:72
CHUNK_DATA
Definition:
http_chunks.h:50
Curl_chunker::dataleft
size_t dataleft
Definition:
http_chunks.h:85
ChunkyState
ChunkyState
Definition:
http_chunks.h:32
CHUNK_STOP
Definition:
http_chunks.h:63
CHUNKE_STOP
Definition:
http_chunks.h:69
CHUNKE_BAD_ENCODING
Definition:
http_chunks.h:76
CHUNKE_TOO_LONG_HEX
Definition:
http_chunks.h:71
Curl_chunker::hexbuffer
char hexbuffer[MAXNUM_SIZE+1]
Definition:
http_chunks.h:81
CHUNK_HEX
Definition:
http_chunks.h:37
CHUNKE_BAD_CHUNK
Definition:
http_chunks.h:73
CHUNK_POSTHEX
Definition:
http_chunks.h:41
CHUNKE_WRITE_ERROR
Definition:
http_chunks.h:74
CHUNKcode
CHUNKcode
Definition:
http_chunks.h:68
CHUNK_CR
Definition:
http_chunks.h:46
CHUNKE_LAST
Definition:
http_chunks.h:77
Curl_chunker::state
ChunkyState state
Definition:
http_chunks.h:83
Curl_chunker::hexindex
int hexindex
Definition:
http_chunks.h:82
CHUNK_LAST
Definition:
http_chunks.h:65
Curl_chunker
Definition:
http_chunks.h:80
CHUNK_FIRST
Definition:
http_chunks.h:33
CHUNK_POSTLF
Definition:
http_chunks.h:57
Curl_chunker::datasize
size_t datasize
Definition:
http_chunks.h:84
CHUNK_POSTCR
Definition:
http_chunks.h:53
MAXNUM_SIZE
#define MAXNUM_SIZE
Definition:
http_chunks.h:30
CHUNKE_STATE_ERROR
Definition:
http_chunks.h:75
This page is maintained by
Wladimir van der Laan
. Generated on Mon Nov 17 2014 12:23:15 for doom3-gpl by
1.8.6
.