Skip to content

Commit

Permalink
Release review (#41)
Browse files Browse the repository at this point in the history
* Solved CMake configuration in Windows.

* Solved defined problems from transport disables.

* Solved UDP and TCP header erros.

* Refs 3599. Reviewed CMake platform selection and adapted memory consumption test.

* Refs #3599. Changed CMake configuration files and updated Micro CDR.

* Updated MicroCDR

* Refs #3599. Added data dir to CMake config file and updated Micro CDR.

* Added transport internal files for internal symbols.

* Added integration test to windows

* Refs 3599. Updated Micro CDR.

* Fixed image

* Refs 3599. Attended pull request comments.
  • Loading branch information
julionce authored and BorjaOuterelo committed Oct 31, 2018
1 parent 1c1251f commit fa43d8e
Show file tree
Hide file tree
Showing 27 changed files with 206 additions and 98 deletions.
77 changes: 40 additions & 37 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ option(EPROSIMA_BUILD_TESTS "Activate the building tests" OFF)
option(THIRDPARTY "Activate the build of thirdparties" OFF)
option(VERBOSE_SERIALIZATION "Use verbose output" OFF)
option(VERBOSE_MESSAGE "Use verbose output" OFF)
if((${CMAKE_SYSTEM_NAME} STREQUAL "Linux") OR (${CMAKE_SYSTEM_NAME} STREQUAL "Generic"))
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
option(MEMORY_PERFORMANCE "Memory performace test." OFF)
endif()

Expand Down Expand Up @@ -107,44 +107,49 @@ eprosima_find_package(microcdr)
# Sources
###############################################################################

# Transport source
foreach(TRANSPORT_TYPE UDP TCP SERIAL)
if(PROFILE_${TRANSPORT_TYPE}_TRANSPORT)
string(TOLOWER ${TRANSPORT_TYPE} TT)
if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
set(PLATFORM_NAME_LINUX ON)
set(${TRANSPORT_TYPE}_SRCS
# Check platform.
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
set(PLATFORM_NAME_LINUX ON)
set(TRANSPORT_TYPES "UDP" "TCP" "SERIAL")
elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows")
set(PLATFORM_NAME_WINDOWS ON)
set(TRANSPORT_TYPES "UDP" "TCP")
elseif(CMAKE_SYSTEM_NAME STREQUAL "Generic")
if(PLATFORM_NAME STREQUAL "nuttx")
set(PLATFORM_NAME_NUTTX ON)
set(TRANSPORT_TYPES "UDP" "TCP" "SERIAL")
endif()
endif()

# Transport sources.
foreach(TRANS_TYPE ${TRANSPORT_TYPES})
if(PROFILE_${TRANS_TYPE}_TRANSPORT)
string(TOLOWER ${TRANS_TYPE} TT)
if(PLATFORM_NAME_LINUX)
set(${TRANS_TYPE}_SRCS
src/c/profile/transport/${TT}/${TT}_transport.c
src/c/profile/transport/${TT}/${TT}_transport_linux.c
)
elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
set(PLATFORM_NAME_WINDOWS ON)
set(${TRANSPORT_TYPE}_SRCS
elseif(PLATFORM_NAME_WINDOWS)
set(${TRANS_TYPE}_SRCS
src/c/profile/transport/${TT}/${TT}_transport.c
src/c/profile/transport/${TT}/${TT}_transport_windows.c
)
elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Generic")
if(${PLATFORM_NAME} STREQUAL "nuttx")
set(PLATFORM_NAME_NUTTX ON)
set(${TRANSPORT_TYPE}_SRCS
src/c/profile/transport/${TT}/${TT}_transport.c
src/c/profile/transport/${TT}/${TT}_transport_linux.c
)
endif()
elseif(PLATFORM_NAME_NUTTX)
set(${TRANS_TYPE}_SRCS
src/c/profile/transport/${TT}/${TT}_transport.c
src/c/profile/transport/${TT}/${TT}_transport_linux.c
)
endif()
endif()
endforeach()

# Transport discovery source
# Transport discovery source.
if(PROFILE_DISCOVERY)
if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
if(PLATFORM_NAME_LINUX)
set(UDP_DISCOVERY_SRCS src/c/profile/discovery/transport/udp_transport_linux_datagram.c)
elseif(PLATFORM_NAME_NUTTX)
set(UDP_DISCOVERY_SRCS src/c/profile/discovery/transport/udp_transport_linux_datagram.c)
# elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
# set(UDP_DISCOVERY_SRCS src/c/profile/discovery/transport/udp_transport_windows_datagram.c)
elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Generic")
if(${PLATFORM_NAME} STREQUAL "nuttx")
set(UDP_DISCOVERY_SRCS src/c/profile/discovery/transport/udp_transport_linux_datagram.c)
endif()
endif()
endif()

Expand Down Expand Up @@ -253,7 +258,7 @@ if(EPROSIMA_BUILD_EXAMPLES)
add_subdirectory(examples/SubscribeHelloWorld)
add_subdirectory(examples/ShapesDemo)
add_subdirectory(examples/Deployment)
if(NOT ${SYSTEM_CMAKE_NAME} STREQUAL "Windows")
if(PLATFORM_NAME_LINUX OR PLATFORM_NAME_NUTTX)
add_subdirectory(examples/Discovery)
endif()
endif()
Expand All @@ -269,19 +274,17 @@ if(EPROSIMA_BUILD_TESTS AND IS_TOP_LEVEL)

if(NOT ((MSVC OR MSVC_IDE) AND EPROSIMA_INSTALLER))
add_subdirectory(test/unitary/streams)
add_subdirectory(test/integration/interaction)

if(NOT WIN32)
add_subdirectory(test/transport/serial_comm)
add_subdirectory(test/integration/interaction)
add_subdirectory(test/integration/cross_serialization)
endif()
endif()
endif()

if((${CMAKE_SYSTEM_NAME} STREQUAL "Linux") OR (${CMAKE_SYSTEM_NAME} STREQUAL "Generic"))
if(MEMORY_PERFORMANCE)
add_subdirectory(test/memory/consumption)
endif()
if(PLATFORM_NAME_LINUX AND MEMORY_PERFORMANCE)
add_subdirectory(test/memory/consumption)
endif()

###############################################################################
Expand Down Expand Up @@ -310,16 +313,16 @@ install(FILES ${PROJECT_BINARY_DIR}/include/uxr/client/config.h

# Export library
install(EXPORT ${PROJECT_NAME}Targets
DESTINATION ${LIB_INSTALL_DIR}/${PROJECT_NAME}/cmake
DESTINATION ${DATA_INSTALL_DIR}/${PROJECT_NAME}/cmake
)

# Package configuration
include(CMakePackageConfigHelpers)
configure_package_config_file(${PROJECT_SOURCE_DIR}/cmake/packaging/Config.cmake.in
${PROJECT_BINARY_DIR}/cmake/config/${PROJECT_NAME}Config.cmake
INSTALL_DESTINATION ${LIB_INSTALL_DIR}${DIR_EXTENSION}/${PROJECT_NAME}/cmake
PATH_VARS BIN_INSTALL_DIR INCLUDE_INSTALL_DIR LIB_INSTALL_DIR
INSTALL_DESTINATION ${DATA_INSTALL_DIR}/${PROJECT_NAME}/cmake
PATH_VARS BIN_INSTALL_DIR INCLUDE_INSTALL_DIR LIB_INSTALL_DIR DATA_INSTALL_DIR
)
install(FILES ${PROJECT_BINARY_DIR}/cmake/config/${PROJECT_NAME}Config.cmake
DESTINATION ${LIB_INSTALL_DIR}${DIR_EXTENSION}/${PROJECT_NAME}/cmake
DESTINATION ${DATA_INSTALL_DIR}/${PROJECT_NAME}/cmake
)
5 changes: 3 additions & 2 deletions cmake/packaging/Config.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@ set(@PROJECT_NAME@_VERSION @PROJECT_VERSION@)

@PACKAGE_INIT@

if(MSVC OR MSVC_IDE)
if((MSVC OR MSVC_IDE) AND EXISTS "@PACKAGE_BIN_INSTALL_DIR@")
set_and_check(@PROJECT_NAME@_BIN_DIR "@PACKAGE_BIN_INSTALL_DIR@")
endif()
set_and_check(@PROJECT_NAME@_INCLUDE_DIR "@PACKAGE_INCLUDE_INSTALL_DIR@")
set_and_check(@PROJECT_NAME@_LIB_DIR "@PACKAGE_LIB_INSTALL_DIR@")
set_and_check(@PROJECT_NAME@_DATA_DIR "@PACKAGE_DATA_INSTALL_DIR@")

include(${@PROJECT_NAME@_LIB_DIR}@DIR_EXTENSION@/@PROJECT_NAME@/cmake/@PROJECT_NAME@Targets.cmake)
include(${@PROJECT_NAME@_DATA_DIR}/@PROJECT_NAME@/cmake/@PROJECT_NAME@Targets.cmake)
Binary file modified docs/client_architecture.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions include/uxr/client/config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@

#cmakedefine PLATFORM_NAME_LINUX
#cmakedefine PLATFORM_NAME_WINDOWS
#cmakedefine PLATFORM_NAME_NUTTX

#define UXR_CONFIG_MAX_OUTPUT_BEST_EFFORT_STREAMS @CONFIG_MAX_OUTPUT_BEST_EFFORT_STREAMS@
#define UXR_CONFIG_MAX_OUTPUT_RELIABLE_STREAMS @CONFIG_MAX_OUTPUT_RELIABLE_STREAMS@
Expand All @@ -41,8 +42,14 @@
#define UXR_CONFIG_MIN_SESSION_CONNECTION_INTERVAL @CONFIG_MIN_SESSION_CONNECTION_INTERVAL@
#define UXR_CONFIG_MIN_HEARTBEAT_TIME_INTERVAL @CONFIG_MIN_HEARTBEAT_TIME_INTERVAL@

#ifdef PROFILE_UDP_TRANSPORT
#define UXR_CONFIG_UDP_TRANSPORT_MTU @CONFIG_UDP_TRANSPORT_MTU@
#endif
#ifdef PROFILE_TCP_TRANSPORT
#define UXR_CONFIG_TCP_TRANSPORT_MTU @CONFIG_TCP_TRANSPORT_MTU@
#endif
#ifdef PROFILE_SERIAL_TRANSPORT
#define UXR_CONFIG_SERIAL_TRANSPORT_MTU @CONFIG_SERIAL_TRANSPORT_MTU@
#endif

#endif // _UXR_CLIENT_CONFIG_H_
13 changes: 1 addition & 12 deletions include/uxr/client/profile/transport/serial/serial_transport.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,19 +43,8 @@ UXRDLLAPI bool uxr_init_serial_transport(uxrSerialTransport* transport,
const int fd,
uint8_t remote_addr,
uint8_t local_addr);
UXRDLLAPI bool uxr_close_serial_transport(uxrSerialTransport* transport);

bool uxr_init_serial_platform(struct uxrSerialPlatform* platform, const int fd, uint8_t remote_addr, uint8_t local_addr);
bool uxr_close_serial_platform(struct uxrSerialPlatform* platform);
size_t uxr_write_serial_data_platform(struct uxrSerialPlatform* platform,
uint8_t* buf,
size_t len,
uint8_t* errcode);
size_t uxr_read_serial_data_platform(struct uxrSerialPlatform* platform,
uint8_t* buf,
size_t len,
int timeout,
uint8_t* errcode);
UXRDLLAPI bool uxr_close_serial_transport(uxrSerialTransport* transport);

#ifdef __cplusplus
}
Expand Down
14 changes: 1 addition & 13 deletions include/uxr/client/profile/transport/tcp/tcp_transport.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,20 +57,8 @@ UXRDLLAPI bool uxr_init_tcp_transport(uxrTCPTransport* transport,
struct uxrTCPPlatform* platform,
const char* ip,
uint16_t port);
UXRDLLAPI bool uxr_close_tcp_transport(uxrTCPTransport* transport);

bool uxr_init_tcp_platform(struct uxrTCPPlatform* platform, const char* ip, uint16_t port);
bool uxr_close_tcp_platform(struct uxrTCPPlatform* platform);
size_t uxr_write_tcp_data_platform(struct uxrTCPPlatform* platform,
const uint8_t* buf,
size_t len,
uint8_t* errcode);
size_t uxr_read_tcp_data_platform(struct uxrTCPPlatform* platform,
uint8_t* buf,
size_t len,
int timeout,
uint8_t* errcode);
void uxr_disconnect_tcp_platform(struct uxrTCPPlatform* platform);
UXRDLLAPI bool uxr_close_tcp_transport(uxrTCPTransport* transport);

#ifdef __cplusplus
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ extern "C"
{
#endif

#include <sys/types.h>
#include <sys/socket.h>
#include <poll.h>

Expand Down
12 changes: 1 addition & 11 deletions include/uxr/client/profile/transport/udp/udp_transport.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,19 +38,9 @@ UXRDLLAPI bool uxr_init_udp_transport(uxrUDPTransport* transport,
struct uxrUDPPlatform* platform,
const char* ip,
uint16_t port);

UXRDLLAPI bool uxr_close_udp_transport(uxrUDPTransport* transport);

bool uxr_init_udp_platform(struct uxrUDPPlatform* platform, const char* ip, uint16_t port);
bool uxr_close_udp_platform(struct uxrUDPPlatform* platform);
size_t uxr_write_udp_data_platform(struct uxrUDPPlatform* platform,
const uint8_t* buf,
size_t len,
uint8_t* errcode);
size_t uxr_read_udp_data_platform(struct uxrUDPPlatform* platform,
uint8_t* buf,
size_t len,
int timeout,
uint8_t* errcode);

#ifdef __cplusplus
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ extern "C"
{
#endif

#include <netinet/in.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <poll.h>

typedef struct uxrUDPPlatform
Expand Down
1 change: 0 additions & 1 deletion include/uxr/client/transport.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
#if defined(PLATFORM_NAME_LINUX)
#include <uxr/client/profile/transport/serial/serial_transport_linux.h>
#elif defined(PLATFORM_NAME_WINDOWS)
#include <uxr/client/profile/transport/serial/serial_transport_windows.h>
#elif defined(PLATFORM_NAME_NUTTX)
#include <uxr/client/profile/transport/serial/serial_transport_linux.h>
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,10 @@ extern "C"
#include <stdbool.h>

#if defined(PLATFORM_NAME_LINUX)
#include <sys/types.h>
#include <sys/socket.h>
#include <poll.h>
#elif define(PLATFORM_NAME_WINDOWS)
#elif defined(PLATFORM_NAME_WINDOWS)
#endif


Expand All @@ -41,7 +42,7 @@ typedef struct uxrUDPTransportDatagram
#if defined(PLATFORM_NAME_LINUX)
uint8_t buffer[UXR_UDP_TRANSPORT_MTU_DATAGRAM];
struct pollfd poll_fd;
#elif define(PLATFORM_NAME_WINDOWS)
#elif defined(PLATFORM_NAME_WINDOWS)
#error "Windows platform not implemented"
#endif

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#include "udp_transport_datagram_internal.h"

#include <sys/types.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <unistd.h>
#include <errno.h>
Expand Down
2 changes: 1 addition & 1 deletion src/c/profile/transport/serial/serial_transport.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <uxr/client/profile/transport/serial/serial_transport.h>
#include "serial_transport_internal.h"
#include <uxr/client/core/communication/serial_protocol.h>
#include <uxr/client/util/time.h>

Expand Down
43 changes: 43 additions & 0 deletions src/c/profile/transport/serial/serial_transport_internal.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// Copyright 2018 Proyectos y Sistemas de Mantenimiento SL (eProsima).
//
// Licensed 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.

#ifndef _SRC_C_PROFILE_TRANSPORT_SERIAL_SERIAL_TRANSPORT_INTERNAL_H_
#define _SRC_C_PROFILE_TRANSPORT_SERIAL_SERIAL_TRANSPORT_INTERNAL_H_

#ifdef __cplusplus
extern "C"
{
#endif

#include <uxr/client/profile/transport/serial/serial_transport.h>

bool uxr_init_serial_platform(struct uxrSerialPlatform* platform, const int fd, uint8_t remote_addr, uint8_t local_addr);
bool uxr_close_serial_platform(struct uxrSerialPlatform* platform);

size_t uxr_write_serial_data_platform(struct uxrSerialPlatform* platform,
uint8_t* buf,
size_t len,
uint8_t* errcode);

size_t uxr_read_serial_data_platform(struct uxrSerialPlatform* platform,
uint8_t* buf,
size_t len,
int timeout,
uint8_t* errcode);

#ifdef __cplusplus
}
#endif

#endif //_SRC_C_PROFILE_TRANSPORT_SERIAL_SERIAL_TRANSPORT_INTERNAL_H_
2 changes: 1 addition & 1 deletion src/c/profile/transport/serial/serial_transport_linux.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <uxr/client/profile/transport/serial/serial_transport_linux.h>
#include <uxr/client/profile/transport/serial/serial_transport.h>
#include "serial_transport_internal.h"

#include <unistd.h>
#include <errno.h>
Expand Down
1 change: 1 addition & 0 deletions src/c/profile/transport/serial/serial_transport_windows.c
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
#include <uxr/client/profile/transport/serial/serial_transport_windows.h>
#include "serial_transport_internal.h"
2 changes: 1 addition & 1 deletion src/c/profile/transport/tcp/tcp_transport.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <uxr/client/profile/transport/tcp/tcp_transport.h>
#include "tcp_transport_internal.h"
#include <uxr/client/util/time.h>

/*******************************************************************************
Expand Down
Loading

0 comments on commit fa43d8e

Please sign in to comment.