Skip to content

Commit

Permalink
Refrag code into userio files. Prepare for next level code update
Browse files Browse the repository at this point in the history
  • Loading branch information
phaag committed Jan 6, 2024
1 parent 05430dd commit b78ffba
Show file tree
Hide file tree
Showing 14 changed files with 639 additions and 420 deletions.
2 changes: 1 addition & 1 deletion src/lib/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ else
nflist = flist.c flist.h
endif
filter = grammar.y scanner.l nftree.c nftree.h ipconv.c ipconv.h rbtree.h filter.h
output = output_util.c output_util.h output_short.c output_short.h
output = userio.c userio.h output_util.c output_util.h output_short.c output_short.h
regex = sgregex/sgregex.c sgregex/sgregex.h
daemon = daemon.c daemon.h
version = version.c version.h
Expand Down
7 changes: 0 additions & 7 deletions src/lib/filter.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,6 @@
#include "config.h"
#include "rbtree.h"

#define NSEL_EVENT_IGNORE 0LL
#define NSEL_EVENT_CREATE 1LL
#define NSEL_EVENT_DELETE 2LL
#define NSEL_EVENT_DENIED 3LL
#define NSEL_EVENT_ALERT 4LL
#define NSEL_EVENT_UPDATE 5LL

#define NEL_EVENT_INVALID 0LL
#define NEL_EVENT_ADD 1LL
#define NEL_EVENT_DELETE 2LL
Expand Down
16 changes: 1 addition & 15 deletions src/lib/grammar.y
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
#include <ctype.h>

#include "util.h"
#include "output_util.h"
#include "userio.h"
#include "rbtree.h"
#include "filter.h"
#include "nfdump.h"
Expand All @@ -68,8 +68,6 @@ static int InitSymbols(void);

static uint32_t Get_fwd_status_id(char *status);

static int IsMD5(char *string);

static int AddGeo(uint16_t direction, char *geoStr);

enum { DIR_UNSPEC = 1,
Expand Down Expand Up @@ -2537,18 +2535,6 @@ int i;

} // End of Get_fwd_status_id

static int IsMD5(char *string) {

int i = 0;
for (i=0; i<32; i++) {
char c = string[i];
if ( c == '\0' || !isxdigit(c))
return 0;
}
return string[i] == '\0';

} // End of IsMD5

static int AddGeo(uint16_t direction, char *geoStr) {
if ( strlen(geoStr) != 2 ) {
yyerror("Need a two letter geo country code");
Expand Down
1 change: 1 addition & 0 deletions src/lib/output_short.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
#include "nfdump.h"
#include "nfxV3.h"
#include "output_util.h"
#include "userio.h"
#include "util.h"

#define IP_STRING_LEN (INET6_ADDRSTRLEN)
Expand Down
Loading

0 comments on commit b78ffba

Please sign in to comment.