celix-dev mailing list archives

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

 ##########
 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:
   I have added extra comment in the protocol header file. The header size is used by the
receiver to know how big the header is. The receiver needs to read the header with payload
size / metedata size to know how big the message is. For static end points (external systems
that don't use celix pubsub) we need to be able send / receive headerless message with only
a payload. Then header is part of the payload. This means that the headerbuffer is not used
because the header is part of the payload. For headerless data the user needs to create a
dedicated protocol service. TCPadmin is the only pubsub admin that can be used as a static
end point because together with the protocol admin it can define what's send over the line.
ZMQ does have internal headers send in front of the data for ZMQ protocol handling

----------------------------------------------------------------
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