Skip to content

Commit

Permalink
src: remove unused headers-exported functions
Browse files Browse the repository at this point in the history
+ remove double definition of IPPairLock
  • Loading branch information
catenacyber committed Jun 29, 2023
1 parent d822ba5 commit 8c1b27c
Show file tree
Hide file tree
Showing 104 changed files with 15 additions and 1,264 deletions.
11 changes: 0 additions & 11 deletions src/app-layer-ftp.c
Expand Up @@ -1369,17 +1369,6 @@ void RegisterFTPParsers(void)
#endif
}

void FTPAtExitPrintStats(void)
{
#ifdef DEBUG
SCMutexLock(&ftp_state_mem_lock);
SCLogDebug("ftp_state_memcnt %"PRIu64", ftp_state_memuse %"PRIu64"",
ftp_state_memcnt, ftp_state_memuse);
SCMutexUnlock(&ftp_state_mem_lock);
#endif
}


/*
* \brief Returns the ending offset of the next line from a multi-line buffer.
*
Expand Down
1 change: 0 additions & 1 deletion src/app-layer-ftp.h
Expand Up @@ -184,7 +184,6 @@ typedef struct FtpDataState_ {

void RegisterFTPParsers(void);
void FTPParserRegisterTests(void);
void FTPAtExitPrintStats(void);
void FTPParserCleanup(void);
uint64_t FTPMemuseGlobalCounter(void);
uint64_t FTPMemcapGlobalCounter(void);
Expand Down
22 changes: 0 additions & 22 deletions src/app-layer-htp-body.c
Expand Up @@ -91,28 +91,6 @@ int HtpBodyAppendChunk(const HTPCfgDir *hcfg, HtpBody *body,
* \param body pointer to the HtpBody holding the list
* \retval none
*/
void HtpBodyPrint(HtpBody *body)
{
if (SCLogDebugEnabled()||1) {
SCEnter();

if (body->first == NULL)
return;

HtpBodyChunk *cur = NULL;
SCLogDebug("--- Start body chunks at %p ---", body);
printf("--- Start body chunks at %p ---\n", body);
for (cur = body->first; cur != NULL; cur = cur->next) {
const uint8_t *data = NULL;
uint32_t data_len = 0;
StreamingBufferSegmentGetData(body->sb, &cur->sbseg, &data, &data_len);
SCLogDebug("Body %p; data %p, len %"PRIu32, body, data, data_len);
printf("Body %p; data %p, len %"PRIu32"\n", body, data, data_len);
PrintRawDataFp(stdout, data, data_len);
}
SCLogDebug("--- End body chunks at %p ---", body);
}
}

/**
* \brief Free the information held in the request body
Expand Down
1 change: 0 additions & 1 deletion src/app-layer-htp-body.h
Expand Up @@ -29,7 +29,6 @@
#define __APP_LAYER_HTP_BODY_H__

int HtpBodyAppendChunk(const HTPCfgDir *, HtpBody *, const uint8_t *, uint32_t);
void HtpBodyPrint(HtpBody *);
void HtpBodyFree(const HTPCfgDir *, HtpBody *);
void HtpBodyPrune(HtpState *, HtpBody *, int);

Expand Down
32 changes: 0 additions & 32 deletions src/app-layer-parser.c
Expand Up @@ -422,12 +422,6 @@ void AppLayerParserRegisterOptionFlags(uint8_t ipproto, AppProto alproto,
SCReturn;
}

uint32_t AppLayerParserGetOptionFlags(uint8_t protomap, AppProto alproto)
{
SCEnter();
SCReturnUInt(alp_ctx.ctxs[protomap][alproto].option_flags);
}

void AppLayerParserRegisterStateFuncs(uint8_t ipproto, AppProto alproto,
void *(*StateAlloc)(void *, AppProto), void (*StateFree)(void *))
{
Expand Down Expand Up @@ -866,11 +860,6 @@ AppLayerDecoderEvents *AppLayerParserGetDecoderEvents(AppLayerParserState *pstat
"AppLayerDecoderEvents *");
}

void AppLayerParserSetDecoderEvents(AppLayerParserState *pstate, AppLayerDecoderEvents *devents)
{
pstate->decoder_events = devents;
}

AppLayerDecoderEvents *AppLayerParserGetEventsByTx(uint8_t ipproto, AppProto alproto,
void *tx)
{
Expand Down Expand Up @@ -1827,27 +1816,6 @@ static inline void AppLayerParserStreamTruncated(AppLayerParserState *pstate, co
SCReturn;
}

#ifdef DEBUG
void AppLayerParserStatePrintDetails(AppLayerParserState *pstate)
{
SCEnter();

if (pstate == NULL)
SCReturn;

AppLayerParserState *p = pstate;
SCLogDebug("AppLayerParser parser state information for parser state p(%p). "
"p->inspect_id[0](%"PRIu64"), "
"p->inspect_id[1](%"PRIu64"), "
"p->log_id(%"PRIu64"), "
"p->decoder_events(%p).",
pstate, p->inspect_id[0], p->inspect_id[1], p->log_id,
p->decoder_events);

SCReturn;
}
#endif

/***** Unittests *****/

