Esp header size, payload size, and trailer size?

I need some help on ESP.
I want to calculate size of ESP header, its payload excluding ESP trailer, ESP trailer size, and AH size.
Is there a way to know that AH is used in the end of ESP or not? Please reply quick and with detail. Thanks.
 
The point is I can't calculate esp payload. and how am I supposed to get my pointer to esp trailer when I don't know the size of esp payload?
 
Again: what is specifically FreeBSD about this? Why wouldn't this be solved by following RFCs and other official protocol documentation?
 
Back
Top