This is Webservice SDK for mbed. LPCXpresso1769/LPC1768/FRDM-K64F/LPC4088

Dependents:   MbedFileServer_1768MiniDK2 RedWireBridge IssueDebug_gcc MiMicRemoteMCU-for-Mbed ... more

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers NyLPC_cModRomFiles.h Source File

NyLPC_cModRomFiles.h

00001 /*********************************************************************************
00002  * PROJECT: MiMic
00003  * --------------------------------------------------------------------------------
00004  *
00005  * This file is part of MiMic
00006  * Copyright (C)2011 Ryo Iizuka
00007  *
00008  * MiMic is free software: you can redistribute it and/or modify
00009  * it under the terms of the GNU Lesser General Public License as published
00010  * by the Free Software Foundation, either version 3 of the License, or
00011  * (at your option) any later version.
00012  *
00013  * This program is distributed in the hope that it will be useful,
00014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016  * GNU General Public License for more details.
00017  *
00018  * You should have received a copy of the GNU Lesser General Public License
00019  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
00020  *
00021  * For further information please contact.
00022  *  http://nyatla.jp/
00023  *  <airmail(at)ebony.plala.or.jp> or <nyatla(at)nyatla.jp>
00024  *
00025  *********************************************************************************/
00026 #ifndef NYLPC_CMODROMFILES_H_
00027 #define NYLPC_CMODROMFILES_H_
00028 #include "NyLPC_http.h"
00029 #include "../NyLPC_cHttpdConnection.h"
00030 #include "NyLPC_cModUrl.h"
00031 #include "NyLPC_utils.h"
00032 #ifdef __cplusplus
00033 extern "C" {
00034 #endif /* __cplusplus */
00035 
00036 
00037 /**
00038  * ROMFileDataに格納したファイルデータを返すモジュールクラスです。
00039  * モジュールに登録したファイルデータは、initializeに登録したルートパスが一致したときに動作します。
00040  * 例えばrootpathが"/test/"の場合に、"/test/my.jpg"のリクエストが有る場合、
00041  * "my.jpg"が登録されていればそれを返します。登録されていなければ404エラーを返します。
00042  * プレフィクスを除いたURLの長さは32-1文字です。
00043  */
00044 typedef struct NyLPC_TcModRomFiles NyLPC_TcModRomFiles_t;
00045 
00046 
00047 struct NyLPC_TcModRomFiles
00048 {
00049     NyLPC_TcModUrl_t super;
00050     /** ルートパス*/
00051     const NyLPC_TChar* _ref_root_path;
00052     /** ROMFileのデータ*/
00053     const struct NyLPC_TRomFileData* _data;
00054     /** ROMFILEデータの数*/
00055     int _num_of_data;
00056 };
00057 
00058 /**
00059  * コンストラクタ。
00060  * @param i_ref_path
00061  * 16文字以内のルートパスを指定します。文字列は外部参照です。インスタンスをfinalizeするまで維持してください。
00062  * path:= {.+}{/(.+)}?
00063  * @param i_ref_root_path
00064  * Must set static variable or hold value until instance is finished.
00065  * 静的に宣言された文字列を指定してください。
00066  */
00067 void NyLPC_cModRomFiles_initialize(NyLPC_TcModRomFiles_t* i_inst,const NyLPC_TChar* i_ref_root_path,const struct NyLPC_TRomFileData* i_data,int i_num_of_data);
00068 void NyLPC_cModRomFiles_finalize(NyLPC_TcModRomFiles_t* i_inst);
00069 
00070 /**
00071  * モジュールがコネクションをハンドリングできるかを返します。
00072  */
00073 NyLPC_TBool NyLPC_cModRomFiles_canHandle(NyLPC_TcModRomFiles_t* i_inst,NyLPC_TcHttpdConnection_t* i_connection);
00074 /**
00075  * モジュールを実行します。canHandleがtrueの時だけ実行できます。
00076  * @return
00077  * 処理が成功すればtrue。失敗したらfalse
00078  */
00079 NyLPC_TBool NyLPC_cModRomFiles_execute(NyLPC_TcModRomFiles_t* i_inst,NyLPC_TcHttpdConnection_t* i_connection);
00080 
00081 
00082 
00083 
00084 
00085 
00086 #ifdef __cplusplus
00087 }
00088 #endif /* __cplusplus */
00089 
00090 #endif /* NYLPC_CMODROMFILES_H_ */