Browse Source

UDS ok, index.html fail

zhangbo 5 years ago
parent
commit
70577addf1

BIN
app/bmc/bmc_app


+ 5 - 5
app/bmc/msghndlr/MsgHndlrTask.c

@@ -212,7 +212,7 @@ ProcessIPMIReq (MsgPkt_T* pReq, MsgPkt_T* pRes)
 	}
 	if(UDS_CHANNEL == pReq->Channel)
 	{
-		//printf("log 2, pReq->Channel: %#x\n", pReq->Channel);
+		printf("log 2, pReq->Size: %d, HdrOffset: %d\n", pReq->Size, HdrOffset);
 		HdrOffset = sizeof(IPMIUDSMsg_T);
 		pReq->Size = pReq->Size -HdrOffset - 1;
 	}
@@ -792,22 +792,22 @@ SwapUDSIPMIMsg ( MsgPkt_T* pIPMIMsgReq,  MsgPkt_T* pIPMIMsgRes)
 	IPMIUDSMsg_T *pIPMIUDSMsgReq = (IPMIUDSMsg_T *)&pIPMIMsgReq->Data[0];
 
 	pIPMIMsgRes->NetFnLUN = pIPMIMsgReq->NetFnLUN;
-	pIPMIMsgRes->Privilege = pIPMIMsgReq->Privilege;
+//	pIPMIMsgRes->Privilege = pIPMIMsgReq->Privilege;
 	pIPMIMsgRes->Cmd = pIPMIMsgReq->Cmd;
 	pIPMIMsgRes->Channel = pIPMIMsgReq->Channel;
 	pIPMIMsgRes->SessionID   = pIPMIMsgReq->SessionID;
 	pIPMIMsgRes->Socket = pIPMIMsgReq->Socket;
 
 	pIPMIUDSMsgRes->NetFnLUN = pIPMIMsgReq->NetFnLUN;
-	pIPMIUDSMsgRes->Privilege = pIPMIMsgReq->Privilege;
+//	pIPMIUDSMsgRes->Privilege = pIPMIMsgReq->Privilege;
 	pIPMIUDSMsgRes->Cmd = pIPMIMsgReq->Cmd;
 	pIPMIUDSMsgRes->ChannelNum = pIPMIMsgReq->Channel;
 	pIPMIUDSMsgRes->SessionID = pIPMIMsgReq->SessionID;
 	//pIPMIUDSMsgRes->AuthFlag = pIPMIUDSMsgReq->AuthFlag;
 	pIPMIUDSMsgRes->IPMIMsgLen = pIPMIMsgRes->Size;
 	
-	strcpy( (char *)pIPMIUDSMsgRes->UserName, (char *)pIPMIUDSMsgReq->UserName);
-	memcpy(pIPMIUDSMsgRes->IPAddr, pIPMIUDSMsgReq->IPAddr, 16);  
+//	strcpy( (char *)pIPMIUDSMsgRes->UserName, (char *)pIPMIUDSMsgReq->UserName);
+//	memcpy(pIPMIUDSMsgRes->IPAddr, pIPMIUDSMsgReq->IPAddr, 16);  
 
 	return;
 }

+ 5 - 5
app/bmc/uds/UDSIfc.c

@@ -330,7 +330,7 @@ int ReadUDSData(MsgPkt_T *MsgPkt,int Socket )
     MsgPkt->SessionID   = pIPMIUDSMsg->SessionID;
     MsgPkt->Cmd         = pIPMIUDSMsg->Cmd;
     MsgPkt->NetFnLUN    = pIPMIUDSMsg->NetFnLUN;
-    MsgPkt->Privilege   = pIPMIUDSMsg->Privilege;
+ //   MsgPkt->Privilege   = pIPMIUDSMsg->Privilege;
     MsgPkt->Socket      = Socket;
     MsgPkt->Size        = RecvdLen;
     MsgPkt->Param       = PARAM_IFC;
