OSDN Git Service

update libMiMic
[mimic/MiMicSDK.git] / lib / src / net / httpd / mod / NyLPC_cModUPnPDevice.c
index 4a285df..2a2c544 100644 (file)
@@ -19,8 +19,8 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.\r
  *\r
  * For further information please contact.\r
- *     http://nyatla.jp/\r
- *     <airmail(at)ebony.plala.or.jp> or <nyatla(at)nyatla.jp>\r
+ *  http://nyatla.jp/\r
+ *  <airmail(at)ebony.plala.or.jp> or <nyatla(at)nyatla.jp>\r
  *\r
  *********************************************************************************/\r
 #include "NyLPC_cModUPnPDevice.h"\r
@@ -28,6 +28,7 @@
 #include "NyLPC_net.h"\r
 #include "NyLPC_stdlib.h"\r
 #include "NyLPC_http.h"\r
+#include <string.h>\r
 #include <ctype.h>\r
 \r
 \r
 #define SIZE_OF_STRBUF 16\r
 struct TUPnPDeviceHeader\r
 {\r
-       struct NyLPC_THttpBasicHeader super;\r
-       //解析用\r
-       NyLPC_TUInt8 _content_id;\r
-       NyLPC_TUInt8 _astate;\r
-       NyLPC_TInt16 _prefix_len;\r
-       NyLPC_TcStr_t _tstr;\r
-       NyLPC_TChar _tstr_buf[SIZE_OF_STRBUF];\r
-       /** 文字列のパーサ*/\r
-       union{\r
-               NyLPC_TInt16 service_idx;\r
-       }content;\r
+    struct NyLPC_THttpBasicHeader super;\r
+    //解析用\r
+    NyLPC_TUInt8 _content_id;\r
+    NyLPC_TUInt8 _astate;\r
+    NyLPC_TInt16 _prefix_len;\r
+    NyLPC_TcStr_t _tstr;\r
+    NyLPC_TChar _tstr_buf[SIZE_OF_STRBUF];\r
+    /** 文字列のパーサ*/\r
+    union{\r
+        NyLPC_TInt16 service_idx;\r
+    }content;\r
 };\r
 \r
 #define ST_PARSE_PATH 1\r
@@ -54,10 +55,10 @@ struct TUPnPDeviceHeader
 /**\r
  * コンテンツID定義(コンテンツ名に対応)\r
  */\r
-#define CONTENT_ID_UNKNOWN             1\r
+#define CONTENT_ID_UNKNOWN      1\r
 #define CONTENT_ID_DEVICE_XML   2\r
-#define CONTENT_ID_CONTROL     3\r
-#define CONTENT_ID_EVENT               4\r
+#define CONTENT_ID_CONTROL      3\r
+#define CONTENT_ID_EVENT        4\r
 \r
 #define QNAME_ID_UNKNOWN 1\r
 #define QNAME_IDX 2\r
