netatalk 4.5.0
Free and Open Source Apple Filing Protocol (AFP) Server
Loading...
Searching...
No Matches
afp_tcp_analytics.h
Go to the documentation of this file.
1#ifndef AFP_TCP_ANALYTICS_H
2#define AFP_TCP_ANALYTICS_H
3
4#include <stdint.h>
5#include <sys/types.h> /* for off_t */
6#include "afpclient.h" /* for CONN */
7
8/* Output format enumeration */
9 typedef enum {
10 TCP_OUTPUT_TEXT,
11 TCP_OUTPUT_CSV
12} TcpOutputFormat;
13
14/* TCP metrics structure */
15 typedef struct {
16 uint32_t server_quantum;
17 int tcp_send_buffer;
18 int tcp_recv_buffer;
19 int tcp_send_window;
20 int tcp_mss;
21 int tcp_congestion_window;
22 int tcp_slow_start_threshold;
23 uint32_t tcp_rtt;
24 uint32_t tcp_rtt_variance;
25 int tcp_retrans;
26 int tcp_total_retrans;
27 int tcp_reordering;
28 int tcp_lost;
29 int tcp_send_mss;
30 int tcp_recv_mss;
31 int tcp_adv_mss;
32 int tcp_recv_space;
33 int is_localhost;
34} TcpMetrics;
35
36/* Session handle for tracking metrics across multiple tests */
37 typedef struct {
38 TcpMetrics initial; /* Captured at session start */
39 TcpMetrics before; /* Captured before current test */
40 TcpMetrics after; /* Captured after current test */
41 TcpMetrics final; /* Captured at session end */
42 off_t current_size; /* Current test file size */
43 TcpOutputFormat format; /* TEXT or CSV */
44 int enable_session_tracking; /* For size sweep mode */
45} TcpAnalyticsSession;
46
47/* API Functions */
48 void tcp_analytics_init(TcpAnalyticsSession *session, TcpOutputFormat format,
49 int enable_session);
50 int tcp_analytics_capture(CONN *conn, TcpMetrics *metrics);
51 int tcp_analytics_session_start(TcpAnalyticsSession *session, CONN *conn);
52 int tcp_analytics_test_start(TcpAnalyticsSession *session, CONN *conn,
53 off_t file_size);
54 int tcp_analytics_test_end(TcpAnalyticsSession *session, CONN *conn);
55 int tcp_analytics_session_end(TcpAnalyticsSession *session, CONN *conn);
56
57#endif /* AFP_TCP_ANALYTICS_H */
tcp_analytics_init
void tcp_analytics_init(TcpAnalyticsSession *session, TcpOutputFormat format, int enable_session)
Initialize TCP analytics session.
Definition afp_tcp_analytics.c:60
TcpOutputFormat
TcpOutputFormat
Definition afp_tcp_analytics.h:9
TCP_OUTPUT_TEXT
@ TCP_OUTPUT_TEXT
Definition afp_tcp_analytics.h:10
TCP_OUTPUT_CSV
@ TCP_OUTPUT_CSV
Definition afp_tcp_analytics.h:11
tcp_analytics_test_start
int tcp_analytics_test_start(TcpAnalyticsSession *session, CONN *conn, off_t file_size)
Mark test start - capture "before" metrics.
Definition afp_tcp_analytics.c:271
tcp_analytics_capture
int tcp_analytics_capture(CONN *conn, TcpMetrics *metrics)
Capture TCP metrics from connection socket via getsockopt().
Definition afp_tcp_analytics.c:72
tcp_analytics_session_end
int tcp_analytics_session_end(TcpAnalyticsSession *session, CONN *conn)
Mark session end - capture "final" metrics and print session summary.
Definition afp_tcp_analytics.c:755
tcp_analytics_session_start
int tcp_analytics_session_start(TcpAnalyticsSession *session, CONN *conn)
Mark session start - capture "initial" metrics for size sweep mode.
Definition afp_tcp_analytics.c:263
tcp_analytics_test_end
int tcp_analytics_test_end(TcpAnalyticsSession *session, CONN *conn)
Mark test end - capture "after" metrics and print per-test comparison.
Definition afp_tcp_analytics.c:451
afpclient.h
session
int session(ATP atp, struct sockaddr_at *sat)
Definition session.c:49
CONN
Definition afpclient.h:176
TcpAnalyticsSession
Definition afp_tcp_analytics.h:37
TcpAnalyticsSession::initial
TcpMetrics initial
Definition afp_tcp_analytics.h:38
TcpAnalyticsSession::after
TcpMetrics after
Definition afp_tcp_analytics.h:40
TcpAnalyticsSession::format
TcpOutputFormat format
Definition afp_tcp_analytics.h:43
TcpAnalyticsSession::before
TcpMetrics before
Definition afp_tcp_analytics.h:39
TcpAnalyticsSession::enable_session_tracking
int enable_session_tracking
Definition afp_tcp_analytics.h:44
TcpAnalyticsSession::current_size
off_t current_size
Definition afp_tcp_analytics.h:42
TcpMetrics
Definition afp_tcp_analytics.h:15
TcpMetrics::tcp_adv_mss
int tcp_adv_mss
Definition afp_tcp_analytics.h:31
TcpMetrics::tcp_lost
int tcp_lost
Definition afp_tcp_analytics.h:28
TcpMetrics::tcp_total_retrans
int tcp_total_retrans
Definition afp_tcp_analytics.h:26
TcpMetrics::tcp_send_buffer
int tcp_send_buffer
Definition afp_tcp_analytics.h:17
TcpMetrics::tcp_mss
int tcp_mss
Definition afp_tcp_analytics.h:20
TcpMetrics::tcp_recv_buffer
int tcp_recv_buffer
Definition afp_tcp_analytics.h:18
TcpMetrics::tcp_congestion_window
int tcp_congestion_window
Definition afp_tcp_analytics.h:21
TcpMetrics::tcp_retrans
int tcp_retrans
Definition afp_tcp_analytics.h:25
TcpMetrics::tcp_rtt
uint32_t tcp_rtt
Definition afp_tcp_analytics.h:23
TcpMetrics::tcp_slow_start_threshold
int tcp_slow_start_threshold
Definition afp_tcp_analytics.h:22
TcpMetrics::server_quantum
uint32_t server_quantum
Definition afp_tcp_analytics.h:16
TcpMetrics::is_localhost
int is_localhost
Definition afp_tcp_analytics.h:33
TcpMetrics::tcp_recv_space
int tcp_recv_space
Definition afp_tcp_analytics.h:32
TcpMetrics::tcp_reordering
int tcp_reordering
Definition afp_tcp_analytics.h:27
TcpMetrics::tcp_send_mss
int tcp_send_mss
Definition afp_tcp_analytics.h:29
TcpMetrics::tcp_send_window
int tcp_send_window
Definition afp_tcp_analytics.h:19
TcpMetrics::tcp_rtt_variance
uint32_t tcp_rtt_variance
Definition afp_tcp_analytics.h:24
TcpMetrics::tcp_recv_mss
int tcp_recv_mss
Definition afp_tcp_analytics.h:30