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

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

libMiMic(MiMic library for mbed)は、WebService機能を提供するSDKです。 mbedでWebAPIに対応したネットワークデバイスを簡単に作ることが出来ます。

libMiMicはMiMic projectで開発しています。MiMic projectについてはこちらをご覧ください。 http://nyatla.jp/mimic/wp/

構成

libMiMicはmbedRTOS上で動作し、ユーザアプリケーションにAPIを提供します。コアAPIはC言語で記述されていますが、使用頻度の高いものについてはmbed向けのC++APIが準備されています。

/media/uploads/nyatla/libmimic-sdk.png

※libMiMicはmbedの標準イーサネットドライバをしようしていません。

標準イーサネットドライバと同時に使用することはできません。

  • MiMicIP - IPv4スタックです。レテンシとメモリ消費量を抑えたuipベースのライブラリです。
  • ARP/ICMP/UDP/TCP - 基礎的なソケットAPIを提供します。APIは独自です。
  • HTTP/1.1 Server - HTTP/1.1に対応したサーバです。マルチセッション・Chunked・持続性接続に対応しています。
  • HTTP Modules - HTTP/1.1の機能モジュールです。以下のモジュールがあります。
    • ROM file provider - ROMに格納したファイルイメージを公開します。
    • File system provider - mbedファイルシステムを公開します。
    • Onchip configuration - プログラムフラッシュを利用して設定を保存します。
    • MiMicVM processor - RPCリクエスト(MiMicVM)を処理します。
    • FileUpload - ファイルアップロードを受け取ります。
    • URL decoder - HTTPリクエストを解析します。
    • UPnP handler -UPnPメッセージを処理します。
    • WebSocket - Websocketサーバです。
  • mDNS - マルチキャストDNSサービスです。
  • UPnP - UPnP/1.0の機能を提供します。UPnP handlerと協調して動作します。(現在はデバイス探索(SSDP)・デスクリプション(Description)のみ実装してあります。)
  • DHCP/APIPA - ゼロコンフィギュレーション用のモジュールです。
  • HTTP/1.1 Client
  • mbed C++ class library - mbed向けのC++CPIです。C言語のものより簡単です。

対応機種

  • mbed(mbed LPC1768)
  • LPCXpresso1769

プログラム

Import programMiMicRemoteMCU-for-Mbed

MiMic RemoteMCU for mbed. This program provides MCU control API over REST API. It can control MCU from Javascript,PHP or any HTTP rest client directly. And, The application has self development environment.

Import programMbedFileServer

The program publishes files at local directory and SD filesystem. It is a full-fledged webServer somewhat.

サンプル

Import programMiMicSimpleHttpd

This is a simplest HTTP server made ​​of libMiMic. It will echo back a request path.

Import programUPnPBasicDevice

Simplest UPnP basic device example. This program to run UPnP basic device on the mbed.

Import programWebSocketSample

MiMicSDK Websocket module sample program.

Import programHttpClientSamlpe

A http client sample program.

Import programTcpSocketClientSamlpe

MiMicSDK Tcp client socket sample program.

Import programUdpSocketSamlpe

Udp socket sample program. This program will send back the received packet.

チュートリアル

English

libMiMic(MiMic library for mbed) is SDK which provides Webservice functions. It can be created networking device easily using mbed.

See more MiMic information, See MiMic project website. http://nyatla.jp/mimic/wp/

Structure

libMiMic run on mbed RTOS and provides networking API to user application. This library has C++ class API for the mbed, and low-level C language API.

/media/uploads/nyatla/libmimic-sdk.png

For WebService general, it can be written in a simple C + + API.

libMiMic does not have the standard Ethernet driver of mbed. It is not possible that will be used with the standard Ethernet driver.

  • MiMicIP - IPv4 protocol stack. This is based uip which is reduced memory and latency.
  • ARP / ICMP / UDP / TCP - Those are provide basic IP protocols.
  • HTTP/1.1 Server - The Http server compatible HTTP/1.1. It supports multi-session, chunked transport, persistent connection.
  • HTTP Modules - There are addon-module for HTTP server. The following modules.
    • ROM file module - Publish the file images in ROM.
    • File system module - Publish thefiles in mbed file system.
    • Onchip configuration module - To save the network settings to the program flash via REST.
    • MiMicVM module - To handle the (MiMicVM) RPC request.
    • FileUpload module - Accept a file via HTTP POST.
    • URL dedoce module - A versatility URL decoder.
    • UPnP handle module - To handle UPnP messages.
    • UPnP - This provides UPnP/1.0 device functions. It works together with UPnP handler.
    • Websocket - websocket (version13) server
  • mDNS Service - DNS-SD protocol server.
  • UPnP - This provides UPnP/1.0 device functions which works with UPnP handler. (You have been implemented (SSDP) ? description only (Description) device search now.) It is a module zero configuration for - DHCP / APIPA. mbed C + + class library - C of mbed for + + is the CPI. It is simple than that of the C language.
  • DHCP/APIPA - It support zero-cpnfigulation.
  • mbed C++ class library. Almost APIs for Web applications are available.
  • HTTP/1.1 Client

Supported target

  • mbed(mbed LPC1768)
  • LPCXpresso1769

Application

Import programMiMicRemoteMCU-for-Mbed

MiMic RemoteMCU for mbed. This program provides MCU control API over REST API. It can control MCU from Javascript,PHP or any HTTP rest client directly. And, The application has self development environment.

Import programMbedFileServer

The program publishes files at local directory and SD filesystem. It is a full-fledged webServer somewhat.

Sample

Import programMiMicSimpleHttpd

This is a simplest HTTP server made ​​of libMiMic. It will echo back a request path.

Import programUPnPBasicDevice

Simplest UPnP basic device example. This program to run UPnP basic device on the mbed.

Import programWebSocketSample

MiMicSDK Websocket module sample program.

Import programHttpClientSamlpe

A http client sample program.

Import programTcpSocketClientSamlpe

MiMicSDK Tcp client socket sample program.

Import programUdpSocketSamlpe

Udp socket sample program. This program will send back the received packet.

Tutorial

Committer:
nyatla
Date:
Thu May 29 14:29:15 2014 +0000
Revision:
69:8c5f220441f5
Parent:
68:f7def7eb5504
Child:
92:4f77028cce64
r354????; LPC4088?????

Who changed what in which revision?

