Class: FFI::LibC::Ifaddrs

Inherits:
Struct
  • Object
show all
Defined in:
lib/ffi/libc/ifaddrs.rb

Overview

Since:

  • 0.1.0

Instance Method Summary collapse

Instance Method Details

#addrSockaddr

The address of the Interface.

Returns:

  • (Sockaddr)

    The basic socket address.

Since:

  • 0.1.0



57
58
59
# File 'lib/ffi/libc/ifaddrs.rb', line 57

def addr
  Sockaddr.new(self[:ifa_addr])
end

#broadaddrSockaddr

The broadcast address of the Interface.

Returns:

Since:

  • 0.1.0



77
78
79
# File 'lib/ffi/libc/ifaddrs.rb', line 77

def broadaddr
  Sockaddr.new(self[:ifa_ifu][:ifu_broadaddr])
end

#dstaddrSockaddr

The destination address of the Interface.

Returns:

  • (Sockaddr)

    The destination address.

Since:

  • 0.1.0



87
88
89
# File 'lib/ffi/libc/ifaddrs.rb', line 87

def dstaddr
  Sockaddr.new(self[:ifa_ifu][:ifu_dstaddr])
end

#flagsInteger

The flags of the Interface.

Returns:

  • (Integer)

    The flags.

Since:

  • 0.1.0



47
48
49
# File 'lib/ffi/libc/ifaddrs.rb', line 47

def flags
  self[:ifa_flags]
end

#nameString

The name of the Interface.

Returns:

  • (String)

    The name.

Since:

  • 0.1.0



37
38
39
# File 'lib/ffi/libc/ifaddrs.rb', line 37

def name
  self[:ifa_name]
end

#netmaskSockaddr

The netmask of the Interface.

Returns:

  • (Sockaddr)

    The socket address containing the netmask.

Since:

  • 0.1.0



67
68
69
# File 'lib/ffi/libc/ifaddrs.rb', line 67

def netmask
  Sockaddr.new(self[:ifa_netmask])
end

#nextIfaddrs?

Gets the next Interface Address in the list.

Returns:

  • (Ifaddrs, nil)

    The next Interface Address in the list.

Since:

  • 0.1.0



25
26
27
28
29
# File 'lib/ffi/libc/ifaddrs.rb', line 25

def next
  unless self[:ifa_next].null?
    Ifaddrs.new(self[:ifa_next])
  end
end