Class: OSPFv2::Options
Instance Attribute Summary collapse
-
#options ⇒ Object
Returns the value of attribute options.
Instance Method Summary collapse
- #dc? ⇒ Boolean
- #e? ⇒ Boolean
- #encode ⇒ Object
-
#initialize(arg = {}) ⇒ Options
constructor
A new instance of Options.
- #l? ⇒ Boolean
- #mc? ⇒ Boolean
- #n? ⇒ Boolean
- #o? ⇒ Boolean
- #p? ⇒ Boolean
- #set(arg) ⇒ Object
- #setDC ⇒ Object
- #setE ⇒ Object
-
#setL ⇒ Object
A new L-bit (L stands for LLS) is introduced into the OSPF Options field (see Figures 2a and 2b).
- #setMC ⇒ Object
-
#setN ⇒ Object
N-bit is used in Hello packets only.
- #setNSSA ⇒ Object
- #setO ⇒ Object
-
#setP ⇒ Object
P-bit is used in Type-7 LSA Header It signals the NSSA border to translate the Type-7 into Type-5.
- #setV6 ⇒ Object
- #to_hash ⇒ Object
- #to_i ⇒ Object
-
#to_s ⇒ Object
V6-bit If this bit is clear, the router/link should be excluded from IPv6 routing calculations.
- #unsetDC ⇒ Object
- #unsetE ⇒ Object
- #unsetL ⇒ Object
- #unsetMC ⇒ Object
- #unsetN ⇒ Object
- #unsetO ⇒ Object
- #unsetP ⇒ Object
- #unsetV6 ⇒ Object
- #v6? ⇒ Boolean
Constructor Details
#initialize(arg = {}) ⇒ Options
Returns a new instance of Options.
120 121 122 123 124 125 126 127 128 129 130 131 132 133 |
# File 'lib/ie/options.rb', line 120 def initialize(arg={}) @options=0 if arg.is_a?(Hash) then set(arg) elsif arg.is_a?(String) _parse_(arg) elsif arg.is_a?(Fixnum) and (0..255) === arg @options = arg elsif arg.is_a?(self.class) set(arg.to_hash) else raise ArgumentError, "Invalid argument", caller end end |
Instance Attribute Details
#options ⇒ Object
Returns the value of attribute options.
118 119 120 |
# File 'lib/ie/options.rb', line 118 def @options end |
Instance Method Details
#dc? ⇒ Boolean
272 |
# File 'lib/ie/options.rb', line 272 def dc? ; __isSet(6) ; end |
#e? ⇒ Boolean
300 |
# File 'lib/ie/options.rb', line 300 def e? ; __isSet(2) ; end |
#encode ⇒ Object
311 312 313 |
# File 'lib/ie/options.rb', line 311 def encode [@options].pack('C') end |
#l? ⇒ Boolean
280 |
# File 'lib/ie/options.rb', line 280 def l? ; __isSet(5) ; end |
#mc? ⇒ Boolean
296 |
# File 'lib/ie/options.rb', line 296 def mc? ; __isSet(3) ; end |
#n? ⇒ Boolean
286 |
# File 'lib/ie/options.rb', line 286 def n? ; __isSet(4) ; end |
#o? ⇒ Boolean
268 |
# File 'lib/ie/options.rb', line 268 def o? ; __isSet(7) ; end |
#p? ⇒ Boolean
292 |
# File 'lib/ie/options.rb', line 292 def p? ; __isSet(4) ; end |
#set(arg) ⇒ Object
135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 |
# File 'lib/ie/options.rb', line 135 def set(arg) return self unless arg.is_a?(Hash) unless arg[:O].nil? and arg[:o].nil? _flag = arg[:O] ||= arg[:o] if _flag.is_a?(TrueClass) setO elsif _flag.is_a?(FalseClass) unsetO elsif _flag.is_a?(Fixnum) if _flag == 0 unsetO else setO end end end unless arg[:DC].nil? and arg[:dc].nil? _flag = arg[:DC] ||= arg[:dc] if _flag.is_a?(TrueClass) setDC elsif _flag.is_a?(FalseClass) unsetDC elsif _flag.is_a?(Fixnum) if _flag == 0 unsetDC else setDC end end end unless arg[:L].nil? and arg[:l].nil? _flag = arg[:L] ||= arg[:l] if _flag.is_a?(TrueClass) setL elsif _flag.is_a?(FalseClass) unsetL elsif _flag.is_a?(Fixnum) if _flag == 0 unsetL else setL end end end unless arg[:N].nil? and arg[:n].nil? _flag = arg[:N] ||= arg[:n] if _flag.is_a?(TrueClass) setN elsif _flag.is_a?(FalseClass) unsetN elsif _flag.is_a?(Fixnum) if _flag == 0 unsetN else setN end end end unless arg[:P].nil? and arg[:p].nil? _flag = arg[:P] ||= arg[:p] if _flag.is_a?(TrueClass) setP elsif _flag.is_a?(FalseClass) unsetP elsif _flag.is_a?(Fixnum) if _flag == 0 unsetP else setP end end end unless arg[:MC].nil? and arg[:mc].nil? _flag = arg[:MC] ||= arg[:mc] if _flag.is_a?(TrueClass) setMC elsif _flag.is_a?(FalseClass) unsetMC elsif _flag.is_a?(Fixnum) if _flag == 0 unsetMC else setMC end end end unless arg[:E].nil? and arg[:e].nil? _flag = arg[:E] ||= arg[:e] if _flag.is_a?(TrueClass) setE elsif _flag.is_a?(FalseClass) unsetE elsif _flag.is_a?(Fixnum) if _flag == 0 unsetE else setE end end end unless arg[:V6].nil? and arg[:v6].nil? _flag = arg[:V6] ||= arg[:v6] if _flag.is_a?(TrueClass) setV6 elsif _flag.is_a?(FalseClass) unsetV6 elsif _flag.is_a?(Fixnum) if _flag == 0 unsetV6 else setV6 end end end self end |
#setDC ⇒ Object
270 |
# File 'lib/ie/options.rb', line 270 def setDC ; __setBit(6) ; end |
#setE ⇒ Object
298 |
# File 'lib/ie/options.rb', line 298 def setE ; __setBit(2) ; end |
#setL ⇒ Object
A new L-bit (L stands for LLS) is introduced into the OSPF Options field (see Figures 2a and 2b). Routers set the L-bit in Hello and DD packets to indicate that the packet contains an LLS data block. In other words, the LLS data block is only examined if the L-bit is set.
278 |
# File 'lib/ie/options.rb', line 278 def setL ; __setBit(5) ; end |
#setMC ⇒ Object
294 |
# File 'lib/ie/options.rb', line 294 def setMC ; __setBit(3) ; end |
#setN ⇒ Object
N-bit is used in Hello packets only. It signals the area is an NSSA area.
284 |
# File 'lib/ie/options.rb', line 284 def setN ; __setBit(4) ; end |
#setNSSA ⇒ Object
306 307 308 309 |
# File 'lib/ie/options.rb', line 306 def setNSSA setN unsetE end |
#setO ⇒ Object
266 |
# File 'lib/ie/options.rb', line 266 def setO ; __setBit(7) ; end |
#setP ⇒ Object
P-bit is used in Type-7 LSA Header It signals the NSSA border to translate the Type-7 into Type-5.
290 |
# File 'lib/ie/options.rb', line 290 def setP ; __setBit(4) ; end |
#setV6 ⇒ Object
302 |
# File 'lib/ie/options.rb', line 302 def setV6 ; __setBit(1) ; end |
#to_hash ⇒ Object
355 356 357 |
# File 'lib/ie/options.rb', line 355 def to_hash to_i end |
#to_i ⇒ Object
351 352 353 |
# File 'lib/ie/options.rb', line 351 def to_i @options end |
#to_s ⇒ Object
V6-bit
If this bit is clear, the router/link should be excluded from IPv6
routing calculations. See Section 3.8 of this memo.
E-bit
This bit describes the way AS-external-LSAs are flooded, as
described in Sections 3.6, 9.5, 10.8 and 12.1.2 of [Ref1].
MC-bit
This bit describes whether IP multicast datagrams are forwarded
according to the specifications in [Ref7].
N-bit
This bit describes the handling of Type-7 LSAs, as specified in
[Ref8].
R-bit
This bit (the `Router' bit) indicates whether the originator is an
active router. If the router bit is clear routes which transit the
advertising node cannot be computed. Clearing the router bit would
be appropriate for a multi-homed host that wants to participate in
routing, but does not want to forward non-locally addressed
packets.
DC-bit
This bit describes the router's handling of demand circuits, as
specified in [Ref10].
347 348 349 |
# File 'lib/ie/options.rb', line 347 def to_s self.class.to_s.split('::').last + ": " + format(' 0x%x [%s]', to_i, _to_s_) #[@options].pack('C').unpack('B8')[0][1..7] end |
#unsetDC ⇒ Object
271 |
# File 'lib/ie/options.rb', line 271 def unsetDC ; __unsetBit(6) ; end |
#unsetE ⇒ Object
299 |
# File 'lib/ie/options.rb', line 299 def unsetE ; __unsetBit(2) ; end |
#unsetL ⇒ Object
279 |
# File 'lib/ie/options.rb', line 279 def unsetL ; __unsetBit(5) ; end |
#unsetMC ⇒ Object
295 |
# File 'lib/ie/options.rb', line 295 def unsetMC ; __unsetBit(3) ; end |
#unsetN ⇒ Object
285 |
# File 'lib/ie/options.rb', line 285 def unsetN ; __unsetBit(4) ; end |
#unsetO ⇒ Object
267 |
# File 'lib/ie/options.rb', line 267 def unsetO ; __unsetBit(7) ; end |
#unsetP ⇒ Object
291 |
# File 'lib/ie/options.rb', line 291 def unsetP ; __unsetBit(4) ; end |
#unsetV6 ⇒ Object
303 |
# File 'lib/ie/options.rb', line 303 def unsetV6 ; __unsetBit(1) ; end |
#v6? ⇒ Boolean
304 |
# File 'lib/ie/options.rb', line 304 def v6? ; __isSet(1) ; end |