@@ -448,13 +448,13 @@ int FillUDSResponsePacket(MsgPkt_T *pReq,MsgPkt_T *pRes,uint8_t UDSCompletionCod
     pIPMIUDSMsgRes->SessionID = pIPMIUDSMsgReq->SessionID;
     pIPMIUDSMsgRes->Cmd = pIPMIUDSMsgReq->Cmd;
     pIPMIUDSMsgRes->NetFnLUN = pIPMIUDSMsgReq->NetFnLUN;
-    pIPMIUDSMsgRes->Privilege = pIPMIUDSMsgReq->Privilege;
+ //   pIPMIUDSMsgRes->Privilege = pIPMIUDSMsgReq->Privilege;
     pIPMIUDSMsgRes->IPMIMsgLen = sizeof(IPMIUDSMsg_T)+sizeof(uint8_t)+1;
     pIPMIUDSMsgRes->ChannelNum = pIPMIUDSMsgReq->ChannelNum;
-    pIPMIUDSMsgRes->AuthFlag = pIPMIUDSMsgReq->AuthFlag;
+//    pIPMIUDSMsgRes->AuthFlag = pIPMIUDSMsgReq->AuthFlag;
     
-    strcpy( (char *)pIPMIUDSMsgRes->UserName, (char *)pIPMIUDSMsgReq->UserName);
-    memcpy(pIPMIUDSMsgRes->IPAddr, pIPMIUDSMsgReq->IPAddr, 16);
+//    strcpy( (char *)pIPMIUDSMsgRes->UserName, (char *)pIPMIUDSMsgReq->UserName);
+//    memcpy(pIPMIUDSMsgRes->IPAddr, pIPMIUDSMsgReq->IPAddr, 16);
 
     pRes->Size = pIPMIUDSMsgRes->IPMIMsgLen;
 

+ 6 - 6
app/common_include/com_IPMIDefs.h

@@ -545,16 +545,16 @@ typedef struct
 typedef struct
 {
     uint32_t SessionID;
-    uint8_t Privilege;
+//    uint8_t Privilege;
     uint16_t IPMIMsgLen;
     uint8_t NetFnLUN;
     uint8_t Cmd;
     uint8_t ChannelNum;
-    uint8_t AuthFlag;
-    uint8_t UserName[MAX_USERNAME_LEN];
-    uint8_t IPAddr[IP6_ADDR_LEN];
-    uint32_t ProcessID;
-    uint32_t ThreadID;
+//    uint8_t AuthFlag;
+//    uint8_t UserName[MAX_USERNAME_LEN];
+//    uint8_t IPAddr[IP6_ADDR_LEN];
+//    uint32_t ProcessID;
+//    uint32_t ThreadID;
 }IPMIUDSMsg_T;
 
 #pragma pack( )

+ 0 - 7
app/goahead-3.6.5/Jimbo_Note.txt

@@ -1,7 +0,0 @@
-1、所有的内存申请和释放都调用 alloc.c里定义的 "PUBLIC void *walloc(ssize num) " 和"PUBLIC void wfree(void *mem)"
-
-2、所有新增的用户代码都编译进 libgo.a 静态库中。
-
-3、请后台数据交互使用 goAction 方式。
-
-4、

BIN
app/goahead-3.6.5/build/linux-arm-static/bin/goahead


BIN
app/goahead-3.6.5/build/linux-arm-static/bin/gopass


BIN
app/goahead-3.6.5/build/linux-arm-static/bin/libgo.a


BIN
app/goahead-3.6.5/build/linux-arm-static/bin/libgoahead-mbedtls.a


BIN
app/goahead-3.6.5/build/linux-arm-static/bin/libmbedtls.a


+ 6 - 6
app/goahead-3.6.5/build/linux-arm-static/inc/com_IPMIDefs.h

@@ -545,16 +545,16 @@ typedef struct
 typedef struct
 {
     uint32_t SessionID;
-    uint8_t Privilege;
+//    uint8_t Privilege;
     uint16_t IPMIMsgLen;
     uint8_t NetFnLUN;
     uint8_t Cmd;
     uint8_t ChannelNum;
-    uint8_t AuthFlag;
-    uint8_t UserName[MAX_USERNAME_LEN];
-    uint8_t IPAddr[IP6_ADDR_LEN];
-    uint32_t ProcessID;
-    uint32_t ThreadID;
+//    uint8_t AuthFlag;
+//    uint8_t UserName[MAX_USERNAME_LEN];
+//    uint8_t IPAddr[IP6_ADDR_LEN];
+//    uint32_t ProcessID;
+//    uint32_t ThreadID;
 }IPMIUDSMsg_T;
 
 #pragma pack( )

+ 10 - 5
app/goahead-3.6.5/build/linux-arm-static/inc/goahead.h

@@ -24,8 +24,6 @@
 extern "C" {
 #endif
 
-#pragma pack(1)
-
 #if (ME_COM_MBEDTLS + ME_COM_MATRIXSSL + ME_COM_NANOSSL + ME_COM_OPENSSL) > 1
     #error "Cannot have more than one SSL provider configured"
 #endif
@@ -4160,9 +4158,16 @@ PUBLIC int websSetSessionVar(Webs *wp, char *name, char *value);
  #include "customize.h"
 #endif
 
-#pragma pack()
-
 #ifdef __cplusplus
 }
 #endif
-#endif /* _h_GOAHEAD */
+#endif /* _h_GOAHEAD */
+
+/*
+    Copyright (c) Embedthis Software. All Rights Reserved.
+    This software is distributed under commercial and open source licenses.
+    You may use the Embedthis GoAhead open source license or you may acquire
+    a commercial license from Embedthis Software. You agree to be fully bound
+    by the terms of either license. Consult the LICENSE.md distributed with
+    this software for full details and other copyrights.
+ */

+ 8 - 8
app/goahead-3.6.5/build/linux-arm-static/inc/libipmi_struct.h

@@ -30,17 +30,17 @@ typedef struct UDS_CHANNEL_T_tag {
 */
 typedef struct IPMI20_UDS_SESSION_T_tag {
   UDS_CHANNEL_T hUDSInfo;
-  char szUserName[MAX_USERNAME_LEN];
-  char szPwd[MAX_PASSWORD_LEN];
-  char szUName[MAX_USERNAME_LEN];
-  char abyIPAddr[IP6_ADDR_LEN];
+//  char szUserName[MAX_USERNAME_LEN];
+//  char szPwd[MAX_PASSWORD_LEN];
+//  char szUName[MAX_USERNAME_LEN];
+//  char abyIPAddr[IP6_ADDR_LEN];
   uint32_t dwSessionID;
-  uint8_t byPreSession;
-  uint8_t byAuthType;
-  uint8_t byRole;
+//  uint8_t byPreSession;
+//  uint8_t byAuthType;
+//  uint8_t byRole;
   uint8_t byChannelNum;
   uint8_t byDefTimeout;
-  uint8_t byMaxRetries;
+//  uint8_t byMaxRetries;
 }PACK IPMI20_UDS_SESSION_T;
 
 

+ 2 - 2
app/goahead-3.6.5/build/linux-arm-static/inc/osdep.h

@@ -130,7 +130,7 @@
     #define ME_OS "linux"
     #define LINUX 1
     #define ME_UNIX_LIKE 1
-    #define ME_WIN_LIKE 0   
+    #define ME_WIN_LIKE 0
     /*** jimbo add ***/
     #define HAS_USHORT 1
     #define HAS_UINT 1
@@ -1395,4 +1395,4 @@ extern "C" {
 /*
     Copyright (c) Michael O'Brien. All Rights Reserved.
     This is proprietary software and requires a commercial license from the author.
- */
+ */

+ 7 - 7
app/goahead-3.6.5/projects/goahead-linux-default-me.h

@@ -46,16 +46,16 @@
     #define ME_COMPILER_HAS_LIB_RT 1
 #endif
 #ifndef ME_COMPILER_HAS_MMU
-    #define ME_COMPILER_HAS_MMU 0   //1
+    #define ME_COMPILER_HAS_MMU 1
 #endif
 #ifndef ME_COMPILER_HAS_MTUNE
-    #define ME_COMPILER_HAS_MTUNE 0 //1
+    #define ME_COMPILER_HAS_MTUNE 1
 #endif
 #ifndef ME_COMPILER_HAS_PAM
     #define ME_COMPILER_HAS_PAM 0
 #endif
 #ifndef ME_COMPILER_HAS_STACK_PROTECTOR
-    #define ME_COMPILER_HAS_STACK_PROTECTOR 0   //1
+    #define ME_COMPILER_HAS_STACK_PROTECTOR 1
 #endif
 #ifndef ME_COMPILER_HAS_SYNC
     #define ME_COMPILER_HAS_SYNC 1
@@ -97,7 +97,7 @@
     #define ME_GOAHEAD_AUTO_LOGIN 0
 #endif
 #ifndef ME_GOAHEAD_CGI
-    #define ME_GOAHEAD_CGI 0    //1
+    #define ME_GOAHEAD_CGI 1
 #endif
 #ifndef ME_GOAHEAD_CGI_VAR_PREFIX
     #define ME_GOAHEAD_CGI_VAR_PREFIX "CGI_"
@@ -148,7 +148,7 @@
     #define ME_GOAHEAD_LIMIT_POST 16384
 #endif
 #ifndef ME_GOAHEAD_LIMIT_PUT
-    #define ME_GOAHEAD_LIMIT_PUT 2048000       //204800000
+    #define ME_GOAHEAD_LIMIT_PUT 204800000
 #endif
 #ifndef ME_GOAHEAD_LIMIT_SESSION_COUNT
     #define ME_GOAHEAD_LIMIT_SESSION_COUNT 512
@@ -163,7 +163,7 @@
     #define ME_GOAHEAD_LIMIT_TIMEOUT 60
 #endif
 #ifndef ME_GOAHEAD_LIMIT_UPLOAD
-    #define ME_GOAHEAD_LIMIT_UPLOAD 2048000     //204800000
+    #define ME_GOAHEAD_LIMIT_UPLOAD 204800000
 #endif
 #ifndef ME_GOAHEAD_LIMIT_URI
     #define ME_GOAHEAD_LIMIT_URI 2048
@@ -267,7 +267,7 @@
     #define ME_ROOT_PREFIX "/"
 #endif
 #ifndef ME_BASE_PREFIX
-    #define ME_BASE_PREFIX "/usr/local" 
+    #define ME_BASE_PREFIX "/usr/local"
 #endif
 #ifndef ME_DATA_PREFIX
     #define ME_DATA_PREFIX "/"

+ 97 - 72
app/goahead-3.6.5/projects/goahead-linux-default.mk

@@ -35,13 +35,13 @@ endif
 ifeq ($(ME_COM_OPENSSL),1)
     ME_COM_SSL := 1
 endif
-#CFLAGS 				  += --param=ssp-buffer-size=4
-#CFLAGS                += -fPIC -fstack-protector -Wformat -Wformat-security -Wl,-z,relro,-z,now -Wl,--as-needed -Wl,--no-copy-dt-needed-entries -Wl,-z,noexecstatck -Wl,-z,noexecheap -w
+
+CFLAGS                += -fPIC -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Wl,-z,relro,-z,now -Wl,--as-needed -Wl,--no-copy-dt-needed-entries -Wl,-z,noexecstatck -Wl,-z,noexecheap -w
 DFLAGS                += -DME_DEBUG=1 -D_REENTRANT -DPIC $(patsubst %,-D%,$(filter ME_%,$(MAKEFLAGS))) -DME_COM_COMPILER=$(ME_COM_COMPILER) -DME_COM_LIB=$(ME_COM_LIB) -DME_COM_MATRIXSSL=$(ME_COM_MATRIXSSL) -DME_COM_MBEDTLS=$(ME_COM_MBEDTLS) -DME_COM_NANOSSL=$(ME_COM_NANOSSL) -DME_COM_OPENSSL=$(ME_COM_OPENSSL) -DME_COM_OSDEP=$(ME_COM_OSDEP) -DME_COM_SSL=$(ME_COM_SSL) -DME_COM_VXWORKS=$(ME_COM_VXWORKS) 
 IFLAGS                += "-I$(BUILD)/inc"
-#LDFLAGS               += '-Wl,--enable-new-dtags' '-Wl,-rpath,$$ORIGIN/' #'-rdynamic'
+LDFLAGS               += '-rdynamic' '-Wl,--enable-new-dtags' '-Wl,-rpath,$$ORIGIN/'
 LIBPATHS              += -L$(BUILD)/bin
-LIBS                  += -lrt -lpthread -lm -lc #-ldl 
+LIBS                  += -lrt -ldl -lpthread -lm
 
 DEBUG                 ?= debug
 CFLAGS-debug          ?= -g
@@ -107,7 +107,31 @@ prep:
 	@echo "$(MAKEFLAGS)" >$(BUILD)/.makeflags
 
 clean:
-	rm -f $(BUILD)/obj/*.o
+	rm -f "$(BUILD)/obj/action.o"
+	rm -f "$(BUILD)/obj/alloc.o"
+	rm -f "$(BUILD)/obj/auth.o"
+	rm -f "$(BUILD)/obj/cgi.o"
+	rm -f "$(BUILD)/obj/cgitest.o"
+	rm -f "$(BUILD)/obj/crypt.o"
+	rm -f "$(BUILD)/obj/file.o"
+	rm -f "$(BUILD)/obj/fs.o"
+	rm -f "$(BUILD)/obj/goahead-mbedtls.o"
+	rm -f "$(BUILD)/obj/goahead-openssl.o"
+	rm -f "$(BUILD)/obj/goahead.o"
+	rm -f "$(BUILD)/obj/gopass.o"
+	rm -f "$(BUILD)/obj/http.o"
+	rm -f "$(BUILD)/obj/js.o"
+	rm -f "$(BUILD)/obj/jst.o"
+	rm -f "$(BUILD)/obj/mbedtls.o"
+	rm -f "$(BUILD)/obj/options.o"
+	rm -f "$(BUILD)/obj/osdep.o"
+	rm -f "$(BUILD)/obj/rom.o"
+	rm -f "$(BUILD)/obj/route.o"
+	rm -f "$(BUILD)/obj/runtime.o"
+	rm -f "$(BUILD)/obj/socket.o"
+	rm -f "$(BUILD)/obj/test.o"
+	rm -f "$(BUILD)/obj/time.o"
+	rm -f "$(BUILD)/obj/upload.o"
 	rm -f "$(BUILD)/bin/goahead"
 	rm -f "$(BUILD)/bin/goahead-test"
 	rm -f "$(BUILD)/bin/gopass"
@@ -641,93 +665,94 @@ $(BUILD)/bin/gopass: $(DEPS_40)
 #
 #   stop
 #
-#
-#stop: $(DEPS_41)
-#
+
+stop: $(DEPS_41)
+
 #
 #   installBinary
 #
 
-#installBinary: $(DEPS_42)
-#	mkdir -p "$(ME_APP_PREFIX)" ; \
-#	rm -f "$(ME_APP_PREFIX)/latest" ; \
-#	ln -s "$(VERSION)" "$(ME_APP_PREFIX)/latest" ; \
-#	mkdir -p "$(ME_MAN_PREFIX)/man1" ; \
-#	chmod 755 "$(ME_MAN_PREFIX)/man1" ; \
-#	mkdir -p "$(ME_VAPP_PREFIX)/bin" ; \
-#	cp $(BUILD)/bin/goahead $(ME_VAPP_PREFIX)/bin/goahead ; \
-#	chmod 755 "$(ME_VAPP_PREFIX)/bin/goahead" ; \
-#	mkdir -p "$(ME_BIN_PREFIX)" ; \
-#	rm -f "$(ME_BIN_PREFIX)/goahead" ; \
-#	ln -s "$(ME_VAPP_PREFIX)/bin/goahead" "$(ME_BIN_PREFIX)/goahead" ; \
-#	mkdir -p "$(ME_VAPP_PREFIX)/bin" ; \
-#	cp $(BUILD)/bin/roots.crt $(ME_VAPP_PREFIX)/bin/roots.crt ; \
-#	mkdir -p "$(ME_WEB_PREFIX)" ; \
-#	cp src/web/index.html $(ME_WEB_PREFIX)/index.html ; \
-#	cp src/web/favicon.ico $(ME_WEB_PREFIX)/favicon.ico ; \
-#	mkdir -p "$(ME_ETC_PREFIX)" ; \
-#	cp src/auth.txt $(ME_ETC_PREFIX)/auth.txt ; \
-#	cp src/route.txt $(ME_ETC_PREFIX)/route.txt ; \
-#	mkdir -p "$(ME_VAPP_PREFIX)/bin" ; \
-#	cp $(BUILD)/bin/libgo.so $(ME_VAPP_PREFIX)/bin/libgo.so ; \
-#	mkdir -p "$(ME_VAPP_PREFIX)/doc/man/man1" ; \
-#	cp doc/dist/man/goahead.1 $(ME_VAPP_PREFIX)/doc/man/man1/goahead.1 ; \
-#	mkdir -p "$(ME_MAN_PREFIX)/man1" ; \
-#	rm -f "$(ME_MAN_PREFIX)/man1/goahead.1" ; \
-#	ln -s "$(ME_VAPP_PREFIX)/doc/man/man1/goahead.1" "$(ME_MAN_PREFIX)/man1/goahead.1" ; \
-#	cp doc/dist/man/gopass.1 $(ME_VAPP_PREFIX)/doc/man/man1/gopass.1 ; \
-#	mkdir -p "$(ME_MAN_PREFIX)/man1" ; \
-#	rm -f "$(ME_MAN_PREFIX)/man1/gopass.1" ; \
-#	ln -s "$(ME_VAPP_PREFIX)/doc/man/man1/gopass.1" "$(ME_MAN_PREFIX)/man1/gopass.1" ; \
-#	cp doc/dist/man/webcomp.1 $(ME_VAPP_PREFIX)/doc/man/man1/webcomp.1 ; \
-#	mkdir -p "$(ME_MAN_PREFIX)/man1" ; \
-#	rm -f "$(ME_MAN_PREFIX)/man1/webcomp.1" ; \
-#	ln -s "$(ME_VAPP_PREFIX)/doc/man/man1/webcomp.1" "$(ME_MAN_PREFIX)/man1/webcomp.1"
+installBinary: $(DEPS_42)
+	mkdir -p "$(ME_APP_PREFIX)" ; \
+	rm -f "$(ME_APP_PREFIX)/latest" ; \
+	ln -s "$(VERSION)" "$(ME_APP_PREFIX)/latest" ; \
+	mkdir -p "$(ME_MAN_PREFIX)/man1" ; \
+	chmod 755 "$(ME_MAN_PREFIX)/man1" ; \
+	mkdir -p "$(ME_VAPP_PREFIX)/bin" ; \
+	cp $(BUILD)/bin/goahead $(ME_VAPP_PREFIX)/bin/goahead ; \
+	chmod 755 "$(ME_VAPP_PREFIX)/bin/goahead" ; \
+	mkdir -p "$(ME_BIN_PREFIX)" ; \
+	rm -f "$(ME_BIN_PREFIX)/goahead" ; \
+	ln -s "$(ME_VAPP_PREFIX)/bin/goahead" "$(ME_BIN_PREFIX)/goahead" ; \
+	mkdir -p "$(ME_VAPP_PREFIX)/bin" ; \
+	cp $(BUILD)/bin/roots.crt $(ME_VAPP_PREFIX)/bin/roots.crt ; \
+	mkdir -p "$(ME_WEB_PREFIX)" ; \
+	cp src/web/index.html $(ME_WEB_PREFIX)/index.html ; \
+	cp src/web/favicon.ico $(ME_WEB_PREFIX)/favicon.ico ; \
+	mkdir -p "$(ME_ETC_PREFIX)" ; \
+	cp src/auth.txt $(ME_ETC_PREFIX)/auth.txt ; \
+	cp src/route.txt $(ME_ETC_PREFIX)/route.txt ; \
+	mkdir -p "$(ME_VAPP_PREFIX)/bin" ; \
+	cp $(BUILD)/bin/libgo.so $(ME_VAPP_PREFIX)/bin/libgo.so ; \
+	mkdir -p "$(ME_VAPP_PREFIX)/doc/man/man1" ; \
+	cp doc/dist/man/goahead.1 $(ME_VAPP_PREFIX)/doc/man/man1/goahead.1 ; \
+	mkdir -p "$(ME_MAN_PREFIX)/man1" ; \
+	rm -f "$(ME_MAN_PREFIX)/man1/goahead.1" ; \
+	ln -s "$(ME_VAPP_PREFIX)/doc/man/man1/goahead.1" "$(ME_MAN_PREFIX)/man1/goahead.1" ; \
+	cp doc/dist/man/gopass.1 $(ME_VAPP_PREFIX)/doc/man/man1/gopass.1 ; \
+	mkdir -p "$(ME_MAN_PREFIX)/man1" ; \
+	rm -f "$(ME_MAN_PREFIX)/man1/gopass.1" ; \
+	ln -s "$(ME_VAPP_PREFIX)/doc/man/man1/gopass.1" "$(ME_MAN_PREFIX)/man1/gopass.1" ; \
+	cp doc/dist/man/webcomp.1 $(ME_VAPP_PREFIX)/doc/man/man1/webcomp.1 ; \
+	mkdir -p "$(ME_MAN_PREFIX)/man1" ; \
+	rm -f "$(ME_MAN_PREFIX)/man1/webcomp.1" ; \
+	ln -s "$(ME_VAPP_PREFIX)/doc/man/man1/webcomp.1" "$(ME_MAN_PREFIX)/man1/webcomp.1"
 
-#   start
-#
 #
-#start: $(DEPS_43)
+#   start
 #
+
+start: $(DEPS_43)
+
 #
 #   install
 #
-#DEPS_44 += stop
-#DEPS_44 += installBinary
-#DEPS_44 += start
-#
-#install: $(DEPS_44)
-#
+DEPS_44 += stop
+DEPS_44 += installBinary
+DEPS_44 += start
+
+install: $(DEPS_44)
+
 #
 #   installPrep
 #
-#
-#installPrep: $(DEPS_45)
-#	if [ "`id -u`" != 0 ] ; \
-#	then echo "Must run as root. Rerun with sudo." ; \
-#	exit 255 ; \
-#	fi
-#
+
+installPrep: $(DEPS_45)
+	if [ "`id -u`" != 0 ] ; \
+	then echo "Must run as root. Rerun with sudo." ; \
+	exit 255 ; \
+	fi
+
 #
 #   uninstall
 #
-#DEPS_46 += stop
-#
-#u#ninstall: $(DEPS_46)
-#
+DEPS_46 += stop
+
+uninstall: $(DEPS_46)
+
 #
 #   uninstallBinary
 #
+
+uninstallBinary: $(DEPS_47)
+	rm -fr "$(ME_WEB_PREFIX)" ; \
+	rm -fr "$(ME_VAPP_PREFIX)" ; \
+	rmdir -p "$(ME_ETC_PREFIX)" 2>/dev/null ; true ; \
+	rmdir -p "$(ME_WEB_PREFIX)" 2>/dev/null ; true ; \
+	rm -f "$(ME_APP_PREFIX)/latest" ; \
+	rmdir -p "$(ME_APP_PREFIX)" 2>/dev/null ; true
+
 #
-#uninstallBinary: $(DEPS_47)
-#	rm -fr "$(ME_WEB_PREFIX)" ; \
-#	rm -fr "$(ME_VAPP_PREFIX)" ; \
-#	rmdir -p "$(ME_ETC_PREFIX)" 2>/dev/null ; true ; \
-#	rmdir -p "$(ME_WEB_PREFIX)" 2>/dev/null ; true ; \
-#	rm -f "$(ME_APP_PREFIX)/latest" ; \
-#	rmdir -p "$(ME_APP_PREFIX)" 2>/dev/null ; true
-#
-##
 #   version
 #
 

+ 9 - 1
app/goahead-3.6.5/src/action.c

@@ -57,7 +57,6 @@ static bool actionHandler(Webs *wp)
             (*((WebsProc) fn))((void*) wp, actionName, wp->query);
 #else
             (*fn)((void*) wp);
-            printf("---> actionHandler call action execute over\n");
 #endif
         }
     }
@@ -119,3 +118,12 @@ PUBLIC void websFooter(Webs *wp)
     websWrite(wp, "</html>\n");
 }
 #endif
+
+/*
+    Copyright (c) Embedthis Software. All Rights Reserved.
+    This software is distributed under commercial and open source licenses.
+    You may use the Embedthis GoAhead open source license or you may acquire
+    a commercial license from Embedthis Software. You agree to be fully bound
+    by the terms of either license. Consult the LICENSE.md distributed with
+    this software for full details and other copyrights.
+ */

+ 381 - 381
app/goahead-3.6.5/src/goahead.c

@@ -1,382 +1,382 @@
-/*
-    goahead.c -- Main program for GoAhead
-
-    Usage: goahead [options] [documents] [IP][:port] ...
-        Options:
-        --auth authFile        # User and role configuration
-        --background           # Run as a Linux daemon
-        --home directory       # Change to directory to run
-        --log logFile:level    # Log to file file at verbosity level
-        --route routeFile      # Route configuration file
-        --verbose              # Same as --log stdout:2
-        --version              # Output version information
-
-    Copyright (c) All Rights Reserved. See details at the end of the file.
- */
-
-/********************************* Includes ***********************************/
-
-#include    "goahead.h"
-#include    "dashboard.h"
-#include    "cJSON.h"
-
-/********************************* Defines ************************************/
-
-static int finished = 0;
-
-/********************************* Forwards ***********************************/
-
-static void initPlatform();
-static void logHeader();
-static void usage();
-
-#if WINDOWS
-static void windowsClose();
-static int windowsInit();
-static LRESULT CALLBACK websWindProc(HWND hwnd, UINT msg, UINT wp, LPARAM lp);
-#endif
-
-#if ME_UNIX_LIKE
-static void sigHandler(int signo);
-#endif
-
-/*********************************** Code *************************************/
-
-MAIN(goahead, int argc, char **argv, char **envp)
-{
-    char    *argp, *home, *documents, *endpoints, *endpoint, *route, *auth, *tok, *lspec;
-    int     argind;
-
-#if WINDOWS
-    if (windowsInit() < 0) {
-        return 0;
-    }
-#endif
-    route = "route.txt";
-    auth = "auth.txt";
-
-/**************** user code before goahead ************************/   
-cJSON_Hooks hooks;
-hooks.malloc_fn = (void *(*)(size_t))walloc;
-hooks.free_fn = (void (*)(void *))wfree;
-cJSON_InitHooks(&hooks);
-
-/**************** user code before goahead end************************/
-    for (argind = 1; argind < argc; argind++) {
-        argp = argv[argind];
-        if (*argp != '-') {
-            break;
-
-        } else if (smatch(argp, "--auth") || smatch(argp, "-a")) {
-            if (argind >= argc) usage();
-            auth = argv[++argind];
-
-#if ME_UNIX_LIKE && !MACOSX
-        } else if (smatch(argp, "--background") || smatch(argp, "-b")) {
-            websSetBackground(1);
-#endif
-
-        } else if (smatch(argp, "--debugger") || smatch(argp, "-d") || smatch(argp, "-D")) {
-            websSetDebug(1);
-
-        } else if (smatch(argp, "--home")) {
-            if (argind >= argc) usage();
-            home = argv[++argind];
-            if (chdir(home) < 0) {
-                error("Cannot change directory to %s", home);
-                exit(-1);
-            }
-        } else if (smatch(argp, "--log") || smatch(argp, "-l")) {
-            if (argind >= argc) usage();
-            logSetPath(argv[++argind]);
-
-        } else if (smatch(argp, "--verbose") || smatch(argp, "-v")) {
-            logSetPath("stdout:2");
-
-        } else if (smatch(argp, "--route") || smatch(argp, "-r")) {
-            route = argv[++argind];
-
-        } else if (smatch(argp, "--version") || smatch(argp, "-V")) {
-            printf("%s\n", ME_VERSION);
-            exit(0);
-
-        } else if (*argp == '-' && isdigit((uchar) argp[1])) {
-            lspec = sfmt("stdout:%s", &argp[1]);
-            logSetPath(lspec);
-            wfree(lspec);
-
-        } else {
-            usage();
-        }
-    }
-    documents = ME_GOAHEAD_DOCUMENTS;
-    if (argc > argind) {
-        documents = argv[argind++];
-    }
-    printf("---> initPlatform\n");
-    initPlatform();
-    printf("---> websOpen\n");
-    if (websOpen(documents, route) < 0) {
-        error("Cannot initialize server. Exiting.");
-        return -1;
-    }
-#if ME_GOAHEAD_AUTH
-    printf("---> websLoad\n");
-    if (websLoad(auth) < 0) {
-        error("Cannot load %s", auth);
-        return -1;
-    }
-#endif
-    logHeader();
-    if (argind < argc) {
-        while (argind < argc) {
-            endpoint = argv[argind++];
-            printf("---> websListen log1\n");
-            if (websListen(endpoint) < 0) {
-                return -1;
-            }
-        }
-    } else {
-        endpoints = sclone(ME_GOAHEAD_LISTEN);
-        for (endpoint = stok(endpoints, ", \t", &tok); endpoint; endpoint = stok(NULL, ", \t,", &tok)) {
-#if !ME_COM_SSL
-            if (strstr(endpoint, "https")) continue;
-#endif
-            printf("---> websListen log2\n");
-            if (websListen(endpoint) < 0) {
-                wfree(endpoints);
-                return -1;
-            }
-        }
-        wfree(endpoints);
-    }
-#if ME_ROM && KEEP
-    /*
-        If not using a route/auth config files, then manually create the routes like this:
-        If custom matching is required, use websSetRouteMatch. If authentication is required, use websSetRouteAuth.
-     */
-    websAddRoute("/", "file", 0);
-#endif
-
-/**************** user code after goahead ************************/   
-websDefineAction("test", actionTest);
-websDefineAction("buy", buy);
-
-websDefineAction("getDeviceInfo", getDeviceInfo);
-websDefineAction("getSysInfo", getSysInfo);
-websDefineAction("getCardInfo", getCardInfo);
-websDefineAction("getSensorInfo", getSensorInfo);
- 
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-/**************** user code after goahead end************************/
-
-#if ME_UNIX_LIKE && !MACOSX
-    /*
-        Service events till terminated
-     */
-    if (websGetBackground()) {
-        printf("---> daemon\n");
-        if (daemon(0, 0) < 0) {
-            error("Cannot run as daemon");
-            return -1;
-        }
-    }
-#endif
-    printf("---> websServiceEvents\n");
-    websServiceEvents(&finished);
-    logmsg(1, "Instructed to exit");
-    printf("---> websClose\n");
-    websClose();
-#if WINDOWS
-    windowsClose();
-#endif
-    return 0;
-}
-
-
-static void logHeader()
-{
-    char    home[ME_GOAHEAD_LIMIT_STRING];
-
-    getcwd(home, sizeof(home));
-    logmsg(2, "Configuration for %s", ME_TITLE);
-    logmsg(2, "---------------------------------------------");
-    logmsg(2, "Version:            %s", ME_VERSION);
-    logmsg(2, "BuildType:          %s", ME_DEBUG ? "Debug" : "Release");
-    logmsg(2, "CPU:                %s", ME_CPU);
-    logmsg(2, "OS:                 %s", ME_OS);
-    logmsg(2, "Host:               %s", websGetServer());
-    logmsg(2, "Directory:          %s", home);
-    logmsg(2, "Documents:          %s", websGetDocuments());
-    logmsg(2, "Configure:          %s", ME_CONFIG_CMD);
-    logmsg(2, "---------------------------------------------");
-}
-
-
-static void usage() {
-    fprintf(stderr, "\n%s Usage:\n\n"
-        "  %s [options] [documents] [[IPaddress][:port] ...]\n\n"
-        "  Options:\n"
-#if ME_GOAHEAD_AUTH
-        "    --auth authFile        # User and role configuration\n"
-#endif
-#if ME_UNIX_LIKE && !MACOSX
-        "    --background           # Run as a Unix daemon\n"
-#endif
-        "    --debugger             # Run in debug mode\n"
-        "    --home directory       # Change to directory to run\n"
-        "    --log logFile:level    # Log to file file at verbosity level\n"
-        "    --route routeFile      # Route configuration file\n"
-        "    --verbose              # Same as --log stdout:2\n"
-        "    --version              # Output version information\n\n",
-        ME_TITLE, ME_NAME);
-    exit(-1);
-}
-
-
-static void initPlatform()
-{
-#if ME_UNIX_LIKE
-    signal(SIGTERM, sigHandler);
-    #ifdef SIGPIPE
-        signal(SIGPIPE, SIG_IGN);
-    #endif
-#elif ME_WIN_LIKE
-    _fmode=_O_BINARY;
-#endif
-}
-
-
-#if ME_UNIX_LIKE
-static void sigHandler(int signo)
-{
-    finished = 1;
-}
-#endif
-
-
-#if WINDOWS
-/*
-    Create a taskbar entry. Register the window class and create a window
- */
-static int windowsInit()
-{
-    HINSTANCE   inst;
-    WNDCLASS    wc;                     /* Window class */
-    HMENU       hSysMenu;
-    HWND        hwnd;
-
-    inst = websGetInst();
-    wc.style         = CS_HREDRAW | CS_VREDRAW;
-    wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
-    wc.hCursor       = LoadCursor(NULL, IDC_ARROW);
-    wc.cbClsExtra    = 0;
-    wc.cbWndExtra    = 0;
-    wc.hInstance     = inst;
-    wc.hIcon         = NULL;
-    wc.lpfnWndProc   = (WNDPROC) websWindProc;
-    wc.lpszMenuName  = wc.lpszClassName = ME_NAME;
-    if (! RegisterClass(&wc)) {
-        return -1;
-    }
-    /*
-        Create a window just so we can have a taskbar to close this web server
-     */
-    hwnd = CreateWindow(ME_NAME, ME_TITLE, WS_MINIMIZE | WS_POPUPWINDOW, CW_USEDEFAULT,
-        0, 0, 0, NULL, NULL, inst, NULL);
-    if (hwnd == NULL) {
-        return -1;
-    }
-
-    /*
-        Add the about box menu item to the system menu
-     */
-    hSysMenu = GetSystemMenu(hwnd, FALSE);
-    if (hSysMenu != NULL) {
-        AppendMenu(hSysMenu, MF_SEPARATOR, 0, NULL);
-    }
-    ShowWindow(hwnd, SW_SHOWNORMAL);
-    UpdateWindow(hwnd);
-    return 0;
-}
-
-
-static void windowsClose()
-{
-    HINSTANCE   inst;
-
-    inst = websGetInst();
-    UnregisterClass(ME_NAME, inst);
-}
-
-
-/*
-    Main menu window message handler.
- */
-static LRESULT CALLBACK websWindProc(HWND hwnd, UINT msg, UINT wp, LPARAM lp)
-{
-    switch (msg) {
-        case WM_DESTROY:
-            PostQuitMessage(0);
-            finished++;
-            return 0;
-
-        case WM_SYSCOMMAND:
-            break;
-    }
-    return DefWindowProc(hwnd, msg, wp, lp);
-}
-
-
-/*
-    Check for Windows Messages
- */
-WPARAM checkWindowsMsgLoop()
-{
-    MSG     msg;
-
-    if (PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE)) {
-        if (!GetMessage(&msg, NULL, 0, 0) || msg.message == WM_QUIT) {
-            return msg.wParam;
-        }
-        TranslateMessage(&msg);
-        DispatchMessage(&msg);
-    }
-    return 0;
-}
-
-
-/*
-    Windows message handler
- */
-static LRESULT CALLBACK websAboutProc(HWND hwndDlg, uint msg, uint wp, long lp)
-{
-    LRESULT    lResult;
-
-    lResult = DefWindowProc(hwndDlg, msg, wp, lp);
-
-    switch (msg) {
-        case WM_CREATE:
-            break;
-        case WM_DESTROY:
-            break;
-        case WM_COMMAND:
-            break;
-    }
-    return lResult;
-}
-
+/*
+    goahead.c -- Main program for GoAhead
+
+    Usage: goahead [options] [documents] [IP][:port] ...
+        Options:
+        --auth authFile        # User and role configuration
+        --background           # Run as a Linux daemon
+        --home directory       # Change to directory to run
+        --log logFile:level    # Log to file file at verbosity level
+        --route routeFile      # Route configuration file
+        --verbose              # Same as --log stdout:2
+        --version              # Output version information
+
+    Copyright (c) All Rights Reserved. See details at the end of the file.
+ */
+
+/********************************* Includes ***********************************/
+
+#include    "goahead.h"
+#include    "dashboard.h"
+#include    "cJSON.h"
+
+/********************************* Defines ************************************/
+
+static int finished = 0;
+
+/********************************* Forwards ***********************************/
+
+static void initPlatform();
+static void logHeader();
+static void usage();
+
+#if WINDOWS
+static void windowsClose();
+static int windowsInit();
+static LRESULT CALLBACK websWindProc(HWND hwnd, UINT msg, UINT wp, LPARAM lp);
+#endif
+
+#if ME_UNIX_LIKE
+static void sigHandler(int signo);
+#endif
+
+/*********************************** Code *************************************/
+
+MAIN(goahead, int argc, char **argv, char **envp)
+{
+    char    *argp, *home, *documents, *endpoints, *endpoint, *route, *auth, *tok, *lspec;
+    int     argind;
+
+#if WINDOWS
+    if (windowsInit() < 0) {
+        return 0;
+    }
+#endif
+    route = "route.txt";
+    auth = "auth.txt";
+
+/**************** user code before goahead ************************/   
+cJSON_Hooks hooks;
+hooks.malloc_fn = (void *(*)(size_t))walloc;
+hooks.free_fn = (void (*)(void *))wfree;
+cJSON_InitHooks(&hooks);
+
+/**************** user code before goahead end************************/
+    for (argind = 1; argind < argc; argind++) {
+        argp = argv[argind];
+        if (*argp != '-') {
+            break;
+
+        } else if (smatch(argp, "--auth") || smatch(argp, "-a")) {
+            if (argind >= argc) usage();
+            auth = argv[++argind];
+
+#if ME_UNIX_LIKE && !MACOSX
+        } else if (smatch(argp, "--background") || smatch(argp, "-b")) {
+            websSetBackground(1);
+#endif
+
+        } else if (smatch(argp, "--debugger") || smatch(argp, "-d") || smatch(argp, "-D")) {
+            websSetDebug(1);
+
+        } else if (smatch(argp, "--home")) {
+            if (argind >= argc) usage();
+            home = argv[++argind];
+            if (chdir(home) < 0) {
+                error("Cannot change directory to %s", home);
+                exit(-1);
+            }
+        } else if (smatch(argp, "--log") || smatch(argp, "-l")) {
+            if (argind >= argc) usage();
+            logSetPath(argv[++argind]);
+
+        } else if (smatch(argp, "--verbose") || smatch(argp, "-v")) {
+            logSetPath("stdout:2");
+
+        } else if (smatch(argp, "--route") || smatch(argp, "-r")) {
+            route = argv[++argind];
+
+        } else if (smatch(argp, "--version") || smatch(argp, "-V")) {
+            printf("%s\n", ME_VERSION);
+            exit(0);
+
+        } else if (*argp == '-' && isdigit((uchar) argp[1])) {
+            lspec = sfmt("stdout:%s", &argp[1]);
+            logSetPath(lspec);
+            wfree(lspec);
+
+        } else {
+            usage();
+        }
+    }
+    documents = ME_GOAHEAD_DOCUMENTS;
+    if (argc > argind) {
+        documents = argv[argind++];
+    }
+    printf("---> initPlatform\n");
+    initPlatform();
+    printf("---> websOpen\n");
+    if (websOpen(documents, route) < 0) {
+        error("Cannot initialize server. Exiting.");
+        return -1;
+    }
+#if ME_GOAHEAD_AUTH
+    printf("---> websLoad\n");
+    if (websLoad(auth) < 0) {
+        error("Cannot load %s", auth);
+        return -1;
+    }
+#endif
+    logHeader();
+    if (argind < argc) {
+        while (argind < argc) {
+            endpoint = argv[argind++];
+            printf("---> websListen log1\n");
+            if (websListen(endpoint) < 0) {
+                return -1;
+            }
+        }
+    } else {
+        endpoints = sclone(ME_GOAHEAD_LISTEN);
+        for (endpoint = stok(endpoints, ", \t", &tok); endpoint; endpoint = stok(NULL, ", \t,", &tok)) {
+#if !ME_COM_SSL
+            if (strstr(endpoint, "https")) continue;
+#endif
+            printf("---> websListen log2\n");
+            if (websListen(endpoint) < 0) {
+                wfree(endpoints);
+                return -1;
+            }
+        }
+        wfree(endpoints);
+    }
+#if ME_ROM && KEEP
+    /*
+        If not using a route/auth config files, then manually create the routes like this:
+        If custom matching is required, use websSetRouteMatch. If authentication is required, use websSetRouteAuth.
+     */
+    websAddRoute("/", "file", 0);
+#endif
+
+/**************** user code after goahead ************************/   
+websDefineAction("test", actionTest);
+websDefineAction("buy", buy);
+
+websDefineAction("getDeviceInfo", getDeviceInfo);
+websDefineAction("getSysInfo", getSysInfo);
+websDefineAction("getCardInfo", getCardInfo);
+websDefineAction("getSensorInfo", getSensorInfo);
+ 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+/**************** user code after goahead end************************/
+
+#if ME_UNIX_LIKE && !MACOSX
+    /*
+        Service events till terminated
+     */
+    if (websGetBackground()) {
+        printf("---> daemon\n");
+        if (daemon(0, 0) < 0) {
+            error("Cannot run as daemon");
+            return -1;
+        }
+    }
+#endif
+    printf("---> websServiceEvents\n");
+    websServiceEvents(&finished);
+    logmsg(1, "Instructed to exit");
+    printf("---> websClose\n");
+    websClose();
+#if WINDOWS
+    windowsClose();
+#endif
+    return 0;
+}
+
+
+static void logHeader()
+{
+    char    home[ME_GOAHEAD_LIMIT_STRING];
+
+    getcwd(home, sizeof(home));
+    logmsg(2, "Configuration for %s", ME_TITLE);
+    logmsg(2, "---------------------------------------------");
+    logmsg(2, "Version:            %s", ME_VERSION);
+    logmsg(2, "BuildType:          %s", ME_DEBUG ? "Debug" : "Release");
+    logmsg(2, "CPU:                %s", ME_CPU);
+    logmsg(2, "OS:                 %s", ME_OS);
+    logmsg(2, "Host:               %s", websGetServer());
+    logmsg(2, "Directory:          %s", home);
+    logmsg(2, "Documents:          %s", websGetDocuments());
+    logmsg(2, "Configure:          %s", ME_CONFIG_CMD);
+    logmsg(2, "---------------------------------------------");
+}
+
+
+static void usage() {
+    fprintf(stderr, "\n%s Usage:\n\n"
+        "  %s [options] [documents] [[IPaddress][:port] ...]\n\n"
+        "  Options:\n"
+#if ME_GOAHEAD_AUTH
+        "    --auth authFile        # User and role configuration\n"
+#endif
+#if ME_UNIX_LIKE && !MACOSX
+        "    --background           # Run as a Unix daemon\n"
+#endif
+        "    --debugger             # Run in debug mode\n"
+        "    --home directory       # Change to directory to run\n"
+        "    --log logFile:level    # Log to file file at verbosity level\n"
+        "    --route routeFile      # Route configuration file\n"
+        "    --verbose              # Same as --log stdout:2\n"
+        "    --version              # Output version information\n\n",
+        ME_TITLE, ME_NAME);
+    exit(-1);
+}
+
+
+static void initPlatform()
+{
+#if ME_UNIX_LIKE
+    signal(SIGTERM, sigHandler);
+    #ifdef SIGPIPE
+        signal(SIGPIPE, SIG_IGN);
+    #endif
+#elif ME_WIN_LIKE
+    _fmode=_O_BINARY;
+#endif
+}
+
+
+#if ME_UNIX_LIKE
+static void sigHandler(int signo)
+{
+    finished = 1;
+}
+#endif
+
+
+#if WINDOWS
+/*
+    Create a taskbar entry. Register the window class and create a window
+ */
+static int windowsInit()
+{
+    HINSTANCE   inst;
+    WNDCLASS    wc;                     /* Window class */
+    HMENU       hSysMenu;
+    HWND        hwnd;
+
+    inst = websGetInst();
+    wc.style         = CS_HREDRAW | CS_VREDRAW;
+    wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
+    wc.hCursor       = LoadCursor(NULL, IDC_ARROW);
+    wc.cbClsExtra    = 0;
+    wc.cbWndExtra    = 0;
+    wc.hInstance     = inst;
+    wc.hIcon         = NULL;
+    wc.lpfnWndProc   = (WNDPROC) websWindProc;
+    wc.lpszMenuName  = wc.lpszClassName = ME_NAME;
+    if (! RegisterClass(&wc)) {
+        return -1;
+    }
+    /*
+        Create a window just so we can have a taskbar to close this web server
+     */
+    hwnd = CreateWindow(ME_NAME, ME_TITLE, WS_MINIMIZE | WS_POPUPWINDOW, CW_USEDEFAULT,
+        0, 0, 0, NULL, NULL, inst, NULL);
+    if (hwnd == NULL) {
+        return -1;
+    }
+
+    /*
+        Add the about box menu item to the system menu
+     */
+    hSysMenu = GetSystemMenu(hwnd, FALSE);
+    if (hSysMenu != NULL) {
+        AppendMenu(hSysMenu, MF_SEPARATOR, 0, NULL);
+    }
+    ShowWindow(hwnd, SW_SHOWNORMAL);
+    UpdateWindow(hwnd);
+    return 0;
+}
+
+
+static void windowsClose()
+{
+    HINSTANCE   inst;
+
+    inst = websGetInst();
+    UnregisterClass(ME_NAME, inst);
+}
+
+
+/*
+    Main menu window message handler.
+ */
+static LRESULT CALLBACK websWindProc(HWND hwnd, UINT msg, UINT wp, LPARAM lp)
+{
+    switch (msg) {
+        case WM_DESTROY:
+            PostQuitMessage(0);
+            finished++;
+            return 0;
+
+        case WM_SYSCOMMAND:
+            break;
+    }
+    return DefWindowProc(hwnd, msg, wp, lp);
+}
+
+
+/*
+    Check for Windows Messages
+ */
+WPARAM checkWindowsMsgLoop()
+{
+    MSG     msg;
+
+    if (PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE)) {
+        if (!GetMessage(&msg, NULL, 0, 0) || msg.message == WM_QUIT) {
+            return msg.wParam;
+        }
+        TranslateMessage(&msg);
+        DispatchMessage(&msg);
+    }
+    return 0;
+}
+
+
+/*
+    Windows message handler
+ */
+static LRESULT CALLBACK websAboutProc(HWND hwndDlg, uint msg, uint wp, long lp)
+{
+    LRESULT    lResult;
+
+    lResult = DefWindowProc(hwndDlg, msg, wp, lp);
+
+    switch (msg) {
+        case WM_CREATE:
+            break;
+        case WM_DESTROY:
+            break;
+        case WM_COMMAND:
+            break;
+    }
+    return lResult;
+}
+
 #endif

+ 10 - 5
app/goahead-3.6.5/src/goahead.h

@@ -24,8 +24,6 @@
 extern "C" {
 #endif
 
-#pragma pack(1)
-
 #if (ME_COM_MBEDTLS + ME_COM_MATRIXSSL + ME_COM_NANOSSL + ME_COM_OPENSSL) > 1
     #error "Cannot have more than one SSL provider configured"
 #endif
@@ -4160,9 +4158,16 @@ PUBLIC int websSetSessionVar(Webs *wp, char *name, char *value);
  #include "customize.h"
 #endif
 
-#pragma pack()
-
 #ifdef __cplusplus
 }
 #endif
-#endif /* _h_GOAHEAD */
+#endif /* _h_GOAHEAD */
+
+/*
+    Copyright (c) Embedthis Software. All Rights Reserved.
+    This software is distributed under commercial and open source licenses.
+    You may use the Embedthis GoAhead open source license or you may acquire
+    a commercial license from Embedthis Software. You agree to be fully bound
+    by the terms of either license. Consult the LICENSE.md distributed with
+    this software for full details and other copyrights.
+ */

+ 0 - 4
app/goahead-3.6.5/src/http.c

@@ -233,7 +233,6 @@ PUBLIC int websOpen(char *documents, char *routeFile)
         return -1;
     }
 #if ME_COM_SSL
