@ -112,6 +112,8 @@ typedef struct PcapFileName_ {
TAILQ_ENTRY ( PcapFileName_ ) next ; /**< Pointer to next Pcap File for tailq. */
TAILQ_ENTRY ( PcapFileName_ ) next ; /**< Pointer to next Pcap File for tailq. */
} PcapFileName ;
} PcapFileName ;
thread_local char * pcap_file_thread = NULL ;
typedef struct PcapLogProfileData_ {
typedef struct PcapLogProfileData_ {
uint64_t total ;
uint64_t total ;
uint64_t cnt ;
uint64_t cnt ;
@ -1103,6 +1105,14 @@ static TmEcode PcapLogDataInit(ThreadVars *t, const void *initdata, void **data)
# endif /* INIT_RING_BUFFER */
# endif /* INIT_RING_BUFFER */
}
}
if ( pl - > mode = = LOGMODE_MULTI ) {
PcapLogOpenFileCtx ( td - > pcap_log ) ;
} else {
if ( pl - > filename = = NULL ) {
PcapLogOpenFileCtx ( pl ) ;
}
}
return TM_ECODE_OK ;
return TM_ECODE_OK ;
}
}
@ -1854,6 +1864,9 @@ static int PcapLogOpenFileCtx(PcapLogData *pl)
SCLogDebug ( " Opening pcap file log %s " , pf - > filename ) ;
SCLogDebug ( " Opening pcap file log %s " , pf - > filename ) ;
TAILQ_INSERT_TAIL ( & pl - > pcap_file_list , pf , next ) ;
TAILQ_INSERT_TAIL ( & pl - > pcap_file_list , pf , next ) ;
if ( pl - > mode = = LOGMODE_MULTI | | pl - > mode = = LOGMODE_NORMAL ) {
pcap_file_thread = pl - > filename ;
}
PCAPLOG_PROFILE_END ( pl - > profile_open ) ;
PCAPLOG_PROFILE_END ( pl - > profile_open ) ;
return 0 ;
return 0 ;
@ -1862,6 +1875,15 @@ error:
return - 1 ;
return - 1 ;
}
}
char * PcapLogGetFilename ( void )
{
/* return pcap filename per thread */
if ( pcap_file_thread ! = NULL ) {
return pcap_file_thread ;
}
return NULL ;
}
static int profiling_pcaplog_enabled = 0 ;
static int profiling_pcaplog_enabled = 0 ;
static int profiling_pcaplog_output_to_file = 0 ;
static int profiling_pcaplog_output_to_file = 0 ;
static char * profiling_pcaplog_file_name = NULL ;
static char * profiling_pcaplog_file_name = NULL ;