Skip to content

Commit de4531e

Browse files
committed
feat(mosq): Initial moquitto v2.0.18 port (TCP only)
1 parent c6e2eb2 commit de4531e

31 files changed

+1273
-1
lines changed

.github/workflows/mosq__build.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: "mosq: build-tests"
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
types: [opened, synchronize, reopened, labeled]
9+
10+
jobs:
11+
build_mosq:
12+
if: contains(github.event.pull_request.labels.*.name, 'Comp::mosq') || github.event_name == 'push'
13+
name: Build
14+
strategy:
15+
matrix:
16+
idf_ver: ["latest", "release-v5.3"]
17+
runs-on: ubuntu-22.04
18+
container: espressif/idf:${{ matrix.idf_ver }}
19+
steps:
20+
- name: Checkout esp-protocols
21+
uses: actions/checkout@v4
22+
with:
23+
submodules: recursive
24+
- name: Build with IDF-${{ matrix.idf_ver }}
25+
env:
26+
EXPECTED_WARNING: "\"_GNU_SOURCE\" redefined"
27+
shell: bash
28+
run: |
29+
. ${IDF_PATH}/export.sh
30+
pip install idf-component-manager idf-build-apps --upgrade
31+
python ci/build_apps.py components/mosquitto/examples/ -c

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
[submodule "components/asio/asio"]
22
path = components/asio/asio
33
url = https://github.com/espressif/asio
4+
[submodule "components/mosq/mosquitto"]
5+
path = components/mosquitto/mosquitto
6+
url = https://github.com/eclipse/mosquitto

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ repos:
6262
hooks:
6363
- id: commit message scopes
6464
name: "commit message must be scoped with: mdns, modem, websocket, asio, mqtt_cxx, console, common, eppp, wifi_remote, tls_cxx"
65-
entry: '\A(?!(feat|fix|ci|bump|test|docs)\((mdns|modem|common|console|websocket|asio|mqtt_cxx|examples|eppp|wifi_remote|tls_cxx)\)\:)'
65+
entry: '\A(?!(feat|fix|ci|bump|test|docs)\((mdns|modem|common|console|websocket|asio|mqtt_cxx|examples|eppp|wifi_remote|tls_cxx|mosq)\)\:)'
6666
language: pygrep
6767
args: [--multiline]
6868
stages: [commit-msg]

ci/check_copyright_config.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,13 @@ asio_component:
4747
- Apache-2.0
4848
- BSL-1.0
4949

50+
mosquitto_component:
51+
include:
52+
- 'components/mosquitto/port/**'
53+
allowed_licenses:
54+
- EPL-2.0
55+
- Apache-2.0
56+
5057
slim_modem_examples:
5158
include:
5259
- 'examples/esp_netif/slip_custom_netif/**'

components/mosquitto/.cz.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
commitizen:
2+
bump_message: 'bump(mosq): $current_version -> $new_version'
3+
pre_bump_hooks: python ../../ci/changelog.py mosq
4+
tag_format: mosq-v$version
5+
version: 2.0.27
6+
version_files:
7+
- idf_component.yml

