Module: DhcpsApi::CommonMethods
- Included in:
- Option, Reservation, Server, Subnet
- Defined in:
- lib/dhcpsapi/common.rb
Instance Method Summary collapse
- #empty_response ⇒ Object
- #free_memory(a_struct) ⇒ Object
- #is_error?(exit_code) ⇒ Boolean
- #retrieve_items(method_to_call, *args) ⇒ Object
Instance Method Details
#empty_response ⇒ Object
94 95 96 |
# File 'lib/dhcpsapi/common.rb', line 94 def empty_response [[], 0, 0, 0] end |
#free_memory(a_struct) ⇒ Object
75 76 77 |
# File 'lib/dhcpsapi/common.rb', line 75 def free_memory(a_struct) DhcpsApi.DhcpRpcFreeMemory(a_struct.pointer) end |
#is_error?(exit_code) ⇒ Boolean
98 99 100 101 102 103 104 |
# File 'lib/dhcpsapi/common.rb', line 98 def is_error?(exit_code) !Set.new([ 0, # no error 234 # more data # 259 no more items ]).include?(exit_code) end |
#retrieve_items(method_to_call, *args) ⇒ Object
79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
# File 'lib/dhcpsapi/common.rb', line 79 def retrieve_items(method_to_call, *args) to_return = [] resume_handle = 0 loop do items, resume_handle, elements_read, elements_total = send(method_to_call, *args) to_return += items args.pop args.push(resume_handle) break if elements_read == elements_total end [to_return, resume_handle] end |