Skip to content

Commit

Permalink
vSomeIP 2.6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
juergengehring committed Feb 28, 2017
1 parent 07d7573 commit 199b12e
Show file tree
Hide file tree
Showing 74 changed files with 2,235 additions and 1,115 deletions.
9 changes: 9 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -276,3 +276,12 @@ v2.5.3
- Fixed initial events on unsubscription
- Improved dispatcher handling for blocking calls
- Crashed applications are now automatically unsubscribed

v2.6.0
- Fixed races and crashes
- Fixed repetition phase timings for find service messages
- Reworked internal event/field distribution to reduce CPU load
- Reworked internal routing info distribution leading to fewer and smaller
messages and lower CPU load
- Extend public application interface with second unsubscribe method with
additional event parameter
8 changes: 6 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ cmake_minimum_required (VERSION 2.8.12)
project (vsomeip)

set (VSOMEIP_MAJOR_VERSION 2)
set (VSOMEIP_MINOR_VERSION 5)
set (VSOMEIP_PATCH_VERSION 3)
set (VSOMEIP_MINOR_VERSION 6)
set (VSOMEIP_PATCH_VERSION 0)
set (VSOMEIP_VERSION ${VSOMEIP_MAJOR_VERSION}.${VSOMEIP_MINOR_VERSION}.${VSOMEIP_PATCH_VERSION})
set (PACKAGE_VERSION ${VSOMEIP_VERSION}) # Used in documentatin/doxygen.in
set (CMAKE_VERBOSE_MAKEFILE off)
Expand Down Expand Up @@ -200,6 +200,10 @@ set (VSOMEIP_ROUTING "vsomeipd")
if (ROUTING)
set (VSOMEIP_ROUTING ${ROUTING})
endif ()
set (VSOMEIP_ROUTING_READY_MESSAGE "SOME/IP routing ready.")
if (ROUTING_READY_MESSAGE)
set (VSOMEIP_ROUTING_READY_MESSAGE ${ROUTING_READY_MESSAGE})
endif ()
message("Predefined unicast address: ${VSOMEIP_UNICAST_ADDRESS}")
message("Predefined diagnosis address: ${VSOMEIP_DIAGNOSIS_ADDRESS}")
message("Predefined routing application: ${VSOMEIP_ROUTING}")
Expand Down
9 changes: 9 additions & 0 deletions documentation/vsomeipUserGuide
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,15 @@ cmake -DENABLE_SIGNAL_HANDLING=1 ..
In the default setting, the application has to take care of shutting
down vsomeip in case these signals are received.

Compilation with user defined "READY" message
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
To compile vsomeip with a user defined message signal the IP routing
to be ready to send/receive messages, call cmake like:
[source,bash]
----
cmake -DROUTING_READY_MESSAGE=<YOUR MESSAGE> ..
----

Compilation of examples
^^^^^^^^^^^^^^^^^^^^^^^
For compilation of the examples call:
Expand Down
17 changes: 13 additions & 4 deletions implementation/configuration/include/internal.hpp.in
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,10 @@
#define VSOMEIP_REQUEST_SERVICE_COMMAND_SIZE 17
#define VSOMEIP_RELEASE_SERVICE_COMMAND_SIZE 11
#define VSOMEIP_STOP_OFFER_SERVICE_COMMAND_SIZE 16
#define VSOMEIP_SUBSCRIBE_COMMAND_SIZE 16
#define VSOMEIP_SUBSCRIBE_ACK_COMMAND_SIZE 15
#define VSOMEIP_SUBSCRIBE_NACK_COMMAND_SIZE 15
#define VSOMEIP_UNSUBSCRIBE_COMMAND_SIZE 14
#define VSOMEIP_SUBSCRIBE_COMMAND_SIZE 18
#define VSOMEIP_SUBSCRIBE_ACK_COMMAND_SIZE 17
#define VSOMEIP_SUBSCRIBE_NACK_COMMAND_SIZE 17
#define VSOMEIP_UNSUBSCRIBE_COMMAND_SIZE 16
#define VSOMEIP_REGISTER_EVENT_COMMAND_SIZE 15
#define VSOMEIP_UNREGISTER_EVENT_COMMAND_SIZE 14
#define VSOMEIP_ID_RESPONSE_COMMAND_SIZE 12
Expand All @@ -115,8 +115,17 @@

#define VSOMEIP_MAX_CLIENTS 255

#define VSOMEIP_ROUTING_READY_MESSAGE "@VSOMEIP_ROUTING_READY_MESSAGE@"

