Skip to content

Commit 491793d

Browse files
committed
Clean up more code.
1 parent ae1adba commit 491793d

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

src/main.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#include "main.h"
22

3-
struct config *cfg = NULL;
3+
config_t *cfg = NULL;
44

55
/**
66
* Signal handler to shut down the program.
@@ -24,7 +24,7 @@ int main(int argc, char *argv[])
2424
{
2525
// Create command line structure.
2626
opterr = 0;
27-
struct cmd_line cmd = {0};
27+
cmd_line_t cmd = {0};
2828

2929
// Parse command line and store values into cmd.
3030
parse_cmd_line(argc, argv, &cmd);
@@ -38,7 +38,7 @@ int main(int argc, char *argv[])
3838
}
3939

4040
// Create AF_XDP-specific command line variable and set defaults.
41-
struct cmd_line_af_xdp cmd_af_xdp = {0};
41+
cmd_line_af_xdp_t cmd_af_xdp = {0};
4242
cmd_af_xdp.batch_size = 1;
4343

4444
// Parse AF_XDP-specific command line.
@@ -62,7 +62,7 @@ int main(int argc, char *argv[])
6262
}
6363

6464
// Create config structure.
65-
cfg = malloc(sizeof(struct config));
65+
cfg = malloc(sizeof(config_t));
6666
memset(cfg, 0, sizeof(*cfg));
6767

6868
int seq_cnt = 0;

src/sequence.c

+7-7
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ void *thread_hdl(void *temp)
259259
// Perform payload checks.
260260
for (int i = 0; i < ti->seq.pl_cnt; i++)
261261
{
262-
struct payload_opt *pl = &ti->seq.pls[i];
262+
payload_opt_t *pl = &ti->seq.pls[i];
263263
u8 *pl_buff = payloads[i];
264264

265265
if (pl->exact != NULL)
@@ -361,7 +361,7 @@ void *thread_hdl(void *temp)
361361
{
362362
ti->seq.pl_cnt = 1;
363363

364-
struct payload_opt *pl = &ti->seq.pls[0];
364+
payload_opt_t *pl = &ti->seq.pls[0];
365365
pl->is_static = 1;
366366

367367
// Calculate lengths.
@@ -523,7 +523,7 @@ void *thread_hdl(void *temp)
523523
for (int i = 0; i < ti->seq.pl_cnt; i++)
524524
{
525525
// Retrieve payload at index.
526-
struct payload_opt *pl = &ti->seq.pls[i];
526+
payload_opt_t *pl = &ti->seq.pls[i];
527527

528528
// Check if we need to calculate random payload.
529529
if (pl->is_static)
@@ -702,7 +702,7 @@ void *thread_hdl(void *temp)
702702
*
703703
* @return Void
704704
**/
705-
void seq_send(const char *interface, struct sequence seq, u16 seq_cnt2, struct cmd_line cmd)
705+
void seq_send(const char *interface, sequence_t seq, u16 seq_cnt2, cmd_line_t cmd)
706706
{
707707
// First, let's check if the destination IP is set.
708708
if (seq.ip.dst_ip == NULL)
@@ -717,7 +717,7 @@ void seq_send(const char *interface, struct sequence seq, u16 seq_cnt2, struct c
717717

718718
// Assign correct values to thread info.
719719
strcpy((char *)&ti.device, interface);
720-
memcpy(&ti.seq, &seq, sizeof(struct sequence));
720+
memcpy(&ti.seq, &seq, sizeof(sequence_t));
721721

722722
// Copy command line.
723723
ti.cmd = cmd;
@@ -761,7 +761,7 @@ void seq_send(const char *interface, struct sequence seq, u16 seq_cnt2, struct c
761761
*
762762
* @return Void
763763
*/
764-
void shutdown_prog(struct config *cfg)
764+
void shutdown_prog(config_t *cfg)
765765
{
766766
for (int i = 0; i < thread_cnt; i++)
767767
{
@@ -773,7 +773,7 @@ void shutdown_prog(struct config *cfg)
773773
// Check if we need to print tracked stats.
774774
for (int i = 0; i < seq_cnt; i++)
775775
{
776-
struct sequence *seq = &cfg->seq[i];
776+
sequence_t *seq = &cfg->seq[i];
777777

778778
if (seq->track)
779779
{

0 commit comments

Comments
 (0)