Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3841496
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T15:39:40+00:00 2026-05-19T15:39:40+00:00

00000 45 00 02 87 8a 97 40 00 40 06 af d7 7f

  • 0
00000   45 00 02 87 8a 97 40 00  40 06 af d7 7f 00 00 01    E.....@.@.......
00016   7f 00 00 01 e0 56 00 50  0d 46 70 a8 0c e2 41 70    .....V.P.Fp...Ap
00032   80 18 01 01 b9 70 00 00  01 01 08 0a 00 64 fa 32    .....p.......d.2

This is how Wireshark/tcpdump/my code represents a part of TCP packet stored in dump file.
Third line’s first value, 80, it a correct TCP data offset of 32 bytes, or 8 32-bit (4 byte) words.

However, when (in my code), struct tcp_hdr is created over this payload (including ip header offset etc), the result of reading my_tcphdr->doff is 6, (equivalent for 24 bytes).

Suppose that reading such data from structure somehow isn’t enough healthy.

How can I read this 4-bit (0xF0?) value to some int, given the (known as correct) pointer: unsigned char *doff = tcp_payload+MAGIC_16?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T15:39:41+00:00Added an answer on May 19, 2026 at 3:39 pm

    You’d extract the byte and shift it 4 places to the right.

    unsigned char *doff = tcp_payload+MAGIC_16
    unsigned char doffval = (*doff) >>4;
    

    As of why your struct tcp_hdr didn’t “work”, you should post that. Perhaps it’s using the wrong endian, or the struct get padded so it doesn’t match the on wire format.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This Code: Something = new Guid() is returning: 00000000-0000-0000-0000-000000000000 all the time and I
I see output like this in my DMP file: Heap entries for Segment00 in
I posted another question similar. This is my old code as some ppl say
I have a table with 3 columns which looks like this: File User Rating
This is my input file to the problem, it contains different type of n/w
Well lets say we have this c# code: public override void Write(XDRDestination destination) {
In my computer this code takes 17 seconds (1000 millions times): static void Main(string[]
I have the following code: <html> <body> <div style=background-color: lightblue; onClick=alert(myArray[0][1])> this is a
I have a csv file with dump data of table and I would like
The code abs(070000) returns 28672, but the code abs(70000) returns 70000. Did the zero

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.