@@ -73,143 +74,143 @@ struct TUPnPDeviceHeader
 \r
 static void writeDeviceNode(const struct NyLPC_TUPnPDevDescDevice* i_dev,NyLPC_TcHttpdConnection_t* i_connection,NyLPC_TUInt16* sidx)\r
 {\r
-       //Required\r
-       NyLPC_cHttpdConnection_sendResponseBodyF(i_connection,\r
-               "<device>"\r
-               "<deviceType>%s</deviceType>"\r
-               "<friendlyName>%s</friendlyName>"\r
-               "<manufacturer>%s</manufacturer>",\r
-               i_dev->device_type,\r
-               i_dev->frendly_name,\r
-               i_dev->manufacturer);\r
-       NyLPC_TInt16 i;\r
-       //Optional\r
-       if(i_dev->manufacturer_url!=NULL){\r
-               NyLPC_cHttpdConnection_sendResponseBodyF(i_connection,\r
-                       "<manufacturerURL>%s</manufacturerURL>",\r
-                       i_dev->manufacturer_url);\r
-       }\r
-       //Recommended\r
-       if(i_dev->model_descriprion!=NULL){\r
-               NyLPC_cHttpdConnection_sendResponseBodyF(i_connection,\r
-                       "<modelDescription>%s</modelDescription>",\r
-                       i_dev->model_descriprion);\r
-       }else{\r
-               NyLPC_cHttpdConnection_sendResponseBodyF(i_connection,\r
-                       "<modelDescription/>"); //Recommended\r
-       }\r
-       //Required\r
-       NyLPC_cHttpdConnection_sendResponseBodyF(i_connection,\r
-               "<modelName>%s</modelName>",\r
-               i_dev->model_name);\r
-       //Recommended\r
-       if(i_dev->model_number!=NULL){\r
-               NyLPC_cHttpdConnection_sendResponseBodyF(i_connection,\r
-                       "<modelNumber>%s</modelNumber>",\r
-                       i_dev->model_number);\r
-       }else{\r
-               NyLPC_cHttpdConnection_sendResponseBodyF(i_connection,\r
-                       "<modelNumber/>");\r
-       }\r
-       //Optional\r
-       if(i_dev->model_url!=NULL){\r
-               NyLPC_cHttpdConnection_sendResponseBodyF(i_connection,\r
-                       "<modelURL>%s</modelURL>",\r
-                       i_dev->model_url);\r
-       }\r
-       //Recommended\r
-       if(i_dev->serial_number!=NULL){\r
-               NyLPC_cHttpdConnection_sendResponseBodyF(i_connection,\r
-                       "<serialNumber>%s</serialNumber>",\r
-                       i_dev->serial_number);\r
-       }else{\r
-               NyLPC_cHttpdConnection_sendResponseBodyF(i_connection,\r
-                       "<serialNumber/>");\r
-       }\r
-       //Required\r
-       NyLPC_cHttpdConnection_sendResponseBodyF(i_connection,\r
-               "<UDN>%s</UDN>",\r
-               i_dev->udn);\r
-       //Oprional\r
-       if(i_dev->upc!=NULL){\r
-               NyLPC_cHttpdConnection_sendResponseBodyF(i_connection,\r
-                       "<UPC>%s</UPC>",\r
-                       i_dev->upc);\r
-       }\r
-       if(i_dev->number_of_icon>0){\r
-               NyLPC_cHttpdConnection_sendResponseBodyF(i_connection,\r
-                       "<iconList>");\r
-               for(i=0;i<i_dev->number_of_icon;i++){\r
-                       NyLPC_cHttpdConnection_sendResponseBodyF(i_connection,\r
-                               "<icon>"\r
-                               "<mimetype>%s</mimetype>"\r
-                               "<width>%d</width>"\r
-                               "<height>%d</height>"\r
-                               "<depth>%d</depth>"\r
-                               "<url>%s</url>"\r
-                               "</icon>",\r
-                               i_dev->icons[i].mimetype,\r
-                               i_dev->icons[i].width,\r
-                               i_dev->icons[i].height,\r
-                               i_dev->icons[i].depth,\r
-                               i_dev->icons[i].url);\r
-               }\r
-               NyLPC_cHttpdConnection_sendResponseBodyF(i_connection,\r
-                       "</iconList>");\r
-       }else{\r
-               NyLPC_cHttpdConnection_sendResponseBodyF(i_connection,\r
-                       "<iconList/>");\r
-       }\r
-       //Optional\r
-       if(i_dev->number_of_service>0){\r
-               NyLPC_cHttpdConnection_sendResponseBodyF(i_connection,\r
-                       "<serviceList>");\r
-               for(i=0;i<i_dev->number_of_service;i++){\r
-                       NyLPC_cHttpdConnection_sendResponseBodyF(i_connection,\r
-                               "<service>"\r
-                               "<serviceType>%s</serviceType>"\r
-                               "<serviceId>%s</serviceId>"\r
-                               "<SCPDURL>%s</SCPDURL>"\r
-                               "<controlURL>./control/%d</controlURL>"\r
-                               "<eventSubURL>./event/%d</eventSubURL>"\r
-                               "</service>",\r
-                               i_dev->services[i].scpd_url,\r
-                               i_dev->services[i].service_type,\r
-                               i_dev->services[i].service_id,\r
-                               (*sidx)+i,\r
-                               (*sidx)+i);\r
-               }\r
-               NyLPC_cHttpdConnection_sendResponseBodyF(i_connection,\r
-                       "</serviceList>");\r
-       }\r
-       if(i_dev->number_of_devices>0){\r
-               NyLPC_cHttpdConnection_sendResponseBodyF(i_connection,\r
-                       "<deviceList>");\r
-               for(i=0;i<i_dev->number_of_devices;i++){\r
-                       (*sidx)=(*sidx)+0x10;\r
-                       writeDeviceNode(i_dev->devices[i],i_connection,sidx);\r
-               }\r
-               NyLPC_cHttpdConnection_sendResponseBodyF(i_connection,\r
-                       "</deviceList>");\r
-       }\r
-       if(i_dev->presentation_url!=NULL){\r
-               NyLPC_cHttpdConnection_sendResponseBodyF(i_connection,\r
-                       "<presentationURL>%s</presentationURL></device>",\r
-                       i_dev->presentation_url);\r
-       }\r
-       else{\r
-               NyLPC_cHttpdConnection_sendResponseBodyF(i_connection,\r
-                       "</device>");\r
-       }\r
+    //Required\r
+    NyLPC_cHttpdConnection_sendResponseBodyF(i_connection,\r
+        "<device>"\r
+        "<deviceType>%s</deviceType>"\r
+        "<friendlyName>%s</friendlyName>"\r
+        "<manufacturer>%s</manufacturer>",\r
+        i_dev->device_type,\r
+        i_dev->frendly_name,\r
+        i_dev->manufacturer);\r
+    NyLPC_TInt16 i;\r
+    //Optional\r
+    if(i_dev->manufacturer_url!=NULL){\r
+        NyLPC_cHttpdConnection_sendResponseBodyF(i_connection,\r
+            "<manufacturerURL>%s</manufacturerURL>",\r
+            i_dev->manufacturer_url);\r
+    }\r
+    //Recommended\r
+    if(i_dev->model_descriprion!=NULL){\r
+        NyLPC_cHttpdConnection_sendResponseBodyF(i_connection,\r
+            "<modelDescription>%s</modelDescription>",\r
+            i_dev->model_descriprion);\r
+    }else{\r
+        NyLPC_cHttpdConnection_sendResponseBodyF(i_connection,\r
+            "<modelDescription/>"); //Recommended\r
+    }\r
+    //Required\r
+    NyLPC_cHttpdConnection_sendResponseBodyF(i_connection,\r
+        "<modelName>%s</modelName>",\r
+        i_dev->model_name);\r
+    //Recommended\r
+    if(i_dev->model_number!=NULL){\r
+        NyLPC_cHttpdConnection_sendResponseBodyF(i_connection,\r
+            "<modelNumber>%s</modelNumber>",\r
+            i_dev->model_number);\r
+    }else{\r
+        NyLPC_cHttpdConnection_sendResponseBodyF(i_connection,\r
+            "<modelNumber/>");\r
+    }\r
+    //Optional\r
+    if(i_dev->model_url!=NULL){\r
+        NyLPC_cHttpdConnection_sendResponseBodyF(i_connection,\r
+            "<modelURL>%s</modelURL>",\r
+            i_dev->model_url);\r
+    }\r
+    //Recommended\r
+    if(i_dev->serial_number!=NULL){\r
+        NyLPC_cHttpdConnection_sendResponseBodyF(i_connection,\r
+            "<serialNumber>%s</serialNumber>",\r
+            i_dev->serial_number);\r
+    }else{\r
+        NyLPC_cHttpdConnection_sendResponseBodyF(i_connection,\r
+            "<serialNumber/>");\r
+    }\r
+    //Required\r
+    NyLPC_cHttpdConnection_sendResponseBodyF(i_connection,\r
+        "<UDN>%s</UDN>",\r
+        i_dev->udn);\r
+    //Oprional\r
+    if(i_dev->upc!=NULL){\r
+        NyLPC_cHttpdConnection_sendResponseBodyF(i_connection,\r
+            "<UPC>%s</UPC>",\r
+            i_dev->upc);\r
+    }\r
+    if(i_dev->number_of_icon>0){\r
+        NyLPC_cHttpdConnection_sendResponseBodyF(i_connection,\r
+            "<iconList>");\r
+        for(i=0;i<i_dev->number_of_icon;i++){\r
+            NyLPC_cHttpdConnection_sendResponseBodyF(i_connection,\r
+                "<icon>"\r
+                "<mimetype>%s</mimetype>"\r
+                "<width>%d</width>"\r
+                "<height>%d</height>"\r
+                "<depth>%d</depth>"\r
+                "<url>%s</url>"\r
+                "</icon>",\r
+                i_dev->icons[i].mimetype,\r
+                i_dev->icons[i].width,\r
+                i_dev->icons[i].height,\r
+                i_dev->icons[i].depth,\r
+                i_dev->icons[i].url);\r
+        }\r
+        NyLPC_cHttpdConnection_sendResponseBodyF(i_connection,\r
+            "</iconList>");\r
+    }else{\r
+        NyLPC_cHttpdConnection_sendResponseBodyF(i_connection,\r
+            "<iconList/>");\r
+    }\r
+    //Optional\r
+    if(i_dev->number_of_service>0){\r
+        NyLPC_cHttpdConnection_sendResponseBodyF(i_connection,\r
+            "<serviceList>");\r
+        for(i=0;i<i_dev->number_of_service;i++){\r
+            NyLPC_cHttpdConnection_sendResponseBodyF(i_connection,\r
+                "<service>"\r
+                "<serviceType>%s</serviceType>"\r
+                "<serviceId>%s</serviceId>"\r
+                "<SCPDURL>%s</SCPDURL>"\r
+                "<controlURL>./control/%d</controlURL>"\r
+                "<eventSubURL>./event/%d</eventSubURL>"\r
+                "</service>",\r
+                i_dev->services[i].scpd_url,\r
+                i_dev->services[i].service_type,\r
+                i_dev->services[i].service_id,\r
+                (*sidx)+i,\r
+                (*sidx)+i);\r
+        }\r
+        NyLPC_cHttpdConnection_sendResponseBodyF(i_connection,\r
+            "</serviceList>");\r
+    }\r
+    if(i_dev->number_of_devices>0){\r
+        NyLPC_cHttpdConnection_sendResponseBodyF(i_connection,\r
+            "<deviceList>");\r
+        for(i=0;i<i_dev->number_of_devices;i++){\r
+            (*sidx)=(*sidx)+0x10;\r
+            writeDeviceNode(i_dev->devices[i],i_connection,sidx);\r
+        }\r
+        NyLPC_cHttpdConnection_sendResponseBodyF(i_connection,\r
+            "</deviceList>");\r
+    }\r
+    if(i_dev->presentation_url!=NULL){\r
+        NyLPC_cHttpdConnection_sendResponseBodyF(i_connection,\r
+            "<presentationURL>%s</presentationURL></device>",\r
+            i_dev->presentation_url);\r
+    }\r
+    else{\r
+        NyLPC_cHttpdConnection_sendResponseBodyF(i_connection,\r
+            "</device>");\r
+    }\r
 }\r
 NyLPC_TBool writeDeviceDescription(const struct NyLPC_TUPnPDevDescDevice* i_dev,NyLPC_TcHttpdConnection_t* i_connection)\r
 {\r
-       NyLPC_cHttpdConnection_sendResponseBodyF(i_connection,\r
-               "<?xml version=\"1.0\"?>"\r
-               "<root xmlns=\"urn:schemas-upnp-org:device-1-0\">"\r
-               "<specVersion><major>1</major><minor>0</minor></specVersion>");\r
-       writeDeviceNode(i_dev,i_connection,0);\r
-       return NyLPC_cHttpdConnection_sendResponseBodyF(i_connection,"</root>");\r
+    NyLPC_cHttpdConnection_sendResponseBodyF(i_connection,\r
+        "<?xml version=\"1.0\"?>"\r
+        "<root xmlns=\"urn:schemas-upnp-org:device-1-0\">"\r
+        "<specVersion><major>1</major><minor>0</minor></specVersion>");\r
+    writeDeviceNode(i_dev,i_connection,0);\r
+    return NyLPC_cHttpdConnection_sendResponseBodyF(i_connection,"</root>");\r
 }\r
 \r
 \r