components/mosquitto/CMakeLists.txt

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
set(m_dir mosquitto)
2+
set(m_src_dir ${m_dir}/src)
3+
set(m_incl_dir ${m_dir}/include)
4+
set(m_lib_dir ${m_dir}/lib)
5+
set(m_deps_dir ${m_dir}/deps)
6+
7+
set(m_srcs
8+
${m_lib_dir}/memory_mosq.c
9+
${m_lib_dir}/util_mosq.c
10+
${m_lib_dir}/net_mosq.c
11+
${m_lib_dir}/will_mosq.c
12+
${m_lib_dir}/alias_mosq.c
13+
${m_lib_dir}/send_mosq.c
14+
${m_lib_dir}/strings_mosq.c
15+
${m_lib_dir}/packet_mosq.c
16+
${m_lib_dir}/packet_datatypes.c
17+
${m_lib_dir}/property_mosq.c
18+
${m_lib_dir}/util_topic.c
19+
${m_lib_dir}/send_publish.c
20+
${m_lib_dir}/send_disconnect.c
21+
${m_lib_dir}/handle_pubackcomp.c
22+
${m_lib_dir}/handle_pubrec.c
23+
${m_lib_dir}/handle_pubrel.c
24+
${m_lib_dir}/handle_ping.c
25+
${m_lib_dir}/time_mosq.c
26+
${m_lib_dir}/utf8_mosq.c
27+
28+
${m_src_dir}/bridge.c
29+
${m_src_dir}/bridge_topic.c
30+
${m_src_dir}/conf_includedir.c
31+
${m_src_dir}/context.c
32+
${m_src_dir}/control.c
33+
${m_src_dir}/database.c
34+
${m_src_dir}/handle_auth.c
35+
${m_src_dir}/handle_connack.c
36+
${m_src_dir}/handle_connect.c
37+
${m_src_dir}/handle_disconnect.c
38+
${m_src_dir}/handle_publish.c
39+
${m_src_dir}/handle_subscribe.c
40+
${m_src_dir}/handle_unsubscribe.c
41+
${m_src_dir}/keepalive.c
42+
${m_src_dir}/logging.c
43+
${m_src_dir}/loop.c
44+
${m_src_dir}/memory_public.c
45+
${m_src_dir}/mosquitto.c
46+
${m_src_dir}/mux.c
47+
${m_src_dir}/mux_epoll.c
48+
${m_src_dir}/mux_poll.c
49+
${m_src_dir}/net.c
50+
${m_src_dir}/password_mosq.c
51+
${m_src_dir}/persist_read.c
52+
${m_src_dir}/persist_read_v234.c
53+
${m_src_dir}/persist_read_v5.c
54+
${m_src_dir}/persist_write.c
55+
${m_src_dir}/persist_write_v5.c
56+
${m_src_dir}/property_broker.c
57+
${m_src_dir}/read_handle.c
58+
${m_src_dir}/retain.c
59+
${m_src_dir}/security.c
60+
${m_src_dir}/security_default.c
61+
${m_src_dir}/send_auth.c
62+
${m_src_dir}/send_connack.c
63+
${m_src_dir}/send_suback.c
64+
${m_src_dir}/send_unsuback.c
65+
${m_src_dir}/service.c
66+
${m_src_dir}/session_expiry.c
67+
${m_src_dir}/signals.c
68+
${m_src_dir}/subs.c
69+
${m_src_dir}/sys_tree.c
70+
${m_src_dir}/topic_tok.c
71+
${m_src_dir}/websockets.c
72+
${m_src_dir}/will_delay.c
73+
${m_src_dir}/xtreport.c)
74+
75+
idf_component_register(SRCS ${m_srcs}
76+
port/callbacks.c port/config.c port/signals.c port/ifaddrs.c port/broker.c port/files.c
77+
PRIV_INCLUDE_DIRS port/priv_include port/priv_include/sys ${m_dir} ${m_src_dir}
78+
${m_incl_dir} ${m_lib_dir} ${m_deps_dir}
79+
INCLUDE_DIRS ${m_incl_dir} port/include
80+
PRIV_REQUIRES newlib
81+
)
82+
83+
target_compile_definitions(${COMPONENT_LIB} PRIVATE "WITH_BROKER")
84+
target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format")

components/mosquitto/LICENSE.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
This project is dual licensed under the Eclipse Public License 2.0 and the
2+
Eclipse Distribution License 1.0 as described in the epl-v20 and edl-v10 files.

components/mosquitto/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# ESP32 Mosquitto port (mosq)
2+
3+
This is a simplified port of the mosquitto broker running on ESP32. It support only a single listener and TCP transport only

components/mosquitto/edl-v10

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
Eclipse Distribution License - v 1.0
2+
3+
Copyright (c) 2007, Eclipse Foundation, Inc. and its licensors.
4+
5+
All rights reserved.
6+
7+
Redistribution and use in source and binary forms, with or without
8+
modification, are permitted provided that the following conditions are met:
9+
10+
Redistributions of source code must retain the above copyright notice, this
11+
list of conditions and the following disclaimer.
12+
13+
Redistributions in binary form must reproduce the above copyright notice,
14+
this list of conditions and the following disclaimer in the documentation
15+
and/or other materials provided with the distribution.
16+
17+
Neither the name of the Eclipse Foundation, Inc. nor the names of its
18+
contributors may be used to endorse or promote products derived from this
19+
software without specific prior written permission.
20+
21+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
22+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
23+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
25+
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
26+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
27+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
28+
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

0 commit comments

Comments
 (0)