diff options
Diffstat (limited to 'lib/avtp_pipeline/rawsock')
-rw-r--r-- | lib/avtp_pipeline/rawsock/CMakeLists.txt | 1 | ||||
-rw-r--r-- | lib/avtp_pipeline/rawsock/openavb_rawsock.h | 2 | ||||
-rw-r--r-- | lib/avtp_pipeline/rawsock/rawsock_impl.c | 23 | ||||
-rw-r--r-- | lib/avtp_pipeline/rawsock/rawsock_impl.h | 1 |
4 files changed, 20 insertions, 7 deletions
diff --git a/lib/avtp_pipeline/rawsock/CMakeLists.txt b/lib/avtp_pipeline/rawsock/CMakeLists.txt index 561116ee..e3e0f49e 100644 --- a/lib/avtp_pipeline/rawsock/CMakeLists.txt +++ b/lib/avtp_pipeline/rawsock/CMakeLists.txt @@ -16,6 +16,7 @@ SET (SRC_FILES ${SRC_FILES} ${AVB_OSAL_DIR}/rawsock/openavb_rawsock.c ${AVB_OSAL_DIR}/rawsock/simple_rawsock.c ${AVB_OSAL_DIR}/rawsock/ring_rawsock.c + ${AVB_OSAL_DIR}/rawsock/sendmmsg_rawsock.c ${PCAP_FILES} ${IGB_FILES} PARENT_SCOPE diff --git a/lib/avtp_pipeline/rawsock/openavb_rawsock.h b/lib/avtp_pipeline/rawsock/openavb_rawsock.h index 156e3711..11eb2b69 100644 --- a/lib/avtp_pipeline/rawsock/openavb_rawsock.h +++ b/lib/avtp_pipeline/rawsock/openavb_rawsock.h @@ -1,5 +1,6 @@ /************************************************************************************************************* Copyright (c) 2012-2015, Symphony Teleca Corporation, a Harman International Industries, Incorporated company +Copyright (c) 2016-2017, Harman International Industries, Incorporated All rights reserved. Redistribution and use in source and binary forms, with or without @@ -61,6 +62,7 @@ typedef struct { bool vlan; // Include VLAN header? U8 vlan_pcp; // VLAN Priority Code Point U16 vlan_vid; // VLAN ID + struct timespec ts; // RX timestamp } hdr_info_t; diff --git a/lib/avtp_pipeline/rawsock/rawsock_impl.c b/lib/avtp_pipeline/rawsock/rawsock_impl.c index c9a4df53..8e4756be 100644 --- a/lib/avtp_pipeline/rawsock/rawsock_impl.c +++ b/lib/avtp_pipeline/rawsock/rawsock_impl.c @@ -1,5 +1,6 @@ /************************************************************************************************************* Copyright (c) 2012-2015, Symphony Teleca Corporation, a Harman International Industries, Incorporated company +Copyright (c) 2016-2017, Harman International Industries, Incorporated All rights reserved. Redistribution and use in source and binary forms, with or without @@ -35,16 +36,16 @@ https://github.com/benhoyt/inih/commit/74d2ca064fb293bc60a77b0bd068075b293cf175. #include "openavb_log.h" void baseRawsockSetRxSignalMode(void *rawsock, bool rxSignalMode) {} -int baseRawsockGetSocket(void *rawsock) { return -1; } -U8 *baseRawsockGetRxFrame(void *rawsock, U32 usecTimeout, U32 *offset, U32 *len) { return NULL; } +int baseRawsockGetSocket(void *rawsock) { AVB_LOG_ERROR("baseRawsockGetSocket called"); return -1; } +U8 *baseRawsockGetRxFrame(void *rawsock, U32 usecTimeout, U32 *offset, U32 *len) { AVB_LOG_ERROR("baseRawsockGetRxFrame called"); return NULL; } bool baseRawsockRelRxFrame(void *rawsock, U8 *pFrame) { return false; } bool baseRawsockRxMulticast(void *rawsock, bool add_membership, const U8 buf[]) { return false; } bool baseRawsockRxAVTPSubtype(void *rawsock, U8 subtype) { return false; } bool baseRawsockTxSetMark(void *rawsock, int prio) { return false; } -U8 *baseRawsockGetTxFrame(void *rawsock, bool blocking, U32 *size) { return NULL; } +U8 *baseRawsockGetTxFrame(void *rawsock, bool blocking, U32 *size) { AVB_LOG_ERROR("baseRawsockGetTxFrame called"); return NULL; } bool baseRawsockRelTxFrame(void *rawsock, U8 *pBuffer) { return false; } -bool baseRawsockTxFrameReady(void *rawsock, U8 *pFrame, U32 len, U64 timeNsec) { return false; } -int baseRawsockSend(void *rawsock) { return -1; } +bool baseRawsockTxFrameReady(void *rawsock, U8 *pFrame, U32 len, U64 timeNsec) { AVB_LOG_ERROR("baseRawsockTxFrameReady called"); return false; } +int baseRawsockSend(void *rawsock) { AVB_LOG_ERROR("baseRawsockSend called"); return -1; } int baseRawsockTxBufLevel(void *rawsock) { return -1; } int baseRawsockRxBufLevel(void *rawsock) { return -1; } unsigned long baseRawsockGetTXOutOfBuffers(void *pvRawsock) { return 0; } @@ -186,16 +187,24 @@ int baseRawsockRxParseHdr(void *pvRawsock, U8 *pBuffer, hdr_info_t *pInfo) { AVB_TRACE_ENTRY(AVB_TRACE_RAWSOCK_DETAIL); + memset(pInfo, 0, sizeof(hdr_info_t)); + eth_hdr_t *eth_hdr = (eth_hdr_t*)pBuffer; pInfo->dhost = eth_hdr->dhost; pInfo->shost = eth_hdr->shost; pInfo->ethertype = ntohs(eth_hdr->ethertype); + pInfo->ts.tv_sec = 0; + pInfo->ts.tv_nsec = 0; int hdrLen = sizeof(eth_hdr_t); if (pInfo->ethertype == ETHERTYPE_8021Q) { + U16 vlan_bits = ntohs(*(U16*)(pBuffer + hdrLen)); pInfo->vlan = TRUE; - // TODO extract vlan_vid and vlan_pcp - hdrLen += 4; + pInfo->vlan_vid = vlan_bits & 0x0FFF; + pInfo->vlan_pcp = (vlan_bits >> 13) & 0x0007; + hdrLen += 2; + pInfo->ethertype = ntohs(*(U16 *)(pBuffer + hdrLen)); + hdrLen += 2; } AVB_TRACE_EXIT(AVB_TRACE_RAWSOCK_DETAIL); diff --git a/lib/avtp_pipeline/rawsock/rawsock_impl.h b/lib/avtp_pipeline/rawsock/rawsock_impl.h index 7269b9f0..050f32ab 100644 --- a/lib/avtp_pipeline/rawsock/rawsock_impl.h +++ b/lib/avtp_pipeline/rawsock/rawsock_impl.h @@ -1,5 +1,6 @@ /************************************************************************************************************* Copyright (c) 2012-2015, Symphony Teleca Corporation, a Harman International Industries, Incorporated company +Copyright (c) 2016-2017, Harman International Industries, Incorporated All rights reserved. Redistribution and use in source and binary forms, with or without |