Skip to content

Commit

Permalink
feat(avahi): Initial avahi port
Browse files Browse the repository at this point in the history
Note the LGPL license, add a warning!
  • Loading branch information
david-cermak committed Jan 23, 2025
1 parent 6d19aab commit 780b855
Show file tree
Hide file tree
Showing 19 changed files with 1,616 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@
[submodule "components/mosquitto/mosquitto"]
path = components/mosquitto/mosquitto
url = https://github.com/eclipse/mosquitto
[submodule "components/avahi/avahi"]
path = components/avahi/avahi
url = https://github.com/avahi/avahi.git
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ repos:
- repo: local
hooks:
- id: commit message scopes
name: "commit message must be scoped with: mdns, modem, websocket, asio, mqtt_cxx, console, common, eppp, tls_cxx, mosq, sockutls"
entry: '\A(?!(feat|fix|ci|bump|test|docs|chore)\((mdns|modem|common|console|websocket|asio|mqtt_cxx|examples|eppp|tls_cxx|mosq|sockutls)\)\:)'
name: "commit message must be scoped with: mdns, modem, websocket, asio, mqtt_cxx, console, common, eppp, tls_cxx, mosq, sockutls, avahi"
entry: '\A(?!(feat|fix|ci|bump|test|docs|chore)\((mdns|modem|common|console|websocket|asio|mqtt_cxx|examples|eppp|tls_cxx|mosq|sockutls|avahi)\)\:)'
language: pygrep
args: [--multiline]
stages: [commit-msg]
8 changes: 8 additions & 0 deletions ci/check_copyright_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,14 @@ mosquitto_component:
- Apache-2.0
- BSD-3-Clause

avahi_component:
include:
- 'components/avahi/**'
allowed_licenses:
- LGPL-2.1
- Apache-2.0
- Unlicense OR CC0-1.0

slim_modem_examples:
include:
- 'examples/esp_netif/slip_custom_netif/**'
Expand Down
60 changes: 60 additions & 0 deletions components/avahi/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
set(avahi_path "avahi")
set(avahi_core "${avahi_path}/avahi-core")
set(avahi_common "${avahi_path}/avahi-common")
set(avahi_core_SRCS "${avahi_core}/server.c"
"${avahi_common}/error.c"
"${avahi_common}/malloc.c"
"${avahi_common}/simple-watch.c"
"${avahi_common}/domain.c"
"${avahi_common}/timeval.c"
"${avahi_common}/strlst.c"
"${avahi_common}/address.c"
"${avahi_common}/rlist.c"
"${avahi_common}/utf8.c"
"${avahi_core}/log.c"
"${avahi_core}/rr.c"
"${avahi_core}/response-sched.c"
"${avahi_core}/probe-sched.c"
"${avahi_core}/query-sched.c"
"${avahi_core}/rrlist.c"
"${avahi_core}/hashmap.c"
"${avahi_core}/announce.c"
"${avahi_core}/domain-util.c"
"${avahi_core}/multicast-lookup.c"
"${avahi_core}/iface.c"
"${avahi_core}/entry.c"
"${avahi_core}/cache.c"
"${avahi_core}/util.c"
"${avahi_core}/addr-util.c"
"${avahi_core}/timeeventq.c"
"${avahi_core}/querier.c"
"${avahi_core}/browse.c"
"${avahi_core}/dns.c"
"${avahi_core}/wide-area.c"
"${avahi_core}/prioq.c"
"${avahi_core}/fdutil.c"
"${avahi_core}/browse-domain.c"
"${avahi_core}/browse-dns-server.c"
"${avahi_core}/browse-service.c"
"${avahi_core}/resolve-host-name.c"
"${avahi_core}/resolve-address.c"
"${avahi_core}/resolve-service.c"
"${avahi_core}/browse-service-type.c"
# "${avahi_core}/browse-record.c"
# "${avahi_core}/resolve-service-group.c"
# "${avahi_core}/resolve-record.c"
)

idf_component_register(SRCS "avahi-port/iface-esp32.c"
"avahi-port/socket.c"
${avahi_core_SRCS}
INCLUDE_DIRS "avahi-port" "${avahi_core}" "${avahi_path}"
REQUIRES "esp_netif")

target_compile_definitions(${COMPONENT_LIB} PRIVATE "HAVE_CONFIG_H")
# ignore specific warnings on certain files
set_source_files_properties(${avahi_common}/domain.c PROPERTIES COMPILE_FLAGS -Wno-char-subscripts)
set_source_files_properties(${avahi_core}/rr.c PROPERTIES COMPILE_FLAGS -Wno-format)
set_source_files_properties(${avahi_core}/iface.c PROPERTIES COMPILE_FLAGS -Wno-format)
set_source_files_properties(${avahi_core}/entry.c PROPERTIES COMPILE_FLAGS -Wno-format)
set_source_files_properties(${avahi_common}/address.c PROPERTIES COMPILE_FLAGS -Wno-format)
508 changes: 508 additions & 0 deletions components/avahi/LICENSE.txt

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions components/avahi/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Simple ESP-IDF avahi port

This is a simple port of avahi for ESP-IDF. It is based on the avahi-core library and is intended to be used as a mDNS service browser.

## Warning

This component uses avahi project which is distributed under the LGPL license. This means that you have to provide the source code of your project to the end user if you use this component in your project.
For more details, please refer to the [LICENSE](LICENSE.txt) file.
1 change: 1 addition & 0 deletions components/avahi/avahi
Submodule avahi added at 1dade8
Loading

0 comments on commit 780b855

Please sign in to comment.