summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryangwei <[email protected]>2024-08-19 18:19:44 +0800
committeryangwei <[email protected]>2024-08-19 18:19:44 +0800
commit6e92f11af00cfdd756112d1626726f8c1c084e06 (patch)
treeff421b1b361102102c055b32c2780fd8b2df16be
parent36e098d25a18304e841217f4b95fc7fecc3dae03 (diff)
✨ feat(session.h): add packet_get_linkid
-rw-r--r--include/stellar/session.h1
-rw-r--r--src/stellar_on_sapp/stellar_on_sapp_api.c8
2 files changed, 9 insertions, 0 deletions
diff --git a/include/stellar/session.h b/include/stellar/session.h
index f617197..23e3956 100644
--- a/include/stellar/session.h
+++ b/include/stellar/session.h
@@ -121,6 +121,7 @@ int packet_get_direction(const struct packet *pkt);
#define PACKET_DIRECTION_INCOMING 0
#define PACKET_DIRECTION_OUTGOING 1
int packet_get_route_direction(const struct packet *pkt);
+int packet_get_linkid(const struct packet *pkt);
const char *packet_get0_data(const struct packet *pkt, size_t *data_len);
int packet_arrive_time(const struct packet *pkt, struct timeval *ts);
diff --git a/src/stellar_on_sapp/stellar_on_sapp_api.c b/src/stellar_on_sapp/stellar_on_sapp_api.c
index f551fc1..904c11b 100644
--- a/src/stellar_on_sapp/stellar_on_sapp_api.c
+++ b/src/stellar_on_sapp/stellar_on_sapp_api.c
@@ -324,6 +324,14 @@ int packet_get_route_direction(const struct packet *pkt)
return PACKET_DIRECTION_UNKNOWN;
}
+int packet_get_linkid(const struct packet *pkt)
+{
+ if(pkt == NULL || pkt->raw_pkt==NULL)return -1;
+ int link_id = -1;
+ get_opt_from_rawpkt(pkt->raw_pkt, RAW_PKT_GET_LINK_ID, &link_id);
+ return link_id;
+}
+
void packet_drop(const struct packet *pkt)
{
if(pkt == NULL || pkt->pstream==NULL)return;