Show Mdiff.txt syntax highlighted
///////
create status.grad_ref (status device)
create Mdiff_grad_binary()
/////////////////////////////////////////////////////////////////
MDForwarder handles three kinds of packets on the packet device:
1. Filter Priority Update: Filter says what priority it is.
2. Send Message: New message, originating from this node. (Unclear if
user filters call this.)
3. Recv From Filter
MDForwarder needs to know the priority of filters that connect as
packet device clients so that it can forward messages in order of
priority. As a result, when a filter connects, it needs to send a
packet stating the priority of the filter. In response, MdForwarder
will place that client's profile in the appropriate place in the
packet_device server's client_list structure.
TinyDiffusion also fetches the attributes for each filter and only
forwards the message if it matches.
Right now, I'm sending the message to the next filter regardless, and
will let the filter decide what to do with it. This allows for more
interesting behavior and simplifies the MdForwarder module.
///////////////////////////////////////////////////////////
// MdOppGradient.c
??? rename functions in .c file, with state pointer
??? declare functions in .h file.
??? references to global vars now go to state vars.
What is AM.h? Active Message?
??? Add timer refs to MdOppGradient State
??? Create periodic timer refs on start-up?
??? Set callbacks
??? Write callbacks
Need a queue for interest messages.
??? Timer function to periodically rebroadcast interests.
Need a queue for gradients that get periodically timed-out.
??? timer function to periodically time-out gradients.
////
Put TD_PP_LOCAL_BUFF_SIZE in DiffTypes.h
////
We won't need a queue for internal messages. Just call the function.
////
TdFilterI.recv will just pass to matchGradient.
////
What's TdFilterI.getMatchAttr? Skip?
////
Skip publish and unpublish?
////
For subscriptions, MdOppGradient keeps a list of subscribed interests
that it periodically sends out.
//// unsubscribe
take handle.
Add a new gradient based on the attrs passed.
Create an IntDiffMsg (interest message) and put that in the queue.
////
TdGradientI.getGradientByIndex - just copies the Nth gradient.
For gradients, MdOppGradient keeps a list of gradients in no
particular order. Periodically it times out gradients that are too
old.
////
Timer.fired() Need to look at example timer callback.
done * install gradient and interest timers in MdOppGradient state.
done * start timers in start()
* modify call backs to have correct signature.
Gradients are added as a result of interests or subscriptions.
////
matchGradient()
if it's an interest...
look for gradients that match the interest.
if the matching gradient is due to a local interest, skip.
if the matching gradient was set up by the same node that set the interest
update the gradient and retransmit the interest
if no matching gradient is found
///
MdOppGradient_addGradient
See more files for this project here