examples/lib: replicate Suricata using the library

With more functions exposed via the library, a library user can now
replicate the Suricata "main" function.
pull/10720/head
Jason Ish 1 year ago committed by Victor Julien
parent cfd98e92a0
commit 2dc39d31c6

@ -1,7 +1,35 @@
/* Copyright (C) 2024 Open Information Security Foundation
*
* You can copy, redistribute or modify this Program under the terms of
* the GNU General Public License version 2 as published by the Free
* Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* version 2 along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*/
#include "suricata.h"
int main(int argc, char **argv)
{
SuricataMain(argc, argv);
return 0;
SuricataPreInit(argv[0]);
SuricataInit(argc, argv);
SuricataPostInit();
/* Suricata is now running, but we enter a loop to keep it running
* until it shouldn't be running anymore. */
SuricataMainLoop();
/* Shutdown engine. */
SuricataShutdown();
GlobalsDestroy();
return EXIT_SUCCESS;
}

Loading…
Cancel
Save