summaryrefslogtreecommitdiffstats
path: root/src/datafile.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2022-11-19 14:45:32 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2022-11-19 14:45:45 +0000
commit843f8a24f27eb0c724a1aec4d95b3790d95e48c7 (patch)
tree447c083f0d4eceafca3e377ad1d574ebc1a0061d /src/datafile.h
parentReleasing debian version 2.9.0-1. (diff)
downloaddnsperf-843f8a24f27eb0c724a1aec4d95b3790d95e48c7.tar.xz
dnsperf-843f8a24f27eb0c724a1aec4d95b3790d95e48c7.zip
Merging upstream version 2.10.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/datafile.h')
-rw-r--r--src/datafile.h23
1 files changed, 17 insertions, 6 deletions
diff --git a/src/datafile.h b/src/datafile.h
index 7b6caf3..a1b737e 100644
--- a/src/datafile.h
+++ b/src/datafile.h
@@ -1,5 +1,5 @@
/*
- * Copyright 2019-2021 OARC, Inc.
+ * Copyright 2019-2022 OARC, Inc.
* Copyright 2017-2018 Akamai Technologies
* Copyright 2006-2016 Nominum, Inc.
* All rights reserved.
@@ -25,27 +25,38 @@
#include <pthread.h>
#include <stdbool.h>
+#include <stdint.h>
-typedef struct perf_datafile {
+typedef enum {
+ input_format_text_query,
+ input_format_text_update,
+ input_format_tcp_wire_format
+} perf_input_format_t;
+
+typedef struct perf_datafile perf_datafile_t;
+struct perf_datafile {
pthread_mutex_t lock;
int pipe_fd;
int fd;
bool is_file;
size_t size, at, have;
bool cached;
- char databuf[(64 * 1024) + 1];
+ char databuf[(64 * 1024) + sizeof(uint16_t)]; /* pad for null-terminated string or TCP wire length */
unsigned int maxruns;
unsigned int nruns;
bool read_any;
-} perf_datafile_t;
-perf_datafile_t* perf_datafile_open(const char* filename);
+ perf_input_format_t format;
+ perf_result_t (*readfunc)(perf_datafile_t* dfile, perf_buffer_t* lines);
+};
+
+perf_datafile_t* perf_datafile_open(const char* filename, perf_input_format_t format);
void perf_datafile_close(perf_datafile_t** dfilep);
void perf_datafile_setmaxruns(perf_datafile_t* dfile, unsigned int maxruns);
void perf_datafile_setpipefd(perf_datafile_t* dfile, int pipe_fd);
-perf_result_t perf_datafile_next(perf_datafile_t* dfile, perf_buffer_t* lines, bool is_update);
+perf_result_t perf_datafile_next(perf_datafile_t* dfile, perf_buffer_t* lines);
unsigned int perf_datafile_nruns(const perf_datafile_t* dfile);