21 CtlPkt reqCp(CtlPkt::CLIENT_ADD_COMTREE,CtlPkt::REQUEST,0);
22 reqCp.zipCode = zipCode;
34 CtlPkt reqCp(CtlPkt::CLIENT_DROP_COMTREE,CtlPkt::REQUEST,0);
49 ipa_t clientIp, ipp_t clientPort,CtlPkt& repCp) {
50 CtlPkt reqCp(CtlPkt::CLIENT_JOIN_COMTREE,CtlPkt::REQUEST,0);
52 reqCp.ip1 = clientIp; reqCp.port1 = clientPort;
66 ipa_t clientIp, ipp_t clientPort,CtlPkt& repCp) {
67 CtlPkt reqCp(CtlPkt::CLIENT_LEAVE_COMTREE,CtlPkt::REQUEST,0);
69 reqCp.ip1 = clientIp; reqCp.port1 = clientPort;
83 CtlPkt reqCp(CtlPkt::ADD_IFACE,CtlPkt::REQUEST,0);
98 CtlPkt reqCp(CtlPkt::DROP_IFACE,CtlPkt::REQUEST,0);
113 CtlPkt reqCp(CtlPkt::MOD_IFACE,CtlPkt::REQUEST,0);
116 reqCp.rspec1 = rates;
128 CtlPkt reqCp(CtlPkt::GET_IFACE,CtlPkt::REQUEST,0);
148 ipa_t peerIp, ipp_t peerPort,
fAdr_t peerAdr,
149 uint64_t nonce, CtlPkt& repCp) {
150 CtlPkt reqCp(CtlPkt::ADD_LINK,CtlPkt::REQUEST,0);
151 reqCp.nodeType = peerType; reqCp.iface = iface; reqCp.link = lnk;
152 reqCp.ip1 = peerIp; reqCp.port1 = peerPort; reqCp.adr1 = peerAdr;
169 uint64_t nonce, CtlPkt& repCp) {
170 CtlPkt reqCp(CtlPkt::ADD_LINK,CtlPkt::REQUEST,0);
171 reqCp.nodeType = peerType; reqCp.iface = iface; reqCp.nonce = nonce;
184 CtlPkt reqCp(CtlPkt::DROP_LINK,CtlPkt::REQUEST,0);
185 if (link != 0) reqCp.link = link;
186 if (peerAdr != 0) reqCp.adr1 = peerAdr;
199 CtlPkt reqCp(CtlPkt::MOD_LINK,CtlPkt::REQUEST,0);
200 reqCp.link = link; reqCp.rspec1 = rates;
212 CtlPkt reqCp(CtlPkt::GET_COMTREE,CtlPkt::REQUEST,0);
225 CtlPkt reqCp(CtlPkt::ADD_COMTREE,CtlPkt::REQUEST,0);
226 reqCp.comtree = comtree;
238 CtlPkt reqCp(CtlPkt::DROP_COMTREE,CtlPkt::REQUEST,0);
239 reqCp.comtree = comtree;
253 int coreFlag,CtlPkt& repCp) {
254 CtlPkt reqCp(CtlPkt::MOD_COMTREE,CtlPkt::REQUEST,0);
255 reqCp.comtree = comtree;
256 reqCp.link = pLink; reqCp.coreFlag = coreFlag;
268 CtlPkt reqCp(CtlPkt::GET_COMTREE,CtlPkt::REQUEST,0);
269 reqCp.comtree = comtree;
283 int peerCoreFlag,CtlPkt& repCp) {
284 CtlPkt reqCp(CtlPkt::ADD_COMTREE_LINK,CtlPkt::REQUEST,0);
285 reqCp.comtree = comtree; reqCp.link = link;
286 reqCp.coreFlag = peerCoreFlag;
301 CtlPkt reqCp(CtlPkt::ADD_COMTREE_LINK,CtlPkt::REQUEST,0);
302 reqCp.comtree = comtree; reqCp.adr1 = peerAdr;
334 fAdr_t peerAdr, CtlPkt& repCp) {
335 CtlPkt reqCp(CtlPkt::DROP_COMTREE_LINK,CtlPkt::REQUEST,0);
336 reqCp.comtree = comtree;
337 if (link == 0 && peerAdr == 0) {
338 logger->
log(
"CpHandler::dropLink: link, peerAdr both 0", 2);
341 if (link != 0) reqCp.link = link;
342 else if (peerAdr != 0) reqCp.adr1 = peerAdr;
373 RateSpec& rates,CtlPkt& repCp) {
374 CtlPkt reqCp(CtlPkt::MOD_COMTREE_LINK,CtlPkt::REQUEST,0);
375 reqCp.comtree = comtree;
376 reqCp.link = link; reqCp.rspec1 = rates;
389 CtlPkt reqCp(CtlPkt::GET_COMTREE_LINK,CtlPkt::REQUEST,0);
390 reqCp.comtree = comtree; reqCp.link = link;
403 CtlPkt reqCp(CtlPkt::NEW_SESSION,CtlPkt::REQUEST,0);
404 reqCp.ip1 = clientIp; reqCp.rspec1 = rates;
417 CtlPkt reqCp(CtlPkt::CLIENT_CONNECT,CtlPkt::REQUEST,0);
418 reqCp.adr1 = clientAdr; reqCp.adr2 =
rtrAdr;
431 CtlPkt reqCp(CtlPkt::CLIENT_DISCONNECT,CtlPkt::REQUEST,0);
432 reqCp.adr1 = clientAdr; reqCp.adr2 =
rtrAdr;
443 CtlPkt reqCp(CtlPkt::BOOT_ROUTER,CtlPkt::REQUEST,0);
461 CtlPkt reqCp(CtlPkt::CONFIG_LEAF,CtlPkt::REQUEST,0);
462 reqCp.adr1 = leafAdr; reqCp.adr2 =
rtrAdr;
478 CtlPkt reqCp(CtlPkt::SET_LEAF_RANGE,CtlPkt::REQUEST,0);
479 reqCp.adr1 = first; reqCp.adr2 = last;
490 CtlPkt reqCp(CtlPkt::BOOT_LEAF,CtlPkt::REQUEST,0);
500 CtlPkt reqCp(CtlPkt::BOOT_COMPLETE,CtlPkt::REQUEST,0);
511 CtlPkt reqCp(CtlPkt::BOOT_ABORT,CtlPkt::REQUEST,0);
530 logger->
log(
"CpHandler::sendRequest: no packets "
531 "left in packet store\n",4,cp);
536 if (cp.mode == CtlPkt::REQUEST) cp.seqNum = 0;
537 cp.payload = p.payload();
538 int plen = cp.pack();
540 logger->
log(
"CpHandler::sendRequest: packing error\n",4,cp);
544 if (cp.type < CtlPkt::CLIENT_NET_SIG_SEP) {
549 p.flags = 0; p.dstAdr = dest; p.srcAdr =
myAdr;
553 if (cp.mode != CtlPkt::REQUEST) {
572 CtlPkt reqCp(CtlPkt::GET_LINK_SET, CtlPkt::REQUEST, 0);
573 reqCp.firstLinkNum = firstLinkNum;
574 reqCp.numOfLinks = numOfLinks;
575 cout << __FUNCTION__ << endl;
596 logger->
log(
"CpHandler::sendAndWait: no packets "
597 "left in packet store\n",4,p);
603 for (
int i = 1; i < 3; i++) {
604 pktx reply =
inq->
deq(1000000000);
605 if (reply == Queue::TIMEOUT) {
609 logger->
log(
"CpHandler::sendAndWait: no "
610 "packets left in packet store\n",
624 if (repCp.mode == CtlPkt::NEG_REPLY) {
625 logger->
log(
"CpHandler::sendAndWait: negative "
626 "reply (" + repCp.errMsg +
627 ") to control packet",1,pr);
632 logger->
log(
"CpHandler::sendAndWait: no response to control packet",
648 logger->
log(
"CpHandler::sendRequest: no packets "
649 "left in packet store\n",4,cp);
653 cp.payload = p.payload();
654 int plen = cp.pack();
656 logger->
log(
"CpHandler::sendRequest: packing error\n",4,cp);
660 if (cp.type < CtlPkt::CLIENT_NET_SIG_SEP) {
665 p.flags = 0; p.dstAdr = dest; p.srcAdr =
myAdr;
681 CtlPkt cp1(cp.type,CtlPkt::NEG_REPLY,cp.seqNum);
683 cp1.payload = p1.payload();
685 p1.length = Forest::OVERHEAD + cp1.pack();
686 p1.type = p.type; p1.flags = 0; p1.comtree = p.comtree;
687 p1.dstAdr = p.srcAdr; p1.srcAdr =
myAdr;