OCT 1.修正接口的返回消息IP池错误 2.删除无用代码
This commit is contained in:
parent
e21d9994e0
commit
ad3ee42e09
|
@ -18,12 +18,6 @@ typedef enum {
|
||||||
CRYPTO_AES256 = 4,
|
CRYPTO_AES256 = 4,
|
||||||
} PROTO_CRYPTO_TYPE;
|
} PROTO_CRYPTO_TYPE;
|
||||||
|
|
||||||
typedef enum {
|
|
||||||
TYPE_ADD_RNG = 0,
|
|
||||||
TYPE_DEL_RNG = 1,
|
|
||||||
TYPE_QUE_USR = 2,
|
|
||||||
} PROTO_POST_TYPE;
|
|
||||||
|
|
||||||
const char *proto_msg_validation(const char *pJsonStr, const char *msgJson, const char *errMsg);
|
const char *proto_msg_validation(const char *pJsonStr, const char *msgJson, const char *errMsg);
|
||||||
const char *proto_create_new(cJSON *pMsgCtx, int httpCode);
|
const char *proto_create_new(cJSON *pMsgCtx, int httpCode);
|
||||||
const char *proto_decode_context(const char *pString, unsigned int *pVer, unsigned long long *pTm, int *pErrCode);
|
const char *proto_decode_context(const char *pString, unsigned int *pVer, unsigned long long *pTm, int *pErrCode);
|
||||||
|
|
|
@ -54,20 +54,20 @@ typedef struct {
|
||||||
} JSON_POST_CTX;
|
} JSON_POST_CTX;
|
||||||
|
|
||||||
static JSON_POST_CTX g_add_msg[] = {
|
static JSON_POST_CTX g_add_msg[] = {
|
||||||
{R"({"type":"object","required":["rangeSet"]})", "Missing required field [rangeSet]"},
|
{R"({"type":"object","required":["rangeSet"]})", "Missing required field [rangeSet]"},
|
||||||
{R"({"properties":{"rangeSet":{"type":"array","minItems":1}}})", "No content in field [rangeSet]"},
|
{R"({"properties":{"rangeSet":{"type":"array","minItems":1}}})", "No content in field [rangeSet]"},
|
||||||
{R"({"properties":{"rangeSet":{"items":{"type":"object","required":["dhcpRange"]}}}})", "Missing required field [dhcpRange]"},
|
{R"({"properties":{"rangeSet":{"items":{"type":"object","required":["dhcpRange"]}}}})", "Missing required field [dhcpRange]"},
|
||||||
// {R"({"properties":{"rangeSet":{"items":{"properties":{"dhcpRange":{"type":"string","minLength":15}}}}}})", "Error in field [dhcpRange]"}
|
// {R"({"properties":{"rangeSet":{"items":{"properties":{"dhcpRange":{"type":"string","minLength":15}}}}}})", "Error in field [dhcpRange]"}
|
||||||
};
|
};
|
||||||
|
|
||||||
static JSON_POST_CTX g_del_msg[] = {
|
static JSON_POST_CTX g_del_msg[] = {
|
||||||
{R"({"type":"object","required":["dhcpRange"]})", "Missing required field [dhcpRange]"},
|
{R"({"type":"object","required":["dhcpRange"]})", "Missing required field [dhcpRange]"},
|
||||||
{R"({"properties":{"dhcpRange":{"type":"array","minItems":1}}})", "No content in field [dhcpRange]"},
|
{R"({"properties":{"dhcpRange":{"type":"array","minItems":1}}})", "No content in field [dhcpRange]"},
|
||||||
// {R"({"properties":{"dhcpRange":{"items":{"type":"string","minLength":15}}}})", "Error in field [dhcpRange]"}
|
// {R"({"properties":{"dhcpRange":{"items":{"type":"string","minLength":15}}}})", "Error in field [dhcpRange]"}
|
||||||
};
|
};
|
||||||
|
|
||||||
static JSON_POST_CTX g_que_msg[] = {
|
static JSON_POST_CTX g_que_msg[] = {
|
||||||
{R"({"type":"object","required":["userMac"]})", "Missing required field [userMac]"},
|
{R"({"type":"object","required":["userMac"]})", "Missing required field [userMac]"},
|
||||||
{R"({"properties":{"userMac":{"type":"array","minItems":1}}})", "No content in field [userMac]"},
|
{R"({"properties":{"userMac":{"type":"array","minItems":1}}})", "No content in field [userMac]"},
|
||||||
// {R"({"properties":{"userMac":{"items":{"type":"string","minLength":17,"maxLength":17}}}})", "Error in field [userMac]"}
|
// {R"({"properties":{"userMac":{"items":{"type":"string","minLength":17,"maxLength":17}}}})", "Error in field [userMac]"}
|
||||||
};
|
};
|
||||||
|
@ -543,16 +543,25 @@ static int delete_dhcpd_rangeset(const char **pRsp, const char *pRequest) {
|
||||||
MYDWORD st_addr;
|
MYDWORD st_addr;
|
||||||
MYDWORD en_addr;
|
MYDWORD en_addr;
|
||||||
mySplit(start, end, del_range, '-');
|
mySplit(start, end, del_range, '-');
|
||||||
st_addr = htonl(inet_addr(start));
|
|
||||||
en_addr = htonl(inet_addr(end));
|
|
||||||
|
|
||||||
PHASH_MAP s;
|
if(isIP(start) && isIP(end)) {
|
||||||
HASH_FIND_INT(delMap, &st_addr, s);
|
st_addr = htonl(inet_addr(start));
|
||||||
if (s == nullptr) {
|
en_addr = htonl(inet_addr(end));
|
||||||
s = (PHASH_MAP)malloc(sizeof(HASH_MAP));
|
|
||||||
s->key = st_addr;
|
PHASH_MAP s;
|
||||||
s->value = en_addr;
|
HASH_FIND_INT(delMap, &st_addr, s);
|
||||||
HASH_ADD_INT(delMap, key, s);
|
if (s == nullptr) {
|
||||||
|
s = (PHASH_MAP)malloc(sizeof(HASH_MAP));
|
||||||
|
s->key = st_addr;
|
||||||
|
s->value = en_addr;
|
||||||
|
HASH_ADD_INT(delMap, key, s);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
cJSON *pdel_Item = cJSON_CreateObject();
|
||||||
|
cJSON_AddStringToObject(pdel_Item, "dhcpRange", del_range);
|
||||||
|
cJSON_AddNumberToObject(pdel_Item, "status", ERR_INPUT_PARAMS);
|
||||||
|
cJSON_AddStringToObject(pdel_Item, "message", getErrorEnumDesc(ERR_INPUT_PARAMS));
|
||||||
|
cJSON_AddItemToArray(pdelArray, pdel_Item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue