TcApi.h File Reference

#include <windows.h>

Data Structures

struct  TC_PACKET_HEADER
 Header prepended to each packet during reception and transmission. More...
struct  TC_LINK_INFO
 Link information on a physical port. More...
struct  PTC_AUTONEG_PARAMETERS
 Structure used with TcPortQueryAutonegotiationParameters and TcPortSetAutonegotiationParameters. More...

Defines

#define TC_CALLCONV   __cdecl
#define TC_PH_FLAGS_CHECKSUM   0x00000001
 The packet contain the FCS at the end of the packet.
#define TC_TX_SCHEDULING_MODE_NO_SCHED   0x00
 The packet will be transmitted without any scheduling policy i.e. as soon as possible, respecting the minimum interframe gap (IFG) of the link layer. The TC_PACKET_HEADER::Timestamp field is ignored by the transmission scheduler.
#define TC_TX_SCHEDULING_MODE_HW_REF   0x01
 Reserved.
#define TC_TX_SCHEDULING_MODE_SW_REF   0x02
 Reserved.
#define TC_PH_FLAGS_TX_SCHEDULING_MODE(a)   ((a)<<24)
 Macro used to define the transmission scheduling policy for a packet.
#define TC_PH_FLAGS_RX_PORT_ID(flags)   ((UCHAR)((flags)>>24))
 Macro used to get the port ID a packet was received from.
#define TC_PH_ERROR_CHECKSUM   0x00000001
 On reception, the received packet has an invalid frame check sequence (FCS).
#define TC_PH_ERROR_SEQUENCE   0x00000002
 On reception, the received packet had a sequence error. A valid delimiter sequence consists of idle->start-of-frame(SOF)->data, ->pad(optional)->end-of-frame(EOF)-fill(optional)->idle.
#define TC_PH_ERROR_SYMBOL   0x00000004
 On reception, the received packet had a symbol error.
#define TC_PH_ERROR_DATA   0x00000008
 On reception, the received packet had a data error.
#define TC_ALIGN_USHORT_TO_64BIT(a)   ((USHORT)(((USHORT)(a) + 7) & ((USHORT)0xFFF8)))
 Macro to align a 16 bit quantity on a 64bit boundary. Used when processing the packets contained in a packets buffer when TcPacketsBufferGetBuffer is used.
#define TC_COUNTER_PORT_TOTAL_RX_BYTES   ((ULONG)0x00000001)
 Total number of bytes received by a port. In case of an aggregated port, it represents the sum of the packets received on each physical port which is part of the aggregation. This counter accounts for errored frames, too.
#define TC_COUNTER_PORT_TOTAL_RX_PACKETS   ((ULONG)0x00000002)
 Total number of packets received by a port. In case of an aggregated port, it represents the sum of the packets received on each physical port which is part of the aggregation. This counter accounts for errored frames, too.
#define TC_COUNTER_PORT_RX_OK_PACKETS   ((ULONG)0x00000003)
 Total number of packets received by a port with no errors. In case of an aggregated port, it represents the sum of the packets received on each physical port which is part of the aggregation.
#define TC_COUNTER_PORT_RX_ERROR_PACKETS   ((ULONG)0x00000004)
 Total number of packets received by a port with errors. In case of an aggregated port, it represents the sum of the packets received on each physical port which is part of the aggregation.
#define TC_COUNTER_PORT_TOTAL_TX_PACKETS   ((ULONG)0x00000005)
 Total number of packets delivered to the physical port for transmission. This counter is incremented before the packets are actually transmitted by the underlying hardware. If the port link is down, this counter is incremented anyways, because the packets are stored in the port transmission buffer.
#define TC_COUNTER_PORT_TOTAL_TX_BYTES   ((ULONG)0x00000006)
 Total number of bytes delivered to the physical port for transmission. This counter is incremented before the packets are actually transmitted by the underlying hardware. If the port link is down, this counter is incremented anyways, because the packets are stored in the port transmission buffer. In case of an aggregated port, this counter is always 0.
#define TC_COUNTER_INSTANCE_TOTAL_RX_BYTES   ((ULONG)0x00010001)
 Total number of bytes received by an instance.
#define TC_COUNTER_INSTANCE_TOTAL_RX_PACKETS   ((ULONG)0x00010002)
 Total number of packets received by an instance.
