From a55dbdfae33b9a1d4e0c4d30d4564f4fc05a4cd5 Mon Sep 17 00:00:00 2001 From: Jason Ish Date: Fri, 23 Aug 2024 14:52:34 -0600 Subject: [PATCH] lib: consistent naming style And add SC prefix. Ticket: #7240 --- examples/lib/custom/main.c | 4 ++-- src/runmode-lib.c | 16 ++++++++-------- src/runmode-lib.h | 12 ++++++------ src/runmodes.c | 4 ++-- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/examples/lib/custom/main.c b/examples/lib/custom/main.c index 3a6a81e44a..85926ce314 100644 --- a/examples/lib/custom/main.c +++ b/examples/lib/custom/main.c @@ -39,7 +39,7 @@ static void *SimpleWorker(void *arg) } /* Start worker. */ - if (RunModeSpawnWorker(tv) != 0) { + if (SCRunModeLibSpawnWorker(tv) != 0) { pthread_exit(NULL); } @@ -68,7 +68,7 @@ static void *SimpleWorker(void *arg) pcap_close(fp); /* Cleanup. */ - RunModeDestroyWorker(tv); + SCRunModeLibDestroyWorker(tv); pthread_exit(NULL); } diff --git a/src/runmode-lib.c b/src/runmode-lib.c index 2699d47e44..94ed43b834 100644 --- a/src/runmode-lib.c +++ b/src/runmode-lib.c @@ -27,16 +27,16 @@ #include "tm-threads.h" /** \brief register runmodes for suricata as a library */ -void RunModeIdsLibRegister(void) +void SCRunModeLibIdsRegister(void) { RunModeRegisterNewRunMode(RUNMODE_LIB, "offline", "Library offline mode (pcap replaying)", - RunModeIdsLibOffline, NULL); - RunModeRegisterNewRunMode(RUNMODE_LIB, "live", "Library live mode", RunModeIdsLibLive, NULL); + SCRunModeLibIdsOffline, NULL); + RunModeRegisterNewRunMode(RUNMODE_LIB, "live", "Library live mode", SCRunModeLibIdsLive, NULL); return; } /** \brief runmode for offline packet processing (pcap files) */ -int RunModeIdsLibOffline(void) +int SCRunModeLibIdsOffline(void) { TimeModeSetOffline(); @@ -44,14 +44,14 @@ int RunModeIdsLibOffline(void) } /** \brief runmode for live packet processing */ -int RunModeIdsLibLive(void) +int SCRunModeLibIdsLive(void) { TimeModeSetLive(); return 0; } -const char *RunModeLibGetDefaultMode(void) +const char *SCRunModeLibGetDefaultMode(void) { return "live"; } @@ -92,7 +92,7 @@ ThreadVars *SCRunModeLibCreateThreadVars(int worker_id) * * This method performs all the initialization tasks. */ -int RunModeSpawnWorker(void *td) +int SCRunModeLibSpawnWorker(void *td) { ThreadVars *tv = (ThreadVars *)td; @@ -106,7 +106,7 @@ int RunModeSpawnWorker(void *td) } /** \brief destroy a worker thread */ -void RunModeDestroyWorker(void *td) +void SCRunModeLibDestroyWorker(void *td) { SCTmThreadsSlotPktAcqLoopFinish((ThreadVars *)td); } diff --git a/src/runmode-lib.h b/src/runmode-lib.h index 44c8c3a474..0e37d3db48 100644 --- a/src/runmode-lib.h +++ b/src/runmode-lib.h @@ -28,16 +28,16 @@ #include "threadvars.h" /** \brief register runmodes for suricata as a library */ -void RunModeIdsLibRegister(void); +void SCRunModeLibIdsRegister(void); /** \brief runmode for live packet processing */ -int RunModeIdsLibLive(void); +int SCRunModeLibIdsLive(void); /** \brief runmode for offline packet processing (pcap files) */ -int RunModeIdsLibOffline(void); +int SCRunModeLibIdsOffline(void); /** \brief runmode default mode (live) */ -const char *RunModeLibGetDefaultMode(void); +const char *SCRunModeLibGetDefaultMode(void); /** * \brief Create ThreadVars for use by a user provided thread. @@ -55,9 +55,9 @@ ThreadVars *SCRunModeLibCreateThreadVars(int worker_id); * * This method performs all the initialization tasks. */ -int RunModeSpawnWorker(void *); +int SCRunModeLibSpawnWorker(void *); /** \brief destroy a worker thread */ -void RunModeDestroyWorker(void *); +void SCRunModeLibDestroyWorker(void *); #endif /* SURICATA_RUNMODE_LIB_H */ diff --git a/src/runmodes.c b/src/runmodes.c index d478e1c658..f5434f4cc8 100644 --- a/src/runmodes.c +++ b/src/runmodes.c @@ -235,7 +235,7 @@ void RunModeRegisterRunModes(void) RunModeUnixSocketRegister(); RunModeIpsWinDivertRegister(); RunModeDpdkRegister(); - RunModeIdsLibRegister(); + SCRunModeLibIdsRegister(); #ifdef UNITTESTS UtRunModeRegister(); #endif @@ -349,7 +349,7 @@ static const char *RunModeGetConfOrDefault(int capture_mode, const char *capture break; #endif case RUNMODE_LIB: - custom_mode = RunModeLibGetDefaultMode(); + custom_mode = SCRunModeLibGetDefaultMode(); break; default: return NULL;