Logo Search packages:      
Sourcecode: libnl2 version File versions  Download package

int nla_ok ( const struct nlattr *  nla,
int  remaining 
)

Check if the attribute header and payload can be accessed safely.

  • nla Attribute of any kind.
  • remaining Number of bytes remaining in attribute stream.
Verifies that the header and payload do not exceed the number of bytes left in the attribute stream. This function must be called before access the attribute header or payload when iterating over the attribute stream using nla_next().

Returns:
True if the attribute can be accessed safely, false otherwise.

Definition at line 488 of file attr.c.

{
      return remaining >= sizeof(*nla) &&
             nla->nla_len >= sizeof(*nla) &&
             nla->nla_len <= remaining;
}


Generated by  Doxygen 1.6.0   Back to index