#define TC_COUNTER_INSTANCE_TOTAL_TX_BYTES   ((ULONG)0x00010003)
 Total number of bytes delivered to the physical port for transmission from this instance. This counter is incremented before the packets are actually transmitted by the underlying hardware. If the port link is down, this counter is incremented anyways, because the packets are stored in the port transmission buffer.
#define TC_COUNTER_INSTANCE_TOTAL_TX_PACKETS   ((ULONG)0x00010004)
 Total number of packets delivered to the physical port for transmission from this instance. This counter is incremented before the packets are actually transmitted by the underlying hardware. If the port link is down, this counter is incremented anyways, because the packets are stored in the port transmission buffer.
#define TC_COUNTER_INSTANCE_RX_OK_PACKETS   ((ULONG)0x00010005)
 Total number of packets received by an instance with no errors.
#define TC_COUNTER_INSTANCE_RX_ERROR_PACKETS   ((ULONG)0x00010006)
 Total number of packets received by an instance with errors.
#define TC_COUNTER_INSTANCE_RX_DROPPED_PACKETS   ((ULONG)0x00010007)
 Total number of packets dropped by the hardware because the application is not fast enough at processing packets.
#define TC_SUCCESS   (TC_STATUS)0x00000000
 The call was successful.
#define TC_SUCCESS_REBOOT_REQUIRED   (TC_STATUS)0x00000001
 The call was successful but a reboot is required for the operation to be effective.
#define TC_ERROR_NO_PORT   (TC_STATUS)0x20000001
 The port does not exist.
#define TC_ERROR_UNKNOWN   (TC_STATUS)0x20000002
 An unknown error occurred.
#define TC_ERROR_NOT_IMPLEMENTED   (TC_STATUS)0x20000003
 This feature has not been implemented yet.
#define TC_ERROR_INVALID_REQUEST   (TC_STATUS)0x20000004
 The request is invalid.
#define TC_ERROR_NOT_AVAILABLE   (TC_STATUS)0x20000005
 The requested counter in a statistics object is not available.
#define TC_ERROR_NO_MEMORY   (TC_STATUS)0x20000006
 Not enough memory available on the system to complete the operation.
#define TC_ERROR_END_OF_BUFFER   (TC_STATUS)0x20000007
 The end of a packets buffer has been reached while reading packets from it.
#define TC_ERROR_INCONSISTENT_BUFFER   (TC_STATUS)0x20000008
 The data inside a packets buffer are inconsistent (e.g. the buffer is truncated or the values in the packet headers are not consistent).
#define TC_ERROR_BUFFER_FULL   (TC_STATUS)0x20000009
 The packets buffer is full and cannot hold the packet passed as parameter to the function.
#define TC_INVALID_PACKET   (TC_STATUS)0x2000000A
 The packet header has some invalid parameters.
#define TC_ERROR_INVALID_PARAMETER   (TC_STATUS)0x2000000B
 A parameter passed to the function has an invalid value.
#define TC_ERROR_CANNOT_CREATE_EVENT   (TC_STATUS)0x2000000C
 Impossible to allocate an event used by the object.
#define TC_ERROR_IO_DEVICE_ERROR   (TC_STATUS)0x2000000D
 I/O error while accessing a kernel device.
#define TC_ERROR_CALLBACK_ALREADY_REGISTERED   (TC_STATUS)0x2000000E
 The event handler has been already registered on the object.
#define TC_ERROR_BUFFER_TOO_SMALL   (TC_STATUS)0x2000000F
 The buffer passed to the function is too small to return the result of the operation.
#define TC_ERROR_REG_PARAMETER_NOT_FOUND   (TC_STATUS)0x20000010
 The required information cannot be found in the registry.
#define TC_PRT_LED_ON   ((ULONG)0x00000000)
#define TC_PRT_LED_OFF   ((ULONG)0x00000001)
#define TC_PRT_LED_BLINK   ((ULONG)0x00000002)
#define TC_PRT_LED_DEFAULT   ((ULONG)0x00000003)
#define TC_BRD_FT_PASSTHRU   0x00000001
 It controls the status of the passthru feature of a board.
#define TC_PRT_FT_LED_0   0x00000001
 It controls the status of LED #0 of a port.
