net: buf: Add API for saving & restoring parsing state
net: buf: Add API for saving & restoring parsing state

Occasionally it may be useful to pass a buffer to a subroutine and
have the routine do parsing of the buffer. However, since there isn't
necessarily a guarantee of how the subroutine performs the parsing it
may be necessary to restore to a well known state after the routine
returns.

This patch adds a simple struct for storing the parsing state as well
as two new functions to save and restore the state.

Change-Id: If9153ff9997021c76243ea9ebff13dfe94c45faa
Signed-off-by: Johan Hedberg <628991c7b0a19c384f9b99c21ec330ce952bb838@intel.com>

holtmann/zephyr,punitvara/zephyr,Vudentz/zephyr,zephyriot/zephyr,zephyriot/zephyr,pklazy/zephyr,bigdinotech/zephyr,runchip/zephyr-cc3200,ldts/zephyr,finikorg/zephyr,sharronliu/zephyr,explora26/zephyr,galak/zephyr,Vudentz/zephyr,sharronliu/zephyr,nashif/zephyr,zephyrproject-rtos/zephyr,galak/zephyr,finikorg/zephyr,explora26/zephyr,runchip/zephyr-cc3200,erwango/zephyr,holtmann/zephyr,kraj/zephyr,Vudentz/zephyr,bboozzoo/zephyr,ldts/zephyr,runchip/zephyr-cc3220,runchip/zephyr-cc3220,fractalclone/zephyr-riscv,sharronliu/zephyr,fractalclone/zephyr-riscv,mbolivar/zephyr,fbsder/zephyr,rsalveti/zephyr,sharronliu/zephyr,aceofall/zephyr-iotos,bigdinotech/zephyr,GiulianoFranchetto/zephyr,aceofall/zephyr-iotos,bigdinotech/zephyr,mirzak/zephyr-os,aceofall/zephyr-iotos,tidyjiang8/zephyr-doc,zephyrproject-rtos/zephyr,nashif/zephyr,runchip/zephyr-cc3220,rsalveti/zephyr,fbsder/zephyr,GiulianoFranchetto/zephyr,Vudentz/zephyr,rsalveti/zephyr,tidyjiang8/zephyr-doc,mbolivar/zephyr,runchip/zephyr-cc3200,nashif/zephyr,tidyjiang8/zephyr-doc,pklazy/zephyr,punitvara/zephyr,punitvara/zephyr,runchip/zephyr-cc3200,explora26/zephyr,mbolivar/zephyr,erwango/zephyr,zephyrproject-rtos/zephyr,Vudentz/zephyr,kraj/zephyr,kraj/zephyr,aceofall/zephyr-iotos,zephyrproject-rtos/zephyr,kraj/zephyr,aceofall/zephyr-iotos,galak/zephyr,fractalclone/zephyr-riscv,runchip/zephyr-cc3200,punitvara/zephyr,holtmann/zephyr,explora26/zephyr,mirzak/zephyr-os,GiulianoFranchetto/zephyr,zephyriot/zephyr,tidyjiang8/zephyr-doc,bigdinotech/zephyr,galak/zephyr,bboozzoo/zephyr,holtmann/zephyr,bboozzoo/zephyr,zephyrproject-rtos/zephyr,runchip/zephyr-cc3220,bboozzoo/zephyr,zephyriot/zephyr,runchip/zephyr-cc3220,fbsder/zephyr,mirzak/zephyr-os,nashif/zephyr,fbsder/zephyr,GiulianoFranchetto/zephyr,fractalclone/zephyr-riscv,nashif/zephyr,finikorg/zephyr,punitvara/zephyr,pklazy/zephyr,finikorg/zephyr,GiulianoFranchetto/zephyr,ldts/zephyr,bboozzoo/zephyr,ldts/zephyr,erwango/zephyr,finikorg/zephyr,rsalveti/zephyr,erwango/zephyr,mirzak/zephyr-os,mbolivar/zephyr,mbolivar/zephyr,bigdinotech/zephyr,pklazy/zephyr,fbsder/zephyr,fractalclone/zephyr-riscv,zephyriot/zephyr,explora26/zephyr,galak/zephyr,mirzak/zephyr-os,rsalveti/zephyr,erwango/zephyr,sharronliu/zephyr,holtmann/zephyr,tidyjiang8/zephyr-doc,Vudentz/zephyr,kraj/zephyr,pklazy/zephyr,ldts/zephyr