54 reset(type1, mode1, seqNum1, payload1);
58 reset(type1, mode1, seqNum1);
70 void CtlPkt::reset(CpType type1, CpMode mode1, uint64_t seqNum1,
77 void CtlPkt::reset(CpType type1, CpMode mode1, uint64_t seqNum1) {
104 adr1 = adr2 =
adr3 = 0;
106 port1 = 0;
port2 = 0;
123 #define packWord(x) {payload[pp++] = htonl(x);}
124 #define packInt32(x,y) {packWord(((x) << 16) | 4); packWord(y);}
125 #define packNonce(x,y) {packWord((x) << 16 | 8); \
126 packWord(((int) (((y)>>32)&0xffffffff))); \
127 packWord((int) ((y)&0xffffffff)); }
128 #define packRspec(x,y) {packWord(x); \
129 packWord(y.bitRateUp); packWord(y.bitRateDown); \
130 packWord(y.pktRateUp); packWord(y.pktRateDown); \
132 #define packString() { int len = min<int>(stringData.length(), 1300); \
133 packWord(STRING << 16 | len); \
134 stringData.copy((char *) &payload[pp],len); \
150 if (
mode == NEG_REPLY) {
151 int len =
errMsg.length();
153 len = min<int>(len,MAX_STRING);
155 payload[pp++] = htonl(len);
156 errMsg.copy((
char*) &payload[pp], len);
158 paylen = 4*(pp + (len+3)/4);
164 if (
mode == REQUEST) {
165 if (
iface == 0 || ip1 == 0 || !rspec1.isSet())
167 packInt32(IFACE,
iface);
169 packRspec(RSPEC1,rspec1);
171 if (ip1 == 0 || port1 == 0)
return 0;
173 packInt32(PORT1,port1);
177 if (
mode == REQUEST) {
178 if (
iface == 0)
return 0;
179 packInt32(IFACE,
iface);
183 if (
mode == REQUEST) {
184 if (
iface == 0)
return 0;
185 packInt32(IFACE,
iface);
187 if (
iface == 0 || ip1 == 0 ||
188 !rspec1.isSet() || !
rspec2.isSet())
190 packInt32(IFACE,
iface);
192 packInt32(PORT1,port1);
193 packRspec(RSPEC1,rspec1);
198 if (
mode == REQUEST) {
199 if (
iface == 0 || !rspec1.isSet())
201 packInt32(IFACE,
iface);
202 packRspec(RSPEC1,rspec1);
206 if (
mode == REQUEST) {
209 packInt32(IFACE,
iface);
210 if (
link != 0) packInt32(LINK,
link);
211 if (ip1 != 0) packInt32(IP1,ip1);
212 if (port1 != 0) packInt32(PORT1,port1);
213 if (adr1 != 0) packInt32(ADR1,adr1);
216 if (
link != 0) packInt32(LINK,
link);
217 if (adr1 != 0) packInt32(ADR1,adr1);
221 if (
mode == REQUEST) {
222 if (
link == 0 && adr1 == 0)
return 0;
223 if (
link != 0) packInt32(LINK,
link);
224 if (adr1 != 0) packInt32(ADR1,adr1);
228 if (
mode == REQUEST) {
229 if (
link == 0)
return 0;
230 packInt32(LINK,
link);
233 ip1 == 0 || port1 == 0 || adr1 == 0 ||
234 !rspec1.isSet() || !
rspec2.isSet())
236 packInt32(LINK,
link);
237 packInt32(IFACE,
iface);
240 packInt32(PORT1,port1);
241 packInt32(ADR1,adr1);
242 packRspec(RSPEC1,rspec1);
244 packInt32(COUNT,
count);
248 if (
mode == REQUEST) {
249 if (index1 == -1 ||
count == -1)
return 0;
250 packInt32(INDEX1,index1);
251 packInt32(COUNT,
count);
255 packInt32(INDEX1,index1);
257 packInt32(COUNT,
count);
261 case GET_COMTREE_SET:
262 if (
mode == REQUEST) {
263 if (index1 == -1 ||
count == -1)
return 0;
264 packInt32(INDEX1,index1);
265 packInt32(COUNT,
count);
269 packInt32(INDEX1,index1);
271 packInt32(COUNT,
count);
276 if (
mode == REQUEST) {
277 if (index1 == -1 ||
count == -1)
return 0;
278 packInt32(INDEX1,index1);
279 packInt32(COUNT,
count);
283 packInt32(INDEX1,index1);
285 packInt32(COUNT,
count);
290 if (
mode == REQUEST) {
291 if (index1 == -1 ||
count == -1)
return 0;
292 packInt32(INDEX1,index1);
293 packInt32(COUNT,
count);
297 packInt32(INDEX1,index1);
299 packInt32(COUNT,
count);
304 if (
mode == REQUEST) {
305 if (
link == 0 || !rspec1.isSet())
return 0;
306 packInt32(LINK,
link);
307 packRspec(RSPEC1,rspec1);
311 if (
mode == REQUEST) {
317 if (
mode == REQUEST) {
323 if (
mode == REQUEST) {
332 packInt32(LINK,
link);
337 if (
mode == REQUEST) {
341 if (
link != 0) packInt32(LINK,
link);
344 case ADD_COMTREE_LINK:
345 if (
mode == REQUEST) {
348 if (
link != 0) packInt32(LINK,
link);
350 if (ip1 != 0) packInt32(IP1,ip1);
351 if (port1 != 0) packInt32(PORT1,port1);
352 if (adr1 != 0) packInt32(ADR1,adr1);
354 if (
link == 0)
return 0;
355 packInt32(LINK,
link);
356 if (rspec1.isSet()) packRspec(RSPEC1,rspec1);
359 case DROP_COMTREE_LINK:
360 if (
mode == REQUEST) {
363 if (
link != 0) packInt32(LINK,
link);
364 if (ip1 != 0) packInt32(IP1,ip1);
365 if (port1 != 0) packInt32(PORT1,port1);
366 if (adr1 != 0) packInt32(ADR1,adr1);
368 if (rspec1.isSet()) packRspec(RSPEC1,rspec1);
370 case MOD_COMTREE_LINK:
371 if (
mode == REQUEST) {
374 packInt32(LINK,
link);
375 if (rspec1.isSet()) packRspec(RSPEC1,rspec1);
377 if (rspec1.isSet()) packRspec(RSPEC1,rspec1);
379 case GET_COMTREE_LINK:
380 if (
mode == REQUEST) {
383 packInt32(LINK,
link);
386 !rspec1.isSet() ||
queue == 0 || adr1 == 0)
389 packInt32(LINK,
link);
390 packRspec(RSPEC1,rspec1);
391 packInt32(QUEUE,
queue);
392 packInt32(ADR1,adr1);
396 if (
mode == REQUEST) {
397 if (
comtree == 0 || adr1 == 0 ||
link == 0)
return 0;
399 packInt32(ADR1,adr1);
400 packInt32(LINK,
link);
405 if (
mode == REQUEST) {
406 if (
comtree == 0 || adr1 == 0)
return 0;
408 packInt32(ADR1,adr1);
412 if (
mode == REQUEST) {
413 if (
comtree == 0 || adr1 == 0)
return 0;
415 packInt32(ADR1,adr1);
420 packInt32(ADR1,adr1);
421 packInt32(LINK,
link);
425 if (
mode == REQUEST) {
426 if (
comtree == 0 || adr1 == 0)
return 0;
428 packInt32(ADR1,adr1);
429 if (
link != 0) packInt32(LINK,
link);
434 if (
mode == REQUEST) {
435 if (
comtree == 0 || adr1 == 0 ||
link == 0)
return 0;
437 packInt32(ADR1,adr1);
438 packInt32(LINK,
link);
441 case DROP_ROUTE_LINK:
442 if (
mode == REQUEST) {
443 if (
comtree == 0 || adr1 == 0 ||
link == 0)
return 0;
445 packInt32(ADR1,adr1);
446 packInt32(LINK,
link);
451 if (
mode == POS_REPLY && index1 == -1)
453 packInt32(INDEX1,index1);
456 if (
mode == REQUEST && index1 == -1)
458 packInt32(INDEX1,index1);
462 if (
mode == REQUEST) {
463 if (index1 == -1)
return false;
464 packInt32(INDEX1,index1);
465 }
else if (
mode == POS_REPLY) {
471 if (
mode == REQUEST) {
474 packInt32(INDEX1,index1);
479 if (
mode == REQUEST) {
480 if (index1 == -1 ||
count == -1)
return false;
481 packInt32(INDEX1,index1);
482 packInt32(COUNT,
count);
483 }
else if (
mode == POS_REPLY) {
487 packInt32(INDEX1,index1);
489 packInt32(COUNT,
count);
490 if (
count > 0) packString();
493 case GET_LOGGED_PACKETS:
494 if (
mode == POS_REPLY) {
498 packInt32(COUNT,
count);
499 if (
count > 0) packString();
502 case ENABLE_PACKET_LOG:
503 if (
mode == REQUEST && (index1 == -1 ||
index2 == -1))
505 packInt32(INDEX1,index1);
510 if (
mode == REQUEST) {
511 if (ip1 == 0 || !rspec1.isSet())
return 0;
513 packRspec(RSPEC1,rspec1);
515 if (adr1 == 0 || adr2 == 0 ||
adr3 == 0 ||
516 ip1 == 0 ||
nonce == 0)
518 packInt32(ADR1,adr1);
519 packInt32(ADR2,adr2);
520 packInt32(ADR3,
adr3);
522 packInt32(PORT1,port1);
523 packNonce(NONCE,
nonce);
527 if (
mode == REQUEST) {
528 if (adr1 == 0 || adr2 == 0)
return 0;
529 packInt32(ADR1,adr1); packInt32(ADR2,adr2);
532 if (
mode == REQUEST) {
533 if (adr1 == 0 || adr2 == 0)
return 0;
534 packInt32(ADR1,adr1);
535 packInt32(ADR2,adr2);
538 case CLIENT_DISCONNECT:
539 if (
mode == REQUEST) {
540 if (adr1 == 0 || adr2 == 0)
return 0;
541 packInt32(ADR1,adr1);
542 packInt32(ADR2,adr2);
546 if (
mode == REQUEST) {
547 if (adr1 == 0 || adr2 == 0 || ip1 == 0 ||
548 port1 == 0 ||
nonce == 0)
return 0;
549 packInt32(ADR1,adr1); packInt32(ADR2,adr2);
550 packInt32(IP1,ip1); packInt32(PORT1,port1);
551 packNonce(NONCE,
nonce);
555 if (
mode == REQUEST) {
556 if (adr1 == 0 || adr2 == 0)
return 0;
557 packInt32(ADR1,adr1); packInt32(ADR2,adr2);
567 if (
mode == REQUEST) {
570 if (adr1 == 0 ||
comtree == 0)
return 0;
571 packInt32(ADR1,adr1); packInt32(COMTREE,
comtree);
579 if (!rspec1.isSet() || !
rspec2.isSet())
581 packRspec(RSPEC1,rspec1);
584 int len =
ivec.size();
585 if (len > 50)
return 0;
587 for (
int i = 0; i < len; i++)
593 if (
mode == REQUEST) {
608 if (adr1 == 0 ||
link == 0 || adr2 == 0 ||
612 packInt32(ADR1,adr1);
613 packInt32(ADR2,adr2);
614 packInt32(LINK,
link);
615 packRspec(RSPEC1,rspec1);
618 int len =
ivec.size();
619 if (len > 50)
return 0;
621 for (
int i = 0; i < len; i++) packWord(
ivec[i]);
626 if (
mode == REQUEST) {
636 if (index1 == 0 || !rspec1.isSet())
return 0;
638 int len =
ivec.size();
639 if (len > 50)
return 0;
641 for (
int i = 0; i < len; i++) packWord(
ivec[i]);
642 packInt32(INDEX1,index1);
643 packRspec(RSPEC1,rspec1);
649 if (adr1 == 0)
return 0;
650 packInt32(ADR1,adr1);
654 if (
mode == REQUEST) {
664 if (adr1 == 0 ||
comtree == 0)
return 0;
666 packInt32(ADR1,adr1);
676 #define unpackWord(x) { x = ntohl(payload[pp++]); }
677 #define unpackRspec(x) { int bru; unpackWord(bru); int brd; unpackWord(brd); \
678 int pru; unpackWord(pru); int prd; unpackWord(prd); \
679 (x).set(bru,brd,pru,prd); }
685 if (payload == 0)
return false;
691 unpackWord(x); unpackWord(y);
694 if (
mode == NEG_REPLY) {
695 if (
paylen > 4*pp && ntohl(payload[pp]) == ERRMSG) {
697 int len; unpackWord(len);
698 errMsg.assign((
char*) &payload[pp], len);
704 uint32_t x; unpackWord(x);
705 uint16_t attr = (uint16_t) (x >> 16);
706 uint16_t len = (uint16_t) (x & 0xffff);
708 case ADR1: unpackWord(adr1);
break;
709 case ADR2: unpackWord(adr2);
break;
710 case ADR3: unpackWord(
adr3);
break;
711 case IP1: unpackWord(ip1);
break;
712 case IP2: unpackWord(
ip2);
break;
713 case PORT1: unpackWord(port1);
break;
714 case PORT2: unpackWord(
port2);
break;
715 case NONCE: uint32_t hi,lo; unpackWord(hi); unpackWord(lo);
717 case RSPEC1: unpackRspec(rspec1);
break;
718 case RSPEC2: unpackRspec(
rspec2);
break;
719 case CORE_FLAG: unpackWord(
coreFlag);
break;
720 case IFACE: unpackWord(
iface);
break;
721 case LINK: unpackWord(
link);
break;
724 case COMTREE: unpackWord(
comtree);
break;
726 case INDEX1: unpackWord(index1);
break;
727 case INDEX2: unpackWord(
index2);
break;
728 case COUNT: unpackWord(
count);
break;
729 case QUEUE: unpackWord(
queue);
break;
730 case ZIPCODE: unpackWord(
zipCode);
break;
731 case STRING:
stringData.assign((
char *) &payload[pp], len);
734 case INTVEC:
ivec.resize(len);
735 for (
int i = 0; i < len; i++) {
736 int x; unpackWord(x);
ivec[i] = x;
738 default: pp += (len+3)/4;
744 if ((
mode == REQUEST &&
745 (
iface == 0 || ip1 == 0 || !rspec1.isSet())) ||
746 (
mode == POS_REPLY && (ip1 == 0 || port1 == 0)))
755 (
mode == POS_REPLY &&
756 (
iface == 0 || ip1 == 0 || port1 == 0 ||
757 !rspec1.isSet() || !
rspec2.isSet())))
761 if ((
mode == REQUEST &&
762 (iface == 0 || !rspec1.isSet())))
766 if (
mode == REQUEST && (index1 == -1 ||
count == -1))
768 if (
mode == POS_REPLY &&
778 if (
mode == REQUEST &&
link == 0 && adr1 == 0)
782 if ((
mode == REQUEST &&
link == 0) ||
783 (
mode == POS_REPLY &&
785 ip1 == 0 || port1 == 0 || adr1 == 0 ||
786 !rspec1.isSet() || !
rspec2.isSet())))
790 if (
mode == REQUEST && link == 0)
794 if (
mode == REQUEST && (index1 == -1 ||
count == -1))
796 if (
mode == POS_REPLY &&
811 (
mode == POS_REPLY &&
817 if (
mode == REQUEST && comtree == 0)
820 case GET_COMTREE_SET:
821 if (
mode == REQUEST && (index1 == -1 ||
count == -1))
823 if (
mode == POS_REPLY &&
828 case ADD_COMTREE_LINK:
829 if (
mode == REQUEST && (comtree == 0 ||
830 (link == 0 && (ip1 == 0 || port1 == 0)
834 case DROP_COMTREE_LINK:
835 if (
mode == REQUEST && (comtree == 0 ||
836 (link == 0 && (ip1 == 0 || port1 == 0)
840 case MOD_COMTREE_LINK:
841 if (
mode == REQUEST && (comtree == 0 || link == 0))
844 case GET_COMTREE_LINK:
845 if ((
mode == REQUEST &&
846 (comtree == 0 || link == 0)) ||
847 (
mode == POS_REPLY &&
848 (comtree == 0 || link == 0 || !rspec1.isSet() ||
849 queue == 0 || adr1 == 0)))
854 if (
mode == REQUEST && (comtree == 0 || adr1 == 0 || link == 0))
858 if (
mode == REQUEST && (comtree == 0 || adr1 == 0))
862 if ((
mode == REQUEST &&
863 (comtree == 0 || adr1 == 0)) ||
864 (
mode == POS_REPLY &&
865 (comtree == 0 || adr1 == 0 || link == 0)))
869 if (
mode == REQUEST && (comtree == 0 || adr1 == 0))
873 if (
mode == REQUEST &&
874 (comtree == 0 || adr1 == 0 || link == 0))
877 case DROP_ROUTE_LINK:
878 if (
mode == REQUEST &&
879 (comtree == 0 || adr1 == 0 || link == 0))
883 if (
mode == REQUEST && (index1 == -1 ||
count == -1))
885 if (
mode == POS_REPLY &&
891 if (
mode == POS_REPLY && index1 == -1)
895 if (
mode == REQUEST && index1 == -1)
899 if ((
mode == REQUEST && index1 == -1) ||
904 if (
mode == REQUEST &&
909 if (
mode == REQUEST && (index1 == -1 ||
count == -1))
911 if (
mode == POS_REPLY &&
916 case GET_LOGGED_PACKETS:
921 case ENABLE_PACKET_LOG:
922 if (
mode == REQUEST && (index1 == -1 ||
index2 == -1))
927 if ((
mode == REQUEST &&
928 (ip1 == 0 || !rspec1.isSet())) ||
929 (
mode == POS_REPLY &&
930 (adr1 == 0 || adr2 == 0 ||
adr3 == 0 ||
931 ip1 == 0 ||
nonce == 0)))
935 if (
mode == REQUEST && (adr1 == 0 || adr2 == 0))
939 if (
mode == REQUEST && (adr1 == 0 || adr2 == 0))
942 case CLIENT_DISCONNECT:
943 if (
mode == REQUEST && (adr1 == 0 || adr2 == 0))
947 if (
mode == REQUEST &&
948 (adr1 == 0 || adr2 == 0 || ip1 == 0 || port1 == 0 ||
953 if (
mode == REQUEST && (adr1 == 0 || adr2 == 0))
return false;
962 if ((
mode == REQUEST && (adr1 == 0 || comtree == 0)) ||
963 (
mode == POS_REPLY && (!rspec1.isSet() || !
rspec2.isSet())))
968 if (
mode == REQUEST &&
969 (adr1 == 0 || link == 0 || adr2 == 0 || comtree == 0 ||
970 !rspec1.isSet() || !
rspec2.isSet()))
975 if ((
mode == REQUEST && (index1 == 0 || !rspec1.isSet() ||
977 (
mode == POS_REPLY && adr1 == 0))
982 if (
mode == REQUEST && (comtree == 0 || adr1 == 0))
986 default:
return false;
996 stringstream ss;
int len;
1014 if (port1 != 0) ss <<
"port1=" << port1;
1020 if (rspec1.isSet()) ss <<
"rspec1=" << rspec1.
toString();
1027 ss <<
"coreFlag=" << (
coreFlag ?
"true" :
"false");
1030 if (iface != 0) ss <<
"iface=" <<
iface;
1033 if (link != 0) ss <<
"link=" <<
link;
1036 if (
nodeType != Forest::UNDEF_NODE)
1038 << Forest::nodeType2string(
nodeType);
1041 if (comtree != 0) ss <<
"comtree=" <<
comtree;
1047 if (index1 >= 0) ss <<
"index1=" << index1;
1074 for (
int i = 0; i < len; i++) ss <<
ivec[i] <<
" ";
1086 case ADD_IFACE: s =
"add_iface";
break;
1087 case DROP_IFACE: s =
"drop_iface";
break;
1088 case GET_IFACE: s =
"get_iface";
break;
1089 case MOD_IFACE: s =
"mod_iface";
break;
1090 case ADD_LINK: s =
"add_link";
break;
1091 case DROP_LINK: s =
"drop_link";
break;
1092 case GET_LINK: s =
"get_link";
break;
1093 case GET_LINK_SET: s =
"get_link_set";
break;
1094 case GET_COMTREE_SET: s =
"get_comtree_set";
break;
1095 case GET_IFACE_SET: s =
"get_iface_set";
break;
1096 case GET_ROUTE_SET: s =
"get_route_set";
break;
1097 case MOD_LINK: s =
"mod_link";
break;
1098 case ADD_COMTREE: s =
"add_comtree";
break;
1099 case DROP_COMTREE: s =
"drop_comtree";
break;
1100 case GET_COMTREE: s =
"get_comtree";
break;
1101 case MOD_COMTREE: s =
"mod_comtree";
break;
1102 case ADD_COMTREE_LINK: s =
"add_comtree_link";
break;
1103 case DROP_COMTREE_LINK: s =
"drop_comtree_link";
break;
1104 case MOD_COMTREE_LINK: s =
"mod_comtree_link";
break;
1105 case GET_COMTREE_LINK: s =
"get_comtree_link";
break;
1106 case ADD_ROUTE: s =
"add_route";
break;
1107 case DROP_ROUTE: s =
"drop_route";
break;
1108 case GET_ROUTE: s =
"get_route";
break;
1109 case MOD_ROUTE: s =
"mod_route";
break;
1110 case ADD_ROUTE_LINK: s =
"add_route_link";
break;
1111 case DROP_ROUTE_LINK: s =
"drop_route_link";
break;
1113 case ADD_FILTER: s =
"add_filter";
break;
1114 case DROP_FILTER: s =
"drop_filter";
break;
1115 case GET_FILTER: s =
"get_filter";
break;
1116 case MOD_FILTER: s =
"mod_filter";
break;
1117 case GET_FILTER_SET: s =
"get_filter_set";
break;
1118 case GET_LOGGED_PACKETS: s =
"get_logged_packets";
break;
1119 case ENABLE_PACKET_LOG: s =
"enable_packet_log";
break;
1121 case NEW_SESSION: s =
"new_session";
break;
1122 case CANCEL_SESSION: s =
"cancel_session";
break;
1123 case CLIENT_CONNECT: s =
"client_connect";
break;
1124 case CLIENT_DISCONNECT: s =
"client_disconnect";
break;
1125 case CONFIG_LEAF: s =
"config_leaf";
break;
1126 case SET_LEAF_RANGE: s =
"set_leaf_range";
break;
1127 case BOOT_ROUTER: s =
"boot_router";
break;
1128 case BOOT_LEAF: s =
"boot_leaf";
break;
1129 case BOOT_COMPLETE: s =
"boot_complete";
break;
1130 case BOOT_ABORT: s =
"boot_abort";
break;
1131 case COMTREE_PATH: s =
"comtree_path";
break;
1132 case ADD_NODE: s =
"comtree_new_leaf";
break;
1133 case ADD_BRANCH: s =
"comtree_add_branch";
break;
1134 case PRUNE: s =
"comtree_prune";
break;
1135 default: s =
"undefined";
break;
1140 bool CtlPkt::string2cpType(
string& s, CpType& type) {
1141 if (s ==
"undef") type = UNDEF_CPTYPE;
1143 else if (s ==
"add_iface") type = ADD_IFACE;
1144 else if (s ==
"drop_iface") type = DROP_IFACE;
1145 else if (s ==
"get_iface") type = GET_IFACE;
1146 else if (s ==
"mod_iface") type = MOD_IFACE;
1148 else if (s ==
"add_link") type = ADD_LINK;
1149 else if (s ==
"drop_link") type = DROP_LINK;
1150 else if (s ==
"get_link") type = GET_LINK;
1151 else if (s ==
"mod_link") type = MOD_LINK;
1152 else if (s ==
"get_link_set") type = GET_LINK_SET;
1154 else if (s ==
"add_comtree") type = ADD_COMTREE;
1155 else if (s ==
"drop_comtree") type = DROP_COMTREE;
1156 else if (s ==
"get_comtree") type = GET_COMTREE;
1157 else if (s ==
"mod_comtree") type = MOD_COMTREE;
1159 else if (s ==
"add_comtree_link") type = ADD_COMTREE_LINK;
1160 else if (s ==
"drop_comtree_link") type = DROP_COMTREE_LINK;
1161 else if (s ==
"get_comtree_link") type = GET_COMTREE_LINK;
1162 else if (s ==
"mod_comtree_link") type = MOD_COMTREE_LINK;
1164 else if (s ==
"add_route") type = ADD_ROUTE;
1165 else if (s ==
"drop_route") type = DROP_ROUTE;
1166 else if (s ==
"get_route") type = GET_ROUTE;
1167 else if (s ==
"mod_route") type = MOD_ROUTE;
1168 else if (s ==
"add_route_link") type = ADD_ROUTE;
1169 else if (s ==
"drop_route_link") type = DROP_ROUTE;
1171 else if (s ==
"add_filter") type = ADD_FILTER;
1172 else if (s ==
"drop_filter") type = DROP_FILTER;
1173 else if (s ==
"mod_filter") type = MOD_FILTER;
1174 else if (s ==
"get_filter") type = GET_FILTER;
1175 else if (s ==
"get_filter_set") type = GET_FILTER_SET;
1176 else if (s ==
"get_logged_packets") type = GET_LOGGED_PACKETS;
1177 else if (s ==
"enable_packet_log") type = ENABLE_PACKET_LOG;
1179 else if (s ==
"new_session") type = NEW_SESSION;
1180 else if (s ==
"cancel_session") type = CANCEL_SESSION;
1181 else if (s ==
"client_connect") type = CLIENT_CONNECT;
1182 else if (s ==
"client_disconnect") type = CLIENT_DISCONNECT;
1184 else if (s ==
"set_leaf_range") type = SET_LEAF_RANGE;
1185 else if (s ==
"config_leaf") type = CONFIG_LEAF;
1187 else if (s ==
"boot_router") type = BOOT_ROUTER;
1188 else if (s ==
"boot_complete") type = BOOT_COMPLETE;
1189 else if (s ==
"boot_abort") type = BOOT_ABORT;
1190 else if (s ==
"boot_leaf") type = BOOT_LEAF;
1192 else if (s ==
"comtree_path") type = COMTREE_PATH;
1193 else if (s ==
"comtree_new_leaf") type = ADD_NODE;
1194 else if (s ==
"comtree_add_branch") type = ADD_BRANCH;
1195 else if (s ==
"comtree_prune") type = PRUNE;
1201 string CtlPkt::cpMode2string(CpMode mode) {
1204 case REQUEST: s =
"request";
break;
1205 case POS_REPLY: s =
"pos reply";
break;
1206 case NEG_REPLY: s =
"neg reply";
break;
1212 bool CtlPkt::string2cpMode(
string& s, CpMode& mode) {
1213 if (s ==
"undef") mode = UNDEF_MODE;
1214 else if (s ==
"request") mode = REQUEST;
1215 else if (s ==
"pos reply") mode = POS_REPLY;
1216 else if (s ==
"neg reply") mode = NEG_REPLY;
1229 ss <<
" (" << cpMode2string(mode) <<
"," <<
seqNum <<
"): ";
1230 if (mode == NEG_REPLY) {
1236 if (mode == REQUEST) {
1246 if (mode == REQUEST) {
1251 if (mode == REQUEST) {
1261 if (mode == REQUEST) {
1267 if (mode == REQUEST) {
1282 if (mode == REQUEST) {
1288 if (mode == REQUEST) {
1302 if (mode == REQUEST) {
1312 case GET_COMTREE_SET:
1313 if (mode == REQUEST) {
1325 if (mode == REQUEST) {
1337 if (mode == REQUEST) {
1349 if (mode == REQUEST) {
1355 if (mode == REQUEST) {
1360 if (mode == REQUEST) {
1366 if (mode == REQUEST) {
1376 if (mode == REQUEST) {
1382 case ADD_COMTREE_LINK:
1383 if (mode == REQUEST) {
1395 case DROP_COMTREE_LINK:
1396 if (mode == REQUEST) {
1405 case MOD_COMTREE_LINK:
1406 if (mode == REQUEST) {
1413 case GET_COMTREE_LINK:
1414 if (mode == REQUEST) {
1426 if (mode == REQUEST) {
1434 if (mode == REQUEST) {
1440 if (mode == REQUEST) {
1450 if (mode == REQUEST) {
1457 case ADD_ROUTE_LINK:
1458 if (mode == REQUEST) {
1464 case DROP_ROUTE_LINK:
1465 if (mode == REQUEST) {
1473 if (mode == POS_REPLY) {
1479 if (mode == REQUEST) {
1484 if (mode == REQUEST) {
1490 if (mode == REQUEST) {
1496 case GET_FILTER_SET:
1497 if (mode == REQUEST) {
1507 case GET_LOGGED_PACKETS:
1508 if (mode == POS_REPLY) {
1513 case ENABLE_PACKET_LOG:
1514 if (mode == REQUEST)
1515 ss <<
" " << (index1 ?
"on" :
"off");
1516 ss <<
" " << (
index2 ?
"local" :
"remote");
1520 if (mode == REQUEST) {
1532 case CANCEL_SESSION:
1533 if (mode == REQUEST) {
1538 case CLIENT_CONNECT:
1539 if (mode == REQUEST) {
1544 case CLIENT_DISCONNECT:
1545 if (mode == REQUEST) {
1551 if (mode == REQUEST) {
1559 case SET_LEAF_RANGE:
1560 if (mode == REQUEST) {
1572 if (mode == REQUEST) {
1583 if (mode == REQUEST) {
1595 if (mode == REQUEST) {
1600 }
else if (mode == POS_REPLY) {
1606 if (mode == REQUEST) {