Optimize integration testing
- Add injection package plug-in - Add libstellar_dynamic.so to facilitate unit testing of upper-level plug-ins
This commit is contained in:
46
test/packet_inject/packet_inject_main.h
Normal file
46
test/packet_inject/packet_inject_main.h
Normal file
@@ -0,0 +1,46 @@
|
||||
#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
|
||||
Reference in New Issue
Block a user