Building.Open.Source.Network.Security.Tools.Components.And.Techniques [Electronic resources] نسخه متنی

This is a Digital Library

With over 100,000 free electronic resource in Persian, Arabic and English

Building.Open.Source.Network.Security.Tools.Components.And.Techniques [Electronic resources] - نسخه متنی

Mike D. Schiffman

| نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
لیست موضوعات
توضیحات
افزودن یادداشت جدید







Interface Functions

The interface family of functions enables the application programmer to have a simple way to query and set parameters on network interfaces. The libdnet interface information structure (described in the datatypes section) employs the flags summarized in Table 6.2 and Table 6.3 to control function and datatype disposition.


































Table 6.2: libdnet Interface Bitmask Values for intf_type

CONSTANT


MEANING





INTF_TYPE_ETH


Ethernet





INTF_TYPE_LOOPBACK


Software loopback
































































Table 6.3: libdnet Interface Bitmask Values for intf_flags

CONSTANT


MEANING





INTF_FLAG_UP


enable the interface





INTF_FLAG_LOOPBACK


interface sits on a loopback network





INTF_FLAG_POINTOPOINT


interface is point to point





INTF_FLAG_NOARP


disable ARP on the interface





INTF_FLAG_BROADCAST


interface supports broadcast





INTF_FLAG_MULTICAST


interface supports multicast









intf_t *intf_open(void);


intf_open() opens and initializes an interface handle for use in subsequent interface functions. Upon success, the function returns a valid intf_t descriptor; upon failure, the function returns NULL.



int intf_get(intf_t *i, struct intf_entry *entry);


intf_get() retrieves an interface configuration entry. To specify which interface, the application programmer should fill in the intf_name element of the entry structure to the canonical name of the interface desired. Upon success, the function returns 0; upon failure, the function returns −1 and sets errno.



int intf_get_src(intf_t *i, struct intf_entry *entry, struct
addr *src);


intf_get_src() retrieves the configuration for the interface whose primary address matches src. Upon success, the function returns 0; upon failure, the function returns −1 and sets errno.



int intf_get_dst(intf_t *i, struct intf_entry *entry, struct
addr *dst);


intf_get_dst() retrieves the configuration for the best interface with which to reach dst. Note that this function performs a TCP connect() to port 666 to the specified address. Upon success, the function returns 0; upon failure, the function returns −1 and sets errno.



int intf_set(intf_t *i, const struct intf_entry *entry);


intf_set() configures the specified network device to which entry refers. Upon success, the function returns 0; upon failure, the function returns −1 and sets errno.



int intf_loop(intf_t *i, intf_handler callback, void *arg);
int callback(const char *device, const struct intf_info *info,
void *arg);


intf_loop() iterates over all available interfaces on the system referenced by i, invoking the specified callback callback with the optional argument arg. Upon success, the function returns 0; upon failure, the function returns −1 and sets errno. The intf_loop() callback function format expects three arguments: a pointer to the device device, a pointer to the interface information structure info, and the optional argument arg.



intf_t *intf_close(intf_t *i);


intf_close() closes the underlying interface and frees any memory associated with i. The function returns NULL.

/ 135