#define TC_PRT_FT_LED_1   0x00000002
 It controls the status of LED #1 of a port.
#define TC_PRT_FT_LED_2   0x00000003
 It controls the status of LED #2 of a port.
#define TC_PRT_FT_RX_SLOT_SIZE   0x00000004
 Internal feature.
#define TC_PRT_FT_TX_SLOT_SIZE   0x00000005
 Internal feature.
#define TC_PRT_FT_RX_SLOTS   0x00000006
 Internal feature.
#define TC_PRT_FT_TX_SLOTS   0x00000007
 Internal feature.
#define TC_PRT_FT_RX_DESCS   0x00000008
 Internal feature.
#define TC_PRT_FT_TX_DESCS   0x00000009
 Internal feature.
#define TC_INST_FT_SNAPLEN   0x00000001
 It controls the snapshot feature of a reception/transmission instance.
#define TC_INST_FT_HW_FILTER   0x00000002
 It controls the hardware filter for the received packets.
#define TC_INST_FT_MINTOCOPY   0x00000003
 It controls the mintocopy feature of a port, i.e. the minimum amount of bytes that should be stored in the kernel buffer before the reception wait handle gets signalled (please see TcInstanceGetReceiveWaitHandle).
#define TC_INST_FT_RX_STATUS   0x00000004
 It controls the reception functionality of an instance i.e. if reception is enabled or not.
#define TC_INST_FT_TX_STATUS   0x00000005
 It controls the transmission functionality of an instance i.e. if transmission is enabled or not.
#define TC_INST_FT_READ_TIMEOUT   0x00000006
 It controls the read timeout of an instance, the maximum timeout after which a packet receive operation will return.
#define TC_HW_FILTER_CORRECT   0x00000001
 Used with the feature TC_INST_FT_HW_FILTER. When this bit flag is set, correct packets (i.e. valid FCS and no PHY errors) are captured.
#define TC_HW_FILTER_WRONG_FCS   0x00000002
 Used with the feature TC_INST_FT_HW_FILTER. When this bit flag is set, packets with a wrong FCS are captured.
#define TC_HW_FILTER_PHY_ERROR   0x00000004
 Used with the feature TC_INST_FT_HW_FILTER. When this bit flag is set, packets received with PHY errors are captured.

Typedefs

typedef TC_PACKET_HEADERPTC_PACKET_HEADER
typedef HANDLE TC_BOARD
 Handle to a physical TurboCap board on the system.
typedef TC_BOARDPTC_BOARD
typedef HANDLE TC_PORT
 Handle to a TurboCap port.
typedef TC_PORTPTC_PORT
typedef HANDLE TC_INSTANCE
 Handle to a capture/injection port instance.
typedef TC_INSTANCEPTC_INSTANCE
typedef HANDLE TC_PACKETS_BUFFER
 Handle to a buffer containing packets to be received or transmitted.
typedef TC_PACKETS_BUFFERPTC_PACKETS_BUFFER
typedef HANDLE TC_STATISTICS
 Handle to a statistics object containing counters related to a port or an instance.
typedef TC_STATISTICSPTC_STATISTICS
typedef TC_LINK_INFOPTC_LINK_INFO
typedef ULONG TC_STATUS
typedef VOID(* TcInstanceEvtLinkStatusChange )(TC_INSTANCE instance, TC_LINK_INFO linkInfo, PVOID context)
 This event callback function processes a link status change event.

Enumerations

enum  TC_PORT_TYPE {
  TC_PORT_TYPE_UNKNOWN = 0,
  TC_PORT_TYPE_PHYSICAL = 1,
  TC_PORT_TYPE_BAP = 2,
  TC_PORT_TYPE_TCAP = 3
}
 

A list of the port types supported by the TurboCap library.

More...
enum  TC_BOARD_TYPE {
  TC_BOARD_TYPE_UNKNOWN = 0,
  TC_BOARD_TYPE_9402PT = 1
}
 

A list of the board types supported by the TurboCap2 library.

More...
enum  TC_LINK_DUPLEX_TYPE {
  TC_UNKNOWN_DUPLEX = 0,
  TC_FULL_DUPLEX = 1,
  TC_HALF_DUPLEX = 2
}
 

Duplex setting of a port when the link is up.

