This is Webservice SDK for mbed. LPCXpresso1769/LPC1768/FRDM-K64F/LPC4088
Dependents: MbedFileServer_1768MiniDK2 RedWireBridge IssueDebug_gcc MiMicRemoteMCU-for-Mbed ... more
NyLPC_cModMiMicSetting.c
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 #include "NyLPC_cModMiMicSetting.h" 00027 #include "NyLPC_stdlib.h" 00028 #include "../NyLPC_cHttpdUtils.h" 00029 #include "NyLPC_http.h" 00030 #include "NyLPC_mimicVm.h" 00031 #include "NyLPC_flash.h" 00032 #include "../NyLPC_cHttpdConnection_protected.h" 00033 //#include <ctype.h> 00034 00035 #define MOD_VERSION "ModMiMicSetting/1.4" 00036 #define SIZE_OF_SETUP_PARAM 8 00037 struct TModMiMicSettingRequest 00038 { 00039 struct NyLPC_THttpBasicHeader super; 00040 NyLPC_TUInt8 _content_id; 00041 //解析用 00042 NyLPC_TUInt8 _qery_name_id; 00043 NyLPC_TUInt8 _astate; 00044 NyLPC_TInt16 _prefix_len; 00045 NyLPC_TcStr_t _tstr; 00046 NyLPC_TChar _tstr_buf[16]; 00047 /** 文字列のパーサ*/ 00048 NyLPC_TcMiMicDbCompiler_t _binparser; 00049 union{ 00050 /** 00051 * スタックサイズ削減のための構造体。tmpは受信処理に使用。 00052 * memimgはFlashへ書き込むときに使用。 00053 */ 00054 union{ 00055 /** 00056 * 受信用構造体。host_name,param_buf[6]までのデータは、memimgのfast_boot以降のデータ構造と位置をあわせてください。 00057 * param_buf[7]以降については値変換必須 00058 * tmpにデータを作成後にmemimgへ整形して書きこむかんじ。 00059 */ 00060 struct{ 00061 NyLPC_TUInt16 param_len; 00062 NyLPC_TUInt16 host_len; 00063 NyLPC_TChar host_name[NyLPC_TcNetConfig_HOSTNAME_LEN]; 00064 /**pパラメータ。最大長さは16。 00065 * 詳細はNyLPC_TcModMiMicSetting_tを参照 00066 */ 00067 NyLPC_TUInt32 param_buf[SIZE_OF_SETUP_PARAM]; 00068 NyLPC_TUInt32 cval;//コマンド値 00069 }tmp; 00070 /** 00071 * 書き込み用構造体 00072 */ 00073 struct NyLPC_TMiMicConfigulation memimg; 00074 }setup; 00075 struct{ 00076 /** 00077 * 不明な名前の場合は、ここに名前をコピー 00078 */ 00079 NyLPC_TChar path[32]; 00080 }unknown; 00081 }content; 00082 }; 00083 00084 #define ST_PARSE_PATH 1 00085 #define ST_PARSE_QUERY_NAME 2 00086 #define ST_PARSE_QUERY_VALUE 3 //Query読み出し中 00087 #define ST_PARSE_QUERY_VALUE_P 4 00088 #define ST_PARSE_QUERY_VALUE_C 5 00089 #define ST_PARSE_QUERY_VALUE_HOST 6 00090 /** 00091 * コンテンツID定義(コンテンツ名に対応) 00092 */ 00093 #define CONTENT_ID_UNKNOWN 1 00094 #define CONTENT_ID_SETUP 2 00095 #define CONTENT_ID_INDEX 3 00096 #define CONTENT_ID_STATUS 4 00097 #define CONTENT_ID_CSS 5 00098 #define CONTENT_ID_LOGO 6 00099 00100 #define QNAME_ID_P 4 00101 #define QNAME_ID_C 5 00102 #define QNAME_ID_HOST 6 00103 #define QNAME_ID_UNKNOWN 0 00104 00105 #define QVAL_C_GET 1 00106 #define QVAL_C_UPDATE 2 00107 #define QVAL_C_UNKNOWN 0 00108 00109 00110 static const struct NyLPC_TTextIdTbl url_tbl[]= 00111 { 00112 {"setup.api",CONTENT_ID_SETUP}, 00113 {NULL,CONTENT_ID_UNKNOWN} 00114 }; 00115 00116 static const struct NyLPC_TTextIdTbl qname_id_table[]= 00117 { 00118 {"p",QNAME_ID_P}, 00119 {"c",QNAME_ID_C}, 00120 {"host",QNAME_ID_HOST}, 00121 {NULL,QNAME_ID_UNKNOWN} 00122 }; 00123 00124 00125 00126 00127 static NyLPC_TBool urlHandler(NyLPC_TcHttpBasicHeaderParser_t* i_inst,NyLPC_TChar i_c,struct NyLPC_THttpBasicHeader* o_out) 00128 { 00129 00130 struct TModMiMicSettingRequest* out=(struct TModMiMicSettingRequest*)o_out; 00131 //読み飛ばし 00132 if(out->_prefix_len<0){ 00133 out->_prefix_len++; 00134 return NyLPC_TBool_TRUE;//読み飛ばし 00135 } 00136 if(out->_astate==ST_PARSE_PATH){ 00137 if(i_c!='\0' && i_c!='?'){ 00138 if(!NyLPC_cStr_put(&(out->_tstr),i_c)){ 00139 NyLPC_OnErrorGoto(ERROR); 00140 } 00141 return NyLPC_TBool_TRUE; 00142 } 00143 out->_content_id=NyLPC_TTextIdTbl_getMatchId(NyLPC_cStr_str(&(out->_tstr)),url_tbl); 00144 switch(out->_content_id) 00145 { 00146 case CONTENT_ID_SETUP: 00147 out->content.setup.tmp.param_len=0;//クエリが無い場合の初期値 00148 out->content.setup.tmp.host_len =0;//クエリが無い場合の初期値 00149 out->content.setup.tmp.cval=QVAL_C_UNKNOWN; 00150 break; 00151 default: 00152 break; 00153 } 00154 NyLPC_cStr_clear(&(out->_tstr)); 00155 out->_astate=ST_PARSE_QUERY_NAME;//クエリ名解析へ 00156 return NyLPC_TBool_TRUE; 00157 } 00158 switch(out->_content_id) 00159 { 00160 case CONTENT_ID_SETUP: 00161 switch(out->_astate){ 00162 case ST_PARSE_QUERY_NAME: 00163 if(i_c!='\0' && i_c!='&' && i_c!='='){ 00164 if(!NyLPC_cStr_put(&(out->_tstr),i_c)){ 00165 NyLPC_OnErrorGoto(ERROR); 00166 } 00167 return NyLPC_TBool_TRUE; 00168 } 00169 //Query確定。 00170 out->_qery_name_id=NyLPC_TTextIdTbl_getMatchId(NyLPC_cStr_str(&(out->_tstr)),qname_id_table); 00171 NyLPC_cStr_clear(&(out->_tstr)); 00172 //クエリ値がある場合 00173 switch(out->_qery_name_id){ 00174 case QNAME_ID_P: 00175 out->_astate=ST_PARSE_QUERY_VALUE_P;//MIMICBCのDBパラメータパーサを借用。 00176 out->content.setup.tmp.param_len=0; 00177 break; 00178 case QNAME_ID_C: 00179 out->_astate=ST_PARSE_QUERY_VALUE_C; 00180 break; 00181 case QNAME_ID_HOST: 00182 out->_astate=ST_PARSE_QUERY_VALUE_HOST;//_host_nameに蓄積 00183 out->content.setup.tmp.host_len=0; 00184 break; 00185 default: 00186 out->_astate=ST_PARSE_QUERY_VALUE; 00187 break; 00188 } 00189 return NyLPC_TBool_TRUE; 00190 case ST_PARSE_QUERY_VALUE: 00191 //未知のクエリは無視 00192 if(i_c!='\0' && i_c!='&'){ 00193 return NyLPC_TBool_TRUE; 00194 } 00195 //クエリ値解析完了 00196 out->_astate=ST_PARSE_QUERY_NAME; 00197 return NyLPC_TBool_TRUE; 00198 case ST_PARSE_QUERY_VALUE_HOST: 00199 //未知のクエリは無視 00200 if(i_c!='\0' && i_c!='&'){ 00201 //許可する文字列は、[:AlNum:]||'_' 00202 if(!isalnum((int)i_c) && i_c!='_'){ 00203 NyLPC_OnErrorGoto(ERROR); 00204 } 00205 out->content.setup.tmp.host_name[out->content.setup.tmp.host_len++]=i_c; 00206 if(out->content.setup.tmp.host_len>=NyLPC_TcNetConfig_HOSTNAME_LEN){ 00207 //長すぎ 00208 NyLPC_OnErrorGoto(ERROR); 00209 } 00210 return NyLPC_TBool_TRUE; 00211 } 00212 //クエリ値解析完了 00213 out->content.setup.tmp.host_name[out->content.setup.tmp.host_len]='\0'; 00214 out->_astate=ST_PARSE_QUERY_NAME; 00215 return NyLPC_TBool_TRUE; 00216 case ST_PARSE_QUERY_VALUE_C: 00217 if(i_c!='\0' && i_c!='&'){ 00218 if(!NyLPC_cStr_put(&(out->_tstr),i_c)){ 00219 NyLPC_OnErrorGoto(ERROR); 00220 } 00221 return NyLPC_TBool_TRUE; 00222 } 00223 if(NyLPC_cStr_isEqual(&out->_tstr,"get")){ 00224 out->content.setup.tmp.cval=QVAL_C_GET; 00225 }else if(NyLPC_cStr_isEqual(&out->_tstr,"update")){ 00226 out->content.setup.tmp.cval=QVAL_C_UPDATE; 00227 }else{ 00228 NyLPC_OnErrorGoto(ERROR); 00229 } 00230 out->_astate=ST_PARSE_QUERY_NAME; 00231 NyLPC_cStr_clear(&(out->_tstr)); 00232 return NyLPC_TBool_TRUE; 00233 case ST_PARSE_QUERY_VALUE_P: 00234 if(i_c!='\0' && i_c!='&'){ 00235 if(out->content.setup.tmp.param_len>=SIZE_OF_SETUP_PARAM) 00236 { 00237 NyLPC_OnErrorGoto(ERROR); 00238 } 00239 switch(NyLPC_cMiMicDbCompiler_compileFragment2(&(out->_binparser),i_c,out->content.setup.tmp.param_buf+out->content.setup.tmp.param_len)) 00240 { 00241 case NyLPC_TcMiMicDbCompiler_RET_CONTINUE: 00242 break; 00243 case NyLPC_TcMiMicDbCompiler_RET_OK: 00244 out->content.setup.tmp.param_len++; 00245 break; 00246 case NyLPC_TcMiMicDbCompiler_RET_ERROR: 00247 default: 00248 //ERROR 00249 NyLPC_OnErrorGoto(ERROR); 00250 } 00251 return NyLPC_TBool_TRUE; 00252 } 00253 //区切りのいいところで終わってる? 00254 if(NyLPC_cMiMicDbCompiler_hasFragment(&(out->_binparser))){ 00255 //ERROR 00256 NyLPC_OnErrorGoto(ERROR); 00257 } 00258 //終端しているなら、次のクエリへ 00259 out->_astate=ST_PARSE_QUERY_NAME; 00260 NyLPC_cStr_clear(&(out->_tstr)); 00261 return NyLPC_TBool_TRUE; 00262 default: 00263 break; 00264 } 00265 NyLPC_OnErrorGoto(ERROR); 00266 default: 00267 NyLPC_OnErrorGoto(ERROR); 00268 } 00269 return NyLPC_TBool_TRUE; 00270 ERROR: 00271 return NyLPC_TBool_FALSE; 00272 } 00273 /** 00274 * デフォルトハンドラ 00275 */ 00276 static const struct NyLPC_TcHttpBasicHeaderParser_Handler handler= 00277 { 00278 NULL, 00279 urlHandler 00280 }; 00281 00282 00283 /** 00284 * コンストラクタ。 00285 */ 00286 void NyLPC_cModMiMicSetting_initialize(NyLPC_TcModMiMicSetting_t* i_inst,const NyLPC_TChar* i_ref_root_path) 00287 { 00288 NyLPC_cModRomFiles_initialize(&i_inst->super,i_ref_root_path,NULL,0); 00289 } 00290 void NyLPC_cModMiMicSetting_finalize(NyLPC_TcModMiMicSetting_t* i_inst) 00291 { 00292 NyLPC_cModRomFiles_finalize(&i_inst->super); 00293 } 00294 /** 00295 * モジュールがコネクションをハンドリングできるかを返します。 00296 */ 00297 NyLPC_TBool NyLPC_cModMiMicSetting_canHandle(NyLPC_TcModMiMicSetting_t* i_inst,NyLPC_TcHttpdConnection_t* i_connection) 00298 { 00299 return NyLPC_cModRomFiles_canHandle(&i_inst->super,i_connection); 00300 } 00301 00302 00303 00304 static void setup_proc(NyLPC_TcHttpdConnection_t* i_connection,struct TModMiMicSettingRequest* i_req); 00305 00306 /** 00307 * モジュールを実行します。 00308 */ 00309 NyLPC_TBool NyLPC_cModMiMicSetting_execute(NyLPC_TcModMiMicSetting_t* i_inst,NyLPC_TcHttpdConnection_t* i_connection) 00310 { 00311 NyLPC_TUInt8 method_type; 00312 struct TModMiMicSettingRequest header; 00313 NyLPC_TcHttpBasicHeaderParser_t parser; 00314 00315 //リクエストParse済へ遷移(この関数の後はModが責任を持ってリクエストを返却) 00316 NyLPC_cHttpdConnection_setReqStatusParsed(i_connection); 00317 00318 //URL解析の準備 00319 header._prefix_len=-((NyLPC_TInt16)strlen(i_inst->super._ref_root_path)+2); 00320 header._astate=ST_PARSE_PATH; 00321 NyLPC_cStr_initialize(&header._tstr,header._tstr_buf,16); 00322 NyLPC_cMiMicDbCompiler_initialize(&header._binparser); 00323 00324 NyLPC_cHttpBasicHeaderParser_initialize(&parser,&handler); 00325 //プリフェッチしたデータを流す 00326 NyLPC_cHttpBasicHeaderParser_parseInit(&parser,&(header.super)); 00327 NyLPC_cHttpdConnection_pushPrefetchInfo(i_connection,&parser,&header.super); 00328 //後続をストリームから取り込む 00329 if(!NyLPC_cHttpBasicHeaderParser_parseStream(&parser,NyLPC_cHttpdConnection_refStream(i_connection),&(header.super))){ 00330 NyLPC_cHttpdUtils_sendErrorResponse(i_connection,500); 00331 NyLPC_OnErrorGoto(Error2); 00332 } 00333 if(!NyLPC_cHttpBasicHeaderParser_parseFinish(&parser,&(header.super))){ 00334 NyLPC_cHttpdUtils_sendErrorResponse(i_connection,500); 00335 NyLPC_OnErrorGoto(Error2); 00336 } 00337 //GETかHEADに制限 00338 method_type=NyLPC_cHttpdConnection_getMethod(i_connection); 00339 if(method_type!=NyLPC_THttpMethodType_GET && method_type!=NyLPC_THttpMethodType_HEAD) 00340 { 00341 NyLPC_cHttpdUtils_sendErrorResponse(i_connection,405); 00342 NyLPC_OnErrorGoto(Error2); 00343 } 00344 //Request::ConnectionがClose設定,又はHTTP1.1では無い場合,CLOSE 00345 if(header.super.connection==NyLPC_THttpMessgeHeader_Connection_CLOSE || header.super.startline.req.version!=NyLPC_THttpVersion_11) 00346 { 00347 NyLPC_cHttpdConnection_setConnectionMode(i_connection,NyLPC_TcHttpdConnection_CONNECTION_MODE_CLOSE); 00348 } 00349 //CGIの実行 00350 switch(header._content_id) 00351 { 00352 case CONTENT_ID_SETUP: 00353 setup_proc(i_connection,&header); 00354 break; 00355 case CONTENT_ID_UNKNOWN: 00356 default: 00357 NyLPC_cHttpdUtils_sendErrorResponse(i_connection,500); 00358 NyLPC_OnErrorGoto(Error2); 00359 } 00360 NyLPC_cHttpBasicHeaderParser_finalize(&parser); 00361 NyLPC_cMiMicDbCompiler_finalize(&header._binparser); 00362 NyLPC_cStr_finalize(&(header._tstr)); 00363 return NyLPC_TBool_TRUE; 00364 Error2: 00365 NyLPC_cHttpBasicHeaderParser_finalize(&parser); 00366 NyLPC_cMiMicDbCompiler_finalize(&header._binparser); 00367 NyLPC_cStr_finalize(&(header._tstr)); 00368 00369 return NyLPC_TBool_FALSE; 00370 } 00371 00372 00373 static void setup_proc(NyLPC_TcHttpdConnection_t* i_connection,struct TModMiMicSettingRequest* i_req) 00374 { 00375 NyLPC_TBool ret; 00376 const struct NyLPC_TMiMicConfigulation* config; 00377 const NyLPC_TcNetConfig_t* currebt_cfg; 00378 const struct NyLPC_TNetInterfaceInfo* netif_info; 00379 NyLPC_Assert( 00380 (NyLPC_cHttpdConnection_getMethod(i_connection)==NyLPC_THttpMethodType_GET)|| 00381 (NyLPC_cHttpdConnection_getMethod(i_connection)==NyLPC_THttpMethodType_HEAD)); 00382 00383 switch(i_req->content.setup.tmp.cval){ 00384 case QVAL_C_GET: 00385 if(!NyLPC_cHttpdUtils_sendJsonHeader(i_connection)){ 00386 NyLPC_OnErrorGoto(Error); 00387 } 00388 if(NyLPC_cHttpdConnection_getMethod(i_connection)==NyLPC_THttpMethodType_GET){ 00389 config=NyLPC_cMiMicConfiglation_loadFromFlash(); 00390 //Flashの内容から 00391 if(!NyLPC_cHttpdConnection_sendResponseBodyF(i_connection, 00392 "{" 00393 "\"application\":\""MOD_VERSION";%s;%s(%s)\"," 00394 "\"landev\":\"%s\",", 00395 NyLPC_cMiMicEnv_getStrProperty(NyLPC_cMiMicEnv_VERSION), 00396 NyLPC_cMiMicEnv_getStrProperty(NyLPC_cMiMicEnv_SHORT_NAME), 00397 NyLPC_cMiMicEnv_getStrProperty(NyLPC_cMiMicEnv_MCU_NAME), 00398 NyLPC_cMiMicEnv_getStrProperty(NyLPC_cMiMicEnv_ETHERNET_PHY) 00399 )) 00400 { 00401 NyLPC_OnErrorGoto(Error); 00402 } 00403 if(!NyLPC_cHttpdConnection_sendResponseBodyF(i_connection, 00404 "\"cfg\":{" 00405 "\"mac00010203\":%u," 00406 "\"mac0405xxxx\":%u," 00407 "\"host\":\"%s\"," 00408 "\"ipv4\":{" 00409 "\"flags\":%u," 00410 "\"ip\":%u," 00411 "\"mask\":%u," 00412 "\"droute\":%u," 00413 "}," 00414 "\"services\":{" 00415 "\"flags\":%u," 00416 "\"http_port\":%u" 00417 "}},", 00418 config->mac_00_01_02_03, 00419 config->mac_04_05_xx_xx, 00420 config->hostname, 00421 config->ipv4_flags, 00422 config->ipv4_addr_net, 00423 config->ipv4_mask_net, 00424 config->ipv4_drut_net, 00425 config->srv_flags, 00426 config->http_port 00427 )){ 00428 NyLPC_OnErrorGoto(Error); 00429 } 00430 //write current status 00431 netif_info=NyLPC_cNet_getInterfaceInfo(); 00432 currebt_cfg=(const NyLPC_TcNetConfig_t*)(netif_info->current_config); 00433 if(!NyLPC_cHttpdConnection_sendResponseBodyF(i_connection, 00434 "\"cur\":{" 00435 "\"mac00010203\":%u," 00436 "\"mac0405xxxx\":%u," 00437 "\"host\":\"%s\"," 00438 "\"ipv4\":{" 00439 "\"flags\":%u," 00440 "\"ip\":%u," 00441 "\"mask\":%u," 00442 "\"droute\":%u," 00443 "}," 00444 "\"services\":{" 00445 "\"flags\":%u," 00446 "\"http_port\":%u" 00447 "}}}", 00448 (currebt_cfg->super.eth_mac.addr[0]<<24)|(currebt_cfg->super.eth_mac.addr[1]<<16)|(currebt_cfg->super.eth_mac.addr[2]<<8)|currebt_cfg->super.eth_mac.addr[3], 00449 (currebt_cfg->super.eth_mac.addr[4]<<24)|(currebt_cfg->super.eth_mac.addr[5]<<16), 00450 currebt_cfg->hostname, 00451 currebt_cfg->tcp_mode, 00452 NyLPC_ntohl(currebt_cfg->super.ip_addr.v), 00453 NyLPC_ntohl(currebt_cfg->super.netmask.v), 00454 NyLPC_ntohl(currebt_cfg->super.dr_addr.v), 00455 currebt_cfg->services.flags, 00456 currebt_cfg->services.http_port 00457 )){ 00458 NyLPC_OnErrorGoto(Error); 00459 } 00460 } 00461 break; 00462 case QVAL_C_UPDATE: 00463 //check parameter length 00464 if(i_req->content.setup.tmp.param_len!=SIZE_OF_SETUP_PARAM || i_req->content.setup.tmp.host_len<1) 00465 { 00466 NyLPC_cHttpdUtils_sendErrorResponse(i_connection,500); 00467 }else{ 00468 //パラメータ→ROMイメージ変換 00469 i_req->content.setup.memimg.fast_boot=0xffffffff; 00470 // ここの部分は受信時にデータ位置を合わせてあるのでコピー不要。 00471 // cfg_image.mac_00_01_02_03=(i_req->content.setup.param_buf[0]); 00472 // cfg_image.mac_04_05_xx_xx=(i_req->content.setup.param_buf[1]&0xffff0000); 00473 // cfg_image.ipv4_flags =i_req->content.setup.param_buf[2]; 00474 // cfg_image.ipv4_addr_net =i_req->content.setup.param_buf[3]; 00475 // cfg_image.ipv4_mask_net =i_req->content.setup.param_buf[4]; 00476 // cfg_image.ipv4_drut_net =i_req->content.setup.param_buf[5]; 00477 // cfg_image.srv_flags =i_req->content.setup.param_buf[6]; 00478 // strcpy(cfg_image.hostname,i_req->content.setup.host_name); 00479 i_req->content.setup.memimg.http_port =(NyLPC_TUInt16)(i_req->content.setup.tmp.param_buf[7]>>16); 00480 i_req->content.setup.memimg.padding32=0xffff; 00481 i_req->content.setup.memimg.padding64=0xffffffff; 00482 //一応確認。 00483 if(i_req->content.setup.memimg.http_port==0){ 00484 NyLPC_cHttpdUtils_sendErrorResponse(i_connection,500); 00485 }else{ 00486 //FreeRTOSの停止 00487 NyLPC_cIsr_enterCritical(); 00488 //Flashへの書き込み 00489 ret=NyLPC_cMiMicConfiglation_updateConfigulation(&i_req->content.setup.memimg); 00490 //FreeRTOSの復帰 00491 NyLPC_cIsr_exitCritical(); 00492 if(!ret){ 00493 NyLPC_cHttpdUtils_sendErrorResponse(i_connection,500); 00494 }else{ 00495 if(!NyLPC_cHttpdUtils_sendJsonHeader(i_connection)){ 00496 NyLPC_OnErrorGoto(Error); 00497 } 00498 if(NyLPC_cHttpdConnection_getMethod(i_connection)==NyLPC_THttpMethodType_GET){ 00499 NyLPC_cHttpdConnection_sendResponseBodyF(i_connection, 00500 "{\"application\":\""MOD_VERSION"\",\"result\":%u}", 00501 ret?0x00000000:0x80000000); 00502 } 00503 } 00504 } 00505 } 00506 //JSONを書く。 00507 break; 00508 default: 00509 NyLPC_cHttpdUtils_sendErrorResponse(i_connection,400); 00510 NyLPC_OnErrorGoto(Error); 00511 break; 00512 } 00513 return; 00514 Error: 00515 return; 00516 }
Generated on Tue Jul 12 2022 15:46:16 by 1.7.2