netfilter
firewalling, NAT, and packet mangling for linux
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
attr.h File Reference
#include <netlink/netlink.h>
#include <netlink/object.h>
#include <netlink/addr.h>
#include <netlink/data.h>
Include dependency graph for attr.h:
This graph shows which files directly or indirectly include this file:

Data Structures

struct  nla_policy
 Attribute validation policy. More...
 

Macros

Attribute Construction (Exception Based)
#define NLA_PUT(msg, attrtype, attrlen, data)
 Add unspecific attribute to netlink message. More...
 
#define NLA_PUT_TYPE(msg, type, attrtype, value)
 Add atomic type attribute to netlink message. More...
 
#define NLA_PUT_U8(msg, attrtype, value)   NLA_PUT_TYPE(msg, uint8_t, attrtype, value)
 Add 8 bit integer attribute to netlink message. More...
 
#define NLA_PUT_U16(msg, attrtype, value)   NLA_PUT_TYPE(msg, uint16_t, attrtype, value)
 Add 16 bit integer attribute to netlink message. More...
 
#define NLA_PUT_U32(msg, attrtype, value)   NLA_PUT_TYPE(msg, uint32_t, attrtype, value)
 Add 32 bit integer attribute to netlink message. More...
 
#define NLA_PUT_U64(msg, attrtype, value)   NLA_PUT_TYPE(msg, uint64_t, attrtype, value)
 Add 64 bit integer attribute to netlink message. More...
 
#define NLA_PUT_STRING(msg, attrtype, value)   NLA_PUT(msg, attrtype, strlen(value) + 1, value)
 Add string attribute to netlink message. More...
 
#define NLA_PUT_FLAG(msg, attrtype)   NLA_PUT(msg, attrtype, 0, NULL)
 Add flag attribute to netlink message. More...
 
#define NLA_PUT_MSECS(msg, attrtype, msecs)   NLA_PUT_U64(msg, attrtype, msecs)
 Add msecs attribute to netlink message. More...
 
#define NLA_PUT_ADDR(msg, attrtype, addr)
 Add address attribute to netlink message. More...
 
#define NLA_PUT_DATA(msg, attrtype, data)
 Add abstract data attribute to netlink message. More...
 
Iterators
#define nla_for_each_attr(pos, head, len, rem)
 Iterate over a stream of attributes. More...
 
#define nla_for_each_nested(pos, nla, rem)
 Iterate over a stream of nested attributes. More...
 

Functions

int nla_attr_size (int payload)
 Return size of attribute whithout padding. More...
 
int nla_total_size (int payload)
 Return size of attribute including padding. More...
 
int nla_padlen (int payload)
 Return length of padding at the tail of the attribute. More...
 
int nla_type (const struct nlattr *)
 Return type of the attribute. More...
 
void * nla_data (const struct nlattr *)
 Return pointer to the payload section. More...
 
int nla_len (const struct nlattr *)
 Return length of the payload . More...
 
int nla_ok (const struct nlattr *, int)
 Check if the attribute header and payload can be accessed safely. More...
 
struct nlattrnla_next (const struct nlattr *, int *)
 Return next attribute in a stream of attributes. More...
 
int nla_parse (struct nlattr **, int, struct nlattr *, int, struct nla_policy *)
 
int nla_validate (struct nlattr *, int, int, struct nla_policy *)
 Validate a stream of attributes. More...
 
struct nlattrnla_find (struct nlattr *, int, int)
 Find a single attribute in a stream of attributes. More...
 
int nla_memcpy (void *, struct nlattr *, int)
 Copy attribute payload to another memory area. More...
 
size_t nla_strlcpy (char *, const struct nlattr *, size_t)
 Copy string attribute payload to a buffer. More...
 
int nla_memcmp (const struct nlattr *, const void *, size_t)
 Compare attribute payload with memory area. More...
 
int nla_strcmp (const struct nlattr *, const char *)
 Compare string attribute payload with string. More...
 
struct nlattrnla_reserve (struct nl_msg *, int, int)
 Reserve space for a attribute. More...
 
int nla_put (struct nl_msg *, int, int, const void *)
 Add a unspecific attribute to netlink message. More...
 
int nla_put_data (struct nl_msg *, int, struct nl_data *)
 Add abstract data as unspecific attribute to netlink message. More...
 
int nla_put_addr (struct nl_msg *, int, struct nl_addr *)
 Add abstract address as unspecific attribute to netlink message. More...
 
uint8_t nla_get_u8 (struct nlattr *)
 Return value of 8 bit integer attribute. More...
 
int nla_put_u8 (struct nl_msg *, int, uint8_t)
 Add 8 bit integer attribute to netlink message. More...
 
uint16_t nla_get_u16 (struct nlattr *)
 Return payload of 16 bit integer attribute. More...
 
int nla_put_u16 (struct nl_msg *, int, uint16_t)
 Add 16 bit integer attribute to netlink message. More...
 
uint32_t nla_get_u32 (struct nlattr *)
 Return payload of 32 bit integer attribute. More...
 
int nla_put_u32 (struct nl_msg *, int, uint32_t)
 Add 32 bit integer attribute to netlink message. More...
 
uint64_t nla_get_u64 (struct nlattr *)
 Return payload of u64 attribute. More...
 
int nla_put_u64 (struct nl_msg *, int, uint64_t)
 Add 64 bit integer attribute to netlink message. More...
 
char * nla_get_string (struct nlattr *)
 Return payload of string attribute. More...
 
char * nla_strdup (struct nlattr *)
 
int nla_put_string (struct nl_msg *, int, const char *)
 Add string attribute to netlink message. More...
 
int nla_get_flag (struct nlattr *)
 Return true if flag attribute is set. More...
 
int nla_put_flag (struct nl_msg *, int)
 Add flag netlink attribute to netlink message. More...
 
unsigned long nla_get_msecs (struct nlattr *)
 Return payload of msecs attribute. More...
 
int nla_put_msecs (struct nl_msg *, int, unsigned long)
 Add a msecs netlink attribute to a netlink message. More...
 
int nla_put_nested (struct nl_msg *, int, struct nl_msg *)
 Add nested attributes to netlink message. More...
 
struct nlattrnla_nest_start (struct nl_msg *, int)
 Start a new level of nested attributes. More...
 
int nla_nest_end (struct nl_msg *, struct nlattr *)
 Finalize nesting of attributes. More...
 
int nla_parse_nested (struct nlattr **, int, struct nlattr *, struct nla_policy *)
 

Basic Attribute Data Types

#define NLA_TYPE_MAX   (__NLA_TYPE_MAX - 1)
 
enum  {
  NLA_UNSPEC,
  NLA_U8,
  NLA_U16,
  NLA_U32,
  NLA_U64,
  NLA_STRING,
  NLA_FLAG,
  NLA_MSECS,
  NLA_NESTED,
  __NLA_TYPE_MAX
}
 Basic attribute data types. More...
 

Macro Definition Documentation

#define NLA_TYPE_MAX   (__NLA_TYPE_MAX - 1)

Function Documentation

int nla_parse ( struct nlattr **  ,
int  ,
struct nlattr ,
int  ,
struct nla_policy  
)

Referenced by genlmsg_parse(), and nlmsg_parse().

Here is the caller graph for this function:

int nla_parse_nested ( struct nlattr **  ,
int  ,
struct nlattr ,
struct nla_policy  
)