summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryangwei <[email protected]>2024-04-30 16:09:53 +0800
committeryangwei <[email protected]>2024-04-30 16:09:53 +0800
commite32196af5d0d5fb875e84ffa801558db4867babb (patch)
tree43b0fb98a4848d5ed5c8cd9fa0a189af60e59d41
parentf4e5f43b959d1321acd128b76fdc82fa94cd877d (diff)
✨ feat(session_get_isn): forward port api from 1.0
-rw-r--r--include/stellar/session.h3
-rw-r--r--src/stellar_on_sapp/stellar_on_sapp_api.c20
2 files changed, 22 insertions, 1 deletions
diff --git a/include/stellar/session.h b/include/stellar/session.h
index 605aed0..f28e46d 100644
--- a/include/stellar/session.h
+++ b/include/stellar/session.h
@@ -28,7 +28,8 @@ enum session_type session_get_type(struct session *sess);
#define SESSION_SEEN_S2C_FLOW (1 << 1)
int session_is_symmetric(struct session *sess, unsigned char *flag);
-
+long long session_get_client_isn(struct session *sess);
+long long session_get_server_isn(struct session *sess);
#define SESSION_IS_TUNNLE_NON (0) /* default is 0, not tunnel; */
#define SESSION_IS_TUNNLE_6OVER4 (1 << 0)
diff --git a/src/stellar_on_sapp/stellar_on_sapp_api.c b/src/stellar_on_sapp/stellar_on_sapp_api.c
index 707ceb9..c3c8430 100644
--- a/src/stellar_on_sapp/stellar_on_sapp_api.c
+++ b/src/stellar_on_sapp/stellar_on_sapp_api.c
@@ -506,4 +506,24 @@ int session_get_current_thread_id(struct session *sess)
}
}
return thread_id;
+}
+
+long long session_get_client_isn(struct session *sess)
+{
+ if(sess || sess->cur_pkt || sess->cur_pkt->a_stream)return -1;
+ struct streaminfo *pstream=sess->cur_pkt->a_stream;
+ uint32_t client_isn=0;
+ int client_isn_sz=sizeof(client_isn);
+ if(MESA_get_stream_opt(pstream, MSO_TCP_ISN_C2S, &(client_isn), &client_isn_sz)!=0)return -1;
+ return client_isn;
+}
+
+long long session_get_server_isn(struct session *sess)
+{
+ if(sess || sess->cur_pkt || sess->cur_pkt->a_stream)return -1;
+ struct streaminfo *pstream=sess->cur_pkt->a_stream;
+ uint32_t server_isn=0;
+ int server_isn_sz=sizeof(server_isn);
+ if(MESA_get_stream_opt(pstream, MSO_TCP_ISN_S2C, &(server_isn), &server_isn_sz)!=0)return -1;
+ return server_isn;
} \ No newline at end of file