-    printf("---> sslOpen\n");
     if (sslOpen() < 0) {
         return -1;
     }
@@ -251,7 +250,6 @@ PUBLIC int websOpen(char *documents, char *routeFile)
         return -1;
     }
 #if ME_GOAHEAD_CGI
-    printf("---> websCgiOpen\n");
     websCgiOpen();
 #endif
     websOptionsOpen();
@@ -2426,7 +2424,6 @@ static int setLocalHost()
     return 0;
 }
 
-
 PUBLIC void websSetHost(char *host)
 {
     scopy(websHost, sizeof(websHost), host);
@@ -3332,7 +3329,6 @@ static void setFileLimits()
     }
     getrlimit(RLIMIT_NOFILE, &r);
     trace(6, "Max files soft %d, max %d", r.rlim_cur, r.rlim_max);
-    //printf("Max files soft %d, max %d", r.rlim_cur, r.rlim_max);
 #endif
 }
 

+ 8 - 8
app/goahead-3.6.5/src/libipmi/inc/libipmi_struct.h

@@ -30,17 +30,17 @@ typedef struct UDS_CHANNEL_T_tag {
 */
 typedef struct IPMI20_UDS_SESSION_T_tag {
   UDS_CHANNEL_T hUDSInfo;
-  char szUserName[MAX_USERNAME_LEN];
-  char szPwd[MAX_PASSWORD_LEN];
-  char szUName[MAX_USERNAME_LEN];
-  char abyIPAddr[IP6_ADDR_LEN];
+//  char szUserName[MAX_USERNAME_LEN];
+//  char szPwd[MAX_PASSWORD_LEN];
+//  char szUName[MAX_USERNAME_LEN];
+//  char abyIPAddr[IP6_ADDR_LEN];
   uint32_t dwSessionID;
-  uint8_t byPreSession;
-  uint8_t byAuthType;
-  uint8_t byRole;
+//  uint8_t byPreSession;
+//  uint8_t byAuthType;
+//  uint8_t byRole;
   uint8_t byChannelNum;
   uint8_t byDefTimeout;
-  uint8_t byMaxRetries;
+//  uint8_t byMaxRetries;
 }PACK IPMI20_UDS_SESSION_T;
 
 

+ 39 - 8
app/goahead-3.6.5/src/libipmi/src/libipmi_session.c

@@ -74,6 +74,34 @@ uint16_t LIBIPMI_CreateSession(IPMI20_UDS_SESSION_T *pUDSSession, int timeout)
     return wRet;
 }
 