namespace vsomeip {

typedef enum {
RIE_ADD_CLIENT = 0x0,
RIE_ADD_SERVICE_INSTANCE = 0x1,
RIE_DEL_SERVICE_INSTANCE = 0x2,
RIE_DEL_CLIENT = 0x3,
} routing_info_entry_e;

struct configuration_data_t {
#ifndef _WIN32
volatile char initialized_;
Expand Down
2 changes: 2 additions & 0 deletions implementation/endpoints/include/endpoint.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ class endpoint {
virtual void increment_use_count() = 0;
virtual void decrement_use_count() = 0;
virtual uint32_t get_use_count() = 0;

virtual void restart() = 0;
};

} // namespace vsomeip
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ class local_client_endpoint_impl: public local_client_endpoint_base_impl {

void register_error_handler(error_handler_t _error_handler);

void restart();

private:
void send_queued();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ class virtual_server_endpoint_impl : public endpoint {
void decrement_use_count();
uint32_t get_use_count();

void restart();

private:
std::string address_;
uint16_t port_;
Expand Down
25 changes: 12 additions & 13 deletions implementation/endpoints/src/local_client_endpoint_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,21 +43,16 @@ bool local_client_endpoint_impl::is_local() const {
return true;
}

void local_client_endpoint_impl::start() {
bool is_open(false);
void local_client_endpoint_impl::restart() {
{
std::lock_guard<std::mutex> its_lock(socket_mutex_);
is_open = socket_.is_open();
}
if (is_open) {
{
std::lock_guard<std::mutex> its_lock(mutex_);
sending_blocked_ = false;
}
restart();
} else {
connect();
std::lock_guard<std::mutex> its_lock(mutex_);
sending_blocked_ = false;
}
client_endpoint_impl::restart();
}

void local_client_endpoint_impl::start() {
connect();
}

void local_client_endpoint_impl::connect() {
Expand All @@ -69,6 +64,10 @@ void local_client_endpoint_impl::connect() {

if (!its_error || its_error == boost::asio::error::already_open) {
socket_.set_option(boost::asio::socket_base::reuse_address(true), its_error);
if (its_error) {
VSOMEIP_WARNING << "local_client_endpoint_impl::connect: "
<< "couldn't enable SO_REUSEADDR: " << its_error.message();
}
socket_.connect(remote_, its_connect_error);

// Credentials
Expand Down
17 changes: 15 additions & 2 deletions implementation/endpoints/src/tcp_client_endpoint_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,19 @@ void tcp_client_endpoint_impl::connect() {
if (!its_error || its_error == boost::asio::error::already_open) {
// Nagle algorithm off
socket_.set_option(ip::tcp::no_delay(true), its_error);
if (its_error) {
VSOMEIP_WARNING << "tcp_client_endpoint::connect: couldn't disable "
<< "Nagle algorithm: " << its_error.message();
}

// Enable SO_REUSEADDR to avoid bind problems with services going offline
// and coming online again and the user has specified only a small number
// of ports in the clients section for one service instance
socket_.set_option(boost::asio::socket_base::reuse_address(true), its_error);

if (its_error) {
VSOMEIP_WARNING << "tcp_client_endpoint::connect: couldn't enable "
<< "SO_REUSEADDR: " << its_error.message();
}
// In case a client endpoint port was configured,
// bind to it before connecting
if (local_.port() != ILLEGAL_PORT) {
Expand Down Expand Up @@ -178,7 +185,13 @@ unsigned short tcp_client_endpoint_impl::get_local_port() const {
std::lock_guard<std::mutex> its_lock(socket_mutex_);
boost::system::error_code its_error;
if (socket_.is_open()) {
return socket_.local_endpoint(its_error).port();
endpoint_type its_endpoint = socket_.local_endpoint(its_error);
if (!its_error) {
return its_endpoint.port();
} else {
VSOMEIP_WARNING << "tcp_client_endpoint_impl::get_local_port() "
<< " couldn't get local_endpoint: " << its_error.message();
}
}
return 0;
}
Expand Down
4 changes: 2 additions & 2 deletions implementation/endpoints/src/tcp_server_endpoint_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -298,8 +298,8 @@ void tcp_server_endpoint_impl::connection::send_queued(

void tcp_server_endpoint_impl::connection::send_magic_cookie(
message_buffer_ptr_t &_buffer) {
if (recv_buffer_size_initial_ == MESSAGE_SIZE_UNLIMITED
|| recv_buffer_size_initial_ - _buffer->size() >=
if (max_message_size_ == MESSAGE_SIZE_UNLIMITED
|| max_message_size_ - _buffer->size() >=
VSOMEIP_SOMEIP_HEADER_SIZE + VSOMEIP_SOMEIP_MAGIC_COOKIE_SIZE) {
_buffer->insert(_buffer->begin(), SERVICE_COOKIE,
SERVICE_COOKIE + sizeof(SERVICE_COOKIE));
Expand Down
8 changes: 7 additions & 1 deletion implementation/endpoints/src/udp_client_endpoint_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,13 @@ unsigned short udp_client_endpoint_impl::get_local_port() const {
std::lock_guard<std::mutex> its_lock(socket_mutex_);
boost::system::error_code its_error;
if (socket_.is_open()) {
return socket_.local_endpoint(its_error).port();
endpoint_type its_endpoint = socket_.local_endpoint(its_error);
if (!its_error) {
return its_endpoint.port();
} else {
VSOMEIP_WARNING << "udp_client_endpoint_impl::get_local_port() "
<< " couldn't get local_endpoint: " << its_error.message();
}
}
return 0;
}
Expand Down
4 changes: 4 additions & 0 deletions implementation/endpoints/src/virtual_server_endpoint_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,4 +109,8 @@ uint32_t virtual_server_endpoint_impl::get_use_count() {
return use_count_;
}

void virtual_server_endpoint_impl::restart() {

}

} // namespace vsomeip
7 changes: 4 additions & 3 deletions implementation/logging/src/dlt_sink_backend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,10 @@ BOOST_LOG_ATTRIBUTE_KEYWORD(severity, "Severity", logging::trivial::severity_lev

void dlt_sink_backend::consume(const logging::record_view &rec) {
#ifdef USE_DLT
std::string message = *rec[expressions::smessage];
logging::trivial::severity_level severity_level = *rec[severity];
DLT_LOG_STRING(dlt_, level_as_dlt(severity_level), message.c_str());
auto message = rec[expressions::smessage];
auto severity_level = rec[severity];
DLT_LOG_STRING(dlt_, (severity_level)?level_as_dlt(*severity_level):DLT_LOG_WARN,
(message)?message.get<std::string>().c_str():"consume() w/o message");
#else
(void)rec;
#endif
Expand Down
17 changes: 12 additions & 5 deletions implementation/routing/include/event.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,20 @@ class event: public std::enable_shared_from_this<event> {
// SIP_RPC_359 (epsilon change)
void set_epsilon_change_function(const epsilon_change_func_t &_epsilon_change_func);

const std::set<eventgroup_t> & get_eventgroups() const;
const std::set<eventgroup_t> get_eventgroups() const;
std::set<eventgroup_t> get_eventgroups(client_t _client) const;
void add_eventgroup(eventgroup_t _eventgroup);
void set_eventgroups(const std::set<eventgroup_t> &_eventgroups);

void notify_one(const std::shared_ptr<endpoint_definition> &_target, bool _flush);
void notify_one(client_t _client, bool _flush);

bool add_subscriber(eventgroup_t _eventgroup, client_t _client);
void remove_subscriber(eventgroup_t _eventgroup, client_t _client);
bool has_subscriber(eventgroup_t _eventgroup, client_t _client);
std::set<client_t> get_subscribers();
void clear_subscribers();

void add_ref(client_t _client, bool _is_provided);
void remove_ref(client_t _client, bool _is_provided);
bool has_ref();
Expand All @@ -96,6 +103,8 @@ class event: public std::enable_shared_from_this<event> {

bool has_ref(client_t _client, bool _is_provided);

std::set<client_t> get_subscribers(eventgroup_t _eventgroup);

private:
void update_cbk(boost::system::error_code const &_error);
void notify(bool _flush);
Expand All @@ -120,11 +129,10 @@ class event: public std::enable_shared_from_this<event> {
std::chrono::milliseconds cycle_;

std::atomic<bool> change_resets_cycle_;

std::atomic<bool> is_updating_on_change_;

std::mutex eventgroups_mutex_;
std::set<eventgroup_t> eventgroups_;
mutable std::mutex eventgroups_mutex_;
std::map<eventgroup_t, std::set<client_t>> eventgroups_;

std::atomic<bool> is_set_;
std::atomic<bool> is_provided_;
Expand All @@ -133,7 +141,6 @@ class event: public std::enable_shared_from_this<event> {
std::map<client_t, std::map<bool, uint32_t>> refs_;

std::atomic<bool> is_shadow_;

std::atomic<bool> is_cache_placeholder_;

epsilon_change_func_t epsilon_change_func_;
Expand Down
8 changes: 5 additions & 3 deletions implementation/routing/include/routing_manager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ class routing_manager {

virtual void subscribe(client_t _client, service_t _service,
instance_t _instance, eventgroup_t _eventgroup,
major_version_t _major,
major_version_t _major, event_t _event,
subscription_type_e _subscription_type) = 0;

virtual void unsubscribe(client_t _client, service_t _service,
instance_t _instance, eventgroup_t _eventgroup) = 0;
instance_t _instance, eventgroup_t _eventgroup, event_t _event) = 0;

virtual bool send(client_t _client, std::shared_ptr<message> _message,
bool _flush) = 0;
Expand All @@ -81,7 +81,7 @@ class routing_manager {
virtual void unregister_event(client_t _client, service_t _service,
instance_t _instance, event_t _event, bool _is_provided) = 0;

virtual std::shared_ptr<event> get_event(service_t _service,
virtual std::shared_ptr<event> find_event(service_t _service,
instance_t _instance, event_t _event) const = 0;

virtual std::set<std::shared_ptr<event>> find_events(service_t _service,
Expand All @@ -99,6 +99,8 @@ class routing_manager {
instance_t _instance, bool _reliable) = 0;

virtual void set_routing_state(routing_state_e _routing_state) = 0;


};

} // namespace vsomeip
Expand Down
Loading

0 comments on commit 199b12e

Please sign in to comment.