This repository has been archived on 2025-09-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
stellar-stellar/test/packet_inject/packet_inject_main.h
luwenpeng f82b85c979 Optimize integration testing
- Add injection package plug-in
- Add libstellar_dynamic.so to facilitate unit testing of upper-level plug-ins
2024-05-28 14:30:42 +08:00

47 lines
942 B
C

#ifndef _PACKET_INJECT_MAIN_H
#define _PACKET_INJECT_MAIN_H
#ifdef __cplusplus
extern "C"
{
#endif
#include <arpa/inet.h>
#define AFTER_RECV_C2S_N_PACKET 1
#define AFTER_RECV_S2C_N_PACKET 2
enum packet_inject_type
{
INJECT_TYPE_TCP_RST = 1,
INJECT_TYPE_TCP_FIN = 2,
INJECT_TYPE_TCP_PAYLOAD = 3,
INJECT_TYPE_TCP_PAYLOAD_FIN_RST = 4,
INJECT_TYPE_UDP_PAYLOAD = 5,
INJECT_TYPE_CTRL_MSG = 6,
};
struct packet_inject_rule
{
int ip_type;
struct in_addr v4; /* network order */
struct in6_addr v6; /* network order */
int port; /* network order */
enum packet_inject_type inject_type;
// inject packet after (C2S/S2C) receiving n packets
int direction; // AFTER_RECV_C2S_N_PACKET or AFTER_RECV_S2C_N_PACKET
uint64_t number; // n packets received
};
extern struct packet_inject_rule rule;
int packet_inject_main(int argc, char **argv);
#ifdef __cplusplus
}
#endif
#endif