Creating a new variable in C from only part of an existing u_char -
I am writing some code to parse the IEEE 802.11 frame, but I am trying to create a new variable whose length depends on the size of the frame.
Here I currently have the code:
frames_bab = len = pkt_hdr-> Lennon-radio_hdr- & gt; Lennon-wifi_hdr_len - 4; U_char * frame_body = (u_char *) (Packet + Radio_Hrit-> Lennon + Wifi_HDR_LN);
Basically, the frame has a header, a body, and a checksum at the end. Calculate the length of the frame by taking the length of the packet and decreasing the length of the two headers, which appear before ( radio_hdr-> len
and wifi_hdr_len
respectively), plus At the end for 4 bytes checksium.
However, how can I make the frame_body
variable without the checksum of the rear? Right now, I'm starting with the contents of the packet starting with the status after two headers, but there is no way to start from that position and end the 4 bytes before the end of packet
? The packet
is an indicator for U_Acher, if it helps.
I am a new programmer, so you can give me any further advice about my code. I would greatly appreciate it. Thanks!