diff options
| author | yangwei <[email protected]> | 2023-08-27 16:44:08 +0800 |
|---|---|---|
| committer | yangwei <[email protected]> | 2023-08-28 13:38:18 +0800 |
| commit | 1fcaa1273da7ef29fdc96dddbedc4050e45d07f9 (patch) | |
| tree | adb16cd09ddce23f60a410a4b4ff197c35afcfc7 /src/dealpkt/plug_support.c | |
| parent | 7bbf7a8250384fbdcc1ccb74bd4cf3edf22a0b97 (diff) | |
✨ feat(thread_id & pkt->stream): 新增接口,支撑stellar-c需求
1、get_current_worker_thread_id
2、get_streaminfo_from_rawpkt
Diffstat (limited to 'src/dealpkt/plug_support.c')
| -rw-r--r-- | src/dealpkt/plug_support.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/dealpkt/plug_support.c b/src/dealpkt/plug_support.c index 2b3e860..cb83b5e 100644 --- a/src/dealpkt/plug_support.c +++ b/src/dealpkt/plug_support.c @@ -405,6 +405,22 @@ const void *get_rawpkt_from_streaminfo(const struct streaminfo *pstream) return NULL;
}
+const struct streaminfo *get_streaminfo_from_rawpkt(const void *rawpkt)
+{
+ if(NULL == rawpkt)return NULL;
+ const raw_pkt_t *p_rawpkt = (const raw_pkt_t *)rawpkt;
+ if(p_rawpkt->magic_num != RAW_PKT_MAGIC_NUM || p_rawpkt->io_lib_pkt_reference == NULL)
+ {
+ return NULL;
+ }
+ const struct streaminfo_private *pstream_pr = container_of(rawpkt, struct streaminfo_private, raw_pkt);
+ if(pstream_pr)
+ {
+ return &pstream_pr->stream_public;
+ }
+ return NULL;
+}
+
int get_rawpkt_opt_from_streaminfo(const struct streaminfo *pstream, int type, void *out_value)
{
int ret = -1;
@@ -636,11 +652,12 @@ void layer_addr_free(struct layer_addr *paddrinfo) free(paddrinfo);
}
-int get_thread_count(void)
+ int get_thread_count(void)
{
return g_packet_io_thread_num;
}
+
time_t get_timestamp_s(void)
{
return g_CurrentTime;
|
