diff options
| author | luwenpeng <[email protected]> | 2024-06-27 15:07:54 +0800 |
|---|---|---|
| committer | luwenpeng <[email protected]> | 2024-06-27 16:00:12 +0800 |
| commit | da9fb7cd118a7429d7b7bb2f51871e52377f2fa4 (patch) | |
| tree | 6b74287a4dc8498e6d38bd35f57dc4e6438d9852 /include | |
| parent | 83bffdd008091a493c17d9ed7eb0690c2eaafb4e (diff) | |
optimizate inject packt test case
Diffstat (limited to 'include')
| -rw-r--r-- | include/stellar/packet.h | 3 | ||||
| -rw-r--r-- | include/stellar/stellar.h | 12 |
2 files changed, 6 insertions, 9 deletions
diff --git a/include/stellar/packet.h b/include/stellar/packet.h index 0ceed05..8995986 100644 --- a/include/stellar/packet.h +++ b/include/stellar/packet.h @@ -36,6 +36,9 @@ uint16_t packet_get_raw_len(const struct packet *pkt); const char *packet_get_payload(const struct packet *pkt); uint16_t packet_get_payload_len(const struct packet *pkt); +struct packet *imitate_tcp_packet(const struct packet *origin_pkt, uint32_t tcp_seq, uint32_t tcp_ack, uint8_t tcp_flags, const char *tcp_payload, uint16_t tcp_payload_len); +struct packet *imitate_udp_packet(const struct packet *origin_pkt, const char *udp_payload, uint16_t udp_payload_len); + #ifdef __cplusplus } #endif diff --git a/include/stellar/stellar.h b/include/stellar/stellar.h index 0f02132..3237455 100644 --- a/include/stellar/stellar.h +++ b/include/stellar/stellar.h @@ -49,15 +49,9 @@ typedef int plugin_on_polling_func(void *plugin_env); int stellar_polling_plugin_register(struct stellar *st, plugin_on_polling_func on_polling, void *plugin_env); uint16_t stellar_get_current_thread_index(); - -// return inject packet length, return 0 if failed -int stellar_inject_tcp_rst(struct stellar *st, const struct session *sess, enum flow_direction inject_dir); -int stellar_inject_tcp_fin(struct stellar *st, const struct session *sess, enum flow_direction inject_dir); -int stellar_inject_tcp_payload(struct stellar *st, const struct session *sess, enum flow_direction inject_dir, const char *payload, uint16_t len); -int stellar_inject_udp_payload(struct stellar *st, const struct session *sess, enum flow_direction inject_dir, const char *payload, uint16_t len); -int stellar_inject_ctrl_msg(struct stellar *st, const struct session *sess, const struct sids *sids, const char *msg, uint16_t len); - -int stellar_main(int argc, char **argv); +// only send user crafted packet, can't send packet which come from network +void stellar_send_crafted_packet(struct stellar *st, struct packet *pkt); +int stellar_run(int argc, char **argv); #ifdef __cplusplus } |
