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

struct nl_addr* nl_addr_build ( int  family,
void *  buf,
size_t  size 
) [read]

Allocate new abstract address object based on a binary address.

  • family Address family.
  • buf Buffer containing the binary address.
  • size Length of binary address buffer.
    Returns:
    Newly allocated address handle or NULL

Definition at line 185 of file addr.c.

References nl_addr_alloc().

Referenced by nl_addr_alloc_attr(), and nl_addr_clone().

{
      struct nl_addr *addr;

      addr = nl_addr_alloc(size);
      if (!addr)
            return NULL;

      addr->a_family = family;
      addr->a_len = size;
      addr->a_prefixlen = size*8;

      if (size)
            memcpy(addr->a_addr, buf, size);

      return addr;
}


Generated by  Doxygen 1.6.0   Back to index