From 1749e049e699a08dece98aa18e525816d3f5c587 Mon Sep 17 00:00:00 2001 From: huangxin Date: Sat, 3 Dec 2022 18:07:12 +0800 Subject: [PATCH] =?UTF-8?q?OCT=201.=20=E6=9B=B4=E6=96=B0=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E6=89=80=E6=9C=89=E7=94=A8=E6=88=B7=E5=8D=8F=E8=AE=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/vcpe.cfg | 2 +- srcs/open_dhcp/query.cpp | 18 ++++++------------ 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/config/vcpe.cfg b/config/vcpe.cfg index 67dc4b5..f4599f9 100644 --- a/config/vcpe.cfg +++ b/config/vcpe.cfg @@ -85,7 +85,7 @@ application: # 2:采用AES128加密后的base64编码格式 # 3:采用3DES加密后的base64编码格式 # 4:采用AES256加密后的base64编码格式 - crypto_type = 0; + crypto_type = 2; crypto_key = "AES@rX2qZWVwGVlYTJLf/6X22w=="; }; diff --git a/srcs/open_dhcp/query.cpp b/srcs/open_dhcp/query.cpp index 043572c..07bde83 100644 --- a/srcs/open_dhcp/query.cpp +++ b/srcs/open_dhcp/query.cpp @@ -116,12 +116,10 @@ static void sendUserList(data19 *req, const char *pRequest) { //fp += sprintf(fp, send200, strlen(rspBuf)); fp += sprintf(fp, "%s", pStrPro); + req->bytes = (int)(fp - req->dp); cJSON_Delete(pRoot); - //cJSON_Delete(pRspMsg); free((void *)pStrPro); - - req->bytes = (int)(fp - req->dp); } static void sendAllLists(data19 *req) { @@ -141,11 +139,6 @@ static void sendAllLists(data19 *req) { char *fp = req->dp; char *maxData = req->dp + (req->memSize - 512); - cJSON *pRspRoot = cJSON_CreateObject(); - cJSON_AddNumberToObject(pRspRoot, "version", 3); - cJSON_AddNumberToObject(pRspRoot, "cryptoType", 0); - cJSON_AddNumberToObject(pRspRoot, "timeStamp", (unsigned int)time(nullptr)); - cJSON *pRspMsg = cJSON_CreateObject(); cJSON *pMsgArray = cJSON_CreateArray(); @@ -160,13 +153,14 @@ static void sendAllLists(data19 *req) { //cJSON_AddItemToArray(pMsgArray, pRspItem); } - cJSON_AddItemToObject(pRspRoot, "msgContent", pRspMsg); + //cJSON_AddItemToObject(pRspRoot, "msgContent", pRspMsg); - fp += sprintf(fp, "%s", cJSON_Print(pRspRoot)); - - cJSON_Delete(pRspRoot); + const char *pStrPro = proto_create_new(pRspMsg, 200); + fp += sprintf(fp, "%s", pStrPro); req->bytes = (int)(fp - req->dp); + + free((void *)pStrPro); } #define VALUE_TO_DHCP_TLV(buf, val, tag) \