Skip to content

Commit

Permalink
DDS-SECURITY 1.1 compliance (eProsima#275)
Browse files Browse the repository at this point in the history
* Refs eProsima#3453. Changed RTPS version and added new PIDs, crypto types and builtin endpoints flags and entityId's.

* Refs eProsima#3454. Parsing new protection kind values on governance parser.

* Refs eProsima#3456. Added EndpointSecurityAttributesMask to EndpointSecurityAttributes

* Refs eProsima#3456. Added PluginEndpointSecurityAttributes.

* Refs eProsima#3454. Setting EndpointSecurityAttributes depending on protection kind.

* Refs eProsima#3456. Added EndpointSecurityAttributes parameter to register_local_datawriter /register_local_datareader

* Refs eProsima#3457. Added ParticipantSecurityAttributesMask.

* Refs eProsima#3457. Added PluginParticipantSecurityAttributesMask.

* Refs eProsima#3454. Setting ParticipantSecurityAttributes depending on protection kind.

* Refs eProsima#3457. Added ParticipantSecurityAttributes parameter to register_local_participant

* Refs eProsima#3461. Sending and checking PID_PARTICIPANT_SECURITY_INFO on PDP.

* Refs eProsima#3461. Sending and checking PID_ENDPOINT_SECURITY_INFO on EDP.

* Refs eProsima#3465. Changed getKey method to pure virtual and added new optional parameter

* Refs eProsima#3465. Using protection flag on topics with key.

* Refs eProsima#3465. Changed getKey on some types.

* Refs eProsima#3465. Added force_md5 to generated pub sub types.

* Refs eProsima#3465. Changed getKey method in all examples and tests. Pending performance, memory and profiling and dynamic related due to conflicts.
Added preprocessor functionallity to check compatible generator api versions (GEN_API_VER), set manually at this moment.

* Refs eProsima#3466. Generated key on register_local_participant depends on rtps protection kind.

* Refs eProsima#3466. Remote participant specific key is only created when rtps origin authentication is specified.

* Refs eProsima#3466. Creating ReaderKeyMaterial depends on flag IS_SUBMESSAGE_ENCRYPTED

* Refs eProsima#3466. Remote writer specific key is only created when origin authentication is specified.

* Refs eProsima#3466. Removed transformation_kind from EntityKeyHandle. The one in the key material is used instead

* Refs eProsima#3466. Changed dds.sec.crypto.cryptotransformkind to dds.sec.crypto.keysize

* Refs eProsima#3466. Improve creation of transformation kind.

* Refs eProsima#3466. EntityKeyMaterial converted to sequence.

* Refs eProsima#3466. Fixed some default values.

* Refs eProsima#3466. Fixing some valgrind errors.

* Refs eProsima#3466. Fixed unitialized values.

* Refs eProsima#3466. Removed transformation_kind from ParticipantKeyHandle. The one in the key material is used instead

* Refs eProsima#3466. Two keys are created on register_local_datawriter when needed.

* Refs eProsima#3466. Setting all keys when needed on register_matched_remote_datareader

* Refs eProsima#3466. All key materials are exchanged.

* Refs eProsima#3466. Using correct keys for payload and submessage encryption / decryption

* Refs eProsima#3507. Fixed serialization of crypto tokens

* Refs eProsima#3466. Correct order when access plugin is not present

* Refs eProsima#3466. Fixed receiver specific mac key creation and mac generation

* Refs eProsima#3466. Fixing memory leak

* Refs eProsima#3461. Fixing default values on ReaderProxyData

* Refs eProsima#3466. Fixing preprocess_secure_submsg

* Refs eProsima#3466. Setting EndpointSecurityAttributes when there is not access_control.

* Refs eProsima#3466. Default values on mock xxxProxyData

* Refs eProsima#3466. Fixing sign-only transform

* Refs eProsima#3466. Fixing leaks when returning due to errors.

* Refs eProsima#3534. Fixed serialization of SecureDataBody

* Refs eProsima#3534. Fixed serialization of SecureDataTag

* Refs eProsima#3535. Set PluginEndpointAttributesMask for builtin secure endpoints

* Refs eProsima#3467. WLPListener ready to receive changes from different readers.

* Refs eProsima#3467. Added new secure WLP builtin flags to participant data.

* Refs eProsima#3467. Creating and matching new builtin endpoints.

* Refs eProsima#3536. Added RSA-2048 support. Allowing self-signed certificates.

* Refs eProsima#3467. Using the protected livelines writer when needed.

* Refs eProsima#3465. PubSubTypes of examples coming from TCP updated to new interface.

* Refs eProsima#3508. Adding relay_only output param to check_remote_datareader.

* Refs eProsima#3468. Fixed some interoperability issues.

* Refs eProsima#3468. Fix generation of Participant2ParticipantKxKeyMaterial

* Refs eProsima#3580. Fixing BuiltinParticipantVolatileMessageSecure

* Refs eProsima#3452. Use transform_kind constants for comparisons.

* Refs eProsima#3613. Fixing computation of session keys

* Refs eProsima#3580. Fixing lookup of keys on preprocess_secure_submsg

* Disable encryption of INFO_DST

* Setting flag is_liveliness_protected.

* Refs eProsima#3638. Fixing serialization of encrypted payload.

* Refs eProsima#3639. Fixed id_range parsing.

* Refs eProsima#3662. Handling more than one session per EntityKeyHandle

* Refs eProsima#3651. Adapting DynamicPubSubType to new TopicDataType interface

* Refs eProsima#3651. Fixed parsing of PID_TYPE_CONSISTENCY_ENFORCEMENT and matching of type identifier.

* Refs eProsima#3651. Adapting test PubSubTypes to new TopicDataType interface

* Refs eProsima#3671. Adapting PKIDH unit test

* Refs eProsima#3671. Adapting AESGCMGMAC unit test and fixing receiver specific mac calculations

* Refs eProsima#3673. Fixing PKIDH regression.

* Refs eProsima#3673. Fixing participant key exchange order.

* Refs eProsima#3673. Fixing parsing of protection_kind properties.

* Refs eProsima#3673. Fixed alignment of serialized payload.

* Refs eProsima#3688. Adapting changes after rebase on develop.

* Refs eProsima#3688. Fixing regression on StaticDiscovery blackbox test.

* Refs eProsima#3688. Addressing PR review.
  • Loading branch information
MiguelCompany authored and richiware committed Nov 8, 2018
1 parent 803863e commit 7247095
Show file tree
Hide file tree
Showing 122 changed files with 3,688 additions and 2,095 deletions.
4 changes: 2 additions & 2 deletions examples/C++/Benchmark/BenchmarkPubSubTypes.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,14 @@ void BenchMarkPubSubType::deleteData(void* data) {
delete((BenchMark*)data);
}

bool BenchMarkPubSubType::getKey(void *data, InstanceHandle_t* handle) {
bool BenchMarkPubSubType::getKey(void *data, InstanceHandle_t* handle, bool force_md5) {
if(!m_isGetKeyDefined)
return false;
BenchMark* p_type = (BenchMark*) data;
eprosima::fastcdr::FastBuffer fastbuffer((char*)m_keyBuffer,BenchMark::getKeyMaxCdrSerializedSize()); // Object that manages the raw buffer.
eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS); // Object that serializes the data.
p_type->serializeKey(ser);
if(BenchMark::getKeyMaxCdrSerializedSize()>16) {
if(force_md5 || BenchMark::getKeyMaxCdrSerializedSize()>16) {
m_md5.init();
m_md5.update(m_keyBuffer,(unsigned int)ser.getSerializedDataLength());
m_md5.finalize();
Expand Down
2 changes: 1 addition & 1 deletion examples/C++/Benchmark/BenchmarkPubSubTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class BenchMarkPubSubType : public eprosima::fastrtps::TopicDataType {
bool serialize(void *data, eprosima::fastrtps::rtps::SerializedPayload_t *payload);
bool deserialize(eprosima::fastrtps::rtps::SerializedPayload_t *payload, void *data);
std::function<uint32_t()> getSerializedSizeProvider(void* data);
bool getKey(void *data, eprosima::fastrtps::rtps::InstanceHandle_t *ihandle);
bool getKey(void *data, eprosima::fastrtps::rtps::InstanceHandle_t *ihandle, bool force_md5=false);
void* createData();
void deleteData(void * data);
MD5 m_md5;
Expand Down
4 changes: 2 additions & 2 deletions examples/C++/Benchmark/Benchmark_bigPubSubTypes.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,14 @@ void BenchMarkBigPubSubType::deleteData(void* data) {
delete((BenchMarkBig*)data);
}

bool BenchMarkBigPubSubType::getKey(void *data, InstanceHandle_t* handle) {
bool BenchMarkBigPubSubType::getKey(void *data, InstanceHandle_t* handle, bool force_md5) {
if(!m_isGetKeyDefined)
return false;
BenchMarkBig* p_type = (BenchMarkBig*) data;
eprosima::fastcdr::FastBuffer fastbuffer((char*)m_keyBuffer,BenchMarkBig::getKeyMaxCdrSerializedSize()); // Object that manages the raw buffer.
eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS); // Object that serializes the data.
p_type->serializeKey(ser);
if(BenchMarkBig::getKeyMaxCdrSerializedSize()>16) {
if(force_md5 || BenchMarkBig::getKeyMaxCdrSerializedSize()>16) {
m_md5.init();
m_md5.update(m_keyBuffer,(unsigned int)ser.getSerializedDataLength());
m_md5.finalize();
Expand Down
2 changes: 1 addition & 1 deletion examples/C++/Benchmark/Benchmark_bigPubSubTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class BenchMarkBigPubSubType : public eprosima::fastrtps::TopicDataType {
bool serialize(void *data, eprosima::fastrtps::rtps::SerializedPayload_t *payload);
bool deserialize(eprosima::fastrtps::rtps::SerializedPayload_t *payload, void *data);
std::function<uint32_t()> getSerializedSizeProvider(void* data);
bool getKey(void *data, eprosima::fastrtps::rtps::InstanceHandle_t *ihandle);
bool getKey(void *data, eprosima::fastrtps::rtps::InstanceHandle_t *ihandle, bool force_md5=false);
void* createData();
void deleteData(void * data);
MD5 m_md5;
Expand Down
4 changes: 2 additions & 2 deletions examples/C++/Benchmark/Benchmark_mediumPubSubTypes.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,14 @@ void BenchMarkMediumPubSubType::deleteData(void* data) {
delete((BenchMarkMedium*)data);
}

bool BenchMarkMediumPubSubType::getKey(void *data, InstanceHandle_t* handle) {
bool BenchMarkMediumPubSubType::getKey(void *data, InstanceHandle_t* handle, bool force_md5) {
if(!m_isGetKeyDefined)
return false;
BenchMarkMedium* p_type = (BenchMarkMedium*) data;
eprosima::fastcdr::FastBuffer fastbuffer((char*)m_keyBuffer,BenchMarkMedium::getKeyMaxCdrSerializedSize()); // Object that manages the raw buffer.
eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS); // Object that serializes the data.
p_type->serializeKey(ser);
if(BenchMarkMedium::getKeyMaxCdrSerializedSize()>16) {
if(force_md5 || BenchMarkMedium::getKeyMaxCdrSerializedSize()>16) {
m_md5.init();
m_md5.update(m_keyBuffer,(unsigned int)ser.getSerializedDataLength());
m_md5.finalize();
Expand Down
2 changes: 1 addition & 1 deletion examples/C++/Benchmark/Benchmark_mediumPubSubTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class BenchMarkMediumPubSubType : public eprosima::fastrtps::TopicDataType {
bool serialize(void *data, eprosima::fastrtps::rtps::SerializedPayload_t *payload);
bool deserialize(eprosima::fastrtps::rtps::SerializedPayload_t *payload, void *data);
std::function<uint32_t()> getSerializedSizeProvider(void* data);
bool getKey(void *data, eprosima::fastrtps::rtps::InstanceHandle_t *ihandle);
bool getKey(void *data, eprosima::fastrtps::rtps::InstanceHandle_t *ihandle, bool force_md5=false);
void* createData();
void deleteData(void * data);
MD5 m_md5;
Expand Down
4 changes: 2 additions & 2 deletions examples/C++/Benchmark/Benchmark_smallPubSubTypes.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,14 @@ void BenchMarkSmallPubSubType::deleteData(void* data) {
delete((BenchMarkSmall*)data);
}

bool BenchMarkSmallPubSubType::getKey(void *data, InstanceHandle_t* handle) {
bool BenchMarkSmallPubSubType::getKey(void *data, InstanceHandle_t* handle, bool force_md5) {
if(!m_isGetKeyDefined)
return false;
BenchMarkSmall* p_type = (BenchMarkSmall*) data;
eprosima::fastcdr::FastBuffer fastbuffer((char*)m_keyBuffer,BenchMarkSmall::getKeyMaxCdrSerializedSize()); // Object that manages the raw buffer.
eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS); // Object that serializes the data.
p_type->serializeKey(ser);
if(BenchMarkSmall::getKeyMaxCdrSerializedSize()>16) {
if(force_md5 || BenchMarkSmall::getKeyMaxCdrSerializedSize()>16) {
m_md5.init();
m_md5.update(m_keyBuffer,(unsigned int)ser.getSerializedDataLength());
m_md5.finalize();
Expand Down
2 changes: 1 addition & 1 deletion examples/C++/Benchmark/Benchmark_smallPubSubTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class BenchMarkSmallPubSubType : public eprosima::fastrtps::TopicDataType {
bool serialize(void *data, eprosima::fastrtps::rtps::SerializedPayload_t *payload);
bool deserialize(eprosima::fastrtps::rtps::SerializedPayload_t *payload, void *data);
std::function<uint32_t()> getSerializedSizeProvider(void* data);
bool getKey(void *data, eprosima::fastrtps::rtps::InstanceHandle_t *ihandle);
bool getKey(void *data, eprosima::fastrtps::rtps::InstanceHandle_t *ihandle, bool force_md5=false);
void* createData();
void deleteData(void * data);
MD5 m_md5;
Expand Down
3 changes: 3 additions & 0 deletions examples/C++/ClientServerTest/ClientServerTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ class OperationDataType:public eprosima::fastrtps::TopicDataType
bool serialize(void*data, eprosima::fastrtps::rtps::SerializedPayload_t* payload);
bool deserialize(eprosima::fastrtps::rtps::SerializedPayload_t* payload,void * data);
std::function<uint32_t()> getSerializedSizeProvider(void* data);
bool getKey(void*, eprosima::fastrtps::rtps::InstanceHandle_t*, bool) { return false; }

void* createData();
void deleteData(void* data);
};
Expand Down Expand Up @@ -93,6 +95,7 @@ class ResultDataType:public eprosima::fastrtps::TopicDataType
bool serialize(void*data, eprosima::fastrtps::rtps::SerializedPayload_t* payload);
bool deserialize(eprosima::fastrtps::rtps::SerializedPayload_t* payload,void * data);
std::function<uint32_t()> getSerializedSizeProvider(void* data);
bool getKey(void*, eprosima::fastrtps::rtps::InstanceHandle_t*, bool) { return false; }
void* createData();
void deleteData(void* data);
};
Expand Down
4 changes: 2 additions & 2 deletions examples/C++/Configurability/samplePubSubTypes.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,14 @@ void samplePubSubType::deleteData(void* data) {
delete((sample*)data);
}

bool samplePubSubType::getKey(void *data, InstanceHandle_t* handle) {
bool samplePubSubType::getKey(void *data, InstanceHandle_t* handle, bool force_md5) {
if(!m_isGetKeyDefined)
return false;
sample* p_type = (sample*) data;
eprosima::fastcdr::FastBuffer fastbuffer((char*)m_keyBuffer,sample::getKeyMaxCdrSerializedSize()); // Object that manages the raw buffer.
eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS); // Object that serializes the data.
p_type->serializeKey(ser);
if(sample::getKeyMaxCdrSerializedSize()>16) {
if(force_md5 || sample::getKeyMaxCdrSerializedSize()>16) {
m_md5.init();
m_md5.update(m_keyBuffer,(unsigned int)ser.getSerializedDataLength());
m_md5.finalize();
Expand Down
2 changes: 1 addition & 1 deletion examples/C++/Configurability/samplePubSubTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class samplePubSubType : public eprosima::fastrtps::TopicDataType {
bool serialize(void *data, eprosima::fastrtps::rtps::SerializedPayload_t *payload);
bool deserialize(eprosima::fastrtps::rtps::SerializedPayload_t *payload, void *data);
std::function<uint32_t()> getSerializedSizeProvider(void* data);
bool getKey(void *data, eprosima::fastrtps::rtps::InstanceHandle_t *ihandle);
bool getKey(void *data, eprosima::fastrtps::rtps::InstanceHandle_t *ihandle, bool force_md5);
void* createData();
void deleteData(void * data);
MD5 m_md5;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,14 @@ void HelloMsgPubSubType::deleteData(void* data) {
delete((HelloMsg*)data);
}

bool HelloMsgPubSubType::getKey(void *data, InstanceHandle_t* handle) {
bool HelloMsgPubSubType::getKey(void *data, InstanceHandle_t* handle, bool force_md5) {
if(!m_isGetKeyDefined)
return false;
HelloMsg* p_type = (HelloMsg*) data;
eprosima::fastcdr::FastBuffer fastbuffer((char*)m_keyBuffer,HelloMsg::getKeyMaxCdrSerializedSize()); // Object that manages the raw buffer.
eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS); // Object that serializes the data.
p_type->serializeKey(ser);
if(HelloMsg::getKeyMaxCdrSerializedSize()>16) {
if(force_md5 || HelloMsg::getKeyMaxCdrSerializedSize()>16) {
m_md5.init();
m_md5.update(m_keyBuffer,(unsigned int)ser.getSerializedDataLength());
m_md5.finalize();
Expand Down
4 changes: 2 additions & 2 deletions examples/C++/DeadlineQoSExample/deadlinepayloadPubSubTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

/*!
/*!
* @file deadlinepayloadPubSubTypes.h
* This header file contains the declaration of the serialization functions.
*
Expand Down Expand Up @@ -40,7 +40,7 @@ class HelloMsgPubSubType : public eprosima::fastrtps::TopicDataType {
bool serialize(void *data, eprosima::fastrtps::rtps::SerializedPayload_t *payload);
bool deserialize(eprosima::fastrtps::rtps::SerializedPayload_t *payload, void *data);
std::function<uint32_t()> getSerializedSizeProvider(void* data);
bool getKey(void *data, eprosima::fastrtps::rtps::InstanceHandle_t *ihandle);
bool getKey(void *data, eprosima::fastrtps::rtps::InstanceHandle_t *ihandle, bool force_md5);
void* createData();
void deleteData(void * data);
MD5 m_md5;
Expand Down
4 changes: 2 additions & 2 deletions examples/C++/Filtering/FilteringExamplePubSubTypes.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,14 @@ void FilteringExamplePubSubType::deleteData(void* data) {
delete((FilteringExample*)data);
}

bool FilteringExamplePubSubType::getKey(void *data, InstanceHandle_t* handle) {
bool FilteringExamplePubSubType::getKey(void *data, InstanceHandle_t* handle, bool force_md5) {
if(!m_isGetKeyDefined)
return false;
FilteringExample* p_type = (FilteringExample*) data;
eprosima::fastcdr::FastBuffer fastbuffer((char*)m_keyBuffer,FilteringExample::getKeyMaxCdrSerializedSize()); // Object that manages the raw buffer.
eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS); // Object that serializes the data.
p_type->serializeKey(ser);
if(FilteringExample::getKeyMaxCdrSerializedSize()>16) {
if(force_md5 || FilteringExample::getKeyMaxCdrSerializedSize()>16) {
m_md5.init();
m_md5.update(m_keyBuffer,(unsigned int)ser.getSerializedDataLength());
m_md5.finalize();
Expand Down
4 changes: 2 additions & 2 deletions examples/C++/Filtering/FilteringExamplePubSubTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

/*!
/*!
* @file FilteringExamplePubSubTypes.h
* This header file contains the declaration of the serialization functions.
*
Expand Down Expand Up @@ -42,7 +42,7 @@ class FilteringExamplePubSubType : public eprosima::fastrtps::TopicDataType {
bool serialize(void *data, eprosima::fastrtps::rtps::SerializedPayload_t *payload);
bool deserialize(eprosima::fastrtps::rtps::SerializedPayload_t *payload, void *data);
std::function<uint32_t()> getSerializedSizeProvider(void* data);
bool getKey(void *data, eprosima::fastrtps::rtps::InstanceHandle_t *ihandle);
bool getKey(void *data, eprosima::fastrtps::rtps::InstanceHandle_t *ihandle, bool force_md5);
void* createData();
void deleteData(void * data);
MD5 m_md5;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,14 @@ void FlowControlExamplePubSubType::deleteData(void* data) {
delete((FlowControlExample*)data);
}

bool FlowControlExamplePubSubType::getKey(void *data, InstanceHandle_t* handle) {
bool FlowControlExamplePubSubType::getKey(void *data, InstanceHandle_t* handle, bool force_md5) {
if(!m_isGetKeyDefined)
return false;
FlowControlExample* p_type = (FlowControlExample*) data;
eprosima::fastcdr::FastBuffer fastbuffer((char*)m_keyBuffer,FlowControlExample::getKeyMaxCdrSerializedSize()); // Object that manages the raw buffer.
eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS); // Object that serializes the data.
p_type->serializeKey(ser);
if(FlowControlExample::getKeyMaxCdrSerializedSize()>16) {
if(force_md5 || FlowControlExample::getKeyMaxCdrSerializedSize()>16) {
m_md5.init();
m_md5.update(m_keyBuffer,(unsigned int)ser.getSerializedDataLength());
m_md5.finalize();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class FlowControlExamplePubSubType : public eprosima::fastrtps::TopicDataType{
bool serialize(void *data, eprosima::fastrtps::rtps::SerializedPayload_t *payload);
bool deserialize(eprosima::fastrtps::rtps::SerializedPayload_t *payload, void *data);
std::function<uint32_t()> getSerializedSizeProvider(void* data);
bool getKey(void *data, eprosima::fastrtps::rtps::InstanceHandle_t *ihandle);
bool getKey(void *data, eprosima::fastrtps::rtps::InstanceHandle_t *ihandle, bool force_md5);
void* createData();
void deleteData(void * data);
MD5 m_md5;
Expand Down
4 changes: 2 additions & 2 deletions examples/C++/HelloWorldExample/HelloWorldPubSubTypes.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,14 @@ void HelloWorldPubSubType::deleteData(void* data) {
delete((HelloWorld*)data);
}

bool HelloWorldPubSubType::getKey(void *data, InstanceHandle_t* handle) {
bool HelloWorldPubSubType::getKey(void *data, InstanceHandle_t* handle, bool force_md5) {
if(!m_isGetKeyDefined)
return false;
HelloWorld* p_type = (HelloWorld*) data;
eprosima::fastcdr::FastBuffer fastbuffer((char*)m_keyBuffer,HelloWorld::getKeyMaxCdrSerializedSize()); // Object that manages the raw buffer.
eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS); // Object that serializes the data.
p_type->serializeKey(ser);
if(HelloWorld::getKeyMaxCdrSerializedSize()>16) {
if(force_md5 || HelloWorld::getKeyMaxCdrSerializedSize()>16) {
m_md5.init();
m_md5.update(m_keyBuffer,(unsigned int)ser.getSerializedDataLength());
m_md5.finalize();
Expand Down
4 changes: 2 additions & 2 deletions examples/C++/HelloWorldExample/HelloWorldPubSubTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

/*!
/*!
* @file HelloWorldPubSubTypes.h
* This header file contains the declaration of the serialization functions.
*
Expand Down Expand Up @@ -42,7 +42,7 @@ class HelloWorldPubSubType : public eprosima::fastrtps::TopicDataType {
bool serialize(void *data, eprosima::fastrtps::rtps::SerializedPayload_t *payload);
bool deserialize(eprosima::fastrtps::rtps::SerializedPayload_t *payload, void *data);
std::function<uint32_t()> getSerializedSizeProvider(void* data);
bool getKey(void *data, eprosima::fastrtps::rtps::InstanceHandle_t *ihandle);
bool getKey(void *data, eprosima::fastrtps::rtps::InstanceHandle_t *ihandle, bool force_md5);
void* createData();
void deleteData(void * data);
MD5 m_md5;
Expand Down
4 changes: 2 additions & 2 deletions examples/C++/HelloWorldExampleTCP/HelloWorldPubSubTypes.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,14 @@ void HelloWorldPubSubType::deleteData(void* data) {
delete((HelloWorld*)data);
}

bool HelloWorldPubSubType::getKey(void *data, InstanceHandle_t* handle) {
bool HelloWorldPubSubType::getKey(void *data, InstanceHandle_t* handle, bool force_md5) {
if(!m_isGetKeyDefined)
return false;
HelloWorld* p_type = (HelloWorld*) data;
eprosima::fastcdr::FastBuffer fastbuffer((char*)m_keyBuffer,HelloWorld::getKeyMaxCdrSerializedSize()); // Object that manages the raw buffer.
eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS); // Object that serializes the data.
p_type->serializeKey(ser);
if(HelloWorld::getKeyMaxCdrSerializedSize()>16) {
if(force_md5 || HelloWorld::getKeyMaxCdrSerializedSize()>16) {
m_md5.init();
m_md5.update(m_keyBuffer,(unsigned int)ser.getSerializedDataLength());
m_md5.finalize();
Expand Down
2 changes: 1 addition & 1 deletion examples/C++/HelloWorldExampleTCP/HelloWorldPubSubTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class HelloWorldPubSubType : public eprosima::fastrtps::TopicDataType {
bool serialize(void *data, eprosima::fastrtps::rtps::SerializedPayload_t *payload);
bool deserialize(eprosima::fastrtps::rtps::SerializedPayload_t *payload, void *data);
std::function<uint32_t()> getSerializedSizeProvider(void* data);
bool getKey(void *data, eprosima::fastrtps::rtps::InstanceHandle_t *ihandle);
bool getKey(void *data, eprosima::fastrtps::rtps::InstanceHandle_t *ihandle, bool force_md5=false);
void* createData();
void deleteData(void * data);
MD5 m_md5;
Expand Down
4 changes: 2 additions & 2 deletions examples/C++/HistoryKind/samplePubSubTypes.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,14 @@ void samplePubSubType::deleteData(void* data) {
delete((sample*)data);
}

bool samplePubSubType::getKey(void *data, InstanceHandle_t* handle) {
bool samplePubSubType::getKey(void *data, InstanceHandle_t* handle, bool force_md5) {
if(!m_isGetKeyDefined)
return false;
sample* p_type = (sample*) data;
eprosima::fastcdr::FastBuffer fastbuffer((char*)m_keyBuffer,sample::getKeyMaxCdrSerializedSize()); // Object that manages the raw buffer.
eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS); // Object that serializes the data.
p_type->serializeKey(ser);
if(sample::getKeyMaxCdrSerializedSize()>16) {
if(force_md5 || sample::getKeyMaxCdrSerializedSize()>16) {
m_md5.init();
m_md5.update(m_keyBuffer,(unsigned int)ser.getSerializedDataLength());
m_md5.finalize();
Expand Down
4 changes: 2 additions & 2 deletions examples/C++/HistoryKind/samplePubSubTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

/*!
/*!
* @file samplePubSubTypes.h
* This header file contains the declaration of the serialization functions.
*
Expand Down Expand Up @@ -40,7 +40,7 @@ class samplePubSubType : public eprosima::fastrtps::TopicDataType {
bool serialize(void *data, eprosima::fastrtps::rtps::SerializedPayload_t *payload);
bool deserialize(eprosima::fastrtps::rtps::SerializedPayload_t *payload, void *data);
std::function<uint32_t()> getSerializedSizeProvider(void* data);
bool getKey(void *data, eprosima::fastrtps::rtps::InstanceHandle_t *ihandle);
bool getKey(void *data, eprosima::fastrtps::rtps::InstanceHandle_t *ihandle, bool force_md5);
void* createData();
void deleteData(void * data);
MD5 m_md5;
Expand Down
4 changes: 2 additions & 2 deletions examples/C++/Keys/samplePubSubTypes.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,14 @@ void samplePubSubType::deleteData(void* data) {
delete((sample*)data);
}

bool samplePubSubType::getKey(void *data, InstanceHandle_t* handle) {
bool samplePubSubType::getKey(void *data, InstanceHandle_t* handle, bool force_md5) {
if(!m_isGetKeyDefined)
return false;
sample* p_type = (sample*) data;
eprosima::fastcdr::FastBuffer fastbuffer((char*)m_keyBuffer,sample::getKeyMaxCdrSerializedSize()); // Object that manages the raw buffer.
eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS); // Object that serializes the data.
p_type->serializeKey(ser);
if(sample::getKeyMaxCdrSerializedSize()>16) {
if(force_md5 || sample::getKeyMaxCdrSerializedSize()>16) {
m_md5.init();
m_md5.update(m_keyBuffer,(unsigned int)ser.getSerializedDataLength());
m_md5.finalize();
Expand Down
4 changes: 2 additions & 2 deletions examples/C++/Keys/samplePubSubTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

/*!
/*!
* @file samplePubSubTypes.h
* This header file contains the declaration of the serialization functions.
*
Expand Down Expand Up @@ -40,7 +40,7 @@ class samplePubSubType : public eprosima::fastrtps::TopicDataType {
bool serialize(void *data, eprosima::fastrtps::rtps::SerializedPayload_t *payload);
bool deserialize(eprosima::fastrtps::rtps::SerializedPayload_t *payload, void *data);
std::function<uint32_t()> getSerializedSizeProvider(void* data);
bool getKey(void *data, eprosima::fastrtps::rtps::InstanceHandle_t *ihandle);
bool getKey(void *data, eprosima::fastrtps::rtps::InstanceHandle_t *ihandle, bool force_md5);
void* createData();
void deleteData(void * data);
MD5 m_md5;
Expand Down
Loading

0 comments on commit 7247095

Please sign in to comment.