Skip to content

Commit

Permalink
netutils: add Eclipse tinydtls support
Browse files Browse the repository at this point in the history
  • Loading branch information
raiden00pl committed Jul 27, 2023
1 parent 33987a7 commit 862df9f
Show file tree
Hide file tree
Showing 4 changed files with 128 additions and 0 deletions.
15 changes: 15 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -1807,3 +1807,18 @@ apps/testing/crypto/hmac.c
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

apps/netutils/tinydtls
======================
/*******************************************************************************
* Copyright (c) 2011, 2012, 2013, 2014, 2015, 2016 Olaf Bergmann (TZI) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* and Eclipse Distribution License v. 1.0 which accompanies this distribution.
* The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
* and the Eclipse Distribution License is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
* Contributors:
* Olaf Bergmann - initial API and implementation
* Hauke Mehrtens - memory optimization, ECC integration
*******************************************************************************/
2 changes: 2 additions & 0 deletions netutils/tinydtls/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/tinydtls
/*.tar.gz
92 changes: 92 additions & 0 deletions netutils/tinydtls/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
# ##############################################################################
# apps/netutils/tinydtls/CMakeLists.txt
#
# Licensed to the Apache Software Foundation (ASF) under one or more contributor
# license agreements. See the NOTICE file distributed with this work for
# additional information regarding copyright ownership. The ASF licenses this
# file to you under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.
#
# ##############################################################################

if(CONFIG_NETUTILS_TINYDTLS)

if(NOT EXISTS ${CMAKE_CURRENT_LIST_DIR}/tinydtls)
FetchContent_Declare(
tinydtls
DOWNLOAD_NAME "${CONFIG_TINYDTLS_VERSION}.tar.gz"
DOWNLOAD_DIR ${CMAKE_CURRENT_LIST_DIR}
URL "https://github.com/eclipse/tinydtls/archive/${CONFIG_TINYDTLS_VERSION}.tar.gz"
SOURCE_DIR
${CMAKE_CURRENT_LIST_DIR}/tinydtls
BINARY_DIR
${CMAKE_BINARY_DIR}/apps/netutils/tinydtls/tinydtls
CONFIGURE_COMMAND
""
BUILD_COMMAND
""
INSTALL_COMMAND
""
TEST_COMMAND
""
DOWNLOAD_NO_PROGRESS true
TIMEOUT 30)

FetchContent_GetProperties(tinydtls)

if(NOT tinydtls_POPULATED)
FetchContent_Populate(tinydtls)
endif()
endif()

add_subdirectory(tinydtls)

target_compile_definitions(
tinydtls
PRIVATE HAVE_ARPA_INET_H
HAVE_ASSERT_H
HAVE_FCNTL_H
HAVE_GETRANDOM
HAVE_INTTYPES_H
HAVE_MEMSET
HAVE_NETDB_H
HAVE_NETINET_IN_H
HAVE_RANDOM
HAVE_SELECT
HAVE_SOCKET
HAVE_STDDEF_H
HAVE_STDINT_H
HAVE_STDLIB_H
HAVE_STRDUP
HAVE_STRERROR
HAVE_STRINGS_H
HAVE_STRING_H
HAVE_STRNLEN
HAVE_SYS_SOCKET_H
HAVE_SYS_STAT_H
HAVE_SYS_TIME_H
HAVE_SYS_TYPES_H
HAVE_TIME_H
HAVE_UNISTD_H
HAVE_VPRINTF
HAVE_SNPRINTF)

target_compile_options(tinydtls PRIVATE -Wno-unused -Wno-inline)

# TODO: this should be function in nuttx/cmake/nuttx_add_library.cmake
set_property(GLOBAL APPEND PROPERTY NUTTX_EXTRA_LIBRARIES tinydtls)
nuttx_add_library_internal(tinydtls)

# allow #include "tinydtls/xxx.h"
target_include_directories(tinydtls PUBLIC .)

endif()
19 changes: 19 additions & 0 deletions netutils/tinydtls/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#
# For a description of the syntax of this configuration file,
# see the file kconfig-language.txt in the NuttX tools repository.
#

config NETUTILS_TINYDTLS
bool "Eclipse Tinydtls"
default n
depends on ALLOW_ECLIPSE_COMPONENTS
---help---
Enable Eclipse tinydtls - a minimal library for DTLS.

if NETUTILS_TINYDTLS

config TINYDTLS_VERSION
string "Tinydtls version"
default "ba830a390642d057fcf21bbb6bd57546d12e584c"

endif # NETUTILS_TINYDTLS

0 comments on commit 862df9f

Please sign in to comment.