Net

- Main Page
- Related Pages
- Modules
- Namespaces
- Data Structures
- Files
- Examples

Typedefs | Enumerations | Functions
Net
Eeze

Gather information about network devices. More...

## Typedefs
typedef struct Eeze_Net | Eeze_Net

## Enumerations
enum | Eeze_Net_Addr_Type { EEZE_NET_ADDR_TYPE_IP, EEZE_NET_ADDR_TYPE_IP6, EEZE_NET_ADDR_TYPE_BROADCAST, EEZE_NET_ADDR_TYPE_BROADCAST6, EEZE_NET_ADDR_TYPE_NETMASK, EEZE_NET_ADDR_TYPE_NETMASK6 }

## Functions
Eeze_Net * | eeze_net_new (const char *name)
| Create a new net object. More...
void | eeze_net_free (Eeze_Net *net)
| Free a net object. More...
const char * | eeze_net_mac_get (Eeze_Net *net)
| Get the MAC address of a net object. More...
int | eeze_net_idx_get (Eeze_Net *net)
| Get the index of a net object. More...
Eina_Bool | eeze_net_scan (Eeze_Net *net)
| Scan an interface to cache its network addresses. More...
const char * | eeze_net_addr_get (Eeze_Net *net, Eeze_Net_Addr_Type type)
| Get the address of a net object. More...
const char * | eeze_net_attribute_get (Eeze_Net *net, const char *attr)
| Get a system attribute of a net object. More...
const char * | eeze_net_syspath_get (Eeze_Net *net)
| Get the /sys/ path of a net object. More...
Eina_List * | eeze_net_list (void)
| Get a list of all the network interfaces available. More...

## Detailed Description

Gather information about network devices.

## Function Documentation

EAPI Eeze_Net * eeze_net_new | ( | const char * | name | ) |

Create a new net object.

Parameters

  name | The name of the underlying device (eth0, br1, etc)

Returns
  A newly allocated net object, or NULL on failure

This function creates a new net object based on `name`. Only the most minimal lookups are performed at creation in order to save memory.

References eina_hash_add(), eina_hash_find(), EINA_REFCOUNT_INIT, EINA_REFCOUNT_REF, eina_stringshare_add(), and eina_stringshare_del().

Referenced by eeze_net_list().

EAPI void eeze_net_free | ( | Eeze_Net * | net | ) |

Free a net object.

Parameters

  net | The object to free

Use this function to free a net object.

See also
  eeze_net_new()
  eeze_net_list()

References eina_hash_del_by_key(), EINA_REFCOUNT_UNREF, and eina_stringshare_del().

EAPI const char * eeze_net_mac_get | ( | Eeze_Net * | net | ) |

Get the MAC address of a net object.

Parameters

  net | The net object

Returns
  The MAC address, NULL on failure Use this function to retrieve the non-stringshared MAC address of `net`.

EAPI int eeze_net_idx_get | ( | Eeze_Net * | net | ) |

Get the index of a net object.

Parameters

  net | The net object

Returns
  The ifindex of the object, -1 on failure Use this function to get the hardware index of `net`

EAPI Eina_Bool eeze_net_scan | ( | Eeze_Net * | net | ) |

Scan an interface to cache its network addresses.

Parameters

  net | The net object to scan

Returns
  EINA_TRUE on success, EINA_FALSE on failure Use this function to scan and cache the ip address, netmask, and broadcast address for an interface. This function will perform a full scan every time it is called, and IPv6 addresses will be cached if Eeze was compiled with IPv6 support was enabled at compile time.

See also
  eeze_net_addr_get()

References EINA_FALSE, and EINA_TRUE.

EAPI const char * eeze_net_addr_get | ( | Eeze_Net * | net,
|  | Eeze_Net_Addr_Type | type
| ) |  |

Get the address of a net object.

Parameters

  net | The net object
  type | The type of address to retrieve

Returns
  The stringshared address for `net` corresponding to `type`, NULL on failure This function returns a value previously cached.

See also
  eeze_net_scan()

EAPI const char * eeze_net_attribute_get | ( | Eeze_Net * | net,
|  | const char * | attr
| ) |  |

Get a system attribute of a net object.

Parameters

  net | The net object
  attr | The attribute to retrieve

Returns
  The non-stringshared value of the attribute, NULL on failure Use this function to perform a udev sysattr lookup on the underlying device of `net`

EAPI const char * eeze_net_syspath_get | ( | Eeze_Net * | net | ) |

Get the /sys/ path of a net object.

Parameters

  net | The net object

Returns
  The stringshared /sys/ path of the interface, NULL on failure

EAPI Eina_List * eeze_net_list | ( | void |  | ) |

Get a list of all the network interfaces available.

Returns
  A list of Eeze_Net objects Use this function to get all network interfaces available to the application. This list must be freed by the user.

References eeze_net_new(), and eina_list_append().