From 17e54e2d0ea4041838bc4f5746c9b5a99394e413 Mon Sep 17 00:00:00 2001 From: david Date: Sat, 29 Oct 2011 19:40:14 +0000 Subject: [PATCH] Document ip_get_data and ip_get_data_any. --- libnetutil/netutil.cc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/libnetutil/netutil.cc b/libnetutil/netutil.cc index 0092a8757..240990585 100644 --- a/libnetutil/netutil.cc +++ b/libnetutil/netutil.cc @@ -687,11 +687,18 @@ static const void *ip_get_data_primitive(const void *packet, unsigned int *len, return NULL; } +/* Find the beginning of the data payload in the IP packet beginning at packet. + Returns the beginning of the payload, updates *len to be the length of the + payload, and fills in hdr if successful. Otherwise returns NULL and *hdr is + undefined. */ const void *ip_get_data(const void *packet, unsigned int *len, struct abstract_ip_hdr *hdr) { return ip_get_data_primitive(packet, len, hdr, true); } +/* As ip_get_data, except that it doesn't insist that the payload be a known + upper-layer protocol. This can matter in IPv6 where the last element of a nh + chain may be a protocol we don't know about. */ const void *ip_get_data_any(const void *packet, unsigned int *len, struct abstract_ip_hdr *hdr) { return ip_get_data_primitive(packet, len, hdr, false);