This function clears the packetbuf and resets all internal state pointers (header size, header pointer, external data pointer). It is used before preparing a packet in the packetbuf or copying a packet to the packetbuf.
This function clears the packetbuf and resets all internal state pointers (header size, header pointer, external data pointer). It is used before preparing a packet in the packetbuf or copying a packet to the packetbuf.
+
+However this function doesn't delete the previous data. It just resets the pointers and variables discussed in the previous section.
+The source code for this function is as follows.
+<source lang="c">
+buflen = bufptr = 0;
+hdrptr = PACKETBUF_HDR_SIZE;
+packetbufptr = &packetbuf[PACKETBUF_HDR_SIZE];
+packetbuf_attr_clear();
+</source>
+The following code resets the variables that points to the payload section. Setting '''buflen''' to be '''zero''' means that the buffer doesn't contain a payload/data part of a packet. Setting '''bufptr''' to be '''zero''' implies that the new packet's data must be stores from the beginning of the buffer's data section.
buflen = bufptr = 0;
buflen = bufptr = 0;
Exception encountered, of type "Error"