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_CMODURL_H_
\r
27 #define NYLPC_CMODURL_H_
\r
29 #include "NyLPC_http.h"
\r
30 #include "../NyLPC_cHttpdConnection.h"
\r
34 #endif /* __cplusplus */
\r
39 typedef NyLPC_TUInt8 NyLPC_cModUrl_ParseMode;
\r
43 #define NyLPC_cModUrl_ParseMode_ALL 0x00
\r
46 * /absolutepath/?queryや/absolutepath/#bookmarkの/absolutepath/だけを取り出します。
\r
48 #define NyLPC_cModUrl_ParseMode_PATH_ONLY 0x01
\r
52 * コネクションヘッダからURLを取得します。
\r
54 typedef struct NyLPC_TcModUrl NyLPC_TcModUrl_t;
\r
57 struct NyLPC_TcModUrl
\r
59 struct NyLPC_THttpBasicHeader _header;
\r
60 NyLPC_TcHttpBodyParser_t _body_parser;
\r
66 void NyLPC_cModUrl_initialize(NyLPC_TcModUrl_t* i_inst);
\r
67 void NyLPC_cModUrl_finalize(NyLPC_TcModUrl_t* i_inst);
\r
70 * コネクションから全てのURLをパースします。
\r
71 * NyLPC_cModUrl_execute2のラッパーです。i_i_pass_prefix_len=0,i_mode=NyLPC_cModUrl_ParseMode_ALLを指定したときと同じ動作をします。
\r
73 * 取得したURL文字列。i_pass_prefix_lenが指定されている場合は、URLの後半部分です。
\r
76 * 処理が成功するとTRUEを返します。FALSEの場合、URLのパースに失敗しています。
\r
77 * TRUEの場合は引き続きResponseの送信処理をしてください。FALSEの場合はそのままリクエストハンドラを終了してください。
\r
79 #define NyLPC_cModUrl_execute(i_inst,i_connection,o_url_buf,i_length_buf) NyLPC_cModUrl_execute2((i_inst),(i_connection),(o_url_buf),(i_length_buf),0,NyLPC_cModUrl_ParseMode_ALL)
\r
82 * コネクションからURLをパースします。
\r
83 * @param i_i_pass_prefix_len
\r
85 * 全てのURLを得るには0を指定します。
\r
87 * 取得したURL文字列。i_pass_prefix_lenが指定されている場合は、URLの後半部分です。
\r
92 * <li>NyLPC_cModUrl_ParseMode_ALL - URL全てを取得します。</li>
\r
93 * <li>NyLPC_cModUrl_ParseMode_PATH_ONLY - クエリ文字列、ブックマークを除く文字列を取得します。</li>
\r
96 * 処理が成功するとTRUEを返します。FALSEの場合、URLのパースに失敗しています。
\r
97 * TRUEの場合は引き続きResponseの送信処理をしてください。FALSEの場合はそのままリクエストハンドラを終了してください。
\r
99 NyLPC_TBool NyLPC_cModUrl_execute2(NyLPC_TcModUrl_t* i_inst,NyLPC_TcHttpdConnection_t* i_connection,char* o_url_buf,NyLPC_TInt16 i_length_buf,NyLPC_TInt16 i_pass_prefix_len, NyLPC_cModUrl_ParseMode i_mode);
\r
102 * HTTPストリームからBODY部分を読み出す。
\r
103 * この関数はexecuteが成功した後に利用できます。
\r
111 NyLPC_TInt16 NyLPC_cModUrl_readBody(NyLPC_TcModUrl_t* i_inst,NyLPC_TcHttpdConnection_t* i_connection,void* i_buf,NyLPC_TInt16 i_buf_size);
\r
114 * basicヘッダオブジェクトを返します。
\r
116 const struct NyLPC_THttpBasicHeader* NyLPC_cModUrl_getHeader(const NyLPC_TcModUrl_t* i_inst);
\r
121 NyLPC_THttpMethodType NyLPC_cModUrl_getMethod(const NyLPC_TcModUrl_t* i_inst);
\r
130 #endif /* __cplusplus */
\r
135 #endif /* NYLPC_CMODURL_H_ */
\r