celix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [celix] abroekhuis commented on a change in pull request #172: Refactor TcpAdmin and add interfacing for VectorIoSerialisation
Date Wed, 01 Apr 2020 11:42:41 GMT
abroekhuis commented on a change in pull request #172: Refactor TcpAdmin and add interfacing
for VectorIoSerialisation
URL: https://github.com/apache/celix/pull/172#discussion_r401424069
 
 

 ##########
 File path: bundles/pubsub/pubsub_protocol_wire_v1/src/pubsub_wire_protocol_impl.c
 ##########
 @@ -65,19 +65,40 @@ celix_status_t pubsubProtocol_destroy(pubsub_protocol_wire_v1_t* protocol)
{
     return status;
 }
 
+celix_status_t pubsubProtocol_getHeaderSize(void* handle, size_t *length) {
+    *length = sizeof(int) * 5 + sizeof(short) * 2; // header + sync + version = 24
+
+    return CELIX_SUCCESS;
+}
+
+celix_status_t pubsubProtocol_getHeaderBufferSize(void* handle, size_t *length) {
+    return pubsubProtocol_getHeaderSize(handle, length);
+}
+
+celix_status_t pubsubProtocol_getSyncHeaderSize(void* handle,  size_t *length) {
+    *length = sizeof(int);
+    return CELIX_SUCCESS;
+}
+
 celix_status_t pubsubProtocol_getSyncHeader(void* handle, void *syncHeader) {
-    for (int i = 0; i < 5; ++i) {
-        ((char *) syncHeader)[i] = '\0';
-    }
     writeInt(syncHeader, 0, PROTOCOL_WIRE_SYNC);
-
     return CELIX_SUCCESS;
 }
 
+celix_status_t pubsubProtocol_isMessageSegmentationSupported(void* handle, bool *isSupported)
{
+    *isSupported = false;
+    return CELIX_SUCCESS;
+}
 celix_status_t pubsubProtocol_encodeHeader(void *handle, pubsub_protocol_message_t *message,
void **outBuffer, size_t *outLength) {
     celix_status_t status = CELIX_SUCCESS;
+    // Get HeaderSize
+    size_t headerSize = 0;
+    pubsubProtocol_getHeaderSize(handle, &headerSize);
 
 Review comment:
   What is the difference between headersize and headerbuffersize, I've read the doc at the
header, but don't quite get it.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message