Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
k-sdk
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
陈伟灿
k-sdk
Commits
0db490ba
Commit
0db490ba
authored
Aug 06, 2020
by
whmaizmy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
【修改内容】增加无效topic的过滤
【提交人】陈伟灿
parent
1761e6e5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
1 deletion
+33
-1
application/kcloud/iot.mk
application/kcloud/iot.mk
+1
-1
application/kcloud/kcloud_data_handle.c
application/kcloud/kcloud_data_handle.c
+32
-0
No files found.
application/kcloud/iot.mk
View file @
0db490ba
...
@@ -11,7 +11,7 @@ CFLAGS += -I$(TOP_DIR)/common/json
...
@@ -11,7 +11,7 @@ CFLAGS += -I$(TOP_DIR)/common/json
CFLAGS
+=
-I
$(TOP_DIR)
/common/nanomsg/include
CFLAGS
+=
-I
$(TOP_DIR)
/common/nanomsg/include
CFLAGS
+=
-I
$(TOP_DIR)
/common/ev/include
CFLAGS
+=
-I
$(TOP_DIR)
/common/ev/include
CFLAGS
+=
-I
$(TOP_DIR)
/common/sqlite
CFLAGS
+=
-I
$(TOP_DIR)
/common/sqlite
LDFLAGS
+=
-lapi_com
LDFLAGS
+=
-lapi_com
-lkk_tsl
LDFLAGS
+=
-L
$(TOP_DIR)
/common/nanomsg
-static
-lnanomsg
LDFLAGS
+=
-L
$(TOP_DIR)
/common/nanomsg
-static
-lnanomsg
LDFLAGS
+=
-L
$(TOP_DIR)
/common/ev
-static
-lev
LDFLAGS
+=
-L
$(TOP_DIR)
/common/ev
-static
-lev
LDFLAGS
+=
-L
$(TOP_DIR)
/output/release/lib
-static
-lapi_com
LDFLAGS
+=
-L
$(TOP_DIR)
/output/release/lib
-static
-lapi_com
...
...
application/kcloud/kcloud_data_handle.c
View file @
0db490ba
...
@@ -43,9 +43,41 @@ void KK_Sendto_CloudData(void *data,int len)
...
@@ -43,9 +43,41 @@ void KK_Sendto_CloudData(void *data,int len)
printf
(
"[%s][%d] payload:%s
\n
"
,
__FUNCTION__
,
__LINE__
,
pData
->
valuestring
);
printf
(
"[%s][%d] payload:%s
\n
"
,
__FUNCTION__
,
__LINE__
,
pData
->
valuestring
);
KK_MQTT_SendMsg
(
pTopic
->
valuestring
,(
const
char
*
)
pData
->
valuestring
);
KK_MQTT_SendMsg
(
pTopic
->
valuestring
,(
const
char
*
)
pData
->
valuestring
);
}
}
#define KK_FILTER_ADD_TOPIC "/thing/topo/add"
#define KK_FILTER_ADD_TOPIC_REPLY "/thing/topo/add_reply"
#define KK_FILTER_DELETE_TOPIC "/thing/topo/delete"
#define KK_FILTER_DELETE_TOPIC_REPLY "/thing/topo/delete_reply"
#define KK_FILTER_REGISTER_TOPIC "/thing/sub/register"
#define KK_FILTER_REGISTER_TOPIC_REPLY "/thing/sub/register_reply"
#define KK_FILTER_LOGIN_TOPIC "/thing/combine/login"
#define KK_FILTER_LOGIN_TOPIC_REPLY "/thing/combine/login_reply"
static
int
_check_invalid_topic
(
char
*
topic
)
{
if
(
strstr
(
topic
,
KK_FILTER_ADD_TOPIC
)
!=
NULL
&&
\
strstr
(
topic
,
KK_FILTER_ADD_TOPIC_REPLY
)
==
NULL
){
return
1
;
}
else
if
(
strstr
(
topic
,
KK_FILTER_DELETE_TOPIC
)
!=
NULL
&&
\
strstr
(
topic
,
KK_FILTER_DELETE_TOPIC_REPLY
)
==
NULL
){
return
1
;
}
else
if
(
strstr
(
topic
,
KK_FILTER_REGISTER_TOPIC
)
!=
NULL
&&
\
strstr
(
topic
,
KK_FILTER_REGISTER_TOPIC_REPLY
)
==
NULL
){
return
1
;
}
else
if
(
strstr
(
topic
,
KK_FILTER_LOGIN_TOPIC
)
!=
NULL
&&
\
strstr
(
topic
,
KK_FILTER_LOGIN_TOPIC_REPLY
)
==
NULL
){
return
1
;
}
return
0
;
}
void
KK_Sendto_DevData
(
const
char
*
topic
,
const
char
*
data
)
void
KK_Sendto_DevData
(
const
char
*
topic
,
const
char
*
data
)
{
{
if
(
_check_invalid_topic
())
{
return
;
//ingore the message
}
char
*
send_data
=
_kk_data_create
(
topic
,
data
);
char
*
send_data
=
_kk_data_create
(
topic
,
data
);
kk_ipc_send
(
IPC_APP2MID
,
send_data
,
strlen
(
send_data
)
+
1
);
kk_ipc_send
(
IPC_APP2MID
,
send_data
,
strlen
(
send_data
)
+
1
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment