Move NETLINK_ROUTE user objects under Netlink::Route
This commit is contained in:
@@ -8,7 +8,7 @@ require 'netlink/route'
|
||||
# The data is memoized - that is, it's downloaded from the kernel once
|
||||
# and then manipulated internally.
|
||||
|
||||
nl = Netlink::RTSocket.new
|
||||
nl = Netlink::Route::Socket.new
|
||||
pp nl.link["eth0"]
|
||||
pp nl.addrs["eth0"]
|
||||
|
||||
|
@@ -7,7 +7,7 @@ require 'netlink/route'
|
||||
# Example of use of low-level API for NETLINK_ROUTE socket.
|
||||
# Each of these method calls performs a netlink protocol exchange.
|
||||
|
||||
nl = Netlink::RTSocket.new
|
||||
nl = Netlink::Route::Socket.new
|
||||
puts "*** links ***"
|
||||
pp nl.read_links
|
||||
puts "*** addrs ***"
|
||||
|
@@ -136,8 +136,9 @@ module Netlink
|
||||
rtattr :table2, RTA_TABLE, :uint32 # NOTE: table in two places!
|
||||
end
|
||||
|
||||
module Route
|
||||
# This is the medium and high-level API using a NETLINK_ROUTE protocol socket
|
||||
class RTSocket < NLSocket
|
||||
class Socket < NLSocket
|
||||
def initialize(opt={})
|
||||
super(opt.merge(:protocol => Netlink::NETLINK_ROUTE))
|
||||
clear_cache
|
||||
@@ -285,3 +286,4 @@ module Netlink
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user