1 /*********************************************************************************
\r
3 * --------------------------------------------------------------------------------
\r
5 * This file is part of MiMic
\r
6 * Copyright (C)2011 Ryo Iizuka
\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
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
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
21 * For further information please contact.
\r
23 * <airmail(at)ebony.plala.or.jp> or <nyatla(at)nyatla.jp>
\r
25 *********************************************************************************/
\r
26 #ifndef NYLPC_CHTTPHEADERWRITER_H_
\r
27 #define NYLPC_CHTTPHEADERWRITER_H_
\r
29 #include "NyLPC_stdlib.h"
\r
30 #include "NyLPC_uipService.h"
\r
31 #include "NyLPC_cHttpStream.h"
\r
32 #include "NyLPC_cHttpBasicHeaderParser.h"
\r
33 #include "NyLPC_cHttpdConfig.h"
\r
37 #endif /* __cplusplus */
\r
40 typedef struct NyLPC_TcHttpHeaderWriter NyLPC_TcHttpHeaderWriter_t;
\r
41 struct NyLPC_TcHttpHeaderWriter
\r
43 NyLPC_TUInt8 _is_chunked;
\r
44 NyLPC_TUInt8 _is_close;
\r
46 NyLPC_TUInt8 _is_error;
\r
48 NyLPC_TUInt32 _content_length;
\r
49 NyLPC_TUInt32 _size_of_sent;
\r
51 NyLPC_TiHttpPtrStream_t* _ref_stream;
\r
55 * Httpリクエストヘッダに対応したHttpヘッダライタを構築します。
\r
56 * インスタンスは、正常/異常の2状態を持ちます。
\r
58 * ConnectionCloseは有効です。
\r
61 NyLPC_TBool NyLPC_cHttpHeaderWriter_initialize(NyLPC_TcHttpHeaderWriter_t* i_inst,NyLPC_TiHttpPtrStream_t* i_ref_stream,const struct NyLPC_THttpBasicHeader* i_req_header);
\r
63 #define NyLPC_cHttpHeaderWriter_finalize(i)
\r
64 NyLPC_TBool NyLPC_cHttpHeaderWriter_writeRequestHeader(NyLPC_TcHttpHeaderWriter_t* i_inst,NyLPC_THttpMethodType i_method,const struct NyLPC_TIPv4Addr* i_host,NyLPC_TUInt16 i_port,const NyLPC_TChar* i_path);
\r
65 NyLPC_TBool NyLPC_cHttpHeaderWriter_writeResponseHeader(NyLPC_TcHttpHeaderWriter_t* i_inst,NyLPC_TUInt16 i_status);
\r
66 NyLPC_TBool NyLPC_cHttpHeaderWriter_writeMessage(NyLPC_TcHttpHeaderWriter_t* i_inst,const NyLPC_TChar* i_name,const NyLPC_TChar* i_field);
\r
68 * \r\n区切りのメッセージをそのままヘッダに挿入します。i_additional_headerの終端は\r\nで閉じてください。
\r
70 NyLPC_TBool NyLPC_cHttpHeaderWriter_writeRawMessage(NyLPC_TcHttpHeaderWriter_t* i_inst,const NyLPC_TChar* i_additional_header);
\r
71 NyLPC_TBool NyLPC_cHttpHeaderWriter_close(NyLPC_TcHttpHeaderWriter_t* i_inst);
\r
72 void NyLPC_cHttpHeaderWriter_setContentLength(NyLPC_TcHttpHeaderWriter_t* i_inst,NyLPC_TUInt32 i_content_length);
\r
74 * ConnectionCloseのON/OFFを設定します。
\r
76 void NyLPC_cHttpHeaderWriter_setConnectionClose(NyLPC_TcHttpHeaderWriter_t* i_inst,NyLPC_TBool i_is_close);
\r
77 void NyLPC_cHttpHeaderWriter_setChunked(NyLPC_TcHttpHeaderWriter_t* i_inst);
\r
81 #endif /* __cplusplus */
\r
83 #endif /* NYLPC_CHTTPHEADERWRITER_H_ */
\r