'''"packetbufptr"''' is a pointer used to point to the memory location which stores the packet's data/payload part.
+
'''packetbufptr''' is used to point to the memory location which stores the packet's data/payload part.
−
'''hdrptr''' point to the first character of the header of a packet. For outgoing packets, the header is stored in the slots with number starting from '''hdrptr''' to '''PACKETBUF_HDR_SIZE-1'''. Keep in mind that the first location of an array is numbered as 0. Therefore, the header is stored in '''packetbuf[hdrptr]''' to '''packetbuf[PACKETBUF_HDR_SIZE-1]'''. For example say i.e say the PACKETBUF_HDR_SIZE is 9 and hdrptr=5 then '''packetbuf[5:8]''' contains the header.
+
'''hdrptr''' stores the index of the packetbuf array where the first character of the header of a packet is stored.
+
For outgoing packets, the header is stored in the slots with number starting from '''hdrptr''' to '''PACKETBUF_HDR_SIZE-1'''. Keep in mind that the first location of an array is numbered as 0. Therefore, the header is stored in '''packetbuf[hdrptr]''' to '''packetbuf[PACKETBUF_HDR_SIZE-1]'''. For example say i.e say the PACKETBUF_HDR_SIZE is 9 and hdrptr=5 then '''packetbuf[5:8]''' contains the header.
[[File:Header.jpg|400px|center]]
[[File:Header.jpg|400px|center]]
−
'''buflen''' refers to the size of the data stored in the data section of the packetbuf. For outgoing packets, it is the length of the packet's payload or data part. For incoming packet, since the whole packet is stored in the data section of the buffer, buflen referes to the total size of the packet.
+
'''buflen''' stores the size of the portion of a packet which is stored in the data section of the packetbuf.
+
For outgoing packets, it is the length of the packet's payload or data part. For incoming packet, since the whole packet is stored in the data section of the buffer, buflen referes to the total size of the packet.