Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
mongoose
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
esp
mongoose
Commits
d0c50632
Commit
d0c50632
authored
Nov 09, 2016
by
Alexander Alashkin
Committed by
Cesanta Bot
Nov 09, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes in MQTT for AWS support
PUBLISHED_FROM=2b82f3793b3c6d0cf1266e4cc0e67930f43002c5
parent
fffb54e2
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
31 additions
and
1 deletion
+31
-1
intro.md
docs/c-api/mqtt.h/intro.md
+1
-0
struct_mg_mqtt_proto_data.md
docs/c-api/mqtt.h/struct_mg_mqtt_proto_data.md
+12
-0
examples.mk
examples/examples.mk
+1
-1
mongoose.c
mongoose.c
+12
-0
mongoose.h
mongoose.h
+5
-0
No files found.
docs/c-api/mqtt.h/intro.md
View file @
d0c50632
...
...
@@ -20,6 +20,7 @@ items:
-
{
name
:
mg_send_mqtt_handshake.md
}
-
{
name
:
mg_send_mqtt_handshake_opt.md
}
-
{
name
:
mg_set_protocol_mqtt.md
}
-
{
name
:
struct_mg_mqtt_proto_data.md
}
---
...
...
docs/c-api/mqtt.h/struct_mg_mqtt_proto_data.md
0 → 100644
View file @
d0c50632
---
title
:
"
struct
mg_mqtt_proto_data"
decl_name
:
"
struct
mg_mqtt_proto_data"
symbol_kind
:
"
struct"
signature
:
|
struct mg_mqtt_proto_data {
uint16_t keep_alive;
};
---
mg_mqtt_proto_data should be in header to allow external access to it
examples/examples.mk
View file @
d0c50632
...
...
@@ -11,7 +11,7 @@ else
ifeq ($(SSL_LIB),openssl)
CFLAGS += -DMG_ENABLE_SSL -lssl -lcrypto
else ifeq ($(SSL_LIB), krypton)
CFLAGS += -DMG_ENABLE_SSL -DMG_DISABLE_PFS
../../../krypton/krypton.c
CFLAGS += -DMG_ENABLE_SSL -DMG_DISABLE_PFS
-DSSL_KRYPTON ../../../krypton/krypton.c -I../../../krypton
endif
CFLAGS += -lpthread
endif
...
...
mongoose.c
View file @
d0c50632
...
...
@@ -8536,8 +8536,14 @@ static void mqtt_handler(struct mg_connection *nc, int ev, void *ev_data) {
}
}
static
void
mg_mqtt_proto_data_destructor
(
void
*
proto_data
)
{
MG_FREE
(
proto_data
);
}
void
mg_set_protocol_mqtt
(
struct
mg_connection
*
nc
)
{
nc
->
proto_handler
=
mqtt_handler
;
nc
->
proto_data
=
MG_CALLOC
(
1
,
sizeof
(
struct
mg_mqtt_proto_data
));
nc
->
proto_data_destructor
=
mg_mqtt_proto_data_destructor
;
}
void
mg_send_mqtt_handshake
(
struct
mg_connection
*
nc
,
const
char
*
client_id
)
{
...
...
@@ -8551,6 +8557,7 @@ void mg_send_mqtt_handshake_opt(struct mg_connection *nc, const char *client_id,
uint8_t
rem_len
;
uint16_t
keep_alive
;
uint16_t
len
;
struct
mg_mqtt_proto_data
*
pd
=
(
struct
mg_mqtt_proto_data
*
)
nc
->
proto_data
;
/*
* 9: version_header(len, magic_string, version_number), 1: flags, 2:
...
...
@@ -8576,6 +8583,7 @@ void mg_send_mqtt_handshake_opt(struct mg_connection *nc, const char *client_id,
if
(
opts
.
keep_alive
==
0
)
{
opts
.
keep_alive
=
60
;
}
keep_alive
=
htons
(
opts
.
keep_alive
);
mg_send
(
nc
,
&
keep_alive
,
2
);
...
...
@@ -8593,6 +8601,10 @@ void mg_send_mqtt_handshake_opt(struct mg_connection *nc, const char *client_id,
mg_send
(
nc
,
&
len
,
2
);
mg_send
(
nc
,
opts
.
password
,
strlen
(
opts
.
password
));
}
if
(
pd
!=
NULL
)
{
pd
->
keep_alive
=
opts
.
keep_alive
;
}
}
static
void
mg_mqtt_prepend_header
(
struct
mg_connection
*
nc
,
uint8_t
cmd
,
...
...
mongoose.h
View file @
d0c50632
...
...
@@ -4712,6 +4712,11 @@ struct mg_send_mqtt_handshake_opts {
const
char
*
password
;
};
/* mg_mqtt_proto_data should be in header to allow external access to it */
struct
mg_mqtt_proto_data
{
uint16_t
keep_alive
;
};
/* Message types */
#define MG_MQTT_CMD_CONNECT 1
#define MG_MQTT_CMD_CONNACK 2
...
...
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