#ifdef UNITTESTS
Expand Down
7 changes: 0 additions & 7 deletions src/app-layer-parser.h
Expand Up @@ -218,7 +218,6 @@ void AppLayerParserRegisterStateDataFunc(

/***** Get and transaction functions *****/

uint32_t AppLayerParserGetOptionFlags(uint8_t protomap, AppProto alproto);
AppLayerGetTxIteratorFunc AppLayerGetTxIterator(const uint8_t ipproto,
const AppProto alproto);

Expand All @@ -235,7 +234,6 @@ void AppLayerParserSetTransactionInspectId(const Flow *f, AppLayerParserState *p
void *alstate, const uint8_t flags, bool tag_txs_as_inspected);

AppLayerDecoderEvents *AppLayerParserGetDecoderEvents(AppLayerParserState *pstate);
void AppLayerParserSetDecoderEvents(AppLayerParserState *pstate, AppLayerDecoderEvents *devents);
AppLayerDecoderEvents *AppLayerParserGetEventsByTx(uint8_t ipproto, AppProto alproto, void *tx);
AppLayerGetFileState AppLayerParserGetTxFiles(
const Flow *f, void *state, void *tx, const uint8_t direction);
Expand Down Expand Up @@ -315,11 +313,6 @@ void AppLayerParserStateFree(AppLayerParserState *pstate);

void AppLayerParserTransactionsCleanup(Flow *f, const uint8_t pkt_dir);

#ifdef DEBUG
void AppLayerParserStatePrintDetails(AppLayerParserState *pstate);
#endif


/***** Unittests *****/

#ifdef UNITTESTS
Expand Down
49 changes: 0 additions & 49 deletions src/conf.c
Expand Up @@ -581,25 +581,6 @@ int ConfValIsFalse(const char *val)
* \retval 1 will be returned if the name is found and was properly
* converted to a double, otherwise 0 will be returned.
*/
int ConfGetDouble(const char *name, double *val)
{
const char *strval = NULL;
double tmpdo;
char *endptr;

if (ConfGet(name, &strval) == 0)
return 0;

errno = 0;
tmpdo = strtod(strval, &endptr);
if (strval[0] == '\0' || *endptr != '\0')
return 0;
if (errno == ERANGE)
return 0;

*val = tmpdo;
return 1;
}

/**
* \brief Retrieve a configuration value as a float
Expand Down Expand Up @@ -868,36 +849,6 @@ int ConfNodeChildValueIsTrue(const ConfNode *node, const char *key)
* \param file The name of the file
* \retval str Pointer to the string path + sig_file
*/
char *ConfLoadCompleteIncludePath(const char *file)
{
const char *defaultpath = NULL;
char *path = NULL;

/* Path not specified */
if (PathIsRelative(file)) {
if (ConfGet("include-path", &defaultpath) == 1) {
SCLogDebug("Default path: %s", defaultpath);
size_t path_len = sizeof(char) * (strlen(defaultpath) +
strlen(file) + 2);
path = SCMalloc(path_len);
if (unlikely(path == NULL))
return NULL;
strlcpy(path, defaultpath, path_len);
if (path[strlen(path) - 1] != '/')
strlcat(path, "/", path_len);
strlcat(path, file, path_len);
} else {
path = SCStrdup(file);
if (unlikely(path == NULL))
return NULL;
}
} else {
path = SCStrdup(file);
if (unlikely(path == NULL))
return NULL;
}
return path;
}

/**
* \brief Prune a configuration node.
Expand Down
5 changes: 2 additions & 3 deletions src/conf.h
Expand Up @@ -61,7 +61,6 @@ ConfNode *ConfGetRootNode(void);
int ConfGet(const char *name, const char **vptr);
int ConfGetInt(const char *name, intmax_t *val);
int ConfGetBool(const char *name, int *val);
int ConfGetDouble(const char *name, double *val);
int ConfGetFloat(const char *name, float *val);
int ConfSet(const char *name, const char *val);
int ConfSetFromString(const char *input, int final);
Expand Down Expand Up @@ -91,8 +90,8 @@ int ConfGetChildValueInt(const ConfNode *base, const char *name, intmax_t *val);
int ConfGetChildValueBool(const ConfNode *base, const char *name, int *val);
int ConfGetChildValueWithDefault(const ConfNode *base, const ConfNode *dflt, const char *name, const char **vptr);
int ConfGetChildValueIntWithDefault(const ConfNode *base, const ConfNode *dflt, const char *name, intmax_t *val);
int ConfGetChildValueBoolWithDefault(const ConfNode *base, const ConfNode *dflt, const char *name, int *val);
char *ConfLoadCompleteIncludePath(const char *);
int ConfGetChildValueBoolWithDefault(
const ConfNode *base, const ConfNode *dflt, const char *name, int *val);
int ConfNodeIsSequence(const ConfNode *node);
ConfNode *ConfSetIfaceNode(const char *ifaces_node_name, const char *iface);
int ConfSetRootAndDefaultNodes(
Expand Down
5 changes: 0 additions & 5 deletions src/defrag-hash.c
Expand Up @@ -74,11 +74,6 @@ uint64_t DefragTrackerGetMemuse(void)
return memusecopy;
}

uint32_t DefragTrackerSpareQueueGetSize(void)
{
return DefragTrackerQueueLen(&defragtracker_spare_q);
}

void DefragTrackerMoveToSpare(DefragTracker *h)
{
DefragTrackerEnqueue(&defragtracker_spare_q, h);
Expand Down
1 change: 0 additions & 1 deletion src/defrag-hash.h
Expand Up @@ -96,7 +96,6 @@ DefragTracker *DefragGetTrackerFromHash (Packet *);
void DefragTrackerRelease(DefragTracker *);
void DefragTrackerClearMemory(DefragTracker *);
void DefragTrackerMoveToSpare(DefragTracker *);
uint32_t DefragTrackerSpareQueueGetSize(void);

int DefragTrackerSetMemcap(uint64_t);
uint64_t DefragTrackerGetMemcap(void);
Expand Down
10 changes: 0 additions & 10 deletions src/defrag-queue.c
Expand Up @@ -130,13 +130,3 @@ DefragTracker *DefragTrackerDequeue (DefragTrackerQueue *q)
DQLOCK_UNLOCK(q);
return dt;
}

uint32_t DefragTrackerQueueLen(DefragTrackerQueue *q)
{
uint32_t len;
DQLOCK_LOCK(q);
len = q->len;
DQLOCK_UNLOCK(q);
return len;
}

3 changes: 1 addition & 2 deletions src/defrag-queue.h
Expand Up @@ -77,8 +77,7 @@ DefragTrackerQueue *DefragTrackerQueueInit(DefragTrackerQueue *);
void DefragTrackerQueueDestroy (DefragTrackerQueue *);

void DefragTrackerEnqueue (DefragTrackerQueue *, DefragTracker *);
DefragTracker *DefragTrackerDequeue (DefragTrackerQueue *);
uint32_t DefragTrackerQueueLen(DefragTrackerQueue *);
DefragTracker *DefragTrackerDequeue(DefragTrackerQueue *);

#endif /* __DEFRAG_QUEUE_H__ */

17 changes: 0 additions & 17 deletions src/detect-engine-address.c
Expand Up @@ -137,23 +137,6 @@ DetectAddress *DetectAddressCopy(DetectAddress *orig)
return ag;
}

