4
Fork 0
This commit is contained in:
R3ABM Artem 2016-07-08 17:40:13 +04:00
parent 4ea54ae61a
commit 43ac499136
2 changed files with 7 additions and 6 deletions

View file

@ -597,15 +597,15 @@ int main(int argc, const char* argv[])
uint8_t* buffer = (uint8_t*)outgoingBuffer->data;
size_t length = recvfrom(mediaHandle, buffer, BUFFER_SIZE, 0, (struct sockaddr*)&address, &size);
if ((size == sizeof(struct sockaddr_in)) &&
if ((size == sizeof(struct sockaddr_in)) &&
(address.sin_addr.s_addr == repeaterSocketAddress.sin_addr.s_addr) &&
(length >= KAIROS_EXCHANGE_HEADER_LENGTH) &&
(le32toh(*(uint32_t*)buffer) == KAIROS_HAM_RECORD_ID))
{
uint16_t number = ++ sequenceNumbers[buffer[8] & 3];
int value = buffer[8] & 3;
outgoingBuffer->type = htole16(REWIND_TYPE_EXTERNAL_SERVER);
outgoingBuffer->flags = htole16(buffer[8] < 4);
outgoingBuffer->number = htole32(number);
outgoingBuffer->flags = htole16(value);
outgoingBuffer->number = htole32(++ sequenceNumbers[value]);
outgoingBuffer->length = htole16(length);
length += sizeof(struct RewindData);
sendto(uplinkHandle, outgoingBuffer, length, 0, serverAddress->ai_addr, serverAddress->ai_addrlen);
@ -686,7 +686,7 @@ int main(int argc, const char* argv[])
uint8_t* buffer = (uint8_t*)outgoingBuffer->data;
size_t length = recvfrom(trapHandle, buffer, BUFFER_SIZE, 0, (struct sockaddr*)&address, &size);
if ((size == sizeof(struct sockaddr_in)) &&
if ((size == sizeof(struct sockaddr_in)) &&
(address.sin_addr.s_addr == repeaterSocketAddress.sin_addr.s_addr) &&
(buffer[0] == (ASN_UNIVERSAL | ASN_CONSTRUCTOR | ASN_SEQUENCE)) &&
(length >= 20))

View file

@ -36,7 +36,8 @@ extern "C"
#define REWIND_TYPE_REMOTE_CONTROL (REWIND_CLASS_KAIROS_DATA + 1)
#define REWIND_TYPE_SNMP_TRAP (REWIND_CLASS_KAIROS_DATA + 2)
#define REWIND_FLAG_REAL_TIME (1 << 0)
#define REWIND_FLAG_SLOT_1 (1 << 0)
#define REWIND_FLAG_SLOT_2 (1 << 1)
struct RewindVersionData
{