+
+/*This Functions Fills the Packet
+ * with the valid fields for UDS*/
+uint32_t FillUDSMessagePacket(IPMI20_UDS_SESSION_T *pUDSSession, uint8_t *Buffer,
+                        uint8_t byNetFnLUN, uint8_t byCommand,
+                        uint8_t *pbyReqData, uint32_t dwReqDataLen)
+{
+    uint8_t *pbyIPMIUDSData;
+    IPMIUDSMsg_T *pUDSMsg;
+    pUDSMsg = (IPMIUDSMsg_T *)&Buffer[0];
+    pbyIPMIUDSData = &Buffer[sizeof(IPMIUDSMsg_T)];
+
+    pUDSMsg->SessionID = pUDSSession->dwSessionID;
+    pUDSMsg->ChannelNum = pUDSSession->byChannelNum;
+    //pUDSMsg->Privilege = pUDSSession->byRole;
+    pUDSMsg->IPMIMsgLen = sizeof(IPMIUDSMsg_T)+dwReqDataLen+1;
+    pUDSMsg->Cmd = byCommand;
+    pUDSMsg->NetFnLUN = byNetFnLUN;
+
+    //memcpy(pUDSMsg->UserName, pUDSSession->szUName, MAX_USERNAME_LEN);
+    //memcpy(pUDSMsg->IPAddr, pUDSSession->abyIPAddr, IP6_ADDR_LEN);
+    //pUDSMsg->ProcessID = getpid();
+    //pUDSMsg->ThreadID = gettid();
+    memcpy(pbyIPMIUDSData, pbyReqData, dwReqDataLen);
+
+    return ( sizeof(IPMIUDSMsg_T) + dwReqDataLen + 1);
+}
+
 /*---------------------------------------------------------------------
 LIBIPMI_Send_RAW_IPMI2_0_Command
 
@@ -88,7 +116,7 @@ uint16_t LIBIPMI_Send_RAW_IPMI2_0_Command(IPMI20_UDS_SESSION_T *pUDSSession,		//
 
 	uint8_t pbyIPMIUDSMsgReq[MAX_REQUEST_SIZE];
    	uint8_t pbyIPMIUDSResData[MAX_RESPONSE_SIZE];
-   	uint32_t retlen=0,byretval=0;
+   	int retlen=0,byretval=0;
 
    	retlen = FillUDSMessagePacket(pUDSSession,pbyIPMIUDSMsgReq,byNetFnLUN,byCommand,pszReqData,dwReqDataLen);
 
@@ -98,12 +126,15 @@ uint16_t LIBIPMI_Send_RAW_IPMI2_0_Command(IPMI20_UDS_SESSION_T *pUDSSession,		//
        return -1;
     }
 
-    byretval = UDS_SendData(&pUDSSession->hUDSInfo,(char *)pbyIPMIUDSMsgReq,retlen,timeout);
-    if(byretval != LIBIPMI_STATUS_SUCCESS)
-        return byretval;
+    send (pUDSSession->hUDSInfo.hSocket,pbyIPMIUDSMsgReq,retlen, MSG_NOSIGNAL);
+    // byretval = UDS_SendData(&pUDSSession->hUDSInfo,(char *)pbyIPMIUDSMsgReq,retlen,timeout);
+    // if(byretval != LIBIPMI_STATUS_SUCCESS)
+    //     return byretval;
+
+    byretval = recv(pUDSSession->hUDSInfo.hSocket,pbyIPMIUDSResData,MAX_RESPONSE_SIZE,0);
 
-    byretval = UDS_ReceiveData(&pUDSSession->hUDSInfo, (char *)pbyIPMIUDSResData, pdwResDataLen,timeout);
-    if(byretval == LIBIPMI_STATUS_SUCCESS)
+    //byretval = UDS_ReceiveData(&pUDSSession->hUDSInfo, (char *)pbyIPMIUDSResData, pdwResDataLen,timeout);
+    if(byretval > 0)
     {
         IPMIUDSMsg_T *pIPMIUDSMsg = (IPMIUDSMsg_T *)&pbyIPMIUDSResData[0];
         uint8_t *bycompletioncode = (uint8_t *)&pbyIPMIUDSResData[sizeof(IPMIUDSMsg_T)];
@@ -118,7 +149,7 @@ uint16_t LIBIPMI_Send_RAW_IPMI2_0_Command(IPMI20_UDS_SESSION_T *pUDSSession,		//
             if((0 == pUDSSession->dwSessionID) && (pIPMIUDSMsg->Cmd == CMD_SET_USER_PASSWORD))
             {
                 pUDSSession->dwSessionID = pIPMIUDSMsg->SessionID;
-                pUDSSession->byRole = pIPMIUDSMsg->Privilege;
+                //pUDSSession->byRole = pIPMIUDSMsg->Privilege;
                 
                 if(UDS_CHANNEL == pUDSSession->byChannelNum)
                 {
@@ -128,7 +159,7 @@ uint16_t LIBIPMI_Send_RAW_IPMI2_0_Command(IPMI20_UDS_SESSION_T *pUDSSession,		//
             else if((0 == pUDSSession->dwSessionID) && (pIPMIUDSMsg->Cmd == CMD_GET_DEV_ID) )
             {
                 pUDSSession->dwSessionID = pIPMIUDSMsg->SessionID;
-                pUDSSession->byRole = pIPMIUDSMsg->Privilege;
+                //pUDSSession->byRole = pIPMIUDSMsg->Privilege;
                 
                 if(UDS_CHANNEL == pUDSSession->byChannelNum)
                 {

+ 247 - 249
app/goahead-3.6.5/src/libipmi/src/libipmi_uds_session.c

@@ -1,252 +1,250 @@
-/*******************************************************************
- * ********************************************************************
- * ****                                                              **
- * ****    (C)Copyright 2008-2009, American Megatrends Inc.          **
- * ****                                                              **
- * ****    All Rights Reserved.                                      **
- * ****                                                              **
- * ****    5555 , Oakbrook Pkwy, Norcross,                           **
- * ****                                                              **
- * ****    Georgia - 30093, USA. Phone-(770)-246-8600.               **
- * ****                                                              **
- * ********************************************************************
- * ********************************************************************
- * ********************************************************************
- * **
- * ** libipmi_uds_session.c
- * ** Unix Domain Socket library file
- * **
- * ** Author: Suresh V (sureshv@amiindia.co.in)
- * *******************************************************************/
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/un.h>
-#include <unistd.h>
-//#include <netinet/in.h>
-//#include <arpa/inet.h>
-#include <sys/time.h>
-#include <sys/select.h>
-#include <sys/file.h>
-#include <fcntl.h>
-#include <errno.h>
-#include "libipmi_session.h"
-#include "libipmi_errorcodes.h"
-#include "com_IPMIDefs.h"
-#include "com_IPMI_AppDevice.h"
-#include "com_IPMI_IPM.h"
-#include "com_IPMI_App.h"
-#include <sys/syscall.h>
-#define gettid()  syscall(SYS_gettid)
-
-
-/*This Functions Fills the Packet
- * with the valid fields for UDS*/
-uint32_t FillUDSMessagePacket(IPMI20_UDS_SESSION_T *pUDSSession, uint8_t *Buffer,
-                        uint8_t byNetFnLUN, uint8_t byCommand,
-                        uint8_t *pbyReqData, uint32_t dwReqDataLen)
-{
-    uint8_t *pbyIPMIUDSData;
-    IPMIUDSMsg_T *pUDSMsg;
-    pUDSMsg = (IPMIUDSMsg_T *)&Buffer[0];
-    pbyIPMIUDSData = &Buffer[sizeof(IPMIUDSMsg_T)];
-
-    pUDSMsg->SessionID = pUDSSession->dwSessionID;
-    pUDSMsg->ChannelNum = pUDSSession->byChannelNum;
-    pUDSMsg->Privilege = pUDSSession->byRole;
- //   pUDSMsg->AuthFlag = AuthEnable;
-    pUDSMsg->IPMIMsgLen = sizeof(IPMIUDSMsg_T)+dwReqDataLen+1;
-    pUDSMsg->Cmd = byCommand;
-    pUDSMsg->NetFnLUN = byNetFnLUN;
-
-    memcpy(pUDSMsg->UserName, pUDSSession->szUName, MAX_USERNAME_LEN);
-    memcpy(pUDSMsg->IPAddr, pUDSSession->abyIPAddr, IP6_ADDR_LEN);
-//    printf("---> FillUDSMessagePacket log2\n");
-    pUDSMsg->ProcessID = getpid();
-    pUDSMsg->ThreadID = gettid();
-    memcpy(pbyIPMIUDSData, pbyReqData, dwReqDataLen);
-
-    return ( sizeof(IPMIUDSMsg_T) + dwReqDataLen + 1);
-}
-
-/*This Function is used to recieve
-  data from UDS Interface as response*/
-uint8_t UDS_ReceiveData( UDS_CHANNEL_T *UDSInfo, char *szBuffer, uint32_t* pdwSize, int timeout )
-{
-    struct timeval wait_time, *pwait_time;
-    fd_set rdfs;
-    int nDes = 0,totalrecvd = 0,ret = 0;
-    IPMIUDSMsg_T *pData = (IPMIUDSMsg_T *)szBuffer;
-    uint32_t nBytesRecvd = 0;
-
-    /* Wait for the socket to get ready */
-    if(timeout >= 0)
-    {
-        wait_time.tv_sec = timeout;
-        wait_time.tv_usec = 0;
-        pwait_time = &wait_time;
-    }
-    else
-        pwait_time = NULL;
-
-    FD_ZERO(&rdfs);
-    FD_SET(UDSInfo->hSocket, &rdfs);
-    nDes = UDSInfo->hSocket + 1;
-
-    while(1)
-    {
-        /* wait for specified amount of time */
-        ret = select (nDes, &rdfs, NULL, NULL, pwait_time);
-        /* socket error */
-        if(ret == -1)
-        {
-            if(errno == EINTR)
-            {
-                printf("select: %s. Continue...\n",strerror(errno));
-                continue;
-            }
-            else
-            {
-                printf("select failed while waiting for read pipe \n");
-                continue;
-            }
-        }
-        else if(ret == 0)
-        {
-              printf("Connection timed out\n");
-              return LIBIPMI_MEDIUM_E_TIMED_OUT;
-         }
-
-        /* socket is ready to receive data */
-        if(FD_ISSET(UDSInfo->hSocket,&rdfs))
-         {
-            nBytesRecvd = recv(UDSInfo->hSocket,szBuffer+totalrecvd,MAX_RESPONSE_SIZE,0);
-            if(nBytesRecvd == 0)
-            {
-                printf("End of File Encountered ... may be socket closure\n");
-                close(UDSInfo->hSocket);
-                return LIBIPMI_MEDIUM_E_RECV_DATA_FAILURE;
-            }
-            if(nBytesRecvd == -1)
-            {
-                printf("Socket Error... may be socket closure\n");
-                close(UDSInfo->hSocket);
-                return LIBIPMI_MEDIUM_E_RECV_DATA_FAILURE;
-            }
-
-            // int i;
-            // printf("---> client recv %#x: ", nBytesRecvd);
-            // for(i=0;i<nBytesRecvd;i++)
-            //     printf("%#x ", szBuffer[totalrecvd+i]);
-            // printf("\n");
-
-            totalrecvd += nBytesRecvd;
-
-            if(totalrecvd < sizeof(IPMIUDSMsg_T))
-            {
-              continue;
-            }
-
-            while(totalrecvd < pData->IPMIMsgLen)
-            {
-              continue;
-            }
-        return LIBIPMI_STATUS_SUCCESS;
-       }
-
-       return LIBIPMI_MEDIUM_E_RECV_DATA_FAILURE; 
-     }
-}
-
-
-/*This Function is used to send the
- * data to UDS Interface*/
-int UDS_SendData(UDS_CHANNEL_T *UDSInfo,char *szBuffer,uint32_t dwsize,int timeout)
-{
-    int nTotalBytesSent = 0, nBytesSent = 0;
-    struct timeval wait_time, *pwait_time;
-    fd_set wdfs;
-    int ret;
-   int nDes;
-
-    /* Wait for the socket to get ready */
-    if(timeout >= 0)
-    {
-        wait_time.tv_sec = timeout;
-        wait_time.tv_usec = 0;
-        pwait_time = &wait_time;
-    }
-    else
-        pwait_time = NULL;
-
-    FD_ZERO(&wdfs);
-    FD_SET(UDSInfo->hSocket, &wdfs);
-    nDes = UDSInfo->hSocket + 1;
-
-TCPSendUDSDataSelect:
-    /* wait for specified amount of time */
-    ret = select (nDes, NULL, &wdfs, NULL, pwait_time);
-    /* socket error */
-    if(ret == -1)
-    {
-        if(errno == EINTR)
-        {
-            printf("select: %s. Continue...\n",strerror(errno));
-            goto TCPSendUDSDataSelect;
-        }
-        else
-        {
-            printf("Select failed while waiting for write pipe \n");
-            close(UDSInfo->hSocket);
-            return LIBIPMI_MEDIUM_E_INVALID_SOCKET;
-        }
-    }
-    /* timed out */
-    else if(ret == 0)
-    {
-        printf("Connection timedout: Write Pipe is full \n");
-        close(UDSInfo->hSocket);
-        return LIBIPMI_MEDIUM_E_TIMED_OUT_ON_SEND;
-    }
-
-   if(FD_ISSET(UDSInfo->hSocket,&wdfs))
-    {
-        /* socket is ready to send data */
-        nTotalBytesSent = 0;
-
-        /* Till the last byte is sent */
-        while( nTotalBytesSent < (int)dwsize )
-        {
-            /* send data */
+// /*******************************************************************
+//  * ********************************************************************
+//  * ****                                                              **
+//  * ****    (C)Copyright 2008-2009, American Megatrends Inc.          **
+//  * ****                                                              **
+//  * ****    All Rights Reserved.                                      **
+//  * ****                                                              **
+//  * ****    5555 , Oakbrook Pkwy, Norcross,                           **
+//  * ****                                                              **
+//  * ****    Georgia - 30093, USA. Phone-(770)-246-8600.               **
+//  * ****                                                              **
+//  * ********************************************************************
+//  * ********************************************************************
+//  * ********************************************************************
+//  * **
+//  * ** libipmi_uds_session.c
+//  * ** Unix Domain Socket library file
+//  * **
+//  * ** Author: Suresh V (sureshv@amiindia.co.in)
+//  * *******************************************************************/
+// #include <stdio.h>
+// #include <stdlib.h>
+// #include <string.h>
+// #include <sys/types.h>
+// #include <sys/socket.h>
+// #include <sys/un.h>
+// #include <unistd.h>
+// //#include <netinet/in.h>
+// //#include <arpa/inet.h>
+// #include <sys/time.h>
+// #include <sys/select.h>
+// #include <sys/file.h>
+// #include <fcntl.h>
+// #include <errno.h>
+// #include "libipmi_session.h"
+// #include "libipmi_errorcodes.h"
+// #include "com_IPMIDefs.h"
+// #include "com_IPMI_AppDevice.h"
+// #include "com_IPMI_IPM.h"
+// #include "com_IPMI_App.h"
+// #include <sys/syscall.h>
+// #define gettid()  syscall(SYS_gettid)
+
+
+// // /*This Functions Fills the Packet
+// //  * with the valid fields for UDS*/
+// // uint32_t FillUDSMessagePacket(IPMI20_UDS_SESSION_T *pUDSSession, uint8_t *Buffer,
+// //                         uint8_t byNetFnLUN, uint8_t byCommand,
+// //                         uint8_t *pbyReqData, uint32_t dwReqDataLen)
+// // {
+// //     uint8_t *pbyIPMIUDSData;
+// //     IPMIUDSMsg_T *pUDSMsg;
+// //     pUDSMsg = (IPMIUDSMsg_T *)&Buffer[0];
+// //     pbyIPMIUDSData = &Buffer[sizeof(IPMIUDSMsg_T)];
+
+// //     pUDSMsg->SessionID = pUDSSession->dwSessionID;
+// //     pUDSMsg->ChannelNum = pUDSSession->byChannelNum;
+// //     //pUDSMsg->Privilege = pUDSSession->byRole;
+// //     pUDSMsg->IPMIMsgLen = sizeof(IPMIUDSMsg_T)+dwReqDataLen+1;
+// //     pUDSMsg->Cmd = byCommand;
+// //     pUDSMsg->NetFnLUN = byNetFnLUN;
+
+// //     //memcpy(pUDSMsg->UserName, pUDSSession->szUName, MAX_USERNAME_LEN);
+// //     //memcpy(pUDSMsg->IPAddr, pUDSSession->abyIPAddr, IP6_ADDR_LEN);
+// //     //pUDSMsg->ProcessID = getpid();
+// //     //pUDSMsg->ThreadID = gettid();
+// //     memcpy(pbyIPMIUDSData, pbyReqData, dwReqDataLen);
+
+// //     return ( sizeof(IPMIUDSMsg_T) + dwReqDataLen + 1);
+// // }
+
+// /*This Function is used to recieve
+//   data from UDS Interface as response*/
+// uint8_t UDS_ReceiveData( UDS_CHANNEL_T *UDSInfo, char *szBuffer, uint32_t* pdwSize, int timeout )
+// {
+//     struct timeval wait_time, *pwait_time;
+//     fd_set rdfs;
+//     int nDes = 0,totalrecvd = 0,ret = 0;
+//     IPMIUDSMsg_T *pData = (IPMIUDSMsg_T *)szBuffer;
+//     uint32_t nBytesRecvd = 0;
+
+//     /* Wait for the socket to get ready */
+//     if(timeout >= 0)
+//     {
+//         wait_time.tv_sec = timeout;
+//         wait_time.tv_usec = 0;
+//         pwait_time = &wait_time;
+//     }
+//     else
+//         pwait_time = NULL;
+
+//     FD_ZERO(&rdfs);
+//     FD_SET(UDSInfo->hSocket, &rdfs);
+//     nDes = UDSInfo->hSocket + 1;
+
+//     while(1)
+//     {
+//         /* wait for specified amount of time */
+//         ret = select (nDes, &rdfs, NULL, NULL, pwait_time);
+//         /* socket error */
+//         if(ret == -1)
+//         {
+//             if(errno == EINTR)
+//             {
+//                 printf("select: %s. Continue...\n",strerror(errno));
+//                 continue;
+//             }
+//             else
+//             {
+//                 printf("select failed while waiting for read pipe \n");
+//                 continue;
+//             }
+//         }
+//         else if(ret == 0)
+//         {
+//               printf("Connection timed out\n");
+//               return LIBIPMI_MEDIUM_E_TIMED_OUT;
+//          }
+
+//         /* socket is ready to receive data */
+//         if(FD_ISSET(UDSInfo->hSocket,&rdfs))
+//          {
+//             nBytesRecvd = recv(UDSInfo->hSocket,szBuffer+totalrecvd,MAX_RESPONSE_SIZE,0);
+//             if(nBytesRecvd == 0)
+//             {
+//                 printf("End of File Encountered ... may be socket closure\n");
+//                 close(UDSInfo->hSocket);
+//                 return LIBIPMI_MEDIUM_E_RECV_DATA_FAILURE;
+//             }
+//             if(nBytesRecvd == -1)
+//             {
+//                 printf("Socket Error... may be socket closure\n");
+//                 close(UDSInfo->hSocket);
+//                 return LIBIPMI_MEDIUM_E_RECV_DATA_FAILURE;
+//             }
+
+//             // int i;
+//             // printf("---> client recv %#x: ", nBytesRecvd);
+//             // for(i=0;i<nBytesRecvd;i++)
+//             //     printf("%#x ", szBuffer[totalrecvd+i]);
+//             // printf("\n");
+
+//             totalrecvd += nBytesRecvd;
+
+//             if(totalrecvd < sizeof(IPMIUDSMsg_T))
+//             {
+//               continue;
+//             }
+
+//             while(totalrecvd < pData->IPMIMsgLen)
+//             {
+//               continue;
+//             }
+//         return LIBIPMI_STATUS_SUCCESS;
+//        }
+
+//        return LIBIPMI_MEDIUM_E_RECV_DATA_FAILURE; 
+//      }
+// }
+
+
+// /*This Function is used to send the
+//  * data to UDS Interface*/
+// int UDS_SendData(UDS_CHANNEL_T *UDSInfo,char *szBuffer,uint32_t dwsize,int timeout)
+// {
+//     int nTotalBytesSent = 0, nBytesSent = 0;
+//     struct timeval wait_time, *pwait_time;
+//     fd_set wdfs;
+//     int ret;
+//    int nDes;
+
+//     /* Wait for the socket to get ready */
+//     if(timeout >= 0)
+//     {
+//         wait_time.tv_sec = timeout;
+//         wait_time.tv_usec = 0;
+//         pwait_time = &wait_time;
+//     }
+//     else
+//         pwait_time = NULL;
+
+//     FD_ZERO(&wdfs);
+//     FD_SET(UDSInfo->hSocket, &wdfs);
+//     nDes = UDSInfo->hSocket + 1;
+
+// TCPSendUDSDataSelect:
+//     /* wait for specified amount of time */
+//     ret = select (nDes, NULL, &wdfs, NULL, pwait_time);
+//     /* socket error */
+//     if(ret == -1)
+//     {
+//         if(errno == EINTR)
+//         {
+//             printf("select: %s. Continue...\n",strerror(errno));
+//             goto TCPSendUDSDataSelect;
+//         }
+//         else
+//         {
+//             printf("Select failed while waiting for write pipe \n");
+//             close(UDSInfo->hSocket);
+//             return LIBIPMI_MEDIUM_E_INVALID_SOCKET;
+//         }
+//     }
+//     /* timed out */
+//     else if(ret == 0)
+//     {
+//         printf("Connection timedout: Write Pipe is full \n");
+//         close(UDSInfo->hSocket);
+//         return LIBIPMI_MEDIUM_E_TIMED_OUT_ON_SEND;
+//     }
+
+//    if(FD_ISSET(UDSInfo->hSocket,&wdfs))
+//     {
+//         /* socket is ready to send data */
+//         nTotalBytesSent = 0;
+
+//         /* Till the last byte is sent */
+//         while( nTotalBytesSent < (int)dwsize )
+//         {
+//             /* send data */
             
-            nBytesSent = send (UDSInfo->hSocket,szBuffer+nTotalBytesSent,dwsize, MSG_NOSIGNAL);
+//             nBytesSent = send (UDSInfo->hSocket,szBuffer+nTotalBytesSent,dwsize, MSG_NOSIGNAL);
             
-            int i=0;
-            // printf("---> client Send %#x: ",  nBytesSent);
-            // for (i = 0; i < nBytesSent; ++i)
-            // {
-            //     printf("%#x ", szBuffer[nTotalBytesSent+i]);
-            // }
-            // printf("\n");
-
-            /* send failure */
-            if ((nBytesSent == -1) && ((EBADF == errno) || (EPIPE == errno)))
-            {
-                printf("Error while sending data \n");
-                close(UDSInfo->hSocket);
-                return LIBIPMI_MEDIUM_E_SEND_DATA_FAILURE;
-            }
-            else
-            {
-                nTotalBytesSent += nBytesSent;
-                dwsize -= nTotalBytesSent;
-            }
-        }
-        return LIBIPMI_STATUS_SUCCESS;
-
-    }
-    return LIBIPMI_MEDIUM_E_SEND_DATA_FAILURE;
- }
+//             int i=0;
+//             // printf("---> client Send %#x: ",  nBytesSent);
+//             // for (i = 0; i < nBytesSent; ++i)
+//             // {
+//             //     printf("%#x ", szBuffer[nTotalBytesSent+i]);
+//             // }
+//             // printf("\n");
+
+//             /* send failure */
+//             if ((nBytesSent == -1) && ((EBADF == errno) || (EPIPE == errno)))
+//             {
+//                 printf("Error while sending data \n");
+//                 close(UDSInfo->hSocket);
+//                 return LIBIPMI_MEDIUM_E_SEND_DATA_FAILURE;
+//             }
+//             else
+//             {
+//                 nTotalBytesSent += nBytesSent;
+//                 dwsize -= nTotalBytesSent;
+//             }
+//         }
+//         return LIBIPMI_STATUS_SUCCESS;
+
+//     }
+//     return LIBIPMI_MEDIUM_E_SEND_DATA_FAILURE;
+//  }
 

