|
|
@ -502,12 +502,6 @@ GoosePublisher_publish(GoosePublisher self, LinkedList dataSet)
|
|
|
|
|
|
|
|
|
|
|
|
if (self->l2Security)
|
|
|
|
if (self->l2Security)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
/* calculate crc */
|
|
|
|
|
|
|
|
uint16_t crc = L2Security_calculateCRC16(self->buffer + self->gooseStart, 8);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
self->buffer[self->gooseStart + 8] = (uint8_t)(crc / 0x100);
|
|
|
|
|
|
|
|
self->buffer[self->gooseStart + 9] = (uint8_t)(crc % 0x100);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* add security extension */
|
|
|
|
/* add security extension */
|
|
|
|
secExtLength = L2Security_addSecurityExtension(self->l2Security, self->buffer,
|
|
|
|
secExtLength = L2Security_addSecurityExtension(self->l2Security, self->buffer,
|
|
|
|
self->gooseStart, self->payloadStart + self->payloadLength - self->gooseStart, GOOSE_MAX_MESSAGE_SIZE);
|
|
|
|
self->gooseStart, self->payloadStart + self->payloadLength - self->gooseStart, GOOSE_MAX_MESSAGE_SIZE);
|
|
|
@ -517,6 +511,12 @@ GoosePublisher_publish(GoosePublisher self, LinkedList dataSet)
|
|
|
|
self->buffer[self->gooseStart + 6] = (uint8_t)((secExtLength >> 8) & 0x0f);
|
|
|
|
self->buffer[self->gooseStart + 6] = (uint8_t)((secExtLength >> 8) & 0x0f);
|
|
|
|
self->buffer[self->gooseStart + 7] = (uint8_t)(secExtLength & 0xff);
|
|
|
|
self->buffer[self->gooseStart + 7] = (uint8_t)(secExtLength & 0xff);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* calculate crc */
|
|
|
|
|
|
|
|
uint16_t crc = L2Security_calculateCRC16(self->buffer + self->gooseStart, 8);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
self->buffer[self->gooseStart + 8] = (uint8_t)(crc / 0x100);
|
|
|
|
|
|
|
|
self->buffer[self->gooseStart + 9] = (uint8_t)(crc % 0x100);
|
|
|
|
|
|
|
|
|
|
|
|
printf("reserved1: %02x %02x\n", self->buffer[self->gooseStart + 6], self->buffer[self->gooseStart + 7]);
|
|
|
|
printf("reserved1: %02x %02x\n", self->buffer[self->gooseStart + 6], self->buffer[self->gooseStart + 7]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|