#ifdef DEBUG
/**
* \brief Prints the address data information for all the DetectAddress
* instances in the DetectAddress list sent as the argument.
*
* \param head Pointer to a list of DetectAddress instances.
*/
void DetectAddressPrintList(DetectAddress *head)
{
SCLogInfo("list:");
for (DetectAddress *cur = head; cur != NULL; cur = cur->next) {
DetectAddressPrint(cur);
}
SCLogInfo("endlist");
}
#endif

/**
* \internal
* \brief Frees a list of DetectAddress instances.
Expand Down
4 changes: 0 additions & 4 deletions src/detect-engine-address.h
Expand Up @@ -50,8 +50,4 @@ void DetectAddressMapFree(DetectEngineCtx *de_ctx);
const DetectAddressHead *DetectParseAddress(DetectEngineCtx *de_ctx,
const char *string, bool *contains_negation);

#ifdef DEBUG
void DetectAddressPrintList(DetectAddress *);
#endif

#endif /* __DETECT_ADDRESS_H__ */
5 changes: 0 additions & 5 deletions src/detect-engine-mpm.c
Expand Up @@ -888,11 +888,6 @@ void PatternMatchDestroy(MpmCtx *mpm_ctx, uint16_t mpm_matcher)
mpm_table[mpm_matcher].DestroyCtx(mpm_ctx);
}

