Index: EcnlProtoTool/trunk/ntshell/webserver/httpd.c
===================================================================
--- EcnlProtoTool/trunk/ntshell/webserver/httpd.c	(revision 436)
+++ EcnlProtoTool/trunk/ntshell/webserver/httpd.c	(revision 441)
@@ -59,5 +59,5 @@
 #define FALSE 0
 
-extern ntstdio_t ntstdio;
+extern ntstdio_t *ntstdio;
 SYSTIM httpd_time;
 struct httpd_state *uploding;
@@ -65,8 +65,17 @@
 
 /*  TCP 送受信ウィンドバッファ  */
+#ifdef SUPPORT_INET6
+uint8_t tcp6_swbuf1[TCP_SWBUF_SIZE];
+uint8_t tcp6_rwbuf1[TCP_RWBUF_SIZE];
+uint8_t tcp6_swbuf2[TCP_SWBUF_SIZE];
+uint8_t tcp6_rwbuf2[TCP_RWBUF_SIZE];
+#endif
+
+#ifdef SUPPORT_INET4
 uint8_t tcp_swbuf1[TCP_SWBUF_SIZE];
 uint8_t tcp_rwbuf1[TCP_RWBUF_SIZE];
 uint8_t tcp_swbuf2[TCP_SWBUF_SIZE];
 uint8_t tcp_rwbuf2[TCP_RWBUF_SIZE];
+#endif
 
 #define ISO_nl      0x0a
@@ -325,5 +334,5 @@
 			// アップロード先はSDカード
 			s->filename[0] = '1';
-			ntstdio_printf(&ntstdio, "create:    %s.%d %s\n", s->addr, ((T_IPV4EP *)s->dst)->portno, s->filename);
+			ntstdio_printf(ntstdio, "create:    %s.%d %s\n", s->addr, ((T_IPV4EP *)s->dst)->portno, s->filename);
 			if (!httpd_fs_create(s->filename, &s->file)) {
 				goto error;
@@ -333,5 +342,5 @@
 		}
 		else if (ntlibc_strcmp(s->filename, uploding->filename) == 0) {
-			ntstdio_printf(&ntstdio, "collision: %s.%d %s\n", s->addr, ((T_IPV4EP *)s->dst)->portno, s->filename);
+			ntstdio_printf(ntstdio, "collision: %s.%d %s\n", s->addr, ((T_IPV4EP *)s->dst)->portno, s->filename);
 			goto error;
 		}