UserRevisionLine numberNew contents of line
nyatla 2:b96c1e90d120 1 /*********************************************************************************
nyatla 2:b96c1e90d120 2 * PROJECT: MiMic
nyatla 2:b96c1e90d120 3 * --------------------------------------------------------------------------------
nyatla 2:b96c1e90d120 4 *
nyatla 2:b96c1e90d120 5 * This file is part of MiMic
nyatla 2:b96c1e90d120 6 * Copyright (C)2011 Ryo Iizuka
nyatla 2:b96c1e90d120 7 *
nyatla 2:b96c1e90d120 8 * MiMic is free software: you can redistribute it and/or modify
nyatla 2:b96c1e90d120 9 * it under the terms of the GNU Lesser General Public License as published
nyatla 2:b96c1e90d120 10 * by the Free Software Foundation, either version 3 of the License, or
nyatla 2:b96c1e90d120 11 * (at your option) any later version.
nyatla 2:b96c1e90d120 12 *
nyatla 2:b96c1e90d120 13 * This program is distributed in the hope that it will be useful,
nyatla 2:b96c1e90d120 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
nyatla 2:b96c1e90d120 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
nyatla 2:b96c1e90d120 16 * GNU General Public License for more details.
nyatla 2:b96c1e90d120 17 *
nyatla 2:b96c1e90d120 18 * You should have received a copy of the GNU Lesser General Public License
nyatla 2:b96c1e90d120 19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
nyatla 2:b96c1e90d120 20 *
nyatla 2:b96c1e90d120 21 * For further information please contact.
nyatla 2:b96c1e90d120 22 * http://nyatla.jp/
nyatla 2:b96c1e90d120 23 * <airmail(at)ebony.plala.or.jp> or <nyatla(at)nyatla.jp>
nyatla 2:b96c1e90d120 24 *
nyatla 2:b96c1e90d120 25 *********************************************************************************/
nyatla 2:b96c1e90d120 26 #include "NyLPC_cModMiMicSetting.h"
nyatla 2:b96c1e90d120 27 #include "NyLPC_stdlib.h"
nyatla 14:4618692ec239 28 #include "../NyLPC_cHttpdUtils.h"
nyatla 2:b96c1e90d120 29 #include "NyLPC_http.h"
nyatla 2:b96c1e90d120 30 #include "NyLPC_mimicVm.h"
nyatla 2:b96c1e90d120 31 #include "NyLPC_flash.h"
nyatla 2:b96c1e90d120 32 #include "../NyLPC_cHttpdConnection_protected.h"
nyatla 7:2b33a8d84eb3 33 #include "../../NyLPC_cNet.h"
nyatla 68:f7def7eb5504 34 //#include <ctype.h>
nyatla 7:2b33a8d84eb3 35
nyatla 51:45d42af201c2 36 #define MOD_VERSION "ModMiMicSetting/1.4"
nyatla 37:fc4b4fd6a649 37 #define SIZE_OF_SETUP_PARAM 8
nyatla 2:b96c1e90d120 38 struct TModMiMicSettingRequest
nyatla 2:b96c1e90d120 39 {
nyatla 2:b96c1e90d120 40 struct NyLPC_THttpBasicHeader super;
nyatla 2:b96c1e90d120 41 NyLPC_TUInt8 _content_id;
nyatla 2:b96c1e90d120 42 //解析用
nyatla 2:b96c1e90d120 43 NyLPC_TUInt8 _qery_name_id;
nyatla 2:b96c1e90d120 44 NyLPC_TUInt8 _astate;
nyatla 2:b96c1e90d120 45 NyLPC_TInt16 _prefix_len;
nyatla 2:b96c1e90d120 46 NyLPC_TcStr_t _tstr;
nyatla 2:b96c1e90d120 47 NyLPC_TChar _tstr_buf[16];
nyatla 2:b96c1e90d120 48 /** 文字列のパーサ*/
nyatla 2:b96c1e90d120 49 NyLPC_TcMiMicDbCompiler_t _binparser;
nyatla 2:b96c1e90d120 50 union{
nyatla 37:fc4b4fd6a649 51 /**
nyatla 37:fc4b4fd6a649 52 * スタックサイズ削減のための構造体。tmpは受信処理に使用。
nyatla 37:fc4b4fd6a649 53 * memimgはFlashへ書き込むときに使用。
nyatla 37:fc4b4fd6a649 54 */
nyatla 37:fc4b4fd6a649 55 union{
nyatla 37:fc4b4fd6a649 56 /**
nyatla 37:fc4b4fd6a649 57 * 受信用構造体。host_name,param_buf[6]までのデータは、memimgのfast_boot以降のデータ構造と位置をあわせてください。
nyatla 37:fc4b4fd6a649 58 * param_buf[7]以降については値変換必須
nyatla 37:fc4b4fd6a649 59 * tmpにデータを作成後にmemimgへ整形して書きこむかんじ。
nyatla 2:b96c1e90d120 60 */
nyatla 37:fc4b4fd6a649 61 struct{
nyatla 37:fc4b4fd6a649 62 NyLPC_TUInt16 param_len;
nyatla 37:fc4b4fd6a649 63 NyLPC_TUInt16 host_len;
nyatla 37:fc4b4fd6a649 64 NyLPC_TChar host_name[NyLPC_TcNetConfig_HOSTNAME_LEN];
nyatla 37:fc4b4fd6a649 65 /**pパラメータ。最大長さは16。
nyatla 37:fc4b4fd6a649 66 * 詳細はNyLPC_TcModMiMicSetting_tを参照
nyatla 37:fc4b4fd6a649 67 */
nyatla 37:fc4b4fd6a649 68 NyLPC_TUInt32 param_buf[SIZE_OF_SETUP_PARAM];
nyatla 37:fc4b4fd6a649 69 NyLPC_TUInt32 cval;//コマンド値
nyatla 37:fc4b4fd6a649 70 }tmp;
nyatla 37:fc4b4fd6a649 71 /**
nyatla 37:fc4b4fd6a649 72 * 書き込み用構造体
nyatla 37:fc4b4fd6a649 73 */
nyatla 37:fc4b4fd6a649 74 struct NyLPC_TMiMicConfigulation memimg;
nyatla 2:b96c1e90d120 75 }setup;
nyatla 2:b96c1e90d120 76 struct{
nyatla 2:b96c1e90d120 77 /**
nyatla 2:b96c1e90d120 78 * 不明な名前の場合は、ここに名前をコピー
nyatla 2:b96c1e90d120 79 */
nyatla 2:b96c1e90d120 80 NyLPC_TChar path[32];
nyatla 2:b96c1e90d120 81 }unknown;
nyatla 2:b96c1e90d120 82 }content;
nyatla 2:b96c1e90d120 83 };
nyatla 2:b96c1e90d120 84
nyatla 2:b96c1e90d120 85 #define ST_PARSE_PATH 1
nyatla 2:b96c1e90d120 86 #define ST_PARSE_QUERY_NAME 2
nyatla 2:b96c1e90d120 87 #define ST_PARSE_QUERY_VALUE 3 //Query読み出し中
nyatla 2:b96c1e90d120 88 #define ST_PARSE_QUERY_VALUE_P 4
nyatla 2:b96c1e90d120 89 #define ST_PARSE_QUERY_VALUE_C 5
nyatla 37:fc4b4fd6a649 90 #define ST_PARSE_QUERY_VALUE_HOST 6
nyatla 2:b96c1e90d120 91 /**
nyatla 2:b96c1e90d120 92 * コンテンツID定義(コンテンツ名に対応)
nyatla 2:b96c1e90d120 93 */
nyatla 2:b96c1e90d120 94 #define CONTENT_ID_UNKNOWN 1
nyatla 2:b96c1e90d120 95 #define CONTENT_ID_SETUP 2
nyatla 2:b96c1e90d120 96 #define CONTENT_ID_INDEX 3
nyatla 2:b96c1e90d120 97 #define CONTENT_ID_STATUS 4
nyatla 2:b96c1e90d120 98 #define CONTENT_ID_CSS 5
nyatla 2:b96c1e90d120 99 #define CONTENT_ID_LOGO 6
nyatla 2:b96c1e90d120 100
nyatla 2:b96c1e90d120 101 #define QNAME_ID_P 4
nyatla 2:b96c1e90d120 102 #define QNAME_ID_C 5
nyatla 37:fc4b4fd6a649 103 #define QNAME_ID_HOST 6
nyatla 2:b96c1e90d120 104 #define QNAME_ID_UNKNOWN 0
nyatla 2:b96c1e90d120 105
nyatla 2:b96c1e90d120 106 #define QVAL_C_GET 1
nyatla 2:b96c1e90d120 107 #define QVAL_C_UPDATE 2
nyatla 2:b96c1e90d120 108 #define QVAL_C_UNKNOWN 0
nyatla 2:b96c1e90d120 109
nyatla 2:b96c1e90d120 110
nyatla 2:b96c1e90d120 111 static const struct NyLPC_TTextIdTbl url_tbl[]=
nyatla 2:b96c1e90d120 112 {
nyatla 2:b96c1e90d120 113 {"setup.api",CONTENT_ID_SETUP},
nyatla 2:b96c1e90d120 114 {NULL,CONTENT_ID_UNKNOWN}
nyatla 2:b96c1e90d120 115 };
nyatla 2:b96c1e90d120 116
nyatla 2:b96c1e90d120 117 static const struct NyLPC_TTextIdTbl qname_id_table[]=
nyatla 2:b96c1e90d120 118 {
nyatla 2:b96c1e90d120 119 {"p",QNAME_ID_P},
nyatla 2:b96c1e90d120 120 {"c",QNAME_ID_C},
nyatla 37:fc4b4fd6a649 121 {"host",QNAME_ID_HOST},
nyatla 2:b96c1e90d120 122 {NULL,QNAME_ID_UNKNOWN}
nyatla 2:b96c1e90d120 123 };
nyatla 2:b96c1e90d120 124
nyatla 2:b96c1e90d120 125
nyatla 2:b96c1e90d120 126
nyatla 2:b96c1e90d120 127
nyatla 2:b96c1e90d120 128 static NyLPC_TBool urlHandler(NyLPC_TcHttpBasicHeaderParser_t* i_inst,NyLPC_TChar i_c,struct NyLPC_THttpBasicHeader* o_out)
nyatla 2:b96c1e90d120 129 {
nyatla 2:b96c1e90d120 130
nyatla 2:b96c1e90d120 131 struct TModMiMicSettingRequest* out=(struct TModMiMicSettingRequest*)o_out;
nyatla 2:b96c1e90d120 132 //読み飛ばし
nyatla 2:b96c1e90d120 133 if(out->_prefix_len<0){
nyatla 2:b96c1e90d120 134 out->_prefix_len++;
nyatla 2:b96c1e90d120 135 return NyLPC_TBool_TRUE;//読み飛ばし
nyatla 2:b96c1e90d120 136 }
nyatla 2:b96c1e90d120 137 if(out->_astate==ST_PARSE_PATH){
nyatla 2:b96c1e90d120 138 if(i_c!='\0' && i_c!='?'){
nyatla 2:b96c1e90d120 139 if(!NyLPC_cStr_put(&(out->_tstr),i_c)){
nyatla 2:b96c1e90d120 140 NyLPC_OnErrorGoto(ERROR);
nyatla 2:b96c1e90d120 141 }
nyatla 2:b96c1e90d120 142 return NyLPC_TBool_TRUE;
nyatla 2:b96c1e90d120 143 }
nyatla 2:b96c1e90d120 144 out->_content_id=NyLPC_TTextIdTbl_getMatchId(NyLPC_cStr_str(&(out->_tstr)),url_tbl);
nyatla 2:b96c1e90d120 145 switch(out->_content_id)
nyatla 2:b96c1e90d120 146 {
nyatla 2:b96c1e90d120 147 case CONTENT_ID_SETUP:
nyatla 37:fc4b4fd6a649 148 out->content.setup.tmp.param_len=0;//クエリが無い場合の初期値
nyatla 37:fc4b4fd6a649 149 out->content.setup.tmp.host_len =0;//クエリが無い場合の初期値
nyatla 37:fc4b4fd6a649 150 out->content.setup.tmp.cval=QVAL_C_UNKNOWN;
nyatla 2:b96c1e90d120 151 break;
nyatla 2:b96c1e90d120 152 default:
nyatla 2:b96c1e90d120 153 break;
nyatla 2:b96c1e90d120 154 }
nyatla 2:b96c1e90d120 155 NyLPC_cStr_clear(&(out->_tstr));
nyatla 2:b96c1e90d120 156 out->_astate=ST_PARSE_QUERY_NAME;//クエリ名解析へ
nyatla 2:b96c1e90d120 157 return NyLPC_TBool_TRUE;
nyatla 2:b96c1e90d120 158 }
nyatla 2:b96c1e90d120 159 switch(out->_content_id)
nyatla 2:b96c1e90d120 160 {
nyatla 2:b96c1e90d120 161 case CONTENT_ID_SETUP:
nyatla 2:b96c1e90d120 162 switch(out->_astate){
nyatla 2:b96c1e90d120 163 case ST_PARSE_QUERY_NAME:
nyatla 2:b96c1e90d120 164 if(i_c!='\0' && i_c!='&' && i_c!='='){
nyatla 2:b96c1e90d120 165 if(!NyLPC_cStr_put(&(out->_tstr),i_c)){
nyatla 2:b96c1e90d120 166 NyLPC_OnErrorGoto(ERROR);
nyatla 2:b96c1e90d120 167 }
nyatla 2:b96c1e90d120 168 return NyLPC_TBool_TRUE;
nyatla 2:b96c1e90d120 169 }
nyatla 2:b96c1e90d120 170 //Query確定。
nyatla 2:b96c1e90d120 171 out->_qery_name_id=NyLPC_TTextIdTbl_getMatchId(NyLPC_cStr_str(&(out->_tstr)),qname_id_table);
nyatla 2:b96c1e90d120 172 NyLPC_cStr_clear(&(out->_tstr));
nyatla 2:b96c1e90d120 173 //クエリ値がある場合
nyatla 2:b96c1e90d120 174 switch(out->_qery_name_id){
nyatla 2:b96c1e90d120 175 case QNAME_ID_P:
nyatla 2:b96c1e90d120 176 out->_astate=ST_PARSE_QUERY_VALUE_P;//MIMICBCのDBパラメータパーサを借用。
nyatla 37:fc4b4fd6a649 177 out->content.setup.tmp.param_len=0;
nyatla 2:b96c1e90d120 178 break;
nyatla 2:b96c1e90d120 179 case QNAME_ID_C:
nyatla 2:b96c1e90d120 180 out->_astate=ST_PARSE_QUERY_VALUE_C;
nyatla 2:b96c1e90d120 181 break;
nyatla 37:fc4b4fd6a649 182 case QNAME_ID_HOST:
nyatla 37:fc4b4fd6a649 183 out->_astate=ST_PARSE_QUERY_VALUE_HOST;//_host_nameに蓄積
nyatla 37:fc4b4fd6a649 184 out->content.setup.tmp.host_len=0;
nyatla 37:fc4b4fd6a649 185 break;
nyatla 2:b96c1e90d120 186 default:
nyatla 2:b96c1e90d120 187 out->_astate=ST_PARSE_QUERY_VALUE;
nyatla 2:b96c1e90d120 188 break;
nyatla 2:b96c1e90d120 189 }
nyatla 2:b96c1e90d120 190 return NyLPC_TBool_TRUE;
nyatla 2:b96c1e90d120 191 case ST_PARSE_QUERY_VALUE:
nyatla 2:b96c1e90d120 192 //未知のクエリは無視
nyatla 2:b96c1e90d120 193 if(i_c!='\0' && i_c!='&'){
nyatla 2:b96c1e90d120 194 return NyLPC_TBool_TRUE;
nyatla 2:b96c1e90d120 195 }
nyatla 2:b96c1e90d120 196 //クエリ値解析完了
nyatla 2:b96c1e90d120 197 out->_astate=ST_PARSE_QUERY_NAME;
nyatla 2:b96c1e90d120 198 return NyLPC_TBool_TRUE;
nyatla 37:fc4b4fd6a649 199 case ST_PARSE_QUERY_VALUE_HOST:
nyatla 37:fc4b4fd6a649 200 //未知のクエリは無視
nyatla 37:fc4b4fd6a649 201 if(i_c!='\0' && i_c!='&'){
nyatla 37:fc4b4fd6a649 202 //許可する文字列は、[:AlNum:]||'_'
nyatla 37:fc4b4fd6a649 203 if(!isalnum(i_c) && i_c!='_'){
nyatla 37:fc4b4fd6a649 204 NyLPC_OnErrorGoto(ERROR);
nyatla 37:fc4b4fd6a649 205 }
nyatla 37:fc4b4fd6a649 206 out->content.setup.tmp.host_name[out->content.setup.tmp.host_len++]=i_c;
nyatla 37:fc4b4fd6a649 207 if(out->content.setup.tmp.host_len>=NyLPC_TcNetConfig_HOSTNAME_LEN){
nyatla 37:fc4b4fd6a649 208 //長すぎ
nyatla 37:fc4b4fd6a649 209 NyLPC_OnErrorGoto(ERROR);
nyatla 37:fc4b4fd6a649 210 }
nyatla 37:fc4b4fd6a649 211 return NyLPC_TBool_TRUE;
nyatla 37:fc4b4fd6a649 212 }
nyatla 37:fc4b4fd6a649 213 //クエリ値解析完了
nyatla 37:fc4b4fd6a649 214 out->content.setup.tmp.host_name[out->content.setup.tmp.host_len]='\0';
nyatla 37:fc4b4fd6a649 215 out->_astate=ST_PARSE_QUERY_NAME;
nyatla 37:fc4b4fd6a649 216 return NyLPC_TBool_TRUE;
nyatla 2:b96c1e90d120 217 case ST_PARSE_QUERY_VALUE_C:
nyatla 2:b96c1e90d120 218 if(i_c!='\0' && i_c!='&'){
nyatla 2:b96c1e90d120 219 if(!NyLPC_cStr_put(&(out->_tstr),i_c)){
nyatla 2:b96c1e90d120 220 NyLPC_OnErrorGoto(ERROR);
nyatla 2:b96c1e90d120 221 }
nyatla 2:b96c1e90d120 222 return NyLPC_TBool_TRUE;
nyatla 2:b96c1e90d120 223 }
nyatla 2:b96c1e90d120 224 if(NyLPC_cStr_isEqual(&out->_tstr,"get")){
nyatla 37:fc4b4fd6a649 225 out->content.setup.tmp.cval=QVAL_C_GET;
nyatla 2:b96c1e90d120 226 }else if(NyLPC_cStr_isEqual(&out->_tstr,"update")){
nyatla 37:fc4b4fd6a649 227 out->content.setup.tmp.cval=QVAL_C_UPDATE;
nyatla 2:b96c1e90d120 228 }else{
nyatla 2:b96c1e90d120 229 NyLPC_OnErrorGoto(ERROR);
nyatla 2:b96c1e90d120 230 }
nyatla 2:b96c1e90d120 231 out->_astate=ST_PARSE_QUERY_NAME;
nyatla 2:b96c1e90d120 232 NyLPC_cStr_clear(&(out->_tstr));
nyatla 2:b96c1e90d120 233 return NyLPC_TBool_TRUE;
nyatla 2:b96c1e90d120 234 case ST_PARSE_QUERY_VALUE_P:
nyatla 2:b96c1e90d120 235 if(i_c!='\0' && i_c!='&'){
nyatla 37:fc4b4fd6a649 236 if(out->content.setup.tmp.param_len>=SIZE_OF_SETUP_PARAM)
nyatla 2:b96c1e90d120 237 {
nyatla 2:b96c1e90d120 238 NyLPC_OnErrorGoto(ERROR);
nyatla 2:b96c1e90d120 239 }
nyatla 37:fc4b4fd6a649 240 switch(NyLPC_cMiMicDbCompiler_compileFragment2(&(out->_binparser),i_c,out->content.setup.tmp.param_buf+out->content.setup.tmp.param_len))
nyatla 2:b96c1e90d120 241 {
nyatla 2:b96c1e90d120 242 case NyLPC_TcMiMicDbCompiler_RET_CONTINUE:
nyatla 2:b96c1e90d120 243 break;
nyatla 2:b96c1e90d120 244 case NyLPC_TcMiMicDbCompiler_RET_OK:
nyatla 37:fc4b4fd6a649 245 out->content.setup.tmp.param_len++;
nyatla 2:b96c1e90d120 246 break;
nyatla 2:b96c1e90d120 247 case NyLPC_TcMiMicDbCompiler_RET_ERROR:
nyatla 2:b96c1e90d120 248 default:
nyatla 2:b96c1e90d120 249 //ERROR
nyatla 2:b96c1e90d120 250 NyLPC_OnErrorGoto(ERROR);
nyatla 2:b96c1e90d120 251 }
nyatla 2:b96c1e90d120 252 return NyLPC_TBool_TRUE;
nyatla 2:b96c1e90d120 253 }
nyatla 2:b96c1e90d120 254 //区切りのいいところで終わってる?
nyatla 2:b96c1e90d120 255 if(NyLPC_cMiMicDbCompiler_hasFragment(&(out->_binparser))){
nyatla 2:b96c1e90d120 256 //ERROR
nyatla 2:b96c1e90d120 257 NyLPC_OnErrorGoto(ERROR);
nyatla 2:b96c1e90d120 258 }
nyatla 2:b96c1e90d120 259 //終端しているなら、次のクエリへ
nyatla 2:b96c1e90d120 260 out->_astate=ST_PARSE_QUERY_NAME;
nyatla 2:b96c1e90d120 261 NyLPC_cStr_clear(&(out->_tstr));
nyatla 2:b96c1e90d120 262 return NyLPC_TBool_TRUE;
nyatla 2:b96c1e90d120 263 default:
nyatla 2:b96c1e90d120 264 break;
nyatla 2:b96c1e90d120 265 }
nyatla 2:b96c1e90d120 266 NyLPC_OnErrorGoto(ERROR);
nyatla 2:b96c1e90d120 267 default:
nyatla 2:b96c1e90d120 268 NyLPC_OnErrorGoto(ERROR);
nyatla 2:b96c1e90d120 269 }
nyatla 2:b96c1e90d120 270 return NyLPC_TBool_TRUE;
nyatla 2:b96c1e90d120 271 ERROR:
nyatla 2:b96c1e90d120 272 return NyLPC_TBool_FALSE;
nyatla 2:b96c1e90d120 273 }
nyatla 2:b96c1e90d120 274 /**
nyatla 2:b96c1e90d120 275 * デフォルトハンドラ
nyatla 2:b96c1e90d120 276 */
nyatla 2:b96c1e90d120 277 static const struct NyLPC_TcHttpBasicHeaderParser_Handler handler=
nyatla 2:b96c1e90d120 278 {
nyatla 48:00d211aac2ec 279 NULL,
nyatla 2:b96c1e90d120 280 urlHandler
nyatla 2:b96c1e90d120 281 };
nyatla 2:b96c1e90d120 282
nyatla 2:b96c1e90d120 283
nyatla 2:b96c1e90d120 284 /**
nyatla 2:b96c1e90d120 285 * コンストラクタ。
nyatla 2:b96c1e90d120 286 */
nyatla 2:b96c1e90d120 287 void NyLPC_cModMiMicSetting_initialize(NyLPC_TcModMiMicSetting_t* i_inst,const NyLPC_TChar* i_ref_root_path)
nyatla 2:b96c1e90d120 288 {
nyatla 2:b96c1e90d120 289 NyLPC_cModRomFiles_initialize(&i_inst->super,i_ref_root_path,NULL,0);
nyatla 2:b96c1e90d120 290 }
nyatla 2:b96c1e90d120 291 void NyLPC_cModMiMicSetting_finalize(NyLPC_TcModMiMicSetting_t* i_inst)
nyatla 2:b96c1e90d120 292 {
nyatla 2:b96c1e90d120 293 NyLPC_cModRomFiles_finalize(&i_inst->super);
nyatla 2:b96c1e90d120 294 }
nyatla 2:b96c1e90d120 295 /**
nyatla 2:b96c1e90d120 296 * モジュールがコネクションをハンドリングできるかを返します。
nyatla 2:b96c1e90d120 297 */
nyatla 2:b96c1e90d120 298 NyLPC_TBool NyLPC_cModMiMicSetting_canHandle(NyLPC_TcModMiMicSetting_t* i_inst,NyLPC_TcHttpdConnection_t* i_connection)
nyatla 2:b96c1e90d120 299 {
nyatla 2:b96c1e90d120 300 return NyLPC_cModRomFiles_canHandle(&i_inst->super,i_connection);
nyatla 2:b96c1e90d120 301 }
nyatla 2:b96c1e90d120 302
nyatla 2:b96c1e90d120 303
nyatla 2:b96c1e90d120 304
nyatla 2:b96c1e90d120 305 static void setup_proc(NyLPC_TcHttpdConnection_t* i_connection,struct TModMiMicSettingRequest* i_req);
nyatla 2:b96c1e90d120 306
nyatla 2:b96c1e90d120 307 /**
nyatla 2:b96c1e90d120 308 * モジュールを実行します。
nyatla 2:b96c1e90d120 309 */
nyatla 2:b96c1e90d120 310 NyLPC_TBool NyLPC_cModMiMicSetting_execute(NyLPC_TcModMiMicSetting_t* i_inst,NyLPC_TcHttpdConnection_t* i_connection)
nyatla 2:b96c1e90d120 311 {
nyatla 19:33b9ba0859ee 312 NyLPC_TUInt8 method_type;
nyatla 2:b96c1e90d120 313 struct TModMiMicSettingRequest header;
nyatla 2:b96c1e90d120 314 NyLPC_TcHttpBasicHeaderParser_t parser;
nyatla 19:33b9ba0859ee 315
nyatla 2:b96c1e90d120 316 //リクエストParse済へ遷移(この関数の後はModが責任を持ってリクエストを返却)
nyatla 2:b96c1e90d120 317 NyLPC_cHttpdConnection_setReqStatusParsed(i_connection);
nyatla 2:b96c1e90d120 318
nyatla 2:b96c1e90d120 319 //URL解析の準備
nyatla 7:2b33a8d84eb3 320 header._prefix_len=-((NyLPC_TInt16)strlen(i_inst->super._ref_root_path)+2);
nyatla 2:b96c1e90d120 321 header._astate=ST_PARSE_PATH;
nyatla 2:b96c1e90d120 322 NyLPC_cStr_initialize(&header._tstr,header._tstr_buf,16);
nyatla 2:b96c1e90d120 323 NyLPC_cMiMicDbCompiler_initialize(&header._binparser);
nyatla 2:b96c1e90d120 324
nyatla 2:b96c1e90d120 325 NyLPC_cHttpBasicHeaderParser_initialize(&parser,&handler);
nyatla 2:b96c1e90d120 326 //プリフェッチしたデータを流す
nyatla 2:b96c1e90d120 327 NyLPC_cHttpBasicHeaderParser_parseInit(&parser,&(header.super));
nyatla 2:b96c1e90d120 328 NyLPC_cHttpdConnection_pushPrefetchInfo(i_connection,&parser,&header.super);
nyatla 2:b96c1e90d120 329 //後続をストリームから取り込む
nyatla 2:b96c1e90d120 330 if(!NyLPC_cHttpBasicHeaderParser_parseStream(&parser,NyLPC_cHttpdConnection_refStream(i_connection),&(header.super))){
nyatla 19:33b9ba0859ee 331 NyLPC_cHttpdUtils_sendErrorResponse(i_connection,500);
nyatla 2:b96c1e90d120 332 NyLPC_OnErrorGoto(Error2);
nyatla 2:b96c1e90d120 333 }
nyatla 2:b96c1e90d120 334 if(!NyLPC_cHttpBasicHeaderParser_parseFinish(&parser,&(header.super))){
nyatla 19:33b9ba0859ee 335 NyLPC_cHttpdUtils_sendErrorResponse(i_connection,500);
nyatla 2:b96c1e90d120 336 NyLPC_OnErrorGoto(Error2);
nyatla 2:b96c1e90d120 337 }
nyatla 19:33b9ba0859ee 338 //GETかHEADに制限
nyatla 19:33b9ba0859ee 339 method_type=NyLPC_cHttpdConnection_getMethod(i_connection);
nyatla 19:33b9ba0859ee 340 if(method_type!=NyLPC_THttpMethodType_GET && method_type!=NyLPC_THttpMethodType_HEAD)
nyatla 2:b96c1e90d120 341 {
nyatla 19:33b9ba0859ee 342 NyLPC_cHttpdUtils_sendErrorResponse(i_connection,405);
nyatla 19:33b9ba0859ee 343 NyLPC_OnErrorGoto(Error2);
nyatla 2:b96c1e90d120 344 }
nyatla 43:a182f2b5ff41 345 //Request::ConnectionがClose設定,又はHTTP1.1では無い場合,CLOSE
nyatla 43:a182f2b5ff41 346 if(header.super.connection==NyLPC_THttpMessgeHeader_Connection_CLOSE || header.super.startline.req.version!=NyLPC_THttpVersion_11)
nyatla 2:b96c1e90d120 347 {
nyatla 43:a182f2b5ff41 348 NyLPC_cHttpdConnection_setConnectionMode(i_connection,NyLPC_TcHttpdConnection_CONNECTION_MODE_CLOSE);
nyatla 2:b96c1e90d120 349 }
nyatla 2:b96c1e90d120 350 //CGIの実行
nyatla 2:b96c1e90d120 351 switch(header._content_id)
nyatla 2:b96c1e90d120 352 {
nyatla 2:b96c1e90d120 353 case CONTENT_ID_SETUP:
nyatla 2:b96c1e90d120 354 setup_proc(i_connection,&header);
nyatla 2:b96c1e90d120 355 break;
nyatla 2:b96c1e90d120 356 case CONTENT_ID_UNKNOWN:
nyatla 2:b96c1e90d120 357 default:
nyatla 19:33b9ba0859ee 358 NyLPC_cHttpdUtils_sendErrorResponse(i_connection,500);
nyatla 2:b96c1e90d120 359 NyLPC_OnErrorGoto(Error2);
nyatla 2:b96c1e90d120 360 }
nyatla 2:b96c1e90d120 361 NyLPC_cHttpBasicHeaderParser_finalize(&parser);
nyatla 2:b96c1e90d120 362 NyLPC_cMiMicDbCompiler_finalize(&header._binparser);
nyatla 2:b96c1e90d120 363 NyLPC_cStr_finalize(&(header._tstr));
nyatla 2:b96c1e90d120 364 return NyLPC_TBool_TRUE;
nyatla 2:b96c1e90d120 365 Error2:
nyatla 2:b96c1e90d120 366 NyLPC_cHttpBasicHeaderParser_finalize(&parser);
nyatla 2:b96c1e90d120 367 NyLPC_cMiMicDbCompiler_finalize(&header._binparser);
nyatla 2:b96c1e90d120 368 NyLPC_cStr_finalize(&(header._tstr));
nyatla 19:33b9ba0859ee 369
nyatla 2:b96c1e90d120 370 return NyLPC_TBool_FALSE;
nyatla 2:b96c1e90d120 371 }
nyatla 2:b96c1e90d120 372
nyatla 2:b96c1e90d120 373
nyatla 2:b96c1e90d120 374 static void setup_proc(NyLPC_TcHttpdConnection_t* i_connection,struct TModMiMicSettingRequest* i_req)
nyatla 2:b96c1e90d120 375 {
nyatla 2:b96c1e90d120 376 NyLPC_TBool ret;
nyatla 37:fc4b4fd6a649 377 const struct NyLPC_TMiMicConfigulation* config;
nyatla 37:fc4b4fd6a649 378 const NyLPC_TcNetConfig_t* currebt_cfg;
nyatla 19:33b9ba0859ee 379 NyLPC_Assert(
nyatla 19:33b9ba0859ee 380 (NyLPC_cHttpdConnection_getMethod(i_connection)==NyLPC_THttpMethodType_GET)||
nyatla 19:33b9ba0859ee 381 (NyLPC_cHttpdConnection_getMethod(i_connection)==NyLPC_THttpMethodType_HEAD));
nyatla 2:b96c1e90d120 382
nyatla 37:fc4b4fd6a649 383 switch(i_req->content.setup.tmp.cval){
nyatla 2:b96c1e90d120 384 case QVAL_C_GET:
nyatla 14:4618692ec239 385 if(!NyLPC_cHttpdUtils_sendJsonHeader(i_connection)){
nyatla 2:b96c1e90d120 386 NyLPC_OnErrorGoto(Error);
nyatla 2:b96c1e90d120 387 }
nyatla 19:33b9ba0859ee 388 if(NyLPC_cHttpdConnection_getMethod(i_connection)==NyLPC_THttpMethodType_GET){
nyatla 19:33b9ba0859ee 389 config=NyLPC_cMiMicConfiglation_loadFromFlash();
nyatla 37:fc4b4fd6a649 390 //Flashの内容から
nyatla 19:33b9ba0859ee 391 if(!NyLPC_cHttpdConnection_sendResponseBodyF(i_connection,
nyatla 21:f2a70f15301f 392 "{"
nyatla 69:8c5f220441f5 393 "\"application\":\""MOD_VERSION";%s;%s(%s)\","
nyatla 37:fc4b4fd6a649 394 "\"landev\":\"%s\",",
nyatla 69:8c5f220441f5 395 NyLPC_cMiMicEnv_getStrProperty(NyLPC_cMiMicEnv_VERSION),
nyatla 69:8c5f220441f5 396 NyLPC_cMiMicEnv_getStrProperty(NyLPC_cMiMicEnv_SHORT_NAME),
nyatla 69:8c5f220441f5 397 NyLPC_cMiMicEnv_getStrProperty(NyLPC_cMiMicEnv_MCU_NAME),
nyatla 69:8c5f220441f5 398 NyLPC_cMiMicEnv_getStrProperty(NyLPC_cMiMicEnv_ETHERNET_PHY)
nyatla 37:fc4b4fd6a649 399 ))
nyatla 37:fc4b4fd6a649 400 {
nyatla 37:fc4b4fd6a649 401 NyLPC_OnErrorGoto(Error);
nyatla 37:fc4b4fd6a649 402 }
nyatla 37:fc4b4fd6a649 403 if(!NyLPC_cHttpdConnection_sendResponseBodyF(i_connection,
nyatla 37:fc4b4fd6a649 404 "\"cfg\":{"
nyatla 21:f2a70f15301f 405 "\"mac00010203\":%u,"
nyatla 21:f2a70f15301f 406 "\"mac0405xxxx\":%u,"
nyatla 37:fc4b4fd6a649 407 "\"host\":\"%s\","
nyatla 37:fc4b4fd6a649 408 "\"ipv4\":{"
nyatla 37:fc4b4fd6a649 409 "\"flags\":%u,"
nyatla 37:fc4b4fd6a649 410 "\"ip\":%u,"
nyatla 37:fc4b4fd6a649 411 "\"mask\":%u,"
nyatla 37:fc4b4fd6a649 412 "\"droute\":%u,"
nyatla 37:fc4b4fd6a649 413 "},"
nyatla 37:fc4b4fd6a649 414 "\"services\":{"
nyatla 37:fc4b4fd6a649 415 "\"flags\":%u,"
nyatla 37:fc4b4fd6a649 416 "\"http_port\":%u"
nyatla 37:fc4b4fd6a649 417 "}},",
nyatla 19:33b9ba0859ee 418 config->mac_00_01_02_03,
nyatla 19:33b9ba0859ee 419 config->mac_04_05_xx_xx,
nyatla 37:fc4b4fd6a649 420 config->hostname,
nyatla 37:fc4b4fd6a649 421 config->ipv4_flags,
nyatla 19:33b9ba0859ee 422 config->ipv4_addr_net,
nyatla 19:33b9ba0859ee 423 config->ipv4_mask_net,
nyatla 19:33b9ba0859ee 424 config->ipv4_drut_net,
nyatla 37:fc4b4fd6a649 425 config->srv_flags,
nyatla 37:fc4b4fd6a649 426 config->http_port
nyatla 19:33b9ba0859ee 427 )){
nyatla 19:33b9ba0859ee 428 NyLPC_OnErrorGoto(Error);
nyatla 19:33b9ba0859ee 429 }
nyatla 27:eb66b517efe6 430 //write current status
nyatla 37:fc4b4fd6a649 431 currebt_cfg=(const NyLPC_TcNetConfig_t*)NyLPC_cUipService_refCurrentConfig();
nyatla 21:f2a70f15301f 432 if(!NyLPC_cHttpdConnection_sendResponseBodyF(i_connection,
nyatla 37:fc4b4fd6a649 433 "\"cur\":{"
nyatla 37:fc4b4fd6a649 434 "\"mac00010203\":%u,"
nyatla 37:fc4b4fd6a649 435 "\"mac0405xxxx\":%u,"
nyatla 37:fc4b4fd6a649 436 "\"host\":\"%s\","
nyatla 37:fc4b4fd6a649 437 "\"ipv4\":{"
nyatla 37:fc4b4fd6a649 438 "\"flags\":%u,"
nyatla 21:f2a70f15301f 439 "\"ip\":%u,"
nyatla 21:f2a70f15301f 440 "\"mask\":%u,"
nyatla 37:fc4b4fd6a649 441 "\"droute\":%u,"
nyatla 37:fc4b4fd6a649 442 "},"
nyatla 37:fc4b4fd6a649 443 "\"services\":{"
nyatla 37:fc4b4fd6a649 444 "\"flags\":%u,"
nyatla 37:fc4b4fd6a649 445 "\"http_port\":%u"
nyatla 37:fc4b4fd6a649 446 "}}}",
nyatla 37:fc4b4fd6a649 447 (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],
nyatla 37:fc4b4fd6a649 448 (currebt_cfg->super.eth_mac.addr[4]<<24)|(currebt_cfg->super.eth_mac.addr[5]<<16),
nyatla 37:fc4b4fd6a649 449 currebt_cfg->hostname,
nyatla 37:fc4b4fd6a649 450 currebt_cfg->tcp_mode,
nyatla 37:fc4b4fd6a649 451 NyLPC_ntohl(currebt_cfg->super.ip_addr.v),
nyatla 37:fc4b4fd6a649 452 NyLPC_ntohl(currebt_cfg->super.netmask.v),
nyatla 37:fc4b4fd6a649 453 NyLPC_ntohl(currebt_cfg->super.dr_addr.v),
nyatla 37:fc4b4fd6a649 454 currebt_cfg->services.flags,
nyatla 37:fc4b4fd6a649 455 currebt_cfg->services.http_port
nyatla 21:f2a70f15301f 456 )){
nyatla 21:f2a70f15301f 457 NyLPC_OnErrorGoto(Error);
nyatla 21:f2a70f15301f 458 }
nyatla 2:b96c1e90d120 459 }
nyatla 2:b96c1e90d120 460 break;
nyatla 2:b96c1e90d120 461 case QVAL_C_UPDATE:
nyatla 2:b96c1e90d120 462 //check parameter length
nyatla 37:fc4b4fd6a649 463 if(i_req->content.setup.tmp.param_len!=SIZE_OF_SETUP_PARAM || i_req->content.setup.tmp.host_len<1)
nyatla 2:b96c1e90d120 464 {
nyatla 19:33b9ba0859ee 465 NyLPC_cHttpdUtils_sendErrorResponse(i_connection,500);
nyatla 2:b96c1e90d120 466 }else{
nyatla 2:b96c1e90d120 467 //パラメータ→ROMイメージ変換
nyatla 37:fc4b4fd6a649 468 i_req->content.setup.memimg.fast_boot=0xffffffff;
nyatla 37:fc4b4fd6a649 469 // ここの部分は受信時にデータ位置を合わせてあるのでコピー不要。
nyatla 37:fc4b4fd6a649 470 // cfg_image.mac_00_01_02_03=(i_req->content.setup.param_buf[0]);
nyatla 37:fc4b4fd6a649 471 // cfg_image.mac_04_05_xx_xx=(i_req->content.setup.param_buf[1]&0xffff0000);
nyatla 37:fc4b4fd6a649 472 // cfg_image.ipv4_flags =i_req->content.setup.param_buf[2];
nyatla 37:fc4b4fd6a649 473 // cfg_image.ipv4_addr_net =i_req->content.setup.param_buf[3];
nyatla 37:fc4b4fd6a649 474 // cfg_image.ipv4_mask_net =i_req->content.setup.param_buf[4];
nyatla 37:fc4b4fd6a649 475 // cfg_image.ipv4_drut_net =i_req->content.setup.param_buf[5];
nyatla 37:fc4b4fd6a649 476 // cfg_image.srv_flags =i_req->content.setup.param_buf[6];
nyatla 37:fc4b4fd6a649 477 // strcpy(cfg_image.hostname,i_req->content.setup.host_name);
nyatla 37:fc4b4fd6a649 478 i_req->content.setup.memimg.http_port =(NyLPC_TUInt16)(i_req->content.setup.tmp.param_buf[7]>>16);
nyatla 37:fc4b4fd6a649 479 i_req->content.setup.memimg.padding=0xffff;
nyatla 2:b96c1e90d120 480 //一応確認。
nyatla 37:fc4b4fd6a649 481 if(i_req->content.setup.memimg.http_port==0){
nyatla 19:33b9ba0859ee 482 NyLPC_cHttpdUtils_sendErrorResponse(i_connection,500);
nyatla 2:b96c1e90d120 483 }else{
nyatla 2:b96c1e90d120 484 //FreeRTOSの停止
nyatla 2:b96c1e90d120 485 NyLPC_cIsr_enterCritical();
nyatla 2:b96c1e90d120 486 //Flashへの書き込み
nyatla 37:fc4b4fd6a649 487 ret=NyLPC_cMiMicConfiglation_updateConfigulation(&i_req->content.setup.memimg);
nyatla 2:b96c1e90d120 488 //FreeRTOSの復帰
nyatla 2:b96c1e90d120 489 NyLPC_cIsr_exitCritical();
nyatla 2:b96c1e90d120 490 if(!ret){
nyatla 19:33b9ba0859ee 491 NyLPC_cHttpdUtils_sendErrorResponse(i_connection,500);
nyatla 2:b96c1e90d120 492 }else{
nyatla 14:4618692ec239 493 if(!NyLPC_cHttpdUtils_sendJsonHeader(i_connection)){
nyatla 2:b96c1e90d120 494 NyLPC_OnErrorGoto(Error);
nyatla 2:b96c1e90d120 495 }
nyatla 19:33b9ba0859ee 496 if(NyLPC_cHttpdConnection_getMethod(i_connection)==NyLPC_THttpMethodType_GET){
nyatla 19:33b9ba0859ee 497 NyLPC_cHttpdConnection_sendResponseBodyF(i_connection,
nyatla 69:8c5f220441f5 498 "{\"application\":\""MOD_VERSION"\",\"result\":%u}",
nyatla 69:8c5f220441f5 499 ret?0x00000000:0x80000000);
nyatla 19:33b9ba0859ee 500 }
nyatla 2:b96c1e90d120 501 }
nyatla 2:b96c1e90d120 502 }
nyatla 2:b96c1e90d120 503 }
nyatla 2:b96c1e90d120 504 //JSONを書く。
nyatla 2:b96c1e90d120 505 break;
nyatla 2:b96c1e90d120 506 default:
nyatla 19:33b9ba0859ee 507 NyLPC_cHttpdUtils_sendErrorResponse(i_connection,400);
nyatla 2:b96c1e90d120 508 NyLPC_OnErrorGoto(Error);
nyatla 2:b96c1e90d120 509 break;
nyatla 2:b96c1e90d120 510 }
nyatla 2:b96c1e90d120 511 return;
nyatla 2:b96c1e90d120 512 Error:
nyatla 2:b96c1e90d120 513 return;
nyatla 2:b96c1e90d120 514 }