Changeset 2473 for source/ariba/Node.cpp
- Timestamp:
- Feb 23, 2009, 2:21:49 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
source/ariba/Node.cpp
r2455 r2473 37 37 // [License] 38 38 39 40 39 #include "Node.h" 41 40 … … 61 60 62 61 } 62 63 63 ServiceInterfaceWrapper(CommunicationListener* listener) : 64 64 nodeListener(NULL), commListener(listener) { 65 65 } 66 67 ~ServiceInterfaceWrapper() { 68 } 66 69 67 70 protected: … … 69 72 70 73 } 74 71 75 void onOverlayDestroy(const SpoVNetID& id) { 72 76 … … 120 124 const NodeID& node) { 121 125 if (commListener != NULL) commListener->onMessage( 122 const_cast<Message*> 126 const_cast<Message*>(message), node, link); 123 127 } 124 128 }; 125 129 126 const ServiceID Node::anonymousService = 0xFF00;130 ServiceID Node::anonymousService = ServiceID(0xFF00); 127 131 128 132 Node::Node(AribaModule& ariba_mod, const Name& node_name) : … … 142 146 //TODO: Implement error handling: no bootstrap node available 143 147 void Node::initiate(const Name& vnetname, const SpoVNetProperties& parm) { 144 utility::OverlayParameterSet 145 ovrpset =146 (utility::OverlayParameterSet::_OverlayStructure) parm.getBaseOverlayType(); 148 utility::OverlayParameterSet ovrpset = 149 (utility::OverlayParameterSet::_OverlayStructure) parm.getBaseOverlayType(); 150 147 151 spovnetId = vnetname.toSpoVNetId(); 148 152 nodeId = generateNodeId(name); 153 149 154 this->context = ariba_mod.underlay_abs->createSpoVNet(spovnetId, nodeId, 150 ariba_mod.ip_addr, ariba_mod.tcp_port);155 ariba_mod.ip_addr, ariba_mod.tcp_port); 151 156 ariba_mod.addBootstrapNode(vnetname, 152 157 new EndpointDescriptor(this->context->getBaseCommunication().getEndpointDescriptor())); 153 158 } 154 159 155 160 void Node::leave() { 156 // not implemeted yet. 157 } 158 159 void Node::bind(NodeListener* listener) { 160 this->context->getOverlay().bind(new ServiceInterfaceWrapper(listener), 161 Node::anonymousService); 162 } 163 164 void Node::unbind(NodeListener* listener) { 165 // TODO: allow unbinding 161 ariba_mod.underlay_abs->leaveSpoVNet( context ); 162 context = NULL; 166 163 } 167 164 … … 171 168 172 169 const SpoVNetID& Node::getSpoVNetId() const { 173 return SpoVNetID::UNSPECIFIED;170 return spovnetId; 174 171 } 175 172 176 173 const NodeID& Node::getNodeId(const LinkID& lid) const { 177 return NodeID::UNSPECIFIED;174 return nodeId; 178 175 } 179 176 … … 201 198 } 202 199 200 void Node::sendBroadcastMessage(const DataMessage& msg, const ServiceID& sid) { 201 return context->getOverlay().broadcastMessage((Message*)msg, sid); 202 } 203 204 void Node::bind(NodeListener* listener) { 205 context->getOverlay().bind(new ServiceInterfaceWrapper(listener), 206 Node::anonymousService); 207 } 208 209 void Node::unbind(NodeListener* listener) { 210 delete context->getOverlay().unbind(Node::anonymousService); 211 } 212 203 213 void Node::bind(CommunicationListener* listener, const ServiceID& sid) { 204 this->context->getOverlay().bind(new ServiceInterfaceWrapper(listener), sid);214 context->getOverlay().bind(new ServiceInterfaceWrapper(listener), sid); 205 215 } 206 216 207 217 void Node::unbind(CommunicationListener* listener, const ServiceID& sid) { 208 // TODO218 delete context->getOverlay().unbind(sid); 209 219 } 210 220
Note:
See TracChangeset
for help on using the changeset viewer.