From: Jon M. <jon...@er...> - 2004-04-30 21:43:13
|
See below Have a nice weekend /Jon Daniel McNeil wrote: >Hi Jon, > >I looking over the changes to the topology events and had some >questions: > >old way was: > >ioctl(tipc_fd, NETWORK_SUBSCRIBE, 0); > >poll() looking for NETWORK_EVENT >ioctl(tipc_fd, GET_NETWORK_EVENT, &netw_subscr) > > which return a node_id and up/down indication > >New way is: > >ioctl(tipc_fd, TIPC_SUBSCRIBE, &tipc_subscr) > > with > > tipc_subscr.seq.type = 0 > tipc_subscr.seq.lower = tipc_addr(zone, cluster, 0); > tipc_subscr.seq.upper = tipc_addr(zone, cluster, 0xfff); > tipc_subscr.timeout = TIPC_WAIT_FOREVER; > tipc_subscr.usr_handle = "abc"; > >poll() looking for TIPC_TOPOLOGY_EVENT >ioctl(tipc_fd, TIPC_GET_EVENT, &tipc_event); > > on return: > > tipc_event.event = TIPC_PUBLISHED (node joined?) > TIPC_WITHDRAWN (node died/left?) > TIPC_SUBSCR_TIMEOUT > > tipc_event.port.node = node_who_joined_or_left > >Do I have this correct? Do the other fields mean anything? > Yes, it is correct. The other fields are also meaningful: found_lower == found_upper == also the node who joined/left, because this is the semantics of subsriptions in general. tipc_event.port is the valid port identity of the publishing port, a "hint" that has turned out to be useful in some cases. Also, tipc_event.s is an aggregated complete copy of the original subscription. If you want the to recover the original usr_handle, or if you have several subscriptions pending and want to know to which the event pertains, you can look here. > >Also in manager.c, the mng_cmd_event() function has > > case TIPC_SUBSCRIBE: > >How is this used? Can you subscribe to events on the management port? >How are results returned? > Yes, you can. If you e.g. want to kkep track of which nodes can bee seen from a node in a different cluster, or simply to verify the consistensy of the assumed fully meshed network in the own cluster, this is a useful feature. When you order such a subscription you must do this on a dedicated socket, because the TIPC manager will conecct back to that socket and keep the connection until the subscription times out or is cancelled. Events are returned on that connection in a tipc_cmd_msg, in the member result.event, which is just like any other event. > >Thanks, > >Daniel > > |