|
# File radius/auth.rb, line 46
def initialize(dictfilename, radhost, myip, timeout)
@dict = Radius::Dict.new
if dictfilename != nil
File.open(dictfilename) {
|fn|
@dict.read(fn)
}
end
@packet = Radius::Packet.new(@dict)
# this is probably better than starting identifiers at 0
@packet.identifier = Process.pid & 0xff
@myip = myip
@host, @port = radhost.split(":")
@port = Socket.getservbyname("radius", "udp") unless @port
@port = 1812 unless @port
@port = @port.to_i # just in case
@timeout = timeout
@sock = UDPSocket.open
@sock.connect(@host, @port)
end
|