OSDN Git Service

update libMiMic
[mimic/MiMicSDK.git] / lib / src / http / NyLPC_cHttpBodyWriter.h
1 /*********************************************************************************\r
2  * PROJECT: MiMic\r
3  * --------------------------------------------------------------------------------\r
4  *\r
5  * This file is part of MiMic\r
6  * Copyright (C)2011 Ryo Iizuka\r
7  *\r
8  * MiMic is free software: you can redistribute it and/or modify\r
9  * it under the terms of the GNU Lesser General Public License as published\r
10  * by the Free Software Foundation, either version 3 of the License, or\r
11  * (at your option) any later version.\r
12  *\r
13  * This program is distributed in the hope that it will be useful,\r
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
16  * GNU General Public License for more details.\r
17  *\r
18  * You should have received a copy of the GNU Lesser General Public License\r
19  * along with this program.  If not, see <http://www.gnu.org/licenses/>.\r
20  *\r
21  * For further information please contact.\r
22  *  http://nyatla.jp/\r
23  *  <airmail(at)ebony.plala.or.jp> or <nyatla(at)nyatla.jp>\r
24  *\r
25  *********************************************************************************/\r
26 \r
27 #ifndef NYLPC_CHTTPBODYWRITER_H_\r
28 #define NYLPC_CHTTPBODYWRITER_H_\r
29 \r
30 #include "NyLPC_cHttpHeaderWriter.h"\r
31 #include "NyLPC_cHttpStream.h"\r
32 #include <stdarg.h>\r
33 \r
34 #ifdef __cplusplus\r
35 extern "C" {\r
36 #endif /* __cplusplus */\r
37 \r
38 typedef struct NyLPC_TcHttpBodyWriter NyLPC_TcHttpBodyWriter_t;\r
39 struct NyLPC_TcHttpBodyWriter\r
40 {\r
41     NyLPC_TiHttpPtrStream_t* _ref_stream;\r
42     NyLPC_TUInt8 _is_chunked;\r
43     NyLPC_TUInt8 _is_error;\r
44     NyLPC_TUInt32 _size_of_sent;\r
45     /** _is_chunked==NyLPC_TUInt8_TRUEの時のみ有効. ContentLengthの値*/\r
46     NyLPC_TUInt32 _content_length;\r
47 };\r
48 \r
49 /**\r
50  * 送信モードの初期値は、contentlength=0,chunked無しです。\r
51  */\r
52 void NyLPC_cHttpBodyWriter_initialize(NyLPC_TcHttpBodyWriter_t* i_inst,NyLPC_TcHttpStream_t* i_stream);\r
53 #define NyLPC_cHttpBodyWriter_finalize(i);\r
54 /** Chunkedエンコーディングで送信する場合*/\r
55 void NyLPC_cHttpBodyWriter_setChunked(NyLPC_TcHttpBodyWriter_t* i_inst);\r
56 /** Contentlengthで送信する場合*/\r
57 void NyLPC_cHttpBodyWriter_setContentLength(NyLPC_TcHttpBodyWriter_t* i_inst,NyLPC_TUInt32 i_content_length);\r
58 NyLPC_TBool NyLPC_cHttpBodyWriter_write(NyLPC_TcHttpBodyWriter_t* i_inst,const void* i_buf,NyLPC_TUInt32 i_len);\r
59 NyLPC_TBool NyLPC_cHttpBodyWriter_close(NyLPC_TcHttpBodyWriter_t* i_inst);\r
60 NyLPC_TBool NyLPC_cHttpBodyWriter_format(NyLPC_TcHttpBodyWriter_t* i_inst,const NyLPC_TChar* i_fmt,...);\r
61 NyLPC_TBool NyLPC_cHttpBodyWriter_formatV(NyLPC_TcHttpBodyWriter_t* i_inst,const NyLPC_TChar* i_fmt,va_list i_args);\r
62 \r
63 \r
64 \r
65 #ifdef __cplusplus\r
66 }\r
67 #endif /* __cplusplus */\r
68 \r
69 #endif /* NYLPC_CHTTPBODYWRITER_H_ */\r