void PatternMatchThreadPrint(MpmThreadCtx *mpm_thread_ctx, uint16_t mpm_matcher)
{
SCLogDebug("mpm_thread_ctx %p, mpm_matcher %"PRIu16" defunct", mpm_thread_ctx, mpm_matcher);
//mpm_table[mpm_matcher].PrintThreadCtx(mpm_thread_ctx);
}
void PatternMatchThreadDestroy(MpmThreadCtx *mpm_thread_ctx, uint16_t mpm_matcher)
{
SCLogDebug("mpm_thread_ctx %p, mpm_matcher %"PRIu16"", mpm_thread_ctx, mpm_matcher);
Expand Down
2 changes: 0 additions & 2 deletions src/detect-engine-mpm.h
Expand Up @@ -46,10 +46,8 @@ void PatternMatchThreadPrepare(MpmThreadCtx *, uint16_t type);

void PatternMatchDestroy(MpmCtx *, uint16_t);
void PatternMatchThreadDestroy(MpmThreadCtx *mpm_thread_ctx, uint16_t);
void PatternMatchThreadPrint(MpmThreadCtx *, uint16_t);

int PatternMatchPrepareGroup(DetectEngineCtx *, SigGroupHead *);
void DetectEngineThreadCtxInfo(ThreadVars *, DetectEngineThreadCtx *);

TmEcode DetectEngineThreadCtxInit(ThreadVars *, void *, void **);
TmEcode DetectEngineThreadCtxDeinit(ThreadVars *, void *);
Expand Down
5 changes: 0 additions & 5 deletions src/detect-engine-siggroup.c
Expand Up @@ -284,11 +284,6 @@ int SigGroupHeadHashAdd(DetectEngineCtx *de_ctx, SigGroupHead *sgh)
return ret;
}

int SigGroupHeadHashRemove(DetectEngineCtx *de_ctx, SigGroupHead *sgh)
{
return HashListTableRemove(de_ctx->sgh_hash_table, (void *)sgh, 0);
}

/**
* \brief Used to lookup a SigGroupHead hash from the detection engine context
* SigGroupHead hash table.
Expand Down
2 changes: 0 additions & 2 deletions src/detect-engine-siggroup.h
Expand Up @@ -38,8 +38,6 @@ void SigGroupHeadHashFree(DetectEngineCtx *);

int SigGroupHeadHashInit(DetectEngineCtx *);

int SigGroupHeadHashRemove(DetectEngineCtx *, SigGroupHead *);

void SigGroupHeadInitDataFree(SigGroupHeadInitData *sghid);
void SigGroupHeadSetSigCnt(SigGroupHead *sgh, uint32_t max_idx);
void SigGroupHeadSetProtoAndDirection(SigGroupHead *sgh,
Expand Down
8 changes: 0 additions & 8 deletions src/detect-engine-tag.c
Expand Up @@ -76,14 +76,6 @@ void TagDestroyCtx(void)
#endif
}

/** \brief Reset the tagging engine context
*/
void TagRestartCtx(void)
{
TagDestroyCtx();
TagInitCtx();
}

int TagHostHasTag(Host *host)
{
return HostGetStorageById(host, host_tag_id) ? 1 : 0;
Expand Down
1 change: 0 additions & 1 deletion src/detect-engine-tag.h
Expand Up @@ -48,7 +48,6 @@ void TagHandlePacket(DetectEngineCtx *, DetectEngineThreadCtx *, Packet *);

void TagInitCtx(void);
void TagDestroyCtx(void);
void TagRestartCtx(void);

int TagTimeoutCheck(Host *, SCTime_t);

Expand Down

0 comments on commit 8c1b27c

Please sign in to comment.