More...
enum  TC_SPEED_CONFIGURATION {
  TC_SPEED_CONF_10MB_FD = 0x00000001,
  TC_SPEED_CONF_10MB_HD = 0x00000002,
  TC_SPEED_CONF_100MB_FD = 0x00000004,
  TC_SPEED_CONF_100MB_HD = 0x00000008,
  TC_SPEED_CONF_1000MB_FD = 0x00000010,
  TC_SPEED_CONF_ALL = 0x0000001F
}
 

Available link speeds that can be configured for the autonegotiation or to force the link speed when autonegotation is disabled. Used in conjunction with TC_AUTONEG_PARAMETERS.

More...

Functions

 C_ASSERT (sizeof(TC_AUTONEG_PARAMETERS)==12)
TC_STATUS TcQueryPortList (PTC_PORT *ppPorts, PULONG pLength)
 It returns a list on all the available ports on the system, both physical and aggregating (TcAP and BAP).
TC_STATUS TcFreePortList (PTC_PORT pPorts)
 It frees a list of port handles returned by TcQueryPortList .
PCHAR TcStatusGetString (TC_STATUS status)
 It translates a status code returned by one of the functions into an error string.
PCHAR TcPortGetName (TC_PORT port)
 It returns the name of a given port.
TC_STATUS TcPortQueryBoard (TC_PORT port, PTC_BOARD pBoard)
 It returns the board handle containing the given port.
PCHAR TcPortGetDescription (TC_PORT port)
 It returns the description of a given port.
TC_STATUS TcPortSetDescription (TC_PORT port, PCHAR pPortName)
 It sets the description of a given physical port.
TC_PORT_TYPE TcPortGetType (TC_PORT port)
 It returns the type of a given port.
TC_STATUS TcPortQueryMacAddress (TC_PORT port, BYTE pMac[6])
 It queries a port for the MAC address.
TC_STATUS TcPortQueryAggregatedPortList (TC_PORT aggregatingPort, PTC_PORT *ppPorts, PULONG pLength)
 It queries an aggregating port for the list of physical ports that it aggregates.
BOOLEAN TcPortIsEqual (TC_PORT portA, TC_PORT portB)
 It compares two port handles to check if they correspond to the same port.
TC_STATUS TcPortQueryLinkStatus (TC_PORT port, PTC_LINK_INFO pLinkInfo)
 Queries a port for the link status.
TC_STATUS TcPortQueryStatistics (TC_PORT port, PTC_STATISTICS pStatistics)
 It queries the statistics of a physical port.
TC_STATUS TcPortSetFeature (TC_PORT port, ULONG feature, ULONG value)
 It sets a specific feature on the port.
TC_STATUS TcPortQueryFeature (TC_PORT port, ULONG feature, PULONG pValue)
 It queries a specific feature on the port.
TC_STATUS TcPortSetAutonegotiationParameters (TC_PORT port, TC_AUTONEG_PARAMETERS autonegParameters)
 It sets the autonegotiation parameters of a physical port i.e. it enables/disables autonegotiation and controls which link speeds should be advertised during autonegotiation.
TC_STATUS TcPortQueryAutonegotiationParameters (TC_PORT port, PTC_AUTONEG_PARAMETERS pAutonegParameters)
 It queries the autonegotiation parameters of a port i.e. if autonegotiation is enabled, which link speed be advertised during autonegotiation and which link speeds are supported by the port.
TC_STATUS TcBoardQueryPortList (TC_BOARD board, PTC_PORT *ppPorts, PULONG pLength)
 It queries a board for the list of physical ports that it contains.
TC_BOARD_TYPE TcBoardGetType (TC_BOARD board)
 It returns the type of a given board.
PCHAR TcBoardGetDescription (TC_BOARD board)
 It returns the description of a given board.
BOOLEAN TcBoardIsEqual (TC_BOARD boardA, TC_BOARD boardB)
 It compares two board handles to check if they correspond to the same board.
TC_STATUS TcBoardSetFeature (TC_BOARD board, ULONG feature, ULONG value)
 It sets a specific feature on the board.
TC_STATUS TcBoardQueryFeature (TC_BOARD board, ULONG feature, PULONG pValue)
 It queries a specific feature on the board.