+ 2 - 2
app/goahead-3.6.5/src/osdep/osdep.h

@@ -130,7 +130,7 @@
     #define ME_OS "linux"
     #define LINUX 1
     #define ME_UNIX_LIKE 1
-    #define ME_WIN_LIKE 0   
+    #define ME_WIN_LIKE 0
     /*** jimbo add ***/
     #define HAS_USHORT 1
     #define HAS_UINT 1
@@ -1395,4 +1395,4 @@ extern "C" {
 /*
     Copyright (c) Michael O'Brien. All Rights Reserved.
     This is proprietary software and requires a commercial license from the author.
- */
+ */

+ 2 - 0
app/goahead-3.6.5/src/route.txt

@@ -44,3 +44,5 @@ route uri=/goform handler=action
 #
 route uri=/
 
+############################### User code ##########################
+route uri=/index.html

+ 0 - 1
app/goahead-3.6.5/src/socket.c

@@ -924,7 +924,6 @@ PUBLIC void socketFree(int sid)
     char        buf[256];
     int         i;
 
-    printf("---> socketFree\n");
     if ((sp = socketPtr(sid)) == NULL) {
         return;
     }

+ 1 - 1
app/goahead-3.6.5/src/web_interface/src/dashboard.c

@@ -141,7 +141,7 @@ void getSysInfo(Webs *wp){
     //Close session
     LIBIPMI_CloseSession(&UDSSession );
 
-    cchar *pStr;
+    char *pStr;
     cJSON * root =  cJSON_CreateObject();
     cJSON * data =  cJSON_CreateObject();
     cJSON_AddItemToObject(root, "data", data);//根节点下添加