summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorluwenpeng <[email protected]>2024-11-18 15:24:38 +0800
committerluwenpeng <[email protected]>2024-11-18 15:24:38 +0800
commita473c2922dbb58a30eacf7f70697ed3108397ebb (patch)
tree5605dd1759c674297a306b878ef652661d974774 /include
parent492a7fb8ead4d9a3f36a2e773041eb285dc34a95 (diff)
feature: packet manager support build packet
Diffstat (limited to 'include')
-rw-r--r--include/stellar/packet.h30
1 files changed, 15 insertions, 15 deletions
diff --git a/include/stellar/packet.h b/include/stellar/packet.h
index 8e9cf54..c20e1b5 100644
--- a/include/stellar/packet.h
+++ b/include/stellar/packet.h
@@ -137,21 +137,6 @@ int packet_get_tunnel_count(const struct packet *pkt);
int packet_get_tunnel_by_idx(const struct packet *pkt, int idx, struct tunnel *out);
/******************************************************************************
- * build
- ******************************************************************************/
-
-/*
- * tcp_seq: the sequence number of the new TCP packet (in host byte order)
- * tcp_ack: the acknowledgment number of the new TCP packet (in host byte order)
- * tcp_options_len: the length of the options (must be a multiple of 4)
- */
-struct packet *packet_build_tcp(const struct packet *origin_pkt, uint32_t tcp_seq, uint32_t tcp_ack, uint8_t tcp_flags,
- const char *tcp_options, uint16_t tcp_options_len,
- const char *tcp_payload, uint16_t tcp_payload_len);
-struct packet *packet_build_udp(const struct packet *origin_pkt, const char *udp_payload, uint16_t udp_payload_len);
-struct packet *packet_build_l3(const struct packet *origin_pkt, uint8_t ip_proto, const char *l3_payload, uint16_t l3_payload_len);
-
-/******************************************************************************
* utils
******************************************************************************/
@@ -183,6 +168,7 @@ enum packet_type
};
enum packet_type packet_get_type(const struct packet *pkt);
+void packet_set_type(struct packet *pkt, enum packet_type type);
void packet_set_action(struct packet *pkt, enum packet_action action);
enum packet_action packet_get_action(const struct packet *pkt);
@@ -228,6 +214,20 @@ typedef void on_packet_claimed_callback(struct packet *pkt, void *arg);
int packet_manager_claim_packet(struct packet_manager *pkt_mgr, uint16_t thread_id, struct packet *pkt, on_packet_claimed_callback cb, void *arg);
void packet_manager_schedule_packet(struct packet_manager *pkt_mgr, uint16_t thread_id, struct packet *pkt, enum packet_stage stage);
+/*
+ * tcp_seq: the sequence number of the new TCP packet (in host byte order)
+ * tcp_ack: the acknowledgment number of the new TCP packet (in host byte order)
+ * tcp_options_len: the length of the options (must be a multiple of 4)
+ */
+struct packet *packet_manager_build_tcp_packet(struct packet_manager *pkt_mgr, const struct packet *origin_pkt,
+ uint32_t tcp_seq, uint32_t tcp_ack, uint8_t tcp_flags,
+ const char *tcp_options, uint16_t tcp_options_len,
+ const char *tcp_payload, uint16_t tcp_payload_len);
+struct packet *packet_manager_build_udp_packet(struct packet_manager *pkt_mgr, const struct packet *origin_pkt,
+ const char *udp_payload, uint16_t udp_payload_len);
+struct packet *packet_manager_build_l3_packet(struct packet_manager *pkt_mgr, const struct packet *origin_pkt,
+ uint8_t ip_proto, const char *l3_payload, uint16_t l3_payload_len);
+
#ifdef __cplusplus
}
#endif