|
|
@ -85,7 +85,7 @@ struct sSVPublisher {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static bool
|
|
|
|
static bool
|
|
|
|
preparePacketBuffer(SVPublisher self, CommParameters* parameters, const char* interfaceId)
|
|
|
|
preparePacketBuffer(SVPublisher self, CommParameters* parameters, const char* interfaceId, bool useVlanTags)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
uint8_t defaultDstAddr[] = CONFIG_SV_DEFAULT_DST_ADDRESS;
|
|
|
|
uint8_t defaultDstAddr[] = CONFIG_SV_DEFAULT_DST_ADDRESS;
|
|
|
|
|
|
|
|
|
|
|
@ -134,6 +134,7 @@ preparePacketBuffer(SVPublisher self, CommParameters* parameters, const char* in
|
|
|
|
|
|
|
|
|
|
|
|
int bufPos = 12;
|
|
|
|
int bufPos = 12;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (useVlanTags) {
|
|
|
|
/* Priority tag - IEEE 802.1Q */
|
|
|
|
/* Priority tag - IEEE 802.1Q */
|
|
|
|
self->buffer[bufPos++] = 0x81;
|
|
|
|
self->buffer[bufPos++] = 0x81;
|
|
|
|
self->buffer[bufPos++] = 0x00;
|
|
|
|
self->buffer[bufPos++] = 0x00;
|
|
|
@ -145,6 +146,7 @@ preparePacketBuffer(SVPublisher self, CommParameters* parameters, const char* in
|
|
|
|
|
|
|
|
|
|
|
|
self->buffer[bufPos++] = tci1; /* Priority + VLAN-ID */
|
|
|
|
self->buffer[bufPos++] = tci1; /* Priority + VLAN-ID */
|
|
|
|
self->buffer[bufPos++] = tci2; /* VLAN-ID */
|
|
|
|
self->buffer[bufPos++] = tci2; /* VLAN-ID */
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* EtherType Sampled Values */
|
|
|
|
/* EtherType Sampled Values */
|
|
|
|
self->buffer[bufPos++] = 0x88;
|
|
|
|
self->buffer[bufPos++] = 0x88;
|
|
|
@ -293,14 +295,14 @@ encodeUtcTime(uint64_t timeval, uint8_t* buffer, int bufPos)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
SVPublisher
|
|
|
|
SVPublisher
|
|
|
|
SVPublisher_create(CommParameters* parameters, const char* interfaceId)
|
|
|
|
SVPublisher_createEx(CommParameters* parameters, const char* interfaceId, bool useVlanTag)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
SVPublisher self = (SVPublisher) GLOBAL_CALLOC(1, sizeof(struct sSVPublisher));
|
|
|
|
SVPublisher self = (SVPublisher) GLOBAL_CALLOC(1, sizeof(struct sSVPublisher));
|
|
|
|
|
|
|
|
|
|
|
|
if (self) {
|
|
|
|
if (self) {
|
|
|
|
self->asduList = NULL;
|
|
|
|
self->asduList = NULL;
|
|
|
|
|
|
|
|
|
|
|
|
if (preparePacketBuffer(self, parameters, interfaceId) == false) {
|
|
|
|
if (preparePacketBuffer(self, parameters, interfaceId, useVlanTag) == false) {
|
|
|
|
GLOBAL_FREEMEM(self);
|
|
|
|
GLOBAL_FREEMEM(self);
|
|
|
|
self = NULL;
|
|
|
|
self = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -310,6 +312,12 @@ SVPublisher_create(CommParameters* parameters, const char* interfaceId)
|
|
|
|
return self;
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SVPublisher
|
|
|
|
|
|
|
|
SVPublisher_create(CommParameters* parameters, const char* interfaceId)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return SVPublisher_createEx(parameters, interfaceId, true);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
SVPublisher_ASDU
|
|
|
|
SVPublisher_ASDU
|
|
|
|
SVPublisher_addASDU(SVPublisher self, const char* svID, const char* datset, uint32_t confRev)
|
|
|
|
SVPublisher_addASDU(SVPublisher self, const char* svID, const char* datset, uint32_t confRev)
|
|
|
|
{
|
|
|
|
{
|
|
|
|