X-Git-Url: https://git.tcpdump.org/libpcap/blobdiff_plain/aa0e2f9bdecdc7705ae7dd50710096bfa0ace30b..cc3ca65d6519faf3a0e4609b5150757c14af36e9:/pcap-tc.c diff --git a/pcap-tc.c b/pcap-tc.c index 58f66cf7..768dbd7c 100644 --- a/pcap-tc.c +++ b/pcap-tc.c @@ -11,7 +11,7 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. Neither the name of CACE Technologies nor the names of its + * 3. Neither the name of CACE Technologies nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * @@ -106,13 +106,13 @@ typedef struct _TC_FUNCTIONS #endif TcFcnInstanceTransmitPackets InstanceTransmitPackets; TcFcnInstanceQueryStatistics InstanceQueryStatistics; - + TcFcnPacketsBufferCreate PacketsBufferCreate; TcFcnPacketsBufferDestroy PacketsBufferDestroy; TcFcnPacketsBufferQueryNextPacket PacketsBufferQueryNextPacket; TcFcnPacketsBufferCommitNextPacket PacketsBufferCommitNextPacket; - TcFcnStatisticsDestroy StatisticsDestroy; + TcFcnStatisticsDestroy StatisticsDestroy; TcFcnStatisticsUpdate StatisticsUpdate; TcFcnStatisticsQueryValue StatisticsQueryValue; } @@ -133,8 +133,8 @@ static int TcSetBuff(pcap_t *p, int dim); static int TcSetMode(pcap_t *p, int mode); static int TcSetMinToCopy(pcap_t *p, int size); static HANDLE TcGetReceiveWaitHandle(pcap_t *p); -static int TcOidGetRequest(pcap_t *p, bpf_u_int32 oid, void *data, size_t len); -static int TcOidSetRequest(pcap_t *p, bpf_u_int32 oid, const void *data, size_t len); +static int TcOidGetRequest(pcap_t *p, bpf_u_int32 oid, void *data, size_t *lenp); +static int TcOidSetRequest(pcap_t *p, bpf_u_int32 oid, const void *data, size_t *lenp); static u_int TcSendqueueTransmit(pcap_t *p, pcap_send_queue *queue, int sync); static int TcSetUserBuffer(pcap_t *p, int size); static int TcLiveDump(pcap_t *p, char *filename, int maxsize, int maxpacks); @@ -143,7 +143,7 @@ static PAirpcapHandle TcGetAirPcapHandle(pcap_t *p); #endif #ifdef _WIN32 -TC_FUNCTIONS g_TcFunctions = +TC_FUNCTIONS g_TcFunctions = { TC_API_UNLOADED, /* LoadStatus */ NULL, /* hTcApiDllHandle */ @@ -169,7 +169,7 @@ TC_FUNCTIONS g_TcFunctions = NULL /* StatisticsQueryValue */ }; #else -TC_FUNCTIONS g_TcFunctions = +TC_FUNCTIONS g_TcFunctions = { TC_API_LOADED, /* LoadStatus */ TcQueryPortList, @@ -277,7 +277,7 @@ HMODULE LoadLibrarySafe(LPCTSTR lpFileName) // break; } - + if (res > MAX_PATH) { // @@ -324,7 +324,7 @@ TC_API_LOAD_STATUS LoadTcFunctions(void) currentStatus = InterlockedCompareExchange((LONG*)&g_TcFunctions.LoadStatus, TC_API_LOADING, TC_API_LOADING); Sleep(10); } - + /* * at this point we are either in the LOADED state, unloaded state (i.e. we are the ones loading everything) * or in cannot load @@ -333,7 +333,7 @@ TC_API_LOAD_STATUS LoadTcFunctions(void) { return TC_API_LOADED; } - + if (currentStatus == TC_API_CANNOT_LOAD) { return TC_API_CANNOT_LOAD; @@ -429,7 +429,7 @@ struct pcap_tc { TC_INSTANCE TcInstance; TC_PACKETS_BUFFER TcPacketsBuffer; ULONG TcAcceptedCount; - PCHAR PpiPacket; + u_char *PpiPacket; }; int @@ -452,7 +452,7 @@ TcFindAllDevs(pcap_if_t **alldevsp, char *errbuf) result = 0; break; } - + /* * enumerate the ports, and add them to the list */ @@ -552,7 +552,7 @@ TcActivate(pcap_t *p) ULONG timeout; PPPI_HEADER pPpiHeader; - if (p->opt.rfmon) + if (p->opt.rfmon) { /* * No monitor mode on Tc cards; they're Ethernet @@ -561,11 +561,11 @@ TcActivate(pcap_t *p) return PCAP_ERROR_RFMON_NOTSUP; } - pt->PpiPacket = (PCHAR)malloc(sizeof(PPI_HEADER) + MAX_TC_PACKET_SIZE); + pt->PpiPacket = malloc(sizeof(PPI_HEADER) + MAX_TC_PACKET_SIZE); if (pt->PpiPacket == NULL) { - snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "Error allocating memory"); + pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "Error allocating memory"); return PCAP_ERROR; } @@ -584,15 +584,15 @@ TcActivate(pcap_t *p) pPpiHeader->Dot3FieldHeader.PfhLength = sizeof(PPI_FIELD_802_3_EXTENSION); pPpiHeader->Dot3FieldHeader.PfhType = PPI_FIELD_TYPE_802_3_EXTENSION; - status = g_TcFunctions.InstanceOpenByName(p->opt.source, &pt->TcInstance); + status = g_TcFunctions.InstanceOpenByName(p->opt.device, &pt->TcInstance); if (status != TC_SUCCESS) { /* Adapter detected but we are not able to open it. Return failure. */ - snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "Error opening TurboCap adapter: %s", g_TcFunctions.StatusGetString(status)); + pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "Error opening TurboCap adapter: %s", g_TcFunctions.StatusGetString(status)); return PCAP_ERROR; } - + p->linktype = DLT_EN10MB; p->dlt_list = (u_int *) malloc(sizeof(u_int) * 2); /* @@ -608,7 +608,7 @@ TcActivate(pcap_t *p) * ignore promiscuous mode * p->opt.promisc */ - + /* * ignore all the buffer sizes @@ -621,7 +621,7 @@ TcActivate(pcap_t *p) if (status != TC_SUCCESS) { - snprintf(p->errbuf, PCAP_ERRBUF_SIZE,"Error enabling reception on a TurboCap instance: %s", g_TcFunctions.StatusGetString(status)); + pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE,"Error enabling reception on a TurboCap instance: %s", g_TcFunctions.StatusGetString(status)); goto bad; } @@ -638,7 +638,7 @@ TcActivate(pcap_t *p) * if the timeout is -1, it means immediate return, no timeout * if the timeout is 0, it means INFINITE */ - + if (p->opt.timeout == 0) { timeout = 0xFFFFFFFF; @@ -649,7 +649,7 @@ TcActivate(pcap_t *p) /* * we insert a minimal timeout here */ - timeout = 10; + timeout = 10; } else { @@ -660,12 +660,12 @@ TcActivate(pcap_t *p) if (status != TC_SUCCESS) { - snprintf(p->errbuf, PCAP_ERRBUF_SIZE,"Error setting the read timeout a TurboCap instance: %s", g_TcFunctions.StatusGetString(status)); + pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE,"Error setting the read timeout a TurboCap instance: %s", g_TcFunctions.StatusGetString(status)); goto bad; } - - p->read_op = TcRead; - p->setfilter_op = TcSetFilter; + + p->read_op = TcRead; + p->setfilter_op = TcSetFilter; p->setdirection_op = NULL; /* Not implemented. */ p->set_datalink_op = TcSetDatalink; p->getnonblock_op = TcGetNonBlock; @@ -715,7 +715,7 @@ TcCreate(const char *device, char *ebuf, int *is_ours) *is_ours = 0; return NULL; } - + /* * enumerate the ports, and add them to the list */ @@ -758,7 +758,7 @@ TcCreate(const char *device, char *ebuf, int *is_ours) /* OK, it's probably ours. */ *is_ours = 1; - p = pcap_create_common(device, ebuf, sizeof (struct pcap_tc)); + p = pcap_create_common(ebuf, sizeof (struct pcap_tc)); if (p == NULL) return NULL; @@ -776,18 +776,18 @@ static int TcSetDatalink(pcap_t *p, int dlt) static int TcGetNonBlock(pcap_t *p, char *errbuf) { - snprintf(p->errbuf, PCAP_ERRBUF_SIZE, + pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "Getting the non blocking status is not available for TurboCap ports"); - snprintf(errbuf, PCAP_ERRBUF_SIZE, + pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE, "Getting the non blocking status is not available for TurboCap ports"); return -1; } static int TcSetNonBlock(pcap_t *p, int nonblock, char *errbuf) { - snprintf(p->errbuf, PCAP_ERRBUF_SIZE, + pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "Setting the non blocking status is not available for TurboCap ports"); - snprintf(errbuf, PCAP_ERRBUF_SIZE, + pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE, "Setting the non blocking status is not available for TurboCap ports"); return -1; } @@ -796,13 +796,13 @@ static int TcSetNonBlock(pcap_t *p, int nonblock, char *errbuf) static void TcCleanup(pcap_t *p) { struct pcap_tc *pt = p->priv; - + if (pt->TcPacketsBuffer != NULL) { g_TcFunctions.PacketsBufferDestroy(pt->TcPacketsBuffer); pt->TcPacketsBuffer = NULL; } - if (pt->TcInstance != NULL) + if (pt->TcInstance != NULL) { /* * here we do not check for the error values @@ -830,15 +830,15 @@ static int TcInject(pcap_t *p, const void *buf, size_t size) if (size >= 0xFFFF) { - snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "send error: the TurboCap API does not support packets larger than 64k"); + pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "send error: the TurboCap API does not support packets larger than 64k"); return -1; } status = g_TcFunctions.PacketsBufferCreate(sizeof(TC_PACKET_HEADER) + TC_ALIGN_USHORT_TO_64BIT((USHORT)size), &buffer); - + if (status != TC_SUCCESS) { - snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "send error: TcPacketsBufferCreate failure: %s (%08x)", g_TcFunctions.StatusGetString(status), status); + pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "send error: TcPacketsBufferCreate failure: %s (%08x)", g_TcFunctions.StatusGetString(status), status); return -1; } @@ -858,12 +858,12 @@ static int TcInject(pcap_t *p, const void *buf, size_t size) if (status != TC_SUCCESS) { - snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "send error: TcInstanceTransmitPackets failure: %s (%08x)", g_TcFunctions.StatusGetString(status), status); + pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "send error: TcInstanceTransmitPackets failure: %s (%08x)", g_TcFunctions.StatusGetString(status), status); } } else { - snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "send error: TcPacketsBufferCommitNextPacket failure: %s (%08x)", g_TcFunctions.StatusGetString(status), status); + pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "send error: TcPacketsBufferCommitNextPacket failure: %s (%08x)", g_TcFunctions.StatusGetString(status), status); } g_TcFunctions.PacketsBufferDestroy(buffer); @@ -887,7 +887,7 @@ static int TcRead(pcap_t *p, int cnt, pcap_handler callback, u_char *user) /* * Has "pcap_breakloop()" been called? */ - if (p->break_loop) + if (p->break_loop) { /* * Yes - clear the flag that indicates that it @@ -903,12 +903,12 @@ static int TcRead(pcap_t *p, int cnt, pcap_handler callback, u_char *user) status = g_TcFunctions.InstanceReceivePackets(pt->TcInstance, &pt->TcPacketsBuffer); if (status != TC_SUCCESS) { - snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "read error, TcInstanceReceivePackets failure: %s (%08x)", g_TcFunctions.StatusGetString(status), status); + pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "read error, TcInstanceReceivePackets failure: %s (%08x)", g_TcFunctions.StatusGetString(status), status); return -1; } } - while (TRUE) + while (TRUE) { struct pcap_pkthdr hdr; TC_PACKET_HEADER tcHeader; @@ -924,14 +924,14 @@ static int TcRead(pcap_t *p, int cnt, pcap_handler callback, u_char *user) * out of the loop without having read any packets, and * return the number of packets we've processed so far. */ - if (p->break_loop) + if (p->break_loop) { - if (n == 0) + if (n == 0) { p->break_loop = 0; return -2; - } - else + } + else { return n; } @@ -941,7 +941,7 @@ static int TcRead(pcap_t *p, int cnt, pcap_handler callback, u_char *user) { break; } - + status = g_TcFunctions.PacketsBufferQueryNextPacket(pt->TcPacketsBuffer, &tcHeader, &data); if (status == TC_ERROR_END_OF_BUFFER) @@ -953,20 +953,20 @@ static int TcRead(pcap_t *p, int cnt, pcap_handler callback, u_char *user) if (status != TC_SUCCESS) { - snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "read error, TcPacketsBufferQueryNextPacket failure: %s (%08x)", g_TcFunctions.StatusGetString(status), status); + pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "read error, TcPacketsBufferQueryNextPacket failure: %s (%08x)", g_TcFunctions.StatusGetString(status), status); return -1; } /* No underlaying filtering system. We need to filter on our own */ - if (p->fcode.bf_insns) + if (p->fcode.bf_insns) { filterResult = bpf_filter(p->fcode.bf_insns, data, tcHeader.Length, tcHeader.CapturedLength); - + if (filterResult == 0) { continue; } - + if (filterResult > tcHeader.CapturedLength) { filterResult = tcHeader.CapturedLength; @@ -976,9 +976,9 @@ static int TcRead(pcap_t *p, int cnt, pcap_handler callback, u_char *user) { filterResult = tcHeader.CapturedLength; } - + pt->TcAcceptedCount ++; - + hdr.ts.tv_sec = (bpf_u_int32)(tcHeader.Timestamp / (ULONGLONG)(1000 * 1000 * 1000)); hdr.ts.tv_usec = (bpf_u_int32)((tcHeader.Timestamp % (ULONGLONG)(1000 * 1000 * 1000)) / 1000); @@ -1021,7 +1021,7 @@ static int TcRead(pcap_t *p, int cnt, pcap_handler callback, u_char *user) } - if (++n >= cnt && cnt > 0) + if (++n >= cnt && cnt > 0) { return n; } @@ -1043,8 +1043,8 @@ TcStats(pcap_t *p, struct pcap_stat *ps) if (status != TC_SUCCESS) { - snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "TurboCap error in TcInstanceQueryStatistics: %s (%08x)", g_TcFunctions.StatusGetString(status), status); - return -1; + pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "TurboCap error in TcInstanceQueryStatistics: %s (%08x)", g_TcFunctions.StatusGetString(status), status); + return -1; } memset(&s, 0, sizeof(s)); @@ -1052,8 +1052,8 @@ TcStats(pcap_t *p, struct pcap_stat *ps) status = g_TcFunctions.StatisticsQueryValue(statistics, TC_COUNTER_INSTANCE_TOTAL_RX_PACKETS, &counter); if (status != TC_SUCCESS) { - snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "TurboCap error in TcStatisticsQueryValue: %s (%08x)", g_TcFunctions.StatusGetString(status), status); - return -1; + pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "TurboCap error in TcStatisticsQueryValue: %s (%08x)", g_TcFunctions.StatusGetString(status), status); + return -1; } if (counter <= (ULONGLONG)0xFFFFFFFF) { @@ -1067,8 +1067,8 @@ TcStats(pcap_t *p, struct pcap_stat *ps) status = g_TcFunctions.StatisticsQueryValue(statistics, TC_COUNTER_INSTANCE_RX_DROPPED_PACKETS, &counter); if (status != TC_SUCCESS) { - snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "TurboCap error in TcStatisticsQueryValue: %s (%08x)", g_TcFunctions.StatusGetString(status), status); - return -1; + pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "TurboCap error in TcStatisticsQueryValue: %s (%08x)", g_TcFunctions.StatusGetString(status), status); + return -1; } if (counter <= (ULONGLONG)0xFFFFFFFF) { @@ -1093,23 +1093,23 @@ TcStats(pcap_t *p, struct pcap_stat *ps) /* * We filter at user level, since the kernel driver does't process the packets */ -static int +static int TcSetFilter(pcap_t *p, struct bpf_program *fp) -{ - if(!fp) +{ + if(!fp) { strncpy(p->errbuf, "setfilter: No filter specified", sizeof(p->errbuf)); return -1; } - + /* Install a user level filter */ - if (install_bpf_program(p, fp) < 0) + if (install_bpf_program(p, fp) < 0) { - snprintf(p->errbuf, sizeof(p->errbuf), + pcap_snprintf(p->errbuf, sizeof(p->errbuf), "setfilter, unable to install the filter: %s", pcap_strerror(errno)); return -1; } - + return 0; } @@ -1128,7 +1128,7 @@ TcStatsEx(pcap_t *p, int *pcap_stat_size) if (status != TC_SUCCESS) { - snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "TurboCap error in TcInstanceQueryStatistics: %s (%08x)", g_TcFunctions.StatusGetString(status), status); + pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "TurboCap error in TcInstanceQueryStatistics: %s (%08x)", g_TcFunctions.StatusGetString(status), status); return NULL; } @@ -1137,7 +1137,7 @@ TcStatsEx(pcap_t *p, int *pcap_stat_size) status = g_TcFunctions.StatisticsQueryValue(statistics, TC_COUNTER_INSTANCE_TOTAL_RX_PACKETS, &counter); if (status != TC_SUCCESS) { - snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "TurboCap error in TcStatisticsQueryValue: %s (%08x)", g_TcFunctions.StatusGetString(status), status); + pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "TurboCap error in TcStatisticsQueryValue: %s (%08x)", g_TcFunctions.StatusGetString(status), status); return NULL; } if (counter <= (ULONGLONG)0xFFFFFFFF) @@ -1152,7 +1152,7 @@ TcStatsEx(pcap_t *p, int *pcap_stat_size) status = g_TcFunctions.StatisticsQueryValue(statistics, TC_COUNTER_INSTANCE_RX_DROPPED_PACKETS, &counter); if (status != TC_SUCCESS) { - snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "TurboCap error in TcStatisticsQueryValue: %s (%08x)", g_TcFunctions.StatusGetString(status), status); + pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "TurboCap error in TcStatisticsQueryValue: %s (%08x)", g_TcFunctions.StatusGetString(status), status); return NULL; } if (counter <= (ULONGLONG)0xFFFFFFFF) @@ -1190,7 +1190,7 @@ TcSetMode(pcap_t *p, int mode) { if (mode != MODE_CAPT) { - snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "Mode %u not supported by TurboCap devices. TurboCap only supports capture.", mode); + pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "Mode %u not supported by TurboCap devices. TurboCap only supports capture.", mode); return -1; } @@ -1205,7 +1205,7 @@ TcSetMinToCopy(pcap_t *p, int size) if (size < 0) { - snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "Mintocopy cannot be less than 0."); + pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "Mintocopy cannot be less than 0."); return -1; } @@ -1213,9 +1213,9 @@ TcSetMinToCopy(pcap_t *p, int size) if (status != TC_SUCCESS) { - snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "TurboCap error setting the mintocopy: %s (%08x)", g_TcFunctions.StatusGetString(status), status); + pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "TurboCap error setting the mintocopy: %s (%08x)", g_TcFunctions.StatusGetString(status), status); } - + return 0; } @@ -1228,18 +1228,18 @@ TcGetReceiveWaitHandle(pcap_t *p) } static int -TcOidGetRequest(pcap_t *p, bpf_u_int32 oid _U_, void *data _U_, size_t len _U_ +TcOidGetRequest(pcap_t *p, bpf_u_int32 oid _U_, void *data _U_, size_t *lenp _U_) { - snprintf(p->errbuf, PCAP_ERRBUF_SIZE, + pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "An OID get request cannot be performed on a TurboCap device"); return PCAP_ERROR; } static int TcOidSetRequest(pcap_t *p, bpf_u_int32 oid _U_, const void *data _U_, - size_t len _U_) + size_t *lenp _U_) { - snprintf(p->errbuf, PCAP_ERRBUF_SIZE, + pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "An OID set request cannot be performed on a TurboCap device"); return PCAP_ERROR; } @@ -1247,7 +1247,7 @@ TcOidSetRequest(pcap_t *p, bpf_u_int32 oid _U_, const void *data _U_, static u_int TcSendqueueTransmit(pcap_t *p, pcap_send_queue *queue _U_, int sync _U_) { - snprintf(p->errbuf, PCAP_ERRBUF_SIZE, + pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "Packets cannot be bulk transmitted on a TurboCap device"); return 0; } @@ -1255,7 +1255,7 @@ TcSendqueueTransmit(pcap_t *p, pcap_send_queue *queue _U_, int sync _U_) static int TcSetUserBuffer(pcap_t *p, int size _U_) { - snprintf(p->errbuf, PCAP_ERRBUF_SIZE, + pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "The user buffer cannot be set on a TurboCap device"); return -1; } @@ -1263,7 +1263,7 @@ TcSetUserBuffer(pcap_t *p, int size _U_) static int TcLiveDump(pcap_t *p, char *filename _U_, int maxsize _U_, int maxpacks _U_) { - snprintf(p->errbuf, PCAP_ERRBUF_SIZE, + pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "Live packet dumping cannot be performed on a TurboCap device"); return -1; } @@ -1271,7 +1271,7 @@ TcLiveDump(pcap_t *p, char *filename _U_, int maxsize _U_, int maxpacks _U_) static int TcLiveDumpEnded(pcap_t *p, int sync _U_) { - snprintf(p->errbuf, PCAP_ERRBUF_SIZE, + pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "Live packet dumping cannot be performed on a TurboCap device"); return -1; }