Kaynağa Gözat

Starts to simplifiy AssebleLinearMessage. Changes constant names to
reflect names in Ethernet/IP Specification

capxilinx 10 yıl önce
ebeveyn
işleme
78dc7654aa

+ 21 - 8
source/src/cip/cipconnectionmanager.c

@@ -201,11 +201,11 @@ EipStatus HandleReceivedConnectedData(EipUint8 *data, int data_length,
   } else {
     /* check if connected address item or sequenced address item  received, otherwise it is no connected message and should not be here */
     if ((g_common_packet_format_data_item.address_item.type_id
-        == kCipItemIdConnectionBased)
+        == kCipItemIdConnectionAddress)
         || (g_common_packet_format_data_item.address_item.type_id
             == kCipItemIdSequencedAddressItem)) { /* found connected address item or found sequenced address item -> for now the sequence number will be ignored */
       if (g_common_packet_format_data_item.data_item.type_id
-          == kCipItemIdConnectedTransportPacket) { /* connected data item received */
+          == kCipItemIdConnectedDataItem) { /* connected data item received */
 
         ConnectionObject *connection_object = GetConnectedObject(
             g_common_packet_format_data_item.address_item.data
@@ -612,9 +612,9 @@ EipStatus AssembleForwardOpenResponse(
   EipByte *message = message_router_response->data;
   cip_common_packet_format_data->item_count = 2;
   cip_common_packet_format_data->data_item.type_id =
-      kCipItemIdUnconnectedMessage;
-  cip_common_packet_format_data->address_item.type_id = kCipItemIdNullAddress;
-  cip_common_packet_format_data->address_item.length = 0;
+      kCipItemIdUnconnectedDataItem;
+
+  AddNullAddressItem(cip_common_packet_format_data);
 
   message_router_response->reply_service = (0x80 | kForwardOpen);
   message_router_response->general_status = general_status;
@@ -695,6 +695,19 @@ EipStatus AssembleForwardOpenResponse(
   return kEipStatusOkSend; /* send reply */
 }
 
+/**
+ * Adds a Null Address Item to the common data packet format data
+ * @param common_data_packet_format_data The CPF data packet where the Null Address Item shall be added
+ */
+void AddNullAddressItem(
+    CipCommonPacketFormatData* common_data_packet_format_data) {
+  /* Precondition: Null Address Item only valid in unconnected messages */
+  assert(common_data_packet_format_data->data_item.type_id == kCipItemIdUnconnectedDataItem);
+
+  common_data_packet_format_data->address_item.type_id = kCipItemIdNullAddress;
+  common_data_packet_format_data->address_item.length = 0;
+}
+
 /*   INT8 assembleFWDCloseResponse(UINT16 pa_ConnectionSerialNr, UINT16 pa_OriginatorVendorID, UINT32 pa_OriginatorSerialNr, S_CIP_MR_Request *pa_MRRequest, S_CIP_MR_Response *pa_MRResponse, S_CIP_CPF_Data *pa_CPF_data, INT8 pa_status, INT8 *pa_msg)
  *   create FWDClose response dependent on status.
  *      pa_ConnectionSerialNr	requested ConnectionSerialNr
@@ -722,9 +735,9 @@ EipStatus AssembleForwardCloseResponse(
   EipByte *message = message_router_response->data;
   common_data_packet_format_data->item_count = 2;
   common_data_packet_format_data->data_item.type_id =
-      kCipItemIdUnconnectedMessage;
-  common_data_packet_format_data->address_item.type_id = kCipItemIdNullAddress;
-  common_data_packet_format_data->address_item.length = 0;
+      kCipItemIdUnconnectedDataItem;
+
+  AddNullAddressItem(common_data_packet_format_data);
 
   AddIntToMessage(connection_serial_number, &message);
   AddIntToMessage(originatior_vendor_id, &message);

+ 2 - 2
source/src/cip/cipioconnection.c

@@ -621,14 +621,14 @@ EipStatus SendConnectedData(ConnectionObject *connection_object) {
     common_packet_format_data->address_item.data.sequence_number =
         connection_object->eip_level_sequence_count_producing;
   } else {
-    common_packet_format_data->address_item.type_id = kCipItemIdConnectionBased;
+    common_packet_format_data->address_item.type_id = kCipItemIdConnectionAddress;
     common_packet_format_data->address_item.length = 4;
 
   }
   common_packet_format_data->address_item.data.connection_identifier =
       connection_object->produced_connection_id;
 
-  common_packet_format_data->data_item.type_id = kCipItemIdConnectedTransportPacket;
+  common_packet_format_data->data_item.type_id = kCipItemIdConnectedDataItem;
 
   CipByteArray *producing_instance_attributes =
       (CipByteArray *) connection_object->producing_instance->attributes->data;

+ 175 - 58
source/src/enet_encap/cpf.c

@@ -32,7 +32,7 @@ int NotifyCommonPacketFormat(EncapsulationData *receive_data,
         == kCipItemIdNullAddress) /* check if NullAddressItem received, otherwise it is no unconnected message and should not be here*/
         { /* found null address item*/
       if (g_common_packet_format_data_item.data_item.type_id
-          == kCipItemIdUnconnectedMessage) { /* unconnected data item received*/
+          == kCipItemIdUnconnectedDataItem) { /* unconnected data item received*/
         return_value = NotifyMR(
             g_common_packet_format_data_item.data_item.data,
             g_common_packet_format_data_item.data_item.length);
@@ -68,7 +68,7 @@ int NotifyConnectedCommonPacketFormat(EncapsulationData *received_data,
   } else {
     return_value = kEipStatusError; /* For connected explicit messages status always has to be 0*/
     if (g_common_packet_format_data_item.address_item.type_id
-        == kCipItemIdConnectionBased) /* check if ConnectedAddressItem received, otherwise it is no connected message and should not be here*/
+        == kCipItemIdConnectionAddress) /* check if ConnectedAddressItem received, otherwise it is no connected message and should not be here*/
         { /* ConnectedAddressItem item */
       ConnectionObject *connection_object = GetConnectedObject(
           g_common_packet_format_data_item.address_item.data
@@ -81,7 +81,7 @@ int NotifyConnectedCommonPacketFormat(EncapsulationData *received_data,
 
         /*TODO check connection id  and sequence count    */
         if (g_common_packet_format_data_item.data_item.type_id
-            == kCipItemIdConnectedTransportPacket) { /* connected data item received*/
+            == kCipItemIdConnectedDataItem) { /* connected data item received*/
           EipUint8 *pnBuf = g_common_packet_format_data_item.data_item.data;
           g_common_packet_format_data_item.address_item.data.sequence_number =
               (EipUint32) GetIntFromMessage(&pnBuf);
@@ -201,9 +201,134 @@ EipStatus CreateCommonPacketFormatStructure(
   }
 }
 
-/** @brief Copy data from message_router_response struct and common_packet_format_data_item into linear memory in pa_msg for transmission over in encapsulation.
+/* null address item -> address length set to 0 */
+/**
+ * Encodes a Null Address Item into the message frame
+ * @param message The message frame
+ * @param size The actual size of the message frame
+ *
+ * @return The new size of the message frame after encoding
+ */
+int EncodeNullAddressItem(EipUint8** message, int size) {
+  /* null address item -> address length set to 0 */
+  size += AddIntToMessage(kCipItemIdNullAddress, message);
+  size += AddIntToMessage(0, message);
+  return size;
+}
+
+/* connected data item -> address length set to 4 and copy ConnectionIdentifier */
+/**
+ * Encodes a Connected Address Item into the message frame
+ * @param message The message frame
+ * @param common_packet_format_data_item The Common Packet Format data structure from which the message is constructed
+ * @param size The actual size of the message frame
+ *
+ * @return The new size of the message frame after encoding
+ */
+int EncodeConnectedAddressItem(
+    EipUint8** message,
+    CipCommonPacketFormatData* common_packet_format_data_item, int size) {
+  /* connected data item -> address length set to 4 and copy ConnectionIdentifier */
+  size += AddIntToMessage(kCipItemIdConnectionAddress, message);
+  size += AddIntToMessage(4, message);
+  size += AddDintToMessage(
+      common_packet_format_data_item->address_item.data.connection_identifier,
+      message);
+  return size;
+}
+
+/* TODO: Add doxygen documentation */
+/* sequenced address item -> address length set to 8 and copy ConnectionIdentifier and SequenceNumber */
+/* sequence number????? */
+int EncodeSequencedAddressItem(
+    EipUint8** message,
+    CipCommonPacketFormatData* common_packet_format_data_item, int size) {
+  /* sequenced address item -> address length set to 8 and copy ConnectionIdentifier and SequenceNumber */
+  size += AddIntToMessage(kCipItemIdSequencedAddressItem, message);
+  size += AddIntToMessage(8, message);
+  size += AddDintToMessage(
+      common_packet_format_data_item->address_item.data.connection_identifier,
+      message);
+  size += AddDintToMessage(
+      common_packet_format_data_item->address_item.data.sequence_number,
+      message);
+  return size;
+}
+
+/**
+ * Adds the item count to the message frame
+ *
+ * @param common_packet_format_data_item The Common Packet Format data structure from which the message is constructed
+ * @param message The message frame
+ * @param size The actual size of the message frame
+ *
+ * @return The new size of the message frame after encoding
+ */
+int EncodeItemCount(CipCommonPacketFormatData* common_packet_format_data_item,
+                    EipUint8** message, int size) {
+  size += AddIntToMessage(common_packet_format_data_item->item_count, message); /* item count */
+  return size;
+}
+
+/**
+ * Adds the data item type to the message frame
+ *
+ * @param common_packet_format_data_item The Common Packet Format data structure from which the message is constructed
+ * @param message The message frame
+ * @param size The actual size of the message frame
+ *
+ * @return The new size of the message frame after encoding
+ */
+int EncodeDataItemType(
+    CipCommonPacketFormatData* common_packet_format_data_item,
+    EipUint8** message, int size) {
+  size += AddIntToMessage(common_packet_format_data_item->data_item.type_id,
+                          message);
+  return size;
+}
+
+/**
+ * Adds the data item section length to the message frame
+ *
+ * @param common_packet_format_data_item The Common Packet Format data structure from which the message is constructed
+ * @param message The message frame
+ * @param size The actual size of the message frame
+ *
+ * @return The new size of the message frame after encoding
+ */
+int EncodeDataItemLength(
+    CipCommonPacketFormatData* common_packet_format_data_item,
+    EipUint8** message, int size) {
+  size += AddIntToMessage(common_packet_format_data_item->data_item.length,
+                          message);
+  return size;
+}
+
+/**
+ * Adds the data items to the message frame
+ *
+ * @param common_packet_format_data_item The Common Packet Format data structure from which the message is constructed
+ * @param message The message frame
+ * @param size The actual size of the message frame
+ *
+ * @return The new size of the message frame after encoding
+ */
+int EncodeDataItemData(
+    CipCommonPacketFormatData* common_packet_format_data_item,
+    EipUint8* message, int size) {
+  for (int i = 0; i < common_packet_format_data_item->data_item.length; i++) {
+    *message = (EipUint8) *(common_packet_format_data_item->data_item.data + i);
+    message++;
+  }
+  size += (common_packet_format_data_item->data_item.length);
+  return size;
+}
+
+/** @brief Copy data from message_router_response struct and common_packet_format_data_item into linear memory in
+ * pa_msg for transmission over in encapsulation.
+ *
  * @param message_router_response	pointer to message router response which has to be aligned into linear memory.
- * @param common_packet_format_data_item	pointer to CPF structure which has to be aligned into linear memory.
+ * @param common_packet_format_data_item pointer to CPF structure which has to be aligned into linear memory.
  * @param message		pointer to linear memory.
  *  @return length of reply in message in bytes
  * 			-1 .. error
@@ -221,62 +346,56 @@ int AssembleLinearMessage(
     size += 6;
   }
 
-  AddIntToMessage(common_packet_format_data_item->item_count, &message); /* item count */
-  size += 2;
+  size = EncodeItemCount(common_packet_format_data_item, &message, size);
+
   /* process Address Item */
-  if (common_packet_format_data_item->address_item.type_id
-      == kCipItemIdNullAddress) { /* null address item -> address length set to 0 */
-    AddIntToMessage(kCipItemIdNullAddress, &message);
-    AddIntToMessage(0, &message);
-    size += 4;
-  }
-  if (common_packet_format_data_item->address_item.type_id
-      == kCipItemIdConnectionBased) { /* connected data item -> address length set to 4 and copy ConnectionIdentifier */
-    AddIntToMessage(kCipItemIdConnectionBased, &message);
-    AddIntToMessage(4, &message);
-    AddDintToMessage(
-        common_packet_format_data_item->address_item.data.connection_identifier,
-        &message);
-    size += 8;
-  }
-  /* sequence number????? */
-  if (common_packet_format_data_item->address_item.type_id
-      == kCipItemIdSequencedAddressItem) { /* sequenced address item -> address length set to 8 and copy ConnectionIdentifier and SequenceNumber */
-    AddIntToMessage(kCipItemIdSequencedAddressItem, &message);
-    AddIntToMessage(8, &message);
-    AddDintToMessage(
-        common_packet_format_data_item->address_item.data.connection_identifier,
-        &message);
-    AddDintToMessage(
-        common_packet_format_data_item->address_item.data.sequence_number,
-        &message);
-    size += 12;
+  switch (common_packet_format_data_item->address_item.type_id) {
+    case kCipItemIdNullAddress: {
+      size = EncodeNullAddressItem(&message, size);
+      break;
+    }
+    case kCipItemIdConnectionAddress: {
+      size = EncodeConnectedAddressItem(&message,
+                                        common_packet_format_data_item, size);
+      break;
+    }
+    case kCipItemIdSequencedAddressItem: {
+      size = EncodeSequencedAddressItem(&message,
+                                        common_packet_format_data_item, size);
+      break;
+    }
   }
 
   /* process Data Item */
   if ((common_packet_format_data_item->data_item.type_id
-      == kCipItemIdUnconnectedMessage)
+      == kCipItemIdUnconnectedDataItem)
       || (common_packet_format_data_item->data_item.type_id
-          == kCipItemIdConnectedTransportPacket)) {
+          == kCipItemIdConnectedDataItem)) {
+
     if (message_router_response) {
-      AddIntToMessage(common_packet_format_data_item->data_item.type_id,
-                      &message);
+      size += EncodeDataItemType(common_packet_format_data_item, &message,
+                                 size);
 
       if (common_packet_format_data_item->data_item.type_id
-          == kCipItemIdConnectedTransportPacket) {
+          == kCipItemIdConnectedDataItem) { /* Connected Item */
+        /* 2 bytes*/
         AddIntToMessage(
-            (EipUint16) (message_router_response->data_length + 4 + 2
+            (EipUint16) (message_router_response->data_length + 4 + 2 /* data length bytes + reply service (1 byte) +
+        reserved (1 byte) + general status (1 byte) + size of additional status (1 byte)*/
                 + (2 * message_router_response->size_of_additional_status)),
             &message);
+        size += 2;
 
+        /* 2 bytes*/
         AddIntToMessage(
             (EipUint16) g_common_packet_format_data_item.address_item.data
                 .sequence_number,
             &message);
+        size += 2;
 
-        size += (4 + message_router_response->data_length + 4 + 2
-            + (2 * message_router_response->size_of_additional_status));
-      } else {
+        size += (message_router_response->data_length + 4
+            + (2 * message_router_response->size_of_additional_status)); /* Two bytes per additional status*/
+      } else { /* Unconnected Item */
         AddIntToMessage(
             (EipUint16) (message_router_response->data_length + 4
                 + (2 * message_router_response->size_of_additional_status)),
@@ -286,13 +405,14 @@ int AssembleLinearMessage(
       }
 
       /* write message router response into linear memory */
-      *message = message_router_response->reply_service;
+      *message = message_router_response->reply_service;  // 1 byte
       message++;
-      *message = message_router_response->reserved; /* reserved = 0 */
+      *message = message_router_response->reserved; /* reserved = 0 -- 1 byte*/
       message++;
-      *message = message_router_response->general_status;
+      *message = message_router_response->general_status;  // 1 byte
       message++;
-      *message = message_router_response->size_of_additional_status;
+
+      *message = message_router_response->size_of_additional_status;  // 1 byte
       message++;
       for (int i = 0; i < message_router_response->size_of_additional_status;
           i++)
@@ -304,19 +424,16 @@ int AssembleLinearMessage(
         message++;
       }
     } else { /* connected IO Message to send */
-      AddIntToMessage(common_packet_format_data_item->data_item.type_id,
-                      &message);
-      AddIntToMessage(common_packet_format_data_item->data_item.length,
-                      &message);
-      for (int i = 0; i < common_packet_format_data_item->data_item.length;
-          i++) {
-        *message = (EipUint8) *(common_packet_format_data_item->data_item.data
-            + i);
-        message++;
-      }
-      size += (common_packet_format_data_item->data_item.length + 4);
+      size += EncodeDataItemType(common_packet_format_data_item, &message,
+                                 size);
+
+      size += EncodeDataItemLength(common_packet_format_data_item, &message,
+                                   size);
+
+      size += EncodeDataItemData(common_packet_format_data_item, message, size);
     }
   }
+
   /* process SockAddr Info Items */
   /* make sure first the O->T and then T->O appears on the wire.
    * EtherNet/IP specification doesn't demand it, but there are EIP

+ 3 - 3
source/src/enet_encap/cpf.h

@@ -24,9 +24,9 @@
 typedef enum {
   kCipItemIdNullAddress = 0x0000, /**< Type: Address; Indicates that encapsulation routing is not needed. */
   kCipItemIdListIdentityResponse = 0x000C,
-  kCipItemIdConnectionBased = 0x00A1, /**< Type: Address; Connection-based, used for connected messages */
-  kCipItemIdConnectedTransportPacket = 0x00B1, /**< Type: Data; Connected Transport packet */
-  kCipItemIdUnconnectedMessage = 0x00B2, /**< Type: Data; Unconnected message */
+  kCipItemIdConnectionAddress = 0x00A1, /**< Type: Address; Connection-based, used for connected messages, see Vol.2, p.42 */
+  kCipItemIdConnectedDataItem = 0x00B1, /**< Type: Data; Connected data item, see Vol.2, p.43 */
+  kCipItemIdUnconnectedDataItem = 0x00B2, /**< Type: Data; Unconnected message */
   kCipItemIdListServiceResponse = 0x0100,
   kCipItemIdSocketAddressInfoOriginatorToTarget = 0x8000, /**< Type: Data; Sockaddr info item originator to target */
   kCipItemIdSocketAddressInfoTargetToOriginator = 0x8001, /**< Type: Data; Sockaddr info item target to originator */

+ 1 - 0
source/src/enet_encap/encap.h

@@ -20,6 +20,7 @@
 
 #define ENCAPSULATION_HEADER_LENGTH	24
 
+/** @brief Ethernet/IP standard port */
 static const int kOpenerEthernetPort = 0xAF12;
 
 /** @brief definition of status codes in encapsulation protocol

+ 18 - 8
source/src/enet_encap/endianconv.c

@@ -44,12 +44,13 @@ EipUint32 GetDintFromMessage(EipUint8** buffer) {
  * @param data value to be written
  * @param buffer pointer where data should be written.
  */
-void AddIntToMessage(EipUint16 data, EipUint8 **buffer) {
+int AddIntToMessage(EipUint16 data, EipUint8 **buffer) {
   unsigned char *p = (unsigned char *) *buffer;
 
   p[0] = (unsigned char) data;
   p[1] = (unsigned char) (data >> 8);
   *buffer += 2;
+  return 2;
 }
 
 /**
@@ -57,7 +58,7 @@ void AddIntToMessage(EipUint16 data, EipUint8 **buffer) {
  * @param data value to be written
  * @param buffer pointer where data should be written.
  */
-void AddDintToMessage(EipUint32 data, EipUint8** buffer) {
+int AddDintToMessage(EipUint32 data, EipUint8** buffer) {
   unsigned char *p = (unsigned char *) *buffer;
 
   p[0] = (unsigned char) data;
@@ -65,6 +66,8 @@ void AddDintToMessage(EipUint32 data, EipUint8** buffer) {
   p[2] = (unsigned char) (data >> 16);
   p[3] = (unsigned char) (data >> 24);
   *buffer += 4;
+
+  return 4;
 }
 
 #ifdef OPENER_SUPPORT_64BIT_DATATYPES
@@ -94,7 +97,7 @@ EipUint64 GetLintFromMessage(EipUint8 **buffer) {
  * @param data value to be written
  * @param buffer pointer where data should be written.
  */
-void AddLintToMessage(EipUint64 data, EipUint8 **buffer) {
+int AddLintToMessage(EipUint64 data, EipUint8 **buffer) {
   EipUint8 *buffer_address = *buffer;
   buffer_address[0] = (EipUint8) (data >> 56) & 0xFF;
   buffer_address[1] = (EipUint8) (data >> 48) & 0xFF;
@@ -105,33 +108,40 @@ void AddLintToMessage(EipUint64 data, EipUint8 **buffer) {
   buffer_address[6] = (EipUint8) (data >> 8) & 0xFF;
   buffer_address[7] = (EipUint8) (data) & 0xFF;
   (*buffer) += 8;
+
+  return 8;
 }
 
 #endif
 
-void EncapsulateIpAddress(EipUint16 port, EipUint32 address,
+
+int EncapsulateIpAddress(EipUint16 port, EipUint32 address,
                                            EipByte *communication_buffer) {
+  int size = 0;
   if (kOpENerEndianessLittle == g_opener_platform_endianess) {
-    AddIntToMessage(htons(AF_INET), &communication_buffer);
-    AddIntToMessage(port, &communication_buffer);
-    AddDintToMessage(address, &communication_buffer);
+    size += AddIntToMessage(htons(AF_INET), &communication_buffer);
+    size += AddIntToMessage(port, &communication_buffer);
+    size += AddDintToMessage(address, &communication_buffer);
 
   } else {
     if (kOpENerEndianessBig == g_opener_platform_endianess) {
       communication_buffer[0] = (unsigned char) (AF_INET >> 8);
       communication_buffer[1] = (unsigned char) AF_INET;
       communication_buffer += 2;
+      size += 2;
 
       communication_buffer[0] = (unsigned char) (port >> 8);
       communication_buffer[1] = (unsigned char) port;
       communication_buffer += 2;
+      size += 2;
 
       communication_buffer[3] = (unsigned char) address;
       communication_buffer[2] = (unsigned char) (address >> 8);
       communication_buffer[1] = (unsigned char) (address >> 16);
       communication_buffer[0] = (unsigned char) (address >> 24);
+      size += 4;
     } else {
-      fprintf(stderr, "No endianess detected! Probably DetermineEndianess was not executed!");
+      fprintf(stderr, "No endianess detected! Probably the DetermineEndianess function was not executed!");
       exit (EXIT_FAILURE);
     }
   }

+ 16 - 4
source/src/enet_encap/endianconv.h

@@ -39,22 +39,34 @@ EipUint32 GetDintFromMessage(EipUint8 **buffer);
  * @brief Write an 16Bit integer to the network buffer.
  * @param data value to write
  * @param buffer pointer to the network buffer array. This pointer will be incremented by 2!
+ *
+ * @return Length in bytes of the encoded message
  */
-void AddIntToMessage(EipUint16 data, EipUint8 **buffer);
+int AddIntToMessage(EipUint16 data, EipUint8 **buffer);
 
 /** @ingroup ENCAP
  *
  * @brief Write an 32Bit integer to the network buffer.
  * @param data value to write
  * @param buffer pointer to the network buffer array. This pointer will be incremented by 4!
+ *
+ * @return Length in bytes of the encoded message
  */
-void AddDintToMessage(EipUint32 data, EipUint8 **buffer);
+int AddDintToMessage(EipUint32 data, EipUint8 **buffer);
 
 #ifdef OPENER_SUPPORT_64BIT_DATATYPES
 
 EipUint64 GetLintFromMessage(EipUint8 **buffer);
 
-void AddLintToMessage(EipUint64 pa_unData, EipUint8 **buffer);
+/** @ingroup ENCAP
+ *
+ * @brief Write an 64Bit integer to the network buffer.
+ * @param data value to write
+ * @param buffer pointer to the network buffer array. This pointer will be incremented by 8!
+ *
+ * @return Length in bytes of the encoded message
+ */
+int AddLintToMessage(EipUint64 pa_unData, EipUint8 **buffer);
 
 #endif
 
@@ -66,7 +78,7 @@ void AddLintToMessage(EipUint64 pa_unData, EipUint8 **buffer);
  * @param address IP address of the socket, has to be provided in big-endian
  * @param communcation_buffer The message buffer for sending the message
  */
-void EncapsulateIpAddress(EipUint16 port, EipUint32 address,
+int EncapsulateIpAddress(EipUint16 port, EipUint32 address,
                                            EipByte *communication_buffer);
 
 /** Identify if we are running on a big or little endian system and set

+ 2 - 0
source/src/opener_api.h

@@ -6,6 +6,8 @@
 #ifndef OPENER_OPENER_API_H_
 #define OPENER_OPENER_API_H_
 
+#include <assert.h>
+
 #include "typedefs.h"
 #include "ciptypes.h"
 #include "ciperror.h"

+ 1 - 0
source/tests/enet_encap/endianconvtest.cpp

@@ -84,6 +84,7 @@ TEST(EndianConversion, AddLintToMessage) {
 
   AddLintToMessage(value_to_add_to_message, &message_pointer);
 
+  /* Expected message from highest to lowest byte [30][52][09][84][0B][EF][2A][2D] */
   BYTES_EQUAL(0x2D, message[0]);
   BYTES_EQUAL(0x2A, message[1]);
   BYTES_EQUAL(0xEF, message[2]);