Class: TIPCSubscr
- Inherits:
-
Object
- Object
- TIPCSubscr
- Defined in:
- lib/tipcsocket.rb
Overview
Represents a TIPC subscription.
From the TIPC Programmer’s Guide:
TIPC provides a network topology service that applications can use to receive
information about what port names exist within the application's network zone.
An application accesses the topology service by opening a message-based
connection to port name {1,1} and then sending "subscription" messages to the
topology service that indicate the port names of interest to the application;
in return, the topology service sends "event" messages to the application when
these names are published or withdrawn by ports within the network.
Instance Attribute Summary collapse
-
#filter ⇒ Object
Returns the value of attribute filter.
-
#name_seq ⇒ Object
Returns the value of attribute name_seq.
-
#timeout ⇒ Object
Returns the value of attribute timeout.
-
#usr_handle ⇒ Object
Returns the value of attribute usr_handle.
Class Method Summary collapse
-
.unpack(bytes) ⇒ Object
Create a new TIPCSubscr instance from a 28 byte binary string containing a TIPC name sequence.
Instance Method Summary collapse
-
#initialize(name_seq, timeout, filter, usr_handle = '') ⇒ TIPCSubscr
constructor
Create a new TIPCSubscr instance.
-
#pack ⇒ Object
Pack an instance of a TIPCSubscr.
Constructor Details
#initialize(name_seq, timeout, filter, usr_handle = '') ⇒ TIPCSubscr
Create a new TIPCSubscr instance.
Parameters
* name_seq - the port name sequence of interest, must be an instance of
TIPCNameSeq
* timeout - subscription timeout value in milliseconds, use the constant
TIPC_WAIT_FOREVER to specify no timeout
* filter - a bitmask containing one or more event filters, see below
for a description of filter types
* usr_handle - 8 byte string that is application defined, this value is
returned to the application as part of all events associated
with the subscription event
Filter Types
* TIPC_SUB_PORTS - causes the topology service to generate a TIPC_PUBLISHED
event for each port name or port name sequence it finds
that overlaps the specified port name sequence; a
TIPC_WITHDRAWN event is issued each time a previously
reported name becomes unavailable
* TIPC_SUB_SERVICE - causes the topology service to generate a single publish
event for the first port it finds with an overlapping
name and a single withdraw event when the last such port
becomes unavailable
* TIPC_SUB_CANCEL - cancels and existing topology service subscription, all
other parameters should match the original subscription
request
306 307 308 309 310 311 |
# File 'lib/tipcsocket.rb', line 306 def initialize(name_seq, timeout, filter, usr_handle = '') @name_seq = name_seq @timeout = timeout @filter = filter @usr_handle = usr_handle end |
Instance Attribute Details
#filter ⇒ Object
Returns the value of attribute filter.
278 279 280 |
# File 'lib/tipcsocket.rb', line 278 def filter @filter end |
#name_seq ⇒ Object
Returns the value of attribute name_seq.
278 279 280 |
# File 'lib/tipcsocket.rb', line 278 def name_seq @name_seq end |
#timeout ⇒ Object
Returns the value of attribute timeout.
278 279 280 |
# File 'lib/tipcsocket.rb', line 278 def timeout @timeout end |
#usr_handle ⇒ Object
Returns the value of attribute usr_handle.
278 279 280 |
# File 'lib/tipcsocket.rb', line 278 def usr_handle @usr_handle end |
Class Method Details
.unpack(bytes) ⇒ Object
Create a new TIPCSubscr instance from a 28 byte binary string containing a TIPC name sequence.
Parameters
* bytes - 28 byte string containing TIPC name sequence
334 335 336 337 |
# File 'lib/tipcsocket.rb', line 334 def self.unpack(bytes) data = bytes.unpack("a12L2a8") self.new(TIPCNameSeq.unpack(data[0]), data[1], data[2], data[3]) end |
Instance Method Details
#pack ⇒ Object
Pack an instance of a TIPCSubscr.
Produces a 28 byte string with the following format:
* name_seq (12 bytes)
* timeout - uint32 (4 bytes)
* filter - uint32 (4 bytes)
* usr_handle - char[8] (8 bytes)
320 321 322 323 324 325 326 327 |
# File 'lib/tipcsocket.rb', line 320 def pack [ self.name_seq.pack, self.timeout, self.filter, self.usr_handle ].pack("a12L2a8") end |