@@ -365,5 +374,5 @@
 
 	if (s->message.body_is_final) {
-		ntstdio_printf(&ntstdio, "\n\n *** Error http_body_is_final() should return 1 \n"
+		ntstdio_printf(ntstdio, "\n\n *** Error http_body_is_final() should return 1 \n"
 			"on last on_body callback call "
 			"but it doesn't! ***\n\n");
@@ -378,5 +387,5 @@
 
 	if (s->message.body_is_final) {
-		ntstdio_printf(&ntstdio, "close:     %s.%d %s\n", s->addr, ((T_IPV4EP *)s->dst)->portno, s->filename);
+		ntstdio_printf(ntstdio, "close:     %s.%d %s\n", s->addr, ((T_IPV4EP *)s->dst)->portno, s->filename);
 		httpd_fs_close(&s->file);
 		memset(&s->file, 0, sizeof(s->file));
@@ -403,5 +412,5 @@
 	struct httpd_state *s = get_context(p);
 	if (s->message.should_keep_alive != http_should_keep_alive(p)) {
-		ntstdio_printf(&ntstdio, "\n\n *** Error http_should_keep_alive() should have same \n"
+		ntstdio_printf(ntstdio, "\n\n *** Error http_should_keep_alive() should have same \n"
 			"value in both on_message_complete and on_headers_complete "
 			"but it doesn't! ***\n\n");
@@ -412,5 +421,5 @@
 		http_body_is_final(p) &&
 		!s->message.body_is_final) {
-		ntstdio_printf(&ntstdio, "\n\n *** Error http_body_is_final() should return 1 \n"
+		ntstdio_printf(ntstdio, "\n\n *** Error http_body_is_final() should return 1 \n"
 			"on last on_body callback call "
 			"but it doesn't! ***\n\n");
@@ -484,5 +493,5 @@
 		slen = tcp_get_buf(s->cepid, (void **)&buf, TMO_FEVR);
 		if (slen < 0) {
-			ntstdio_printf(&ntstdio, "send_file#tcp_get_buf(%s.%d) => %d\n", s->addr, ((T_IPV4EP *)s->dst)->portno, slen);
+			ntstdio_printf(ntstdio, "send_file#tcp_get_buf(%s.%d) => %d\n", s->addr, ((T_IPV4EP *)s->dst)->portno, slen);
 			s->state = STATE_CLOSING;
 			break;
@@ -497,5 +506,5 @@
 		len = httpd_fs_read(&s->file, buf, len);
 		if (len <= 0) {
-			ntstdio_printf(&ntstdio, "send_file#httpd_fs_read(%s.%d) => %d\n", s->addr, ((T_IPV4EP *)s->dst)->portno, len);
+			ntstdio_printf(ntstdio, "send_file#httpd_fs_read(%s.%d) => %d\n", s->addr, ((T_IPV4EP *)s->dst)->portno, len);
 			break;
 		}
@@ -505,5 +514,5 @@
 
 		if ((slen = tcp_snd_buf(s->cepid, len)) != E_OK) {
-			ntstdio_printf(&ntstdio, "send_file#tcp_snd_buf(%s.%d) => %d\n", s->addr, ((T_IPV4EP *)s->dst)->portno, slen);
+			ntstdio_printf(ntstdio, "send_file#tcp_snd_buf(%s.%d) => %d\n", s->addr, ((T_IPV4EP *)s->dst)->portno, slen);
 			s->state = STATE_CLOSING;
 			break;
@@ -511,5 +520,5 @@
 	}
 
-	ntstdio_printf(&ntstdio, "close:     %s.%d %s\n", s->addr, ((T_IPV4EP *)s->dst)->portno, s->filename);
+	ntstdio_printf(ntstdio, "close:     %s.%d %s\n", s->addr, ((T_IPV4EP *)s->dst)->portno, s->filename);
 	httpd_fs_close(&s->file);
 	s->file.len = 0;
@@ -527,5 +536,5 @@
 		slen = tcp_get_buf(s->cepid, (void **)&buf, TMO_FEVR);
 		if (slen < 0) {
-			ntstdio_printf(&ntstdio, "send_data#tcp_get_buf(%s.%d) => %d\n", s->addr, ((T_IPV4EP *)s->dst)->portno, slen);
+			ntstdio_printf(ntstdio, "send_data#tcp_get_buf(%s.%d) => %d\n", s->addr, ((T_IPV4EP *)s->dst)->portno, slen);
 			s->state = STATE_CLOSING;
 			break;
@@ -544,5 +553,5 @@
 
 		if ((slen = tcp_snd_buf(s->cepid, len)) != E_OK) {
-			ntstdio_printf(&ntstdio, "send_data#tcp_snd_buf(%s.%d) => %d\n", s->addr, ((T_IPV4EP *)s->dst)->portno, slen);
+			ntstdio_printf(ntstdio, "send_data#tcp_snd_buf(%s.%d) => %d\n", s->addr, ((T_IPV4EP *)s->dst)->portno, slen);
 			s->state = STATE_CLOSING;
 			break;
@@ -690,5 +699,5 @@
 		break;
 	case OUT_STATE_OPEN_GET_FILE:
-		ntstdio_printf(&ntstdio, "open:      %s.%d %s\n", s->addr, ((T_IPV4EP *)s->dst)->portno, s->filename);
+		ntstdio_printf(ntstdio, "open:      %s.%d %s\n", s->addr, ((T_IPV4EP *)s->dst)->portno, s->filename);
 		if (!httpd_fs_open(s->filename, sizeof(s->message.request_url), &s->file)) {
 			s->filename = NULL;
@@ -704,26 +713,26 @@
 		break;
 	case OUT_STATE_WAIT_POST_BODY:
-		//ntstdio_printf(&ntstdio, "wait post body\n");
+		//ntstdio_printf(ntstdio, "wait post body\n");
 		s->out.wait = true;
 		break;
 	case OUT_STATE_BODY_RECEIVED:
-		//ntstdio_printf(&ntstdio, "body received\n");
+		//ntstdio_printf(ntstdio, "body received\n");
 		s->out.statushdr = http_header_200;
 		s->out.state = OUT_STATE_SEND_HEADER;
 		break;
 	case OUT_STATE_SEND_HEADER:
-		//ntstdio_printf(&ntstdio, "send header\n");
+		//ntstdio_printf(ntstdio, "send header\n");
 		send_headers(s, s->out.statushdr);
 		break;
 	case OUT_STATE_SEND_FILE:
-		//ntstdio_printf(&ntstdio, "send file %d\n", s->file.len);
+		//ntstdio_printf(ntstdio, "send file %d\n", s->file.len);
 		send_file(s);
 		break;
 	case OUT_STATE_SEND_DATA:
-		//ntstdio_printf(&ntstdio, "send data %d\n", s->response_len);
+		//ntstdio_printf(ntstdio, "send data %d\n", s->response_len);
 		send_data(s);
 		break;
 	case OUT_STATE_SEND_END:
-		//ntstdio_printf(&ntstdio, "send end\n");
+		//ntstdio_printf(ntstdio, "send end\n");
 		s->out.wait = true;
 		if (s->message.should_keep_alive && s->reset == 0) {
@@ -783,5 +792,5 @@
 	slen = tcp_get_buf(s->cepid, (void **)&buf, TMO_FEVR);
 	if (slen < 0) {
-		ntstdio_printf(&ntstdio, "send_ws_data#tcp_get_buf(%s.%d) => %d\n", s->addr, ((T_IPV4EP *)s->dst)->portno, slen);
+		ntstdio_printf(ntstdio, "send_ws_data#tcp_get_buf(%s.%d) => %d\n", s->addr, ((T_IPV4EP *)s->dst)->portno, slen);
 		return;
 	}
@@ -847,5 +856,5 @@
 				//}
 			}
-			ntstdio_printf(&ntstdio, "handle_input#tcp_rcv_buf#%d(%s.%d) => %d\n", s->in.state, s->addr, ((T_IPV4EP *)s->dst)->portno, len);
+			ntstdio_printf(ntstdio, "handle_input#tcp_rcv_buf#%d(%s.%d) => %d\n", s->in.state, s->addr, ((T_IPV4EP *)s->dst)->portno, len);
 			uploding = NULL;
 			s->state = STATE_CLOSING;
@@ -855,5 +864,5 @@
 		tcp_rel_buf(s->cepid, done);
 		if (s->parser.http_errno != HPE_OK) {
-			ntstdio_printf(&ntstdio, "http_parser error %s.%d => %d\n", s->addr, ((T_IPV4EP *)s->dst)->portno, s->parser.http_errno);
+			ntstdio_printf(ntstdio, "http_parser error %s.%d => %d\n", s->addr, ((T_IPV4EP *)s->dst)->portno, s->parser.http_errno);
 			uploding = NULL;
 			s->state = STATE_CLOSING;
@@ -880,5 +889,5 @@
 					break;
 				}
-				ntstdio_printf(&ntstdio, "handle_input#tcp_rcv_buf#%d(%s.%d) => %d\n", s->in.state, s->addr, ((T_IPV4EP *)s->dst)->portno, len);
+				ntstdio_printf(ntstdio, "handle_input#tcp_rcv_buf#%d(%s.%d) => %d\n", s->in.state, s->addr, ((T_IPV4EP *)s->dst)->portno, len);
 				s->state = STATE_CLOSING;
 				break;
@@ -918,7 +927,7 @@
 
 	if (s == NULL)
-		ntstdio_printf(&ntstdio, "callback_nblk_tcp(%d, %d)\n", fncd, cepid);
+		ntstdio_printf(ntstdio, "callback_nblk_tcp(%d, %d)\n", fncd, cepid);
 	else
-		ntstdio_printf(&ntstdio, "callback_nblk_tcp(%d, %s.%d)\n", fncd, s->addr, ((T_IPV4EP *)s->dst)->portno);
+		ntstdio_printf(ntstdio, "callback_nblk_tcp(%d, %s.%d)\n", fncd, s->addr, ((T_IPV4EP *)s->dst)->portno);
 
 	return E_PAR;
@@ -936,5 +945,5 @@
 		ret2 = get_tim(&httpd_time);
 		if (ret2 != E_OK) {
-			ntstdio_printf(&ntstdio, "get_tim\n");
+			ntstdio_printf(ntstdio, "get_tim\n");
 			return;
 		}
@@ -944,5 +953,5 @@
 			memset(&s->dst, 0, sizeof(s->dst));
 			if ((ret = tcp_acp_cep(s->cepid, TCP_REPID, (T_IPV4EP *)s->dst, TMO_FEVR)) != E_OK) {
-				ntstdio_printf(&ntstdio, "tcp_acp_cep(%d) => %d\n", s->cepid, ret);
+				ntstdio_printf(ntstdio, "tcp_acp_cep(%d) => %d\n", s->cepid, ret);
 				tslp_tsk(100 * 1000);	// TODO
 				s->state = STATE_CLOSING;
@@ -950,5 +959,5 @@
 			}
 			IP2STR(s->addr, &((T_IPV4EP *)s->dst)->ipaddr);
-			ntstdio_printf(&ntstdio, "connected: %s.%d\n", s->addr, ((T_IPV4EP *)s->dst)->portno);
+			ntstdio_printf(ntstdio, "connected: %s.%d\n", s->addr, ((T_IPV4EP *)s->dst)->portno);
 			memset(&s->in, 0, sizeof(s->in));
 			memset(&s->out, 0, sizeof(s->out));
@@ -965,5 +974,5 @@
 			break;
 		case STATE_CLOSING:
-			ntstdio_printf(&ntstdio, "close:     %s.%d\n", s->addr, ((T_IPV4EP *)s->dst)->portno);
+			ntstdio_printf(ntstdio, "close:     %s.%d\n", s->addr, ((T_IPV4EP *)s->dst)->portno);
 			tcp_sht_cep(s->cepid);
 			tcp_cls_cep(s->cepid, TMO_FEVR);