TC_STATUS TcInstanceOpenByPort (TC_PORT port, PTC_INSTANCE pInstance)
 It opens a reception/transmission instance of a port given a port handle.
TC_STATUS TcInstanceOpenByName (PCHAR name, PTC_INSTANCE pInstance)
 It opens a reception/transmission instance of a port given the port unique name.
TC_STATUS TcInstanceClose (TC_INSTANCE instance)
 It closes an reception/transmission instance.
TC_PORT TcInstanceGetPort (TC_INSTANCE instance)
 It returns the underlying port handle of an instance.
TC_STATUS TcInstanceRegisterEvtLinkStatusChange (TC_INSTANCE instance, TcInstanceEvtLinkStatusChange eventHandler, PVOID context)
 It registers an event handler that gets called whenever the link status changes.
TC_STATUS TcInstanceSetFeature (TC_INSTANCE instance, ULONG feature, ULONG value)
 It sets a specific feature on the instance.
TC_STATUS TcInstanceQueryFeature (TC_INSTANCE instance, ULONG feature, PULONG pValue)
 It queries a specific feature on the instance.
TC_STATUS TcInstanceReceivePackets (TC_INSTANCE instance, PTC_PACKETS_BUFFER pBuffer)
 It receives packets from a specific port.
HANDLE TcInstanceGetReceiveWaitHandle (TC_INSTANCE instance)
 It returns a Windows waitable handle that gets signalled when some packets are available to be received.
TC_STATUS TcInstanceTransmitPackets (TC_INSTANCE instance, TC_PACKETS_BUFFER buffer)
 It transmits a packets buffer on the port described by a given instance.
TC_STATUS TcInstanceQueryStatistics (TC_INSTANCE instance, PTC_STATISTICS pStatistics)
 It queries the statistics of an instance.
PVOID TcPacketsBufferGetBuffer (TC_PACKETS_BUFFER buffer)
 It returns the underlying raw buffer of a packets buffer.
ULONG TcPacketsBufferGetEffectiveLength (TC_PACKETS_BUFFER buffer)
 It returns the effective length of a packets buffer i.e. the number of bytes that have been effectively used for packets in the internal raw buffer.
ULONG TcPacketsBufferGetLength (TC_PACKETS_BUFFER buffer)
 It returns the total length of a packets buffer i.e. the size of the internal raw buffer.
TC_STATUS TcPacketsBufferCreate (ULONG size, PTC_PACKETS_BUFFER pBuffer)
 It creates a packets buffer used for transmission given its internal raw buffer size.
VOID TcPacketsBufferDestroy (TC_PACKETS_BUFFER buffer)
 It releases a buffer previously allocated by TcPacketsBufferCreate or returned by TcInstanceReceivePackets.
VOID TcPacketsBufferResetIndex (TC_PACKETS_BUFFER buffer)
 It resets the internal index used to read packets with TcPacketsBufferQueryNextPacket to the beginning of the buffer.
TC_STATUS TcPacketsBufferQueryNextPacket (TC_PACKETS_BUFFER buffer, PTC_PACKET_HEADER pHeader, PVOID *ppData)
 It returns the next available packet within a packets buffer.
TC_STATUS TcPacketsBufferCommitNextPacket (TC_PACKETS_BUFFER buffer, PTC_PACKET_HEADER pHeader, PVOID pData)
 It adds a packet to a given packets buffer.
TC_STATUS TcPacketsBufferSetEffectiveLength (TC_PACKETS_BUFFER buffer, ULONG effectiveLength)
 It sets the effective length of the buffer i.e. the number of bytes that actually contain packets in the internal raw buffer.
VOID TcStatisticsDestroy (TC_STATISTICS statistics)
 It releases a statistics handle returned by TcPortQueryStatistics or TcInstanceQueryStatistics.
TC_STATUS TcStatisticsUpdate (TC_STATISTICS statistics)
 It updates the port or instance statistics referred to by a given handle.
TC_STATUS TcStatisticsQueryValue (TC_STATISTICS statistics, ULONG counterId, PULONGLONG pValue)
 It queries a statitics object for a specific counter of an instance or a port.

Define Documentation

#define TC_CALLCONV   __cdecl

TurboCap API documentation. Copyright (c) 2007-2008 CACE Technologies. All rights reserved.