Class: CIMD::Connection

Inherits:
Object
  • Object
show all
Defined in:
lib/cimd_structures.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(server, port, user_identity, password, alpha_orig_address, window_size, keep_alive) ⇒ Connection

Returns a new instance of Connection.



14
15
16
17
18
19
20
21
22
23
# File 'lib/cimd_structures.rb', line 14

def initialize(server,port,user_identity,password,alpha_orig_address,window_size,keep_alive)
  @server = server
  @port = port
  @user_identity = user_identity
  @password = password
  @keep_alive = keep_alive
  @packet_number = 1
  @alpha_orig_address = alpha_orig_address
  @window_size = window_size
end

Instance Attribute Details

#alpha_orig_addressObject

Returns the value of attribute alpha_orig_address.



12
13
14
# File 'lib/cimd_structures.rb', line 12

def alpha_orig_address
  @alpha_orig_address
end

#keep_aliveObject

Returns the value of attribute keep_alive.



9
10
11
# File 'lib/cimd_structures.rb', line 9

def keep_alive
  @keep_alive
end

#packet_numberObject

Returns the value of attribute packet_number.



10
11
12
# File 'lib/cimd_structures.rb', line 10

def packet_number
  @packet_number
end

#passwordObject

Returns the value of attribute password.



8
9
10
# File 'lib/cimd_structures.rb', line 8

def password
  @password
end

#portObject

Returns the value of attribute port.



6
7
8
# File 'lib/cimd_structures.rb', line 6

def port
  @port
end

#serverObject

Returns the value of attribute server.



5
6
7
# File 'lib/cimd_structures.rb', line 5

def server
  @server
end

#user_identityObject

Returns the value of attribute user_identity.



7
8
9
# File 'lib/cimd_structures.rb', line 7

def user_identity
  @user_identity
end

#window_sizeObject

Returns the value of attribute window_size.



11
12
13
# File 'lib/cimd_structures.rb', line 11

def window_size
  @window_size
end

Instance Method Details

#packet_number!Object



33
34
35
36
37
# File 'lib/cimd_structures.rb', line 33

def packet_number!
  f = @packet_number
  (@packet_number += 2) > 255 ? @packet_number = 1 : @packet_number
  return f
end

#packet_number?Boolean

Returns:

  • (Boolean)


29
30
31
# File 'lib/cimd_structures.rb', line 29

def packet_number?
  return @packet_number
end

#to_sObject



25
26
27
# File 'lib/cimd_structures.rb', line 25

def to_s
  return sprintf "\n\n*** Connection object:\nServer: %s\n,Port: %s\n,User identity: %s\nPassword: %s\nKeep Alive: %3d\nAlpha Orig Address: %s\n Packet number: %d\n\n",@server,@port,@user_identity,@password,@keep_alive,@alpha_orig_address,@packet_number
end