@@ -222,61 +223,61 @@ NyLPC_TBool writeDeviceDescription(const struct NyLPC_TUPnPDevDescDevice* i_dev,
  */\r
 static NyLPC_TInt16 parseSidx(const NyLPC_TChar* i_str)\r
 {\r
-       //先頭は/であること\r
-       if(*i_str!='/'){\r
-               return -1;\r
-       }\r
-       //2桁の16進数であること\r
-       if(!isxdigit(*(i_str+1)) || !isxdigit(*(i_str+2))){\r
-               return -1;\r
-       }\r
-       //サービスID化\r
-       return NyLPC_ctox(*(i_str+1))<<8 | NyLPC_ctox(*(i_str+2));\r
+    //先頭は/であること\r
+    if(*i_str!='/'){\r
+        return -1;\r
+    }\r
+    //2桁の16進数であること\r
+    if(!isxdigit((int)(*(i_str+1))) || !isxdigit((int)(*(i_str+2)))){\r
+        return -1;\r
+    }\r
+    //サービスID化\r
+    return NyLPC_ctox(*(i_str+1))<<8 | NyLPC_ctox(*(i_str+2));\r
 }\r
 \r
 \r
 static NyLPC_TBool urlHandler(NyLPC_TcHttpBasicHeaderParser_t* i_inst,NyLPC_TChar i_c,struct NyLPC_THttpBasicHeader* o_out)\r
 {\r
 \r
-       struct TUPnPDeviceHeader* out=(struct TUPnPDeviceHeader*)o_out;\r
-       //読み飛ばし\r
-       if(out->_prefix_len<0){\r
-               out->_prefix_len++;\r
-               return NyLPC_TBool_TRUE;//読み飛ばし\r
-       }\r
-       if(out->_astate==ST_PARSE_PATH){\r
-               if(i_c!='\0' && i_c!='?'){\r
-                       if(!NyLPC_cStr_put(&(out->_tstr),i_c)){\r
-                               NyLPC_OnErrorGoto(ERROR);\r
-                       }\r
-                       return NyLPC_TBool_TRUE;\r
-               }\r
-               if(strcmp(NyLPC_cStr_str(&(out->_tstr)),CONTENT_STR_DEVICE_XML)==0){\r
-                       out->_content_id=CONTENT_ID_DEVICE_XML;\r
-               }else if(strncmp(CONTENT_STR_CONTROL_PATH,NyLPC_cStr_str(&(out->_tstr)),7)==0){\r
-                       out->_content_id=CONTENT_ID_CONTROL;\r
-                       parseSidx(NyLPC_cStr_str(&(out->_tstr))+7);\r
-               }else if(strncmp(CONTENT_STR_EVENT_PATH,NyLPC_cStr_str(&(out->_tstr)),5)==0){\r
-                       out->_content_id=CONTENT_ID_EVENT;\r
-                       parseSidx(NyLPC_cStr_str(&(out->_tstr))+5);\r
-               }else{\r
-                       NyLPC_OnErrorGoto(ERROR);\r
-               }\r
-               NyLPC_cStr_clear(&(out->_tstr));\r
-               out->_astate=ST_PARSE_QUERY_NAME;//クエリ名解析へ\r
-               return NyLPC_TBool_TRUE;\r
-       }\r
-       return NyLPC_TBool_TRUE;\r
+    struct TUPnPDeviceHeader* out=(struct TUPnPDeviceHeader*)o_out;\r
+    //読み飛ばし\r
+    if(out->_prefix_len<0){\r
+        out->_prefix_len++;\r
+        return NyLPC_TBool_TRUE;//読み飛ばし\r
+    }\r
+    if(out->_astate==ST_PARSE_PATH){\r
+        if(i_c!='\0' && i_c!='?'){\r
+            if(!NyLPC_cStr_put(&(out->_tstr),i_c)){\r
+                NyLPC_OnErrorGoto(ERROR);\r
+            }\r
+            return NyLPC_TBool_TRUE;\r
+        }\r
+        if(strcmp(NyLPC_cStr_str(&(out->_tstr)),CONTENT_STR_DEVICE_XML)==0){\r
+            out->_content_id=CONTENT_ID_DEVICE_XML;\r
+        }else if(strncmp(CONTENT_STR_CONTROL_PATH,NyLPC_cStr_str(&(out->_tstr)),7)==0){\r
+            out->_content_id=CONTENT_ID_CONTROL;\r
+            parseSidx(NyLPC_cStr_str(&(out->_tstr))+7);\r
+        }else if(strncmp(CONTENT_STR_EVENT_PATH,NyLPC_cStr_str(&(out->_tstr)),5)==0){\r
+            out->_content_id=CONTENT_ID_EVENT;\r
+            parseSidx(NyLPC_cStr_str(&(out->_tstr))+5);\r
+        }else{\r
+            NyLPC_OnErrorGoto(ERROR);\r
+        }\r
+        NyLPC_cStr_clear(&(out->_tstr));\r
+        out->_astate=ST_PARSE_QUERY_NAME;//クエリ名解析へ\r
+        return NyLPC_TBool_TRUE;\r
+    }\r
+    return NyLPC_TBool_TRUE;\r
 ERROR:\r
-       return NyLPC_TBool_FALSE;\r
+    return NyLPC_TBool_FALSE;\r
 }\r
 /**\r
  * デフォルトハンドラ\r
  */\r
 static const struct NyLPC_TcHttpBasicHeaderParser_Handler handler=\r
 {\r
-       NULL,\r
-       urlHandler\r
+    NULL,\r
+    urlHandler\r
 };\r
 \r
 \r
@@ -289,19 +290,19 @@ static const struct NyLPC_TcHttpBasicHeaderParser_Handler handler=
  */\r
 void NyLPC_cModUPnPDevice_initialize(NyLPC_TcModUPnPDevice_t* i_inst,const NyLPC_TcUPnP_t* i_ref_upnp)\r
 {\r
-       NyLPC_cModRomFiles_initialize(&i_inst->super,i_ref_upnp->_ref_root_path,NULL,0);\r
-       i_inst->_ref_upnp=i_ref_upnp;\r
+    NyLPC_cModRomFiles_initialize(&i_inst->super,i_ref_upnp->_ref_root_path,NULL,0);\r
+    i_inst->_ref_upnp=i_ref_upnp;\r
 }\r
 void NyLPC_cModUPnPDevice_finalize(NyLPC_TcModUPnPDevice_t* i_inst)\r
 {\r
-       NyLPC_cModRomFiles_finalize(&i_inst->super);\r
+    NyLPC_cModRomFiles_finalize(&i_inst->super);\r
 }\r
 /**\r
  * モジュールがコネクションをハンドリングできるかを返します。\r
  */\r
 NyLPC_TBool NyLPC_cModUPnPDevice_canHandle(NyLPC_TcModUPnPDevice_t* i_inst,NyLPC_TcHttpdConnection_t* i_connection)\r
 {\r
-       return NyLPC_cModRomFiles_canHandle(&i_inst->super,i_connection);\r
+    return NyLPC_cModRomFiles_canHandle(&i_inst->super,i_connection);\r
 }\r
 \r
 /**\r
@@ -309,65 +310,65 @@ NyLPC_TBool NyLPC_cModUPnPDevice_canHandle(NyLPC_TcModUPnPDevice_t* i_inst,NyLPC
  */\r
 NyLPC_TBool NyLPC_cModUPnPDevice_execute(NyLPC_TcModUPnPDevice_t* i_inst,NyLPC_TcHttpdConnection_t* i_connection)\r
 {\r
-       NyLPC_TUInt8 method_type;\r
-       struct TUPnPDeviceHeader header;\r
-       NyLPC_TcHttpBasicHeaderParser_t parser;\r
+    NyLPC_TUInt8 method_type;\r
+    struct TUPnPDeviceHeader header;\r
+    NyLPC_TcHttpBasicHeaderParser_t parser;\r
 \r
-       //リクエストParse済へ遷移(この関数の後はModが責任を持ってリクエストを返却)\r
-       NyLPC_cHttpdConnection_setReqStatusParsed(i_connection);\r
-       NyLPC_cStr_initialize(&header._tstr,header._tstr_buf,SIZE_OF_STRBUF);\r
+    //リクエストParse済へ遷移(この関数の後はModが責任を持ってリクエストを返却)\r
+    NyLPC_cHttpdConnection_setReqStatusParsed(i_connection);\r
+    NyLPC_cStr_initialize(&header._tstr,header._tstr_buf,SIZE_OF_STRBUF);\r
 \r
-       //URL解析の準備\r
-       header._prefix_len=-((NyLPC_TInt16)strlen(i_inst->super._ref_root_path)+2);\r
-       header._astate=ST_PARSE_PATH;\r
+    //URL解析の準備\r
+    header._prefix_len=-((NyLPC_TInt16)strlen(i_inst->super._ref_root_path)+2);\r
+    header._astate=ST_PARSE_PATH;\r
 \r
-       NyLPC_cHttpBasicHeaderParser_initialize(&parser,&handler);\r
-       NyLPC_cHttpBasicHeaderParser_parseInit(&parser,&(header.super));\r
-       //プリフェッチしたデータを流す\r
-       NyLPC_cHttpdConnection_pushPrefetchInfo(i_connection,&parser,&header.super);\r
-       //後続をストリームから取り込む\r
-       if(!NyLPC_cHttpBasicHeaderParser_parseStream(&parser,NyLPC_cHttpdConnection_refStream(i_connection),&(header.super))){\r
-               NyLPC_cHttpdUtils_sendErrorResponse(i_connection,500);\r
-               NyLPC_OnErrorGoto(Error2);\r
-       }\r
-       if(!NyLPC_cHttpBasicHeaderParser_parseFinish(&parser,&(header.super))){\r
-               NyLPC_cHttpdUtils_sendErrorResponse(i_connection,500);\r
-               NyLPC_OnErrorGoto(Error2);\r
-       }\r
-       //GETかHEADに制限(Descriptionの場合だけ)\r
-       method_type=NyLPC_cHttpdConnection_getMethod(i_connection);\r
-       if(method_type!=NyLPC_THttpMethodType_GET && method_type!=NyLPC_THttpMethodType_HEAD)\r
-       {\r
-               NyLPC_cHttpdUtils_sendErrorResponse(i_connection,405);\r
-               NyLPC_OnErrorGoto(Error2);\r
-       }\r
-       //Request::ConnectionがClose設定,又はHTTP1.1では無い場合,CLOSE\r
-       if(header.super.connection==NyLPC_THttpMessgeHeader_Connection_CLOSE || header.super.startline.req.version!=NyLPC_THttpVersion_11)\r
-       {\r
-               NyLPC_cHttpdConnection_setConnectionMode(i_connection,NyLPC_TcHttpdConnection_CONNECTION_MODE_CLOSE);\r
-       }\r
-       //CGIの実行\r
-       switch(header._content_id)\r
-       {\r
-       case CONTENT_ID_DEVICE_XML:\r
-               NyLPC_cHttpdConnection_sendResponseHeader(i_connection,200,CONTENT_STR_XML_MIME_TYPE,NULL);\r
-               writeDeviceDescription(i_inst->_ref_upnp->ref_root_device,i_connection);\r
-               //DeviceXML\r
-               break;\r
-       case CONTENT_ID_CONTROL:\r
-               //SoapHandler 未実装\r
-       case CONTENT_ID_EVENT:\r
-               //EventHandler 未実装\r
-       default:\r
-               NyLPC_cHttpdUtils_sendErrorResponse(i_connection,500);\r
-               NyLPC_OnErrorGoto(Error2);\r
-       }\r
-       NyLPC_cHttpBasicHeaderParser_finalize(&parser);\r
-       NyLPC_cStr_finalize(&header._tstr);\r
-       return NyLPC_TBool_TRUE;\r
+    NyLPC_cHttpBasicHeaderParser_initialize(&parser,&handler);\r
+    NyLPC_cHttpBasicHeaderParser_parseInit(&parser,&(header.super));\r
+    //プリフェッチしたデータを流す\r
+    NyLPC_cHttpdConnection_pushPrefetchInfo(i_connection,&parser,&header.super);\r
+    //後続をストリームから取り込む\r
+    if(!NyLPC_cHttpBasicHeaderParser_parseStream(&parser,NyLPC_cHttpdConnection_refStream(i_connection),&(header.super))){\r
+        NyLPC_cHttpdUtils_sendErrorResponse(i_connection,500);\r
+        NyLPC_OnErrorGoto(Error2);\r
+    }\r
+    if(!NyLPC_cHttpBasicHeaderParser_parseFinish(&parser,&(header.super))){\r
+        NyLPC_cHttpdUtils_sendErrorResponse(i_connection,500);\r
+        NyLPC_OnErrorGoto(Error2);\r
+    }\r
+    //GETかHEADに制限(Descriptionの場合だけ)\r
+    method_type=NyLPC_cHttpdConnection_getMethod(i_connection);\r
+    if(method_type!=NyLPC_THttpMethodType_GET && method_type!=NyLPC_THttpMethodType_HEAD)\r
+    {\r
+        NyLPC_cHttpdUtils_sendErrorResponse(i_connection,405);\r
+        NyLPC_OnErrorGoto(Error2);\r
+    }\r
+    //Request::ConnectionがClose設定,又はHTTP1.1では無い場合,CLOSE\r
+    if(header.super.connection==NyLPC_THttpMessgeHeader_Connection_CLOSE || header.super.startline.req.version!=NyLPC_THttpVersion_11)\r
+    {\r
+        NyLPC_cHttpdConnection_setConnectionMode(i_connection,NyLPC_TcHttpdConnection_CONNECTION_MODE_CLOSE);\r
+    }\r
+    //CGIの実行\r
+    switch(header._content_id)\r
+    {\r
+    case CONTENT_ID_DEVICE_XML:\r
+        NyLPC_cHttpdConnection_sendResponseHeader(i_connection,200,CONTENT_STR_XML_MIME_TYPE,NULL);\r
+        writeDeviceDescription(i_inst->_ref_upnp->ref_root_device,i_connection);\r
+        //DeviceXML\r
+        break;\r
+    case CONTENT_ID_CONTROL:\r
+        //SoapHandler 未実装\r
+    case CONTENT_ID_EVENT:\r
+        //EventHandler 未実装\r
+    default:\r
+        NyLPC_cHttpdUtils_sendErrorResponse(i_connection,500);\r
+        NyLPC_OnErrorGoto(Error2);\r
+    }\r
+    NyLPC_cHttpBasicHeaderParser_finalize(&parser);\r
+    NyLPC_cStr_finalize(&header._tstr);\r
+    return NyLPC_TBool_TRUE;\r
 Error2:\r
-       NyLPC_cHttpBasicHeaderParser_finalize(&parser);\r
-       NyLPC_cStr_finalize(&header._tstr);\r
-       return NyLPC_TBool_FALSE;\r
+    NyLPC_cHttpBasicHeaderParser_finalize(&parser);\r
+    NyLPC_cStr_finalize(&header._tstr);\r
+    return NyLPC_TBool_FALSE;\r
 }\r
 \r