-
Notifications
You must be signed in to change notification settings - Fork 179
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add new tiles * add in blackhole tile * remove for now * changes
- Loading branch information
Showing
4 changed files
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#include "tiles.h" | ||
|
||
/** | ||
* Tile used to filter out all packets when used as a consumer. | ||
* As the name suggests, it is a "black hole" for incoming packets. | ||
*/ | ||
|
||
static void | ||
before_frag( void * _ctx FD_PARAM_UNUSED, | ||
ulong in_idx FD_PARAM_UNUSED, | ||
ulong seq FD_PARAM_UNUSED, | ||
ulong sig FD_PARAM_UNUSED, | ||
int * opt_filter ) { | ||
*opt_filter = 1; | ||
} | ||
|
||
static ulong | ||
populate_allowed_fds( void * scratch, | ||
ulong out_fds_cnt, | ||
int * out_fds ) { | ||
(void)scratch; | ||
if( FD_UNLIKELY( out_fds_cnt < 2 ) ) FD_LOG_ERR(( "out_fds_cnt %lu", out_fds_cnt )); | ||
|
||
ulong out_cnt = 0; | ||
out_fds[ out_cnt++ ] = 2; /* stderr */ | ||
if( FD_LIKELY( -1!=fd_log_private_logfile_fd() ) ) | ||
out_fds[ out_cnt++ ] = fd_log_private_logfile_fd(); /* logfile */ | ||
return out_cnt; | ||
} | ||
|
||
fd_topo_run_tile_t fd_tile_blackhole = { | ||
.name = "blackhole", | ||
.mux_flags = FD_MUX_FLAG_MANUAL_PUBLISH | FD_MUX_FLAG_COPY, | ||
.burst = 1UL, | ||
.mux_before_frag = before_frag, | ||
.populate_allowed_fds = populate_allowed_fds, | ||
.privileged_init = NULL, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters