Net

- Main Page
- Related Pages
- Modules
- 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.
void | eeze_net_free (Eeze_Net *net)
| Free a net object.
const char * | eeze_net_mac_get (Eeze_Net *net)
| Get the MAC address of a net object.
int | eeze_net_idx_get (Eeze_Net *net)
| Get the index of a net object.
Eina_Bool | eeze_net_scan (Eeze_Net *net)
| Scan an interface to cache its network addresses.
const char * | eeze_net_addr_get (Eeze_Net *net, Eeze_Net_Addr_Type type)
| Get the address of a net object.
const char * | eeze_net_attribute_get (Eeze_Net *net, const char *attr)
| Get a system attribute of a net object.
const char * | eeze_net_syspath_get (Eeze_Net *net)
| Get the /sys/ path of a net object.
Eina_List * | eeze_net_list (void)
| Get a list of all the network interfaces available.

## Detailed Description

Gather information about network devices.

## Function Documentation

## ◆ eeze_net_new()

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().

## ◆ eeze_net_free()

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, EINA_SAFETY_ON_NULL_RETURN, and eina_stringshare_del().

## ◆ eeze_net_mac_get()

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`.

References EINA_SAFETY_ON_NULL_RETURN_VAL.

## ◆ eeze_net_idx_get()

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`

References EINA_SAFETY_ON_NULL_RETURN_VAL.

## ◆ eeze_net_scan()

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, EINA_SAFETY_ON_NULL_RETURN_VAL, eina_stringshare_replace_length(), and EINA_TRUE.

## ◆ eeze_net_addr_get()

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()

References EINA_SAFETY_ON_NULL_RETURN_VAL.

## ◆ eeze_net_attribute_get()

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`

References EINA_SAFETY_ON_NULL_RETURN_VAL, and EINA_SAFETY_ON_TRUE_RETURN_VAL.

## ◆ eeze_net_syspath_get()

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

References EINA_SAFETY_ON_NULL_RETURN_VAL.

## ◆ eeze_net_list()

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().