Class: Netconf::IOProc

Inherits:
Transport show all
Defined in:
lib/net/netconf/ioproc.rb

Constant Summary collapse

DEFAULT_RDBLKSZ =
(1024*1024)

Instance Attribute Summary collapse

Attributes inherited from Transport

#capabilities, #rpc, #session_id, #state, #timeout, #waitio

Instance Method Summary collapse

Methods inherited from Transport

#close, #closed?, #has_capability?, #open, #open?, #rpc_exec, #send_and_receive

Constructor Details

#initialize(args_h = {}, &block) ⇒ IOProc

Returns a new instance of IOProc.



9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/net/netconf/ioproc.rb', line 9

def initialize( args_h = {}, &block )
  os_type = args_h[:os_type] || Netconf::DEFAULT_OS_TYPE

  @args = args_h.clone

  # an OS specific implementation must exist to support this transport type
  extend Netconf::const_get( os_type )::IOProc

  @trans_timeout = @args[:timeout] || Netconf::DEFAULT_TIMEOUT
  @trans_waitio = @args[:waitio] || Netconf::DEFAULT_WAITIO

  super( &block )
end

Instance Attribute Details

#argsObject (readonly)

Returns the value of attribute args.



7
8
9
# File 'lib/net/netconf/ioproc.rb', line 7

def args
  @args
end

Instance Method Details

#puts(str = nil) ⇒ Object



49
50
51
# File 'lib/net/netconf/ioproc.rb', line 49

def puts( str = nil )
  @trans.puts( str )
end

#trans_closeObject



36
37
38
39
# File 'lib/net/netconf/ioproc.rb', line 36

def trans_close
  @trans.write Netconf::RPC::MSG_CLOSE_SESSION
  @trans.close
end

#trans_openObject

the OS specific transport must implement this method



24
25
26
# File 'lib/net/netconf/ioproc.rb', line 24

def trans_open # :yield: self
  raise "Unsupported IOProc"
end

#trans_receiveObject



45
46
47
# File 'lib/net/netconf/ioproc.rb', line 45

def trans_receive
  Netconf.trans_receive
end

#trans_receive_helloObject



28
29
30
# File 'lib/net/netconf/ioproc.rb', line 28

def trans_receive_hello
  trans_receive()
end

#trans_send(cmd_str) ⇒ Object



41
42
43
# File 'lib/net/netconf/ioproc.rb', line 41

def trans_send( cmd_str )
  @trans.write( cmd_str )
end

#trans_send_helloObject



32
33
34
# File 'lib/net/netconf/ioproc.rb', line 32

def trans_send_hello
  nil
end

#waitfor(on_re) ⇒ Object



53
54
55
# File 'lib/net/netconf/ioproc.rb', line 53

def waitfor( on_re )
  Netconf.waitfor(on_re)
end