diff options
| author | yangwei <[email protected]> | 2023-11-16 12:05:09 +0800 |
|---|---|---|
| committer | yangwei <[email protected]> | 2023-11-16 12:05:40 +0800 |
| commit | f0521c6fd95e8e5e28b430dd252fa63024ffa0ad (patch) | |
| tree | eda7342b66f662e8a03a00cf1d031a97dcfb2330 /test | |
| parent | 4d010bd0e41b86cca3dfc94c9c54da850faeae4c (diff) | |
✨ feat(stream_rawpkt.h): update get current l3 l4 hdr interface
Diffstat (limited to 'test')
| -rw-r--r-- | test/test_app_sapp.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/test/test_app_sapp.c b/test/test_app_sapp.c index d0778ed..c2d5d2d 100644 --- a/test/test_app_sapp.c +++ b/test/test_app_sapp.c @@ -3,6 +3,7 @@ #include "sapp_private_api.h" #include "gdev_keepalive.h" #include "stream_base.h" +#include <netinet/in.h> #ifdef __cplusplus extern "C" { @@ -270,11 +271,17 @@ char print_stream_tunnel_type(struct streaminfo *a_tcp, void **pme, int thread_ } char test_get_this_layer_header(struct streaminfo *a_tcp, void **pme, int thread_seq,void *a_packet) { - struct mesa_ip4_hdr *ip4hdr = (struct mesa_ip4_hdr *)get_this_layer_header(a_tcp); - - DPRINT("iphdr:%p, ip->v=%d, ip->hl=%d, ip->len=%u\n", ip4hdr, ip4hdr->ip_v, ip4hdr->ip_hl*4, ntohs(ip4hdr->ip_len)); + if (a_packet) + { + struct mesa_ip4_hdr *ip4hdr = (struct mesa_ip4_hdr *)get_current_layer3_header(a_tcp); + DPRINT("iphdr:%p, ip->v=%d, ip->hl=%d, ip->len=%u\n", ip4hdr, ip4hdr->ip_v, ip4hdr->ip_hl * 4, + ntohs(ip4hdr->ip_len)); + struct mesa_tcp_hdr *tcphdr = (struct mesa_tcp_hdr *)get_current_layer4_header(a_tcp); + DPRINT("tcphdr:%p, tcp->flags=%hhu, tcp->off=%hhu, tcp->sport=%hu, tcp->dport->%hu\n", tcphdr, tcphdr->th_flags, tcphdr->th_off, + ntohs(tcphdr->th_sport), ntohs(tcphdr->th_dport)); + } - return APP_STATE_GIVEME; + return APP_STATE_GIVEME; } static void test_get_tcp_opts_show_detail(struct tcp_option *opt_array, int optnum) |
