PageRenderTime 63ms CodeModel.GetById 23ms RepoModel.GetById 0ms app.codeStats 0ms

/qwaqvm/platforms/Cross/third-party/resiprocate-src-1.6/p2p/MessageStructsGen.cxx

http://openqwaq.googlecode.com/
C++ | 2889 lines | 2246 code | 574 blank | 69 comment | 88 complexity | 4b5b7b265fe760ba106131c7b248949d MD5 | raw file
Possible License(s): GPL-2.0, LGPL-2.1, LGPL-2.0, BSD-3-Clause
  1. #include <iostream>
  2. #include <iomanip>
  3. #include "rutil/Logger.hxx"
  4. #include "rutil/ParseException.hxx"
  5. #include "rutil/Data.hxx"
  6. #include "rutil/DataStream.hxx"
  7. #include "P2PSubsystem.hxx"
  8. #define RESIPROCATE_SUBSYSTEM P2PSubsystem::P2P
  9. #include "MessageStructsGen.hxx"
  10. #include <assert.h>
  11. namespace s2c {
  12. /* EKR: Most unprincipled hack of the day */
  13. #define TELLP(a) (static_cast<resip::DataStream &>(a)).tellp()
  14. #define SEEKP(a,b) (static_cast<resip::DataStream &>(a)).seekp(b)
  15. // Classes for NodeIdStruct */
  16. NodeIdStruct :: NodeIdStruct ()
  17. {
  18. mName = "NodeIdStruct";
  19. StackLog(<< "Constructing NodeIdStruct");
  20. mHigh=0;
  21. mLow=0;
  22. };
  23. NodeIdStruct :: NodeIdStruct (const NodeIdStruct &from)
  24. {
  25. // World's lamest copy constructor
  26. if(this==&from) return;
  27. mName = "NodeIdStruct";
  28. resip::Data dat;
  29. {
  30. resip::DataStream strm(dat);
  31. from.encode(strm);
  32. }
  33. {
  34. resip::DataStream strm(dat);
  35. decode(strm);
  36. }
  37. }
  38. void NodeIdStruct :: print(std::ostream& out, int indent) const
  39. {
  40. do_indent(out,indent);
  41. (out) << "NodeId:\n";
  42. indent+=2;
  43. do_indent(out, indent);
  44. (out) << "high:" << std::hex << (unsigned long long)mHigh << "\n";
  45. do_indent(out, indent);
  46. (out) << "low:" << std::hex << (unsigned long long)mLow << "\n";
  47. };
  48. void NodeIdStruct :: decode(std::istream& in)
  49. {
  50. StackLog(<< "Decoding NodeIdStruct");
  51. decode_uintX(in, 64, mHigh);
  52. StackLog( << "mHigh =" << std::hex << (unsigned long long) mHigh );
  53. decode_uintX(in, 64, mLow);
  54. StackLog( << "mLow =" << std::hex << (unsigned long long) mLow );
  55. };
  56. void NodeIdStruct :: encode(std::ostream& out) const
  57. {
  58. StackLog(<< "Encoding NodeIdStruct");
  59. StackLog( << "mHigh =" << std::hex << (unsigned long long) mHigh );
  60. encode_uintX(out, 64, mHigh);
  61. StackLog( << "mLow =" << std::hex << (unsigned long long) mLow );
  62. encode_uintX(out, 64, mLow);
  63. };
  64. // Classes for ResourceIdStruct */
  65. ResourceIdStruct :: ResourceIdStruct ()
  66. {
  67. mName = "ResourceIdStruct";
  68. StackLog(<< "Constructing ResourceIdStruct");
  69. };
  70. ResourceIdStruct :: ResourceIdStruct (const ResourceIdStruct &from)
  71. {
  72. // World's lamest copy constructor
  73. if(this==&from) return;
  74. mName = "ResourceIdStruct";
  75. resip::Data dat;
  76. {
  77. resip::DataStream strm(dat);
  78. from.encode(strm);
  79. }
  80. {
  81. resip::DataStream strm(dat);
  82. decode(strm);
  83. }
  84. }
  85. void ResourceIdStruct :: print(std::ostream& out, int indent) const
  86. {
  87. do_indent(out,indent);
  88. (out) << "ResourceId:\n";
  89. indent+=2;
  90. out << mId.hex();
  91. };
  92. void ResourceIdStruct :: decode(std::istream& in)
  93. {
  94. StackLog(<< "Decoding ResourceIdStruct");
  95. {
  96. UInt32 len;
  97. int c;
  98. decode_uintX(in, 8, len);
  99. resip::DataStream strm(mId);
  100. while(len--){
  101. c=in.get();
  102. if(c==EOF)
  103. throw resip::ParseException("Premature end of data",
  104. "id",__FILE__,__LINE__);
  105. strm.put(c);
  106. };
  107. }
  108. };
  109. void ResourceIdStruct :: encode(std::ostream& out) const
  110. {
  111. StackLog(<< "Encoding ResourceIdStruct");
  112. encode_uintX(out, 8, mId.size());
  113. out << mId;
  114. };
  115. // Classes for IPv4AddrPortStruct */
  116. IPv4AddrPortStruct :: IPv4AddrPortStruct ()
  117. {
  118. mName = "IPv4AddrPortStruct";
  119. StackLog(<< "Constructing IPv4AddrPortStruct");
  120. mAddr=0;
  121. mPort=0;
  122. };
  123. IPv4AddrPortStruct :: IPv4AddrPortStruct (const IPv4AddrPortStruct &from)
  124. {
  125. // World's lamest copy constructor
  126. if(this==&from) return;
  127. mName = "IPv4AddrPortStruct";
  128. resip::Data dat;
  129. {
  130. resip::DataStream strm(dat);
  131. from.encode(strm);
  132. }
  133. {
  134. resip::DataStream strm(dat);
  135. decode(strm);
  136. }
  137. }
  138. void IPv4AddrPortStruct :: print(std::ostream& out, int indent) const
  139. {
  140. do_indent(out,indent);
  141. (out) << "IPv4AddrPort:\n";
  142. indent+=2;
  143. do_indent(out, indent);
  144. (out) << "addr:" << std::hex << (unsigned long long)mAddr << "\n";
  145. do_indent(out, indent);
  146. (out) << "port:" << std::hex << (unsigned long long)mPort << "\n";
  147. };
  148. void IPv4AddrPortStruct :: decode(std::istream& in)
  149. {
  150. StackLog(<< "Decoding IPv4AddrPortStruct");
  151. decode_uintX(in, 32, mAddr);
  152. StackLog( << "mAddr =" << std::hex << (unsigned long long) mAddr );
  153. decode_uintX(in, 16, mPort);
  154. StackLog( << "mPort =" << std::hex << (unsigned long long) mPort );
  155. };
  156. void IPv4AddrPortStruct :: encode(std::ostream& out) const
  157. {
  158. StackLog(<< "Encoding IPv4AddrPortStruct");
  159. StackLog( << "mAddr =" << std::hex << (unsigned long long) mAddr );
  160. encode_uintX(out, 32, mAddr);
  161. StackLog( << "mPort =" << std::hex << (unsigned long long) mPort );
  162. encode_uintX(out, 16, mPort);
  163. };
  164. // Classes for IPv6AddrPortStruct */
  165. IPv6AddrPortStruct :: IPv6AddrPortStruct ()
  166. {
  167. mName = "IPv6AddrPortStruct";
  168. StackLog(<< "Constructing IPv6AddrPortStruct");
  169. for(unsigned int i=0;i<16;i++){
  170. mAddr[i]=0;
  171. }
  172. mPort=0;
  173. };
  174. IPv6AddrPortStruct :: IPv6AddrPortStruct (const IPv6AddrPortStruct &from)
  175. {
  176. // World's lamest copy constructor
  177. if(this==&from) return;
  178. mName = "IPv6AddrPortStruct";
  179. resip::Data dat;
  180. {
  181. resip::DataStream strm(dat);
  182. from.encode(strm);
  183. }
  184. {
  185. resip::DataStream strm(dat);
  186. decode(strm);
  187. }
  188. }
  189. void IPv6AddrPortStruct :: print(std::ostream& out, int indent) const
  190. {
  191. do_indent(out,indent);
  192. (out) << "IPv6AddrPort:\n";
  193. indent+=2;
  194. for(unsigned int i=0;i<16;i++) {
  195. do_indent(out, indent);
  196. (out) << "opaque:" << std::hex << (unsigned long long) mAddr[i] << "\n";
  197. }
  198. do_indent(out, indent);
  199. (out) << "port:" << std::hex << (unsigned long long)mPort << "\n";
  200. };
  201. void IPv6AddrPortStruct :: decode(std::istream& in)
  202. {
  203. StackLog(<< "Decoding IPv6AddrPortStruct");
  204. for(unsigned int i=0;i<16;i++){
  205. decode_uintX(in, 8, mAddr[i]);
  206. StackLog( << "mAddr[i] =" << std::hex << (unsigned long long) mAddr[i] );
  207. }
  208. decode_uintX(in, 16, mPort);
  209. StackLog( << "mPort =" << std::hex << (unsigned long long) mPort );
  210. };
  211. void IPv6AddrPortStruct :: encode(std::ostream& out) const
  212. {
  213. StackLog(<< "Encoding IPv6AddrPortStruct");
  214. for(unsigned int i=0;i<16;i++){
  215. StackLog( << "mAddr[i] =" << std::hex << (unsigned long long) mAddr[i] );
  216. encode_uintX(out, 8, mAddr[i]);
  217. }
  218. StackLog( << "mPort =" << std::hex << (unsigned long long) mPort );
  219. encode_uintX(out, 16, mPort);
  220. };
  221. // Classes for IpAddressAndPortStruct */
  222. IpAddressAndPortStruct :: IpAddressAndPortStruct ()
  223. {
  224. mName = "IpAddressAndPortStruct";
  225. StackLog(<< "Constructing IpAddressAndPortStruct");
  226. mType=(AddressType)0;
  227. mLength=0;
  228. mIpv4Address.mV4addrPort=0;
  229. mIpv6Address.mV6addrPort=0;
  230. };
  231. IpAddressAndPortStruct :: IpAddressAndPortStruct (const IpAddressAndPortStruct &from)
  232. {
  233. // World's lamest copy constructor
  234. if(this==&from) return;
  235. mName = "IpAddressAndPortStruct";
  236. resip::Data dat;
  237. {
  238. resip::DataStream strm(dat);
  239. from.encode(strm);
  240. }
  241. {
  242. resip::DataStream strm(dat);
  243. decode(strm);
  244. }
  245. }
  246. void IpAddressAndPortStruct :: print(std::ostream& out, int indent) const
  247. {
  248. do_indent(out,indent);
  249. (out) << "IpAddressAndPort:\n";
  250. indent+=2;
  251. do_indent(out, indent);
  252. (out) << "type:" << std::hex << (unsigned long long) mType << "\n";
  253. do_indent(out, indent);
  254. (out) << "length:" << std::hex << (unsigned long long)mLength << "\n";
  255. };
  256. void IpAddressAndPortStruct :: decode(std::istream& in)
  257. {
  258. StackLog(<< "Decoding IpAddressAndPortStruct");
  259. {
  260. u_int32 v;
  261. decode_uintX(in, 8, v);
  262. mType=(AddressType)v;
  263. }
  264. decode_uintX(in, 8, mLength);
  265. StackLog( << "mLength =" << std::hex << (unsigned long long) mLength );
  266. switch(mType){
  267. case 1:
  268. mIpv4Address.mV4addrPort = new IPv4AddrPortStruct();
  269. mIpv4Address.mV4addrPort->decode(in);
  270. break;
  271. case 2:
  272. mIpv6Address.mV6addrPort = new IPv6AddrPortStruct();
  273. mIpv6Address.mV6addrPort->decode(in);
  274. break;
  275. default: /* User error */
  276. assert(1==0);
  277. }
  278. };
  279. void IpAddressAndPortStruct :: encode(std::ostream& out) const
  280. {
  281. StackLog(<< "Encoding IpAddressAndPortStruct");
  282. encode_uintX(out, 8, (u_int64)(mType));
  283. StackLog( << "mLength =" << std::hex << (unsigned long long) mLength );
  284. encode_uintX(out, 8, mLength);
  285. switch(mType) {
  286. case 1:
  287. mIpv4Address.mV4addrPort->encode(out);
  288. break;
  289. case 2:
  290. mIpv6Address.mV6addrPort->encode(out);
  291. break;
  292. default: /* User error */
  293. assert(1==0);
  294. }
  295. };
  296. // Classes for DestinationStruct */
  297. DestinationStruct :: DestinationStruct ()
  298. {
  299. mName = "DestinationStruct";
  300. StackLog(<< "Constructing DestinationStruct");
  301. mType=(DestinationType)0;
  302. mPeer.mNodeId=0;
  303. mResource.mResourceId=0;
  304. };
  305. DestinationStruct :: DestinationStruct (const DestinationStruct &from)
  306. {
  307. // World's lamest copy constructor
  308. if(this==&from) return;
  309. mName = "DestinationStruct";
  310. resip::Data dat;
  311. {
  312. resip::DataStream strm(dat);
  313. from.encode(strm);
  314. }
  315. {
  316. resip::DataStream strm(dat);
  317. decode(strm);
  318. }
  319. }
  320. void DestinationStruct :: print(std::ostream& out, int indent) const
  321. {
  322. do_indent(out,indent);
  323. (out) << "Destination:\n";
  324. indent+=2;
  325. do_indent(out, indent);
  326. (out) << "type:" << std::hex << (unsigned long long) mType << "\n";
  327. };
  328. void DestinationStruct :: decode(std::istream& in)
  329. {
  330. StackLog(<< "Decoding DestinationStruct");
  331. {
  332. u_int32 v;
  333. decode_uintX(in, 8, v);
  334. mType=(DestinationType)v;
  335. }
  336. {
  337. resip::Data d;
  338. read_varray1(in, 1, d);
  339. resip::DataStream in_auto(d);
  340. switch(mType){
  341. case 1:
  342. mPeer.mNodeId = new NodeIdStruct();
  343. mPeer.mNodeId->decode(in_auto);
  344. break;
  345. case 2:
  346. mResource.mResourceId = new ResourceIdStruct();
  347. mResource.mResourceId->decode(in_auto);
  348. break;
  349. case 3:
  350. {
  351. UInt32 len;
  352. int c;
  353. decode_uintX(in_auto, 8, len);
  354. resip::DataStream strm(mCompressed.mCompressedId);
  355. while(len--){
  356. c=in_auto.get();
  357. if(c==EOF)
  358. throw resip::ParseException("Premature end of data",
  359. "compressed_id",__FILE__,__LINE__);
  360. strm.put(c);
  361. };
  362. }
  363. break;
  364. default: /* User error */
  365. assert(1==0);
  366. }
  367. if(in_auto.peek()!=EOF)
  368. throw resip::ParseException("Inner encoded value too long",
  369. "Destination",__FILE__,__LINE__);
  370. }
  371. };
  372. void DestinationStruct :: encode(std::ostream& out) const
  373. {
  374. StackLog(<< "Encoding DestinationStruct");
  375. encode_uintX(out, 8, (u_int64)(mType));
  376. long pos1=TELLP(out);
  377. for(int i=0;i<1;i++) out.put(0);
  378. switch(mType) {
  379. case 1:
  380. mPeer.mNodeId->encode(out);
  381. break;
  382. case 2:
  383. mResource.mResourceId->encode(out);
  384. break;
  385. case 3:
  386. encode_uintX(out, 8, mCompressed.mCompressedId.size());
  387. out << mCompressed.mCompressedId;
  388. break;
  389. default: /* User error */
  390. assert(1==0);
  391. }
  392. long pos2=TELLP(out);
  393. SEEKP(out,pos1);
  394. encode_uintX(out, 8, (pos2 - pos1) - 1);
  395. SEEKP(out,pos2);
  396. };
  397. // Classes for SignerIdentityStruct */
  398. SignerIdentityStruct :: SignerIdentityStruct ()
  399. {
  400. mName = "SignerIdentityStruct";
  401. StackLog(<< "Constructing SignerIdentityStruct");
  402. mIdentityType=(SignerIdentityType)0;
  403. };
  404. SignerIdentityStruct :: SignerIdentityStruct (const SignerIdentityStruct &from)
  405. {
  406. // World's lamest copy constructor
  407. if(this==&from) return;
  408. mName = "SignerIdentityStruct";
  409. resip::Data dat;
  410. {
  411. resip::DataStream strm(dat);
  412. from.encode(strm);
  413. }
  414. {
  415. resip::DataStream strm(dat);
  416. decode(strm);
  417. }
  418. }
  419. void SignerIdentityStruct :: print(std::ostream& out, int indent) const
  420. {
  421. do_indent(out,indent);
  422. (out) << "SignerIdentity:\n";
  423. indent+=2;
  424. do_indent(out, indent);
  425. (out) << "identity_type:" << std::hex << (unsigned long long) mIdentityType << "\n";
  426. out << mSignerIdentity.hex();
  427. };
  428. void SignerIdentityStruct :: decode(std::istream& in)
  429. {
  430. StackLog(<< "Decoding SignerIdentityStruct");
  431. {
  432. u_int32 v;
  433. decode_uintX(in, 8, v);
  434. mIdentityType=(SignerIdentityType)v;
  435. }
  436. {
  437. UInt32 len;
  438. int c;
  439. decode_uintX(in, 16, len);
  440. resip::DataStream strm(mSignerIdentity);
  441. while(len--){
  442. c=in.get();
  443. if(c==EOF)
  444. throw resip::ParseException("Premature end of data",
  445. "signer_identity",__FILE__,__LINE__);
  446. strm.put(c);
  447. };
  448. }
  449. };
  450. void SignerIdentityStruct :: encode(std::ostream& out) const
  451. {
  452. StackLog(<< "Encoding SignerIdentityStruct");
  453. encode_uintX(out, 8, (u_int64)(mIdentityType));
  454. encode_uintX(out, 16, mSignerIdentity.size());
  455. out << mSignerIdentity;
  456. };
  457. // Classes for SignatureAndHashAlgorithmStruct */
  458. SignatureAndHashAlgorithmStruct :: SignatureAndHashAlgorithmStruct ()
  459. {
  460. mName = "SignatureAndHashAlgorithmStruct";
  461. StackLog(<< "Constructing SignatureAndHashAlgorithmStruct");
  462. mSig=0;
  463. mHash=0;
  464. };
  465. SignatureAndHashAlgorithmStruct :: SignatureAndHashAlgorithmStruct (const SignatureAndHashAlgorithmStruct &from)
  466. {
  467. // World's lamest copy constructor
  468. if(this==&from) return;
  469. mName = "SignatureAndHashAlgorithmStruct";
  470. resip::Data dat;
  471. {
  472. resip::DataStream strm(dat);
  473. from.encode(strm);
  474. }
  475. {
  476. resip::DataStream strm(dat);
  477. decode(strm);
  478. }
  479. }
  480. void SignatureAndHashAlgorithmStruct :: print(std::ostream& out, int indent) const
  481. {
  482. do_indent(out,indent);
  483. (out) << "SignatureAndHashAlgorithm:\n";
  484. indent+=2;
  485. do_indent(out, indent);
  486. (out) << "sig:" << std::hex << (unsigned long long)mSig << "\n";
  487. do_indent(out, indent);
  488. (out) << "hash:" << std::hex << (unsigned long long)mHash << "\n";
  489. };
  490. void SignatureAndHashAlgorithmStruct :: decode(std::istream& in)
  491. {
  492. StackLog(<< "Decoding SignatureAndHashAlgorithmStruct");
  493. decode_uintX(in, 8, mSig);
  494. StackLog( << "mSig =" << std::hex << (unsigned long long) mSig );
  495. decode_uintX(in, 8, mHash);
  496. StackLog( << "mHash =" << std::hex << (unsigned long long) mHash );
  497. };
  498. void SignatureAndHashAlgorithmStruct :: encode(std::ostream& out) const
  499. {
  500. StackLog(<< "Encoding SignatureAndHashAlgorithmStruct");
  501. StackLog( << "mSig =" << std::hex << (unsigned long long) mSig );
  502. encode_uintX(out, 8, mSig);
  503. StackLog( << "mHash =" << std::hex << (unsigned long long) mHash );
  504. encode_uintX(out, 8, mHash);
  505. };
  506. // Classes for SignatureStruct */
  507. SignatureStruct :: SignatureStruct ()
  508. {
  509. mName = "SignatureStruct";
  510. StackLog(<< "Constructing SignatureStruct");
  511. mAlgorithm=0;
  512. mIdentity=0;
  513. };
  514. SignatureStruct :: SignatureStruct (const SignatureStruct &from)
  515. {
  516. // World's lamest copy constructor
  517. if(this==&from) return;
  518. mName = "SignatureStruct";
  519. resip::Data dat;
  520. {
  521. resip::DataStream strm(dat);
  522. from.encode(strm);
  523. }
  524. {
  525. resip::DataStream strm(dat);
  526. decode(strm);
  527. }
  528. }
  529. void SignatureStruct :: print(std::ostream& out, int indent) const
  530. {
  531. do_indent(out,indent);
  532. (out) << "Signature:\n";
  533. indent+=2;
  534. mAlgorithm->print(out, indent);
  535. mIdentity->print(out, indent);
  536. out << mSignatureValue.hex();
  537. };
  538. void SignatureStruct :: decode(std::istream& in)
  539. {
  540. StackLog(<< "Decoding SignatureStruct");
  541. mAlgorithm = new SignatureAndHashAlgorithmStruct();
  542. mAlgorithm->decode(in);
  543. mIdentity = new SignerIdentityStruct();
  544. mIdentity->decode(in);
  545. {
  546. UInt32 len;
  547. int c;
  548. decode_uintX(in, 16, len);
  549. resip::DataStream strm(mSignatureValue);
  550. while(len--){
  551. c=in.get();
  552. if(c==EOF)
  553. throw resip::ParseException("Premature end of data",
  554. "signature_value",__FILE__,__LINE__);
  555. strm.put(c);
  556. };
  557. }
  558. };
  559. void SignatureStruct :: encode(std::ostream& out) const
  560. {
  561. StackLog(<< "Encoding SignatureStruct");
  562. mAlgorithm->encode(out);
  563. mIdentity->encode(out);
  564. encode_uintX(out, 16, mSignatureValue.size());
  565. out << mSignatureValue;
  566. };
  567. // Classes for ForwardingHeaderStruct */
  568. ForwardingHeaderStruct :: ForwardingHeaderStruct ()
  569. {
  570. mName = "ForwardingHeaderStruct";
  571. StackLog(<< "Constructing ForwardingHeaderStruct");
  572. mReloToken=0;
  573. mOverlay=0;
  574. mTtl=0;
  575. mReserved=0;
  576. mFragment=0;
  577. mVersion=0;
  578. mLength=0;
  579. mTransactionId=0;
  580. mFlags=0;
  581. mRouteLogLenDummy=0;
  582. mMessageCode=0;
  583. };
  584. ForwardingHeaderStruct :: ForwardingHeaderStruct (const ForwardingHeaderStruct &from)
  585. {
  586. // World's lamest copy constructor
  587. if(this==&from) return;
  588. mName = "ForwardingHeaderStruct";
  589. resip::Data dat;
  590. {
  591. resip::DataStream strm(dat);
  592. from.encode(strm);
  593. }
  594. {
  595. resip::DataStream strm(dat);
  596. decode(strm);
  597. }
  598. }
  599. void ForwardingHeaderStruct :: print(std::ostream& out, int indent) const
  600. {
  601. do_indent(out,indent);
  602. (out) << "ForwardingHeader:\n";
  603. indent+=2;
  604. do_indent(out, indent);
  605. (out) << "relo_token:" << std::hex << (unsigned long long)mReloToken << "\n";
  606. do_indent(out, indent);
  607. (out) << "overlay:" << std::hex << (unsigned long long)mOverlay << "\n";
  608. do_indent(out, indent);
  609. (out) << "ttl:" << std::hex << (unsigned long long)mTtl << "\n";
  610. do_indent(out, indent);
  611. (out) << "reserved:" << std::hex << (unsigned long long)mReserved << "\n";
  612. do_indent(out, indent);
  613. (out) << "fragment:" << std::hex << (unsigned long long)mFragment << "\n";
  614. do_indent(out, indent);
  615. (out) << "version:" << std::hex << (unsigned long long)mVersion << "\n";
  616. do_indent(out, indent);
  617. (out) << "length:" << std::hex << (unsigned long long)mLength << "\n";
  618. do_indent(out, indent);
  619. (out) << "transaction_id:" << std::hex << (unsigned long long)mTransactionId << "\n";
  620. do_indent(out, indent);
  621. (out) << "flags:" << std::hex << (unsigned long long)mFlags << "\n";
  622. for(unsigned int i=0;i<mViaList.size();i++){
  623. mViaList[i]->print(out, indent);
  624. }
  625. for(unsigned int i=0;i<mDestinationList.size();i++){
  626. mDestinationList[i]->print(out, indent);
  627. }
  628. do_indent(out, indent);
  629. (out) << "route_log_len_dummy:" << std::hex << (unsigned long long)mRouteLogLenDummy << "\n";
  630. do_indent(out, indent);
  631. (out) << "message_code:" << std::hex << (unsigned long long)mMessageCode << "\n";
  632. };
  633. void ForwardingHeaderStruct :: decode(std::istream& in)
  634. {
  635. StackLog(<< "Decoding ForwardingHeaderStruct");
  636. decode_uintX(in, 32, mReloToken);
  637. StackLog( << "mReloToken =" << std::hex << (unsigned long long) mReloToken );
  638. decode_uintX(in, 32, mOverlay);
  639. StackLog( << "mOverlay =" << std::hex << (unsigned long long) mOverlay );
  640. decode_uintX(in, 8, mTtl);
  641. StackLog( << "mTtl =" << std::hex << (unsigned long long) mTtl );
  642. decode_uintX(in, 8, mReserved);
  643. StackLog( << "mReserved =" << std::hex << (unsigned long long) mReserved );
  644. decode_uintX(in, 16, mFragment);
  645. StackLog( << "mFragment =" << std::hex << (unsigned long long) mFragment );
  646. decode_uintX(in, 8, mVersion);
  647. StackLog( << "mVersion =" << std::hex << (unsigned long long) mVersion );
  648. decode_uintX(in, 24, mLength);
  649. StackLog( << "mLength =" << std::hex << (unsigned long long) mLength );
  650. decode_uintX(in, 64, mTransactionId);
  651. StackLog( << "mTransactionId =" << std::hex << (unsigned long long) mTransactionId );
  652. decode_uintX(in, 16, mFlags);
  653. StackLog( << "mFlags =" << std::hex << (unsigned long long) mFlags );
  654. {
  655. resip::Data d;
  656. read_varray1(in, 2, d);
  657. resip::DataStream in2(d);
  658. int i=0;
  659. while(in2.peek()!=EOF){
  660. mViaList.push_back(0);
  661. mViaList[i] = new DestinationStruct();
  662. mViaList[i]->decode(in2);
  663. i++;
  664. }
  665. ; }
  666. {
  667. resip::Data d;
  668. read_varray1(in, 2, d);
  669. resip::DataStream in2(d);
  670. int i=0;
  671. while(in2.peek()!=EOF){
  672. mDestinationList.push_back(0);
  673. mDestinationList[i] = new DestinationStruct();
  674. mDestinationList[i]->decode(in2);
  675. i++;
  676. }
  677. ; }
  678. decode_uintX(in, 16, mRouteLogLenDummy);
  679. StackLog( << "mRouteLogLenDummy =" << std::hex << (unsigned long long) mRouteLogLenDummy );
  680. decode_uintX(in, 16, mMessageCode);
  681. StackLog( << "mMessageCode =" << std::hex << (unsigned long long) mMessageCode );
  682. };
  683. void ForwardingHeaderStruct :: encode(std::ostream& out) const
  684. {
  685. StackLog(<< "Encoding ForwardingHeaderStruct");
  686. StackLog( << "mReloToken =" << std::hex << (unsigned long long) mReloToken );
  687. encode_uintX(out, 32, mReloToken);
  688. StackLog( << "mOverlay =" << std::hex << (unsigned long long) mOverlay );
  689. encode_uintX(out, 32, mOverlay);
  690. StackLog( << "mTtl =" << std::hex << (unsigned long long) mTtl );
  691. encode_uintX(out, 8, mTtl);
  692. StackLog( << "mReserved =" << std::hex << (unsigned long long) mReserved );
  693. encode_uintX(out, 8, mReserved);
  694. StackLog( << "mFragment =" << std::hex << (unsigned long long) mFragment );
  695. encode_uintX(out, 16, mFragment);
  696. StackLog( << "mVersion =" << std::hex << (unsigned long long) mVersion );
  697. encode_uintX(out, 8, mVersion);
  698. StackLog( << "mLength =" << std::hex << (unsigned long long) mLength );
  699. encode_uintX(out, 24, mLength);
  700. StackLog( << "mTransactionId =" << std::hex << (unsigned long long) mTransactionId );
  701. encode_uintX(out, 64, mTransactionId);
  702. StackLog( << "mFlags =" << std::hex << (unsigned long long) mFlags );
  703. encode_uintX(out, 16, mFlags);
  704. {
  705. long pos1=TELLP(out);
  706. for(int i=0;i<2;i++) out.put(0);
  707. for(unsigned int i=0;i<mViaList.size();i++)
  708. {
  709. mViaList[i]->encode(out);
  710. }
  711. long pos2=TELLP(out);
  712. SEEKP(out,pos1);
  713. encode_uintX(out, 16, (pos2 - pos1) - 2);
  714. SEEKP(out,pos2);
  715. }
  716. {
  717. long pos1=TELLP(out);
  718. for(int i=0;i<2;i++) out.put(0);
  719. for(unsigned int i=0;i<mDestinationList.size();i++)
  720. {
  721. mDestinationList[i]->encode(out);
  722. }
  723. long pos2=TELLP(out);
  724. SEEKP(out,pos1);
  725. encode_uintX(out, 16, (pos2 - pos1) - 2);
  726. SEEKP(out,pos2);
  727. }
  728. StackLog( << "mRouteLogLenDummy =" << std::hex << (unsigned long long) mRouteLogLenDummy );
  729. encode_uintX(out, 16, mRouteLogLenDummy);
  730. StackLog( << "mMessageCode =" << std::hex << (unsigned long long) mMessageCode );
  731. encode_uintX(out, 16, mMessageCode);
  732. };
  733. // Classes for ForwardingLayerMessageStruct */
  734. ForwardingLayerMessageStruct :: ForwardingLayerMessageStruct ()
  735. {
  736. mName = "ForwardingLayerMessageStruct";
  737. StackLog(<< "Constructing ForwardingLayerMessageStruct");
  738. mHeader=0;
  739. mSig=0;
  740. };
  741. ForwardingLayerMessageStruct :: ForwardingLayerMessageStruct (const ForwardingLayerMessageStruct &from)
  742. {
  743. // World's lamest copy constructor
  744. if(this==&from) return;
  745. mName = "ForwardingLayerMessageStruct";
  746. resip::Data dat;
  747. {
  748. resip::DataStream strm(dat);
  749. from.encode(strm);
  750. }
  751. {
  752. resip::DataStream strm(dat);
  753. decode(strm);
  754. }
  755. }
  756. void ForwardingLayerMessageStruct :: print(std::ostream& out, int indent) const
  757. {
  758. do_indent(out,indent);
  759. (out) << "ForwardingLayerMessage:\n";
  760. indent+=2;
  761. mHeader->print(out, indent);
  762. out << mPayload.hex();
  763. mSig->print(out, indent);
  764. };
  765. void ForwardingLayerMessageStruct :: decode(std::istream& in)
  766. {
  767. StackLog(<< "Decoding ForwardingLayerMessageStruct");
  768. mHeader = new ForwardingHeaderStruct();
  769. mHeader->decode(in);
  770. {
  771. UInt32 len;
  772. int c;
  773. decode_uintX(in, 24, len);
  774. resip::DataStream strm(mPayload);
  775. while(len--){
  776. c=in.get();
  777. if(c==EOF)
  778. throw resip::ParseException("Premature end of data",
  779. "payload",__FILE__,__LINE__);
  780. strm.put(c);
  781. };
  782. }
  783. mSig = new SignatureStruct();
  784. mSig->decode(in);
  785. };
  786. void ForwardingLayerMessageStruct :: encode(std::ostream& out) const
  787. {
  788. StackLog(<< "Encoding ForwardingLayerMessageStruct");
  789. mHeader->encode(out);
  790. encode_uintX(out, 24, mPayload.size());
  791. out << mPayload;
  792. mSig->encode(out);
  793. };
  794. // Classes for MessagePayloadStruct */
  795. MessagePayloadStruct :: MessagePayloadStruct ()
  796. {
  797. mName = "MessagePayloadStruct";
  798. StackLog(<< "Constructing MessagePayloadStruct");
  799. };
  800. MessagePayloadStruct :: MessagePayloadStruct (const MessagePayloadStruct &from)
  801. {
  802. // World's lamest copy constructor
  803. if(this==&from) return;
  804. mName = "MessagePayloadStruct";
  805. resip::Data dat;
  806. {
  807. resip::DataStream strm(dat);
  808. from.encode(strm);
  809. }
  810. {
  811. resip::DataStream strm(dat);
  812. decode(strm);
  813. }
  814. }
  815. void MessagePayloadStruct :: print(std::ostream& out, int indent) const
  816. {
  817. do_indent(out,indent);
  818. (out) << "MessagePayload:\n";
  819. indent+=2;
  820. out << mPayload.hex();
  821. };
  822. void MessagePayloadStruct :: decode(std::istream& in)
  823. {
  824. StackLog(<< "Decoding MessagePayloadStruct");
  825. {
  826. UInt32 len;
  827. int c;
  828. decode_uintX(in, 24, len);
  829. resip::DataStream strm(mPayload);
  830. while(len--){
  831. c=in.get();
  832. if(c==EOF)
  833. throw resip::ParseException("Premature end of data",
  834. "payload",__FILE__,__LINE__);
  835. strm.put(c);
  836. };
  837. }
  838. };
  839. void MessagePayloadStruct :: encode(std::ostream& out) const
  840. {
  841. StackLog(<< "Encoding MessagePayloadStruct");
  842. encode_uintX(out, 24, mPayload.size());
  843. out << mPayload;
  844. };
  845. // Classes for ErrorResponseStruct */
  846. ErrorResponseStruct :: ErrorResponseStruct ()
  847. {
  848. mName = "ErrorResponseStruct";
  849. StackLog(<< "Constructing ErrorResponseStruct");
  850. mErrorCode=0;
  851. };
  852. ErrorResponseStruct :: ErrorResponseStruct (const ErrorResponseStruct &from)
  853. {
  854. // World's lamest copy constructor
  855. if(this==&from) return;
  856. mName = "ErrorResponseStruct";
  857. resip::Data dat;
  858. {
  859. resip::DataStream strm(dat);
  860. from.encode(strm);
  861. }
  862. {
  863. resip::DataStream strm(dat);
  864. decode(strm);
  865. }
  866. }
  867. void ErrorResponseStruct :: print(std::ostream& out, int indent) const
  868. {
  869. do_indent(out,indent);
  870. (out) << "ErrorResponse:\n";
  871. indent+=2;
  872. do_indent(out, indent);
  873. (out) << "error_code:" << std::hex << (unsigned long long)mErrorCode << "\n";
  874. out << mReasonPhrase.hex();
  875. out << mErrorInfo.hex();
  876. };
  877. void ErrorResponseStruct :: decode(std::istream& in)
  878. {
  879. StackLog(<< "Decoding ErrorResponseStruct");
  880. decode_uintX(in, 16, mErrorCode);
  881. StackLog( << "mErrorCode =" << std::hex << (unsigned long long) mErrorCode );
  882. {
  883. UInt32 len;
  884. int c;
  885. decode_uintX(in, 8, len);
  886. resip::DataStream strm(mReasonPhrase);
  887. while(len--){
  888. c=in.get();
  889. if(c==EOF)
  890. throw resip::ParseException("Premature end of data",
  891. "reason_phrase",__FILE__,__LINE__);
  892. strm.put(c);
  893. };
  894. }
  895. {
  896. UInt32 len;
  897. int c;
  898. decode_uintX(in, 16, len);
  899. resip::DataStream strm(mErrorInfo);
  900. while(len--){
  901. c=in.get();
  902. if(c==EOF)
  903. throw resip::ParseException("Premature end of data",
  904. "error_info",__FILE__,__LINE__);
  905. strm.put(c);
  906. };
  907. }
  908. };
  909. void ErrorResponseStruct :: encode(std::ostream& out) const
  910. {
  911. StackLog(<< "Encoding ErrorResponseStruct");
  912. StackLog( << "mErrorCode =" << std::hex << (unsigned long long) mErrorCode );
  913. encode_uintX(out, 16, mErrorCode);
  914. encode_uintX(out, 8, mReasonPhrase.size());
  915. out << mReasonPhrase;
  916. encode_uintX(out, 16, mErrorInfo.size());
  917. out << mErrorInfo;
  918. };
  919. // Classes for JoinReqStruct */
  920. JoinReqStruct :: JoinReqStruct ()
  921. {
  922. mName = "JoinReqStruct";
  923. StackLog(<< "Constructing JoinReqStruct");
  924. mJoiningPeerId=0;
  925. };
  926. JoinReqStruct :: JoinReqStruct (const JoinReqStruct &from)
  927. {
  928. // World's lamest copy constructor
  929. if(this==&from) return;
  930. mName = "JoinReqStruct";
  931. resip::Data dat;
  932. {
  933. resip::DataStream strm(dat);
  934. from.encode(strm);
  935. }
  936. {
  937. resip::DataStream strm(dat);
  938. decode(strm);
  939. }
  940. }
  941. void JoinReqStruct :: print(std::ostream& out, int indent) const
  942. {
  943. do_indent(out,indent);
  944. (out) << "JoinReq:\n";
  945. indent+=2;
  946. mJoiningPeerId->print(out, indent);
  947. out << mOverlaySpecificData.hex();
  948. };
  949. void JoinReqStruct :: decode(std::istream& in)
  950. {
  951. StackLog(<< "Decoding JoinReqStruct");
  952. mJoiningPeerId = new NodeIdStruct();
  953. mJoiningPeerId->decode(in);
  954. {
  955. UInt32 len;
  956. int c;
  957. decode_uintX(in, 16, len);
  958. resip::DataStream strm(mOverlaySpecificData);
  959. while(len--){
  960. c=in.get();
  961. if(c==EOF)
  962. throw resip::ParseException("Premature end of data",
  963. "overlay_specific_data",__FILE__,__LINE__);
  964. strm.put(c);
  965. };
  966. }
  967. };
  968. void JoinReqStruct :: encode(std::ostream& out) const
  969. {
  970. StackLog(<< "Encoding JoinReqStruct");
  971. mJoiningPeerId->encode(out);
  972. encode_uintX(out, 16, mOverlaySpecificData.size());
  973. out << mOverlaySpecificData;
  974. };
  975. // Classes for JoinAnsStruct */
  976. JoinAnsStruct :: JoinAnsStruct ()
  977. {
  978. mName = "JoinAnsStruct";
  979. StackLog(<< "Constructing JoinAnsStruct");
  980. };
  981. JoinAnsStruct :: JoinAnsStruct (const JoinAnsStruct &from)
  982. {
  983. // World's lamest copy constructor
  984. if(this==&from) return;
  985. mName = "JoinAnsStruct";
  986. resip::Data dat;
  987. {
  988. resip::DataStream strm(dat);
  989. from.encode(strm);
  990. }
  991. {
  992. resip::DataStream strm(dat);
  993. decode(strm);
  994. }
  995. }
  996. void JoinAnsStruct :: print(std::ostream& out, int indent) const
  997. {
  998. do_indent(out,indent);
  999. (out) << "JoinAns:\n";
  1000. indent+=2;
  1001. out << mOverlaySpecificData.hex();
  1002. };
  1003. void JoinAnsStruct :: decode(std::istream& in)
  1004. {
  1005. StackLog(<< "Decoding JoinAnsStruct");
  1006. {
  1007. UInt32 len;
  1008. int c;
  1009. decode_uintX(in, 16, len);
  1010. resip::DataStream strm(mOverlaySpecificData);
  1011. while(len--){
  1012. c=in.get();
  1013. if(c==EOF)
  1014. throw resip::ParseException("Premature end of data",
  1015. "overlay_specific_data",__FILE__,__LINE__);
  1016. strm.put(c);
  1017. };
  1018. }
  1019. };
  1020. void JoinAnsStruct :: encode(std::ostream& out) const
  1021. {
  1022. StackLog(<< "Encoding JoinAnsStruct");
  1023. encode_uintX(out, 16, mOverlaySpecificData.size());
  1024. out << mOverlaySpecificData;
  1025. };
  1026. // Classes for LeaveReqStruct */
  1027. LeaveReqStruct :: LeaveReqStruct ()
  1028. {
  1029. mName = "LeaveReqStruct";
  1030. StackLog(<< "Constructing LeaveReqStruct");
  1031. mLeavingPeerId=0;
  1032. };
  1033. LeaveReqStruct :: LeaveReqStruct (const LeaveReqStruct &from)
  1034. {
  1035. // World's lamest copy constructor
  1036. if(this==&from) return;
  1037. mName = "LeaveReqStruct";
  1038. resip::Data dat;
  1039. {
  1040. resip::DataStream strm(dat);
  1041. from.encode(strm);
  1042. }
  1043. {
  1044. resip::DataStream strm(dat);
  1045. decode(strm);
  1046. }
  1047. }
  1048. void LeaveReqStruct :: print(std::ostream& out, int indent) const
  1049. {
  1050. do_indent(out,indent);
  1051. (out) << "LeaveReq:\n";
  1052. indent+=2;
  1053. mLeavingPeerId->print(out, indent);
  1054. out << mOverlaySpecificData.hex();
  1055. };
  1056. void LeaveReqStruct :: decode(std::istream& in)
  1057. {
  1058. StackLog(<< "Decoding LeaveReqStruct");
  1059. mLeavingPeerId = new NodeIdStruct();
  1060. mLeavingPeerId->decode(in);
  1061. {
  1062. UInt32 len;
  1063. int c;
  1064. decode_uintX(in, 16, len);
  1065. resip::DataStream strm(mOverlaySpecificData);
  1066. while(len--){
  1067. c=in.get();
  1068. if(c==EOF)
  1069. throw resip::ParseException("Premature end of data",
  1070. "overlay_specific_data",__FILE__,__LINE__);
  1071. strm.put(c);
  1072. };
  1073. }
  1074. };
  1075. void LeaveReqStruct :: encode(std::ostream& out) const
  1076. {
  1077. StackLog(<< "Encoding LeaveReqStruct");
  1078. mLeavingPeerId->encode(out);
  1079. encode_uintX(out, 16, mOverlaySpecificData.size());
  1080. out << mOverlaySpecificData;
  1081. };
  1082. // Classes for RouteQueryReqStruct */
  1083. RouteQueryReqStruct :: RouteQueryReqStruct ()
  1084. {
  1085. mName = "RouteQueryReqStruct";
  1086. StackLog(<< "Constructing RouteQueryReqStruct");
  1087. mSendUpdate=(Boolean)0;
  1088. mDestination=0;
  1089. };
  1090. RouteQueryReqStruct :: RouteQueryReqStruct (const RouteQueryReqStruct &from)
  1091. {
  1092. // World's lamest copy constructor
  1093. if(this==&from) return;
  1094. mName = "RouteQueryReqStruct";
  1095. resip::Data dat;
  1096. {
  1097. resip::DataStream strm(dat);
  1098. from.encode(strm);
  1099. }
  1100. {
  1101. resip::DataStream strm(dat);
  1102. decode(strm);
  1103. }
  1104. }
  1105. void RouteQueryReqStruct :: print(std::ostream& out, int indent) const
  1106. {
  1107. do_indent(out,indent);
  1108. (out) << "RouteQueryReq:\n";
  1109. indent+=2;
  1110. do_indent(out, indent);
  1111. (out) << "send_update:" << std::hex << (unsigned long long) mSendUpdate << "\n";
  1112. mDestination->print(out, indent);
  1113. out << mOverlaySpecificData.hex();
  1114. };
  1115. void RouteQueryReqStruct :: decode(std::istream& in)
  1116. {
  1117. StackLog(<< "Decoding RouteQueryReqStruct");
  1118. {
  1119. u_int32 v;
  1120. decode_uintX(in, 8, v);
  1121. mSendUpdate=(Boolean)v;
  1122. }
  1123. mDestination = new DestinationStruct();
  1124. mDestination->decode(in);
  1125. {
  1126. UInt32 len;
  1127. int c;
  1128. decode_uintX(in, 16, len);
  1129. resip::DataStream strm(mOverlaySpecificData);
  1130. while(len--){
  1131. c=in.get();
  1132. if(c==EOF)
  1133. throw resip::ParseException("Premature end of data",
  1134. "overlay_specific_data",__FILE__,__LINE__);
  1135. strm.put(c);
  1136. };
  1137. }
  1138. };
  1139. void RouteQueryReqStruct :: encode(std::ostream& out) const
  1140. {
  1141. StackLog(<< "Encoding RouteQueryReqStruct");
  1142. encode_uintX(out, 8, (u_int64)(mSendUpdate));
  1143. mDestination->encode(out);
  1144. encode_uintX(out, 16, mOverlaySpecificData.size());
  1145. out << mOverlaySpecificData;
  1146. };
  1147. // Classes for FramedMessageStruct */
  1148. FramedMessageStruct :: FramedMessageStruct ()
  1149. {
  1150. mName = "FramedMessageStruct";
  1151. StackLog(<< "Constructing FramedMessageStruct");
  1152. mType=(FramedMessageType)0;
  1153. mData.mSequence=0;
  1154. mAck.mAckSequence=0;
  1155. mAck.mReceived=0;
  1156. };
  1157. FramedMessageStruct :: FramedMessageStruct (const FramedMessageStruct &from)
  1158. {
  1159. // World's lamest copy constructor
  1160. if(this==&from) return;
  1161. mName = "FramedMessageStruct";
  1162. resip::Data dat;
  1163. {
  1164. resip::DataStream strm(dat);
  1165. from.encode(strm);
  1166. }
  1167. {
  1168. resip::DataStream strm(dat);
  1169. decode(strm);
  1170. }
  1171. }
  1172. void FramedMessageStruct :: print(std::ostream& out, int indent) const
  1173. {
  1174. do_indent(out,indent);
  1175. (out) << "FramedMessage:\n";
  1176. indent+=2;
  1177. do_indent(out, indent);
  1178. (out) << "type:" << std::hex << (unsigned long long) mType << "\n";
  1179. };
  1180. void FramedMessageStruct :: decode(std::istream& in)
  1181. {
  1182. StackLog(<< "Decoding FramedMessageStruct");
  1183. {
  1184. u_int32 v;
  1185. decode_uintX(in, 8, v);
  1186. mType=(FramedMessageType)v;
  1187. }
  1188. switch(mType){
  1189. case 128:
  1190. decode_uintX(in, 24, mData.mSequence);
  1191. StackLog( << "mData.mSequence =" << std::hex << (unsigned long long) mData.mSequence );
  1192. {
  1193. UInt32 len;
  1194. int c;
  1195. decode_uintX(in, 24, len);
  1196. resip::DataStream strm(mData.mMessage);
  1197. while(len--){
  1198. c=in.get();
  1199. if(c==EOF)
  1200. throw resip::ParseException("Premature end of data",
  1201. "message",__FILE__,__LINE__);
  1202. strm.put(c);
  1203. };
  1204. }
  1205. break;
  1206. case 129:
  1207. decode_uintX(in, 24, mAck.mAckSequence);
  1208. StackLog( << "mAck.mAckSequence =" << std::hex << (unsigned long long) mAck.mAckSequence );
  1209. decode_uintX(in, 32, mAck.mReceived);
  1210. StackLog( << "mAck.mReceived =" << std::hex << (unsigned long long) mAck.mReceived );
  1211. break;
  1212. default: /* User error */
  1213. assert(1==0);
  1214. }
  1215. };
  1216. void FramedMessageStruct :: encode(std::ostream& out) const
  1217. {
  1218. StackLog(<< "Encoding FramedMessageStruct");
  1219. encode_uintX(out, 8, (u_int64)(mType));
  1220. switch(mType) {
  1221. case 128:
  1222. StackLog( << "mData.mSequence =" << std::hex << (unsigned long long) mData.mSequence );
  1223. encode_uintX(out, 24, mData.mSequence);
  1224. encode_uintX(out, 24, mData.mMessage.size());
  1225. out << mData.mMessage;
  1226. break;
  1227. case 129:
  1228. StackLog( << "mAck.mAckSequence =" << std::hex << (unsigned long long) mAck.mAckSequence );
  1229. encode_uintX(out, 24, mAck.mAckSequence);
  1230. StackLog( << "mAck.mReceived =" << std::hex << (unsigned long long) mAck.mReceived );
  1231. encode_uintX(out, 32, mAck.mReceived);
  1232. break;
  1233. default: /* User error */
  1234. assert(1==0);
  1235. }
  1236. };
  1237. // Classes for IceCandidateStruct */
  1238. IceCandidateStruct :: IceCandidateStruct ()
  1239. {
  1240. mName = "IceCandidateStruct";
  1241. StackLog(<< "Constructing IceCandidateStruct");
  1242. };
  1243. IceCandidateStruct :: IceCandidateStruct (const IceCandidateStruct &from)
  1244. {
  1245. // World's lamest copy constructor
  1246. if(this==&from) return;
  1247. mName = "IceCandidateStruct";
  1248. resip::Data dat;
  1249. {
  1250. resip::DataStream strm(dat);
  1251. from.encode(strm);
  1252. }
  1253. {
  1254. resip::DataStream strm(dat);
  1255. decode(strm);
  1256. }
  1257. }
  1258. void IceCandidateStruct :: print(std::ostream& out, int indent) const
  1259. {
  1260. do_indent(out,indent);
  1261. (out) << "IceCandidate:\n";
  1262. indent+=2;
  1263. out << mCandidate.hex();
  1264. };
  1265. void IceCandidateStruct :: decode(std::istream& in)
  1266. {
  1267. StackLog(<< "Decoding IceCandidateStruct");
  1268. {
  1269. UInt32 len;
  1270. int c;
  1271. decode_uintX(in, 16, len);
  1272. resip::DataStream strm(mCandidate);
  1273. while(len--){
  1274. c=in.get();
  1275. if(c==EOF)
  1276. throw resip::ParseException("Premature end of data",
  1277. "candidate",__FILE__,__LINE__);
  1278. strm.put(c);
  1279. };
  1280. }
  1281. };
  1282. void IceCandidateStruct :: encode(std::ostream& out) const
  1283. {
  1284. StackLog(<< "Encoding IceCandidateStruct");
  1285. encode_uintX(out, 16, mCandidate.size());
  1286. out << mCandidate;
  1287. };
  1288. // Classes for ConnectReqAnsStruct */
  1289. ConnectReqAnsStruct :: ConnectReqAnsStruct ()
  1290. {
  1291. mName = "ConnectReqAnsStruct";
  1292. StackLog(<< "Constructing ConnectReqAnsStruct");
  1293. mApplication=0;
  1294. };
  1295. ConnectReqAnsStruct :: ConnectReqAnsStruct (const ConnectReqAnsStruct &from)
  1296. {
  1297. // World's lamest copy constructor
  1298. if(this==&from) return;
  1299. mName = "ConnectReqAnsStruct";
  1300. resip::Data dat;
  1301. {
  1302. resip::DataStream strm(dat);
  1303. from.encode(strm);
  1304. }
  1305. {
  1306. resip::DataStream strm(dat);
  1307. decode(strm);
  1308. }
  1309. }
  1310. void ConnectReqAnsStruct :: print(std::ostream& out, int indent) const
  1311. {
  1312. do_indent(out,indent);
  1313. (out) << "ConnectReqAns:\n";
  1314. indent+=2;
  1315. out << mUfrag.hex();
  1316. out << mPassword.hex();
  1317. do_indent(out, indent);
  1318. (out) << "application:" << std::hex << (unsigned long long)mApplication << "\n";
  1319. out << mRole.hex();
  1320. for(unsigned int i=0;i<mCandidates.size();i++){
  1321. mCandidates[i]->print(out, indent);
  1322. }
  1323. };
  1324. void ConnectReqAnsStruct :: decode(std::istream& in)
  1325. {
  1326. StackLog(<< "Decoding ConnectReqAnsStruct");
  1327. {
  1328. UInt32 len;
  1329. int c;
  1330. decode_uintX(in, 8, len);
  1331. resip::DataStream strm(mUfrag);
  1332. while(len--){
  1333. c=in.get();
  1334. if(c==EOF)
  1335. throw resip::ParseException("Premature end of data",
  1336. "ufrag",__FILE__,__LINE__);
  1337. strm.put(c);
  1338. };
  1339. }
  1340. {
  1341. UInt32 len;
  1342. int c;
  1343. decode_uintX(in, 8, len);
  1344. resip::DataStream strm(mPassword);
  1345. while(len--){
  1346. c=in.get();
  1347. if(c==EOF)
  1348. throw resip::ParseException("Premature end of data",
  1349. "password",__FILE__,__LINE__);
  1350. strm.put(c);
  1351. };
  1352. }
  1353. decode_uintX(in, 16, mApplication);
  1354. StackLog( << "mApplication =" << std::hex << (unsigned long long) mApplication );
  1355. {
  1356. UInt32 len;
  1357. int c;
  1358. decode_uintX(in, 8, len);
  1359. resip::DataStream strm(mRole);
  1360. while(len--){
  1361. c=in.get();
  1362. if(c==EOF)
  1363. throw resip::ParseException("Premature end of data",
  1364. "role",__FILE__,__LINE__);
  1365. strm.put(c);
  1366. };
  1367. }
  1368. {
  1369. resip::Data d;
  1370. read_varray1(in, 2, d);
  1371. resip::DataStream in2(d);
  1372. int i=0;
  1373. while(in2.peek()!=EOF){
  1374. mCandidates.push_back(0);
  1375. mCandidates[i] = new IceCandidateStruct();
  1376. mCandidates[i]->decode(in2);
  1377. i++;
  1378. }
  1379. ; }
  1380. };
  1381. void ConnectReqAnsStruct :: encode(std::ostream& out) const
  1382. {
  1383. StackLog(<< "Encoding ConnectReqAnsStruct");
  1384. encode_uintX(out, 8, mUfrag.size());
  1385. out << mUfrag;
  1386. encode_uintX(out, 8, mPassword.size());
  1387. out << mPassword;
  1388. StackLog( << "mApplication =" << std::hex << (unsigned long long) mApplication );
  1389. encode_uintX(out, 16, mApplication);
  1390. encode_uintX(out, 8, mRole.size());
  1391. out << mRole;
  1392. {
  1393. long pos1=TELLP(out);
  1394. for(int i=0;i<2;i++) out.put(0);
  1395. for(unsigned int i=0;i<mCandidates.size();i++)
  1396. {
  1397. mCandidates[i]->encode(out);
  1398. }
  1399. long pos2=TELLP(out);
  1400. SEEKP(out,pos1);
  1401. encode_uintX(out, 16, (pos2 - pos1) - 2);
  1402. SEEKP(out,pos2);
  1403. }
  1404. };
  1405. // Classes for PingReqStruct */
  1406. PingReqStruct :: PingReqStruct ()
  1407. {
  1408. mName = "PingReqStruct";
  1409. StackLog(<< "Constructing PingReqStruct");
  1410. };
  1411. PingReqStruct :: PingReqStruct (const PingReqStruct &from)
  1412. {
  1413. // World's lamest copy constructor
  1414. if(this==&from) return;
  1415. mName = "PingReqStruct";
  1416. resip::Data dat;
  1417. {
  1418. resip::DataStream strm(dat);
  1419. from.encode(strm);
  1420. }
  1421. {
  1422. resip::DataStream strm(dat);
  1423. decode(strm);
  1424. }
  1425. }
  1426. void PingReqStruct :: print(std::ostream& out, int indent) const
  1427. {
  1428. do_indent(out,indent);
  1429. (out) << "PingReq:\n";
  1430. indent+=2;
  1431. for(unsigned int i=0;i<mRequestedInfo.size();i++){
  1432. do_indent(out, indent);
  1433. (out) << "uint8:" << std::hex << (unsigned long long) mRequestedInfo[i] << "\n";
  1434. }
  1435. };
  1436. void PingReqStruct :: decode(std::istream& in)
  1437. {
  1438. StackLog(<< "Decoding PingReqStruct");
  1439. {
  1440. resip::Data d;
  1441. read_varray1(in, 1, d);
  1442. resip::DataStream in2(d);
  1443. int i=0;
  1444. while(in2.peek()!=EOF){
  1445. mRequestedInfo.push_back(0);
  1446. decode_uintX(in2, 8, mRequestedInfo[i]);
  1447. StackLog( << "mRequestedInfo[i] =" << std::hex << (unsigned long long) mRequestedInfo[i] );
  1448. i++;
  1449. }
  1450. ; }
  1451. };
  1452. void PingReqStruct :: encode(std::ostream& out) const
  1453. {
  1454. StackLog(<< "Encoding PingReqStruct");
  1455. {
  1456. long pos1=TELLP(out);
  1457. for(int i=0;i<1;i++) out.put(0);
  1458. for(unsigned int i=0;i<mRequestedInfo.size();i++)
  1459. {
  1460. StackLog( << "mRequestedInfo[i] =" << std::hex << (unsigned long long) mRequestedInfo[i] );
  1461. encode_uintX(out, 8, mRequestedInfo[i]);
  1462. }
  1463. long pos2=TELLP(out);
  1464. SEEKP(out,pos1);
  1465. encode_uintX(out, 8, (pos2 - pos1) - 1);
  1466. SEEKP(out,pos2);
  1467. }
  1468. };
  1469. // Classes for PingInformationStruct */
  1470. PingInformationStruct :: PingInformationStruct ()
  1471. {
  1472. mName = "PingInformationStruct";
  1473. StackLog(<< "Constructing PingInformationStruct");
  1474. mType=(PingInformationType)0;
  1475. mResponsibleSet.mResponsiblePpb=0;
  1476. mNumResources.mNumResources=0;
  1477. };
  1478. PingInformationStruct :: PingInformationStruct (const PingInformationStruct &from)
  1479. {
  1480. // World's lamest copy constructor
  1481. if(this==&from) return;
  1482. mName = "PingInformationStruct";
  1483. resip::Data dat;
  1484. {
  1485. resip::DataStream strm(dat);
  1486. from.encode(strm);
  1487. }
  1488. {
  1489. resip::DataStream strm(dat);
  1490. decode(strm);
  1491. }
  1492. }
  1493. void PingInformationStruct :: print(std::ostream& out, int indent) const
  1494. {
  1495. do_indent(out,indent);
  1496. (out) << "PingInformation:\n";
  1497. indent+=2;
  1498. do_indent(out, indent);
  1499. (out) << "type:" << std::hex << (unsigned long long) mType << "\n";
  1500. };
  1501. void PingInformationStruct :: decode(std::istream& in)
  1502. {
  1503. StackLog(<< "Decoding PingInformationStruct");
  1504. {
  1505. u_int32 v;
  1506. decode_uintX(in, 8, v);
  1507. mType=(PingInformationType)v;
  1508. }
  1509. switch(mType){
  1510. case 1:
  1511. decode_uintX(in, 32, mResponsibleSet.mResponsiblePpb);
  1512. StackLog( << "mResponsibleSet.mResponsiblePpb =" << std::hex << (unsigned long long) mResponsibleSet.mResponsiblePpb );
  1513. break;
  1514. case 2:
  1515. decode_uintX(in, 32, mNumResources.mNumResources);
  1516. StackLog( << "mNumResources.mNumResources =" << std::hex << (unsigned long long) mNumResources.mNumResources );
  1517. break;
  1518. default: /* User error */
  1519. assert(1==0);
  1520. }
  1521. };
  1522. void PingInformationStruct :: encode(std::ostream& out) const
  1523. {
  1524. StackLog(<< "Encoding PingInformationStruct");
  1525. encode_uintX(out, 8, (u_int64)(mType));
  1526. switch(mType) {
  1527. case 1:
  1528. StackLog( << "mResponsibleSet.mResponsiblePpb =" << std::hex << (unsigned long long) mResponsibleSet.mResponsiblePpb );
  1529. encode_uintX(out, 32, mResponsibleSet.mResponsiblePpb);
  1530. break;
  1531. case 2:
  1532. StackLog( << "mNumResources.mNumResources =" << std::hex << (unsigned long long) mNumResources.mNumResources );
  1533. encode_uintX(out, 32, mNumResources.mNumResources);
  1534. break;
  1535. default: /* User error */
  1536. assert(1==0);
  1537. }
  1538. };
  1539. // Classes for PingAnsStruct */
  1540. PingAnsStruct :: PingAnsStruct ()
  1541. {
  1542. mName = "PingAnsStruct";
  1543. StackLog(<< "Constructing PingAnsStruct");
  1544. mResponseId=0;
  1545. };
  1546. PingAnsStruct :: PingAnsStruct (const PingAnsStruct &from)
  1547. {
  1548. // World's lamest copy constructor
  1549. if(this==&from) return;
  1550. mName = "PingAnsStruct";
  1551. resip::Data dat;
  1552. {
  1553. resip::DataStream strm(dat);
  1554. from.encode(strm);
  1555. }
  1556. {
  1557. resip::DataStream strm(dat);
  1558. decode(strm);
  1559. }
  1560. }
  1561. void PingAnsStruct :: print(std::ostream& out, int indent) const
  1562. {
  1563. do_indent(out,indent);
  1564. (out) << "PingAns:\n";
  1565. indent+=2;
  1566. do_indent(out, indent);
  1567. (out) << "response_id:" << std::hex << (unsigned long long)mResponseId << "\n";
  1568. for(unsigned int i=0;i<mPingInfo.size();i++){
  1569. mPingInfo[i]->print(out, indent);
  1570. }
  1571. };
  1572. void PingAnsStruct :: decode(std::istream& in)
  1573. {
  1574. StackLog(<< "Decoding PingAnsStruct");
  1575. decode_uintX(in, 64, mResponseId);
  1576. StackLog( << "mResponseId =" << std::hex << (unsigned long long) mResponseId );
  1577. {
  1578. resip::Data d;
  1579. read_varray1(in, 2, d);
  1580. resip::DataStream in2(d);
  1581. int i=0;
  1582. while(in2.peek()!=EOF){
  1583. mPingInfo.push_back(0);
  1584. mPingInfo[i] = new PingInformationStruct();
  1585. mPingInfo[i]->decode(in2);
  1586. i++;
  1587. }
  1588. ; }
  1589. };
  1590. void PingAnsStruct :: encode(std::ostream& out) const
  1591. {
  1592. StackLog(<< "Encoding PingAnsStruct");
  1593. StackLog( << "mResponseId =" << std::hex << (unsigned long long) mResponseId );
  1594. encode_uintX(out, 64, mResponseId);
  1595. {
  1596. long pos1=TELLP(out);
  1597. for(int i=0;i<2;i++) out.put(0);
  1598. for(unsigned int i=0;i<mPingInfo.size();i++)
  1599. {
  1600. mPingInfo[i]->encode(out);
  1601. }
  1602. long pos2=TELLP(out);
  1603. SEEKP(out,pos1);
  1604. encode_uintX(out, 16, (pos2 - pos1) - 2);
  1605. SEEKP(out,pos2);
  1606. }
  1607. };
  1608. // Classes for TunnelReqStruct */
  1609. TunnelReqStruct :: TunnelReqStruct ()
  1610. {
  1611. mName = "TunnelReqStruct";
  1612. StackLog(<< "Constructing TunnelReqStruct");
  1613. mApplication=0;
  1614. };
  1615. TunnelReqStruct :: TunnelReqStruct (const TunnelReqStruct &from)
  1616. {
  1617. // World's lamest copy constructor
  1618. if(this==&from) return;
  1619. mName = "TunnelReqStruct";
  1620. resip::Data dat;
  1621. {
  1622. resip::DataStream strm(dat);
  1623. from.encode(strm);
  1624. }
  1625. {
  1626. resip::DataStream strm(dat);
  1627. decode(strm);
  1628. }
  1629. }
  1630. void TunnelReqStruct :: print(std::ostream& out, int indent) const
  1631. {
  1632. do_indent(out,indent);
  1633. (out) << "TunnelReq:\n";
  1634. indent+=2;
  1635. do_indent(out, indent);
  1636. (out) << "application:" << std::hex << (unsigned long long)mApplication << "\n";
  1637. out << mDialogId.hex();
  1638. out << mApplicationPdu.hex();
  1639. };
  1640. void TunnelReqStruct :: decode(std::istream& in)
  1641. {
  1642. StackLog(<< "Decoding TunnelReqStruct");
  1643. decode_uintX(in, 16, mApplication);
  1644. StackLog( << "mApplication =" << std::hex << (unsigned long long) mApplication );
  1645. {
  1646. UInt32 len;
  1647. int c;
  1648. decode_uintX(in, 8, len);
  1649. resip::DataStream strm(mDialogId);
  1650. while(len--){
  1651. c=in.get();
  1652. if(c==EOF)
  1653. throw resip::ParseException("Premature end of data",
  1654. "dialog_id",__FILE__,__LINE__);
  1655. strm.put(c);
  1656. };
  1657. }
  1658. {
  1659. UInt32 len;
  1660. int c;
  1661. decode_uintX(in, 24, len);
  1662. resip::DataStream strm(mApplicationPdu);
  1663. while(len--){
  1664. c=in.get();
  1665. if(c==EOF)
  1666. throw resip::ParseException("Premature end of data",
  1667. "application_pdu",__FILE__,__LINE__);
  1668. strm.put(c);
  1669. };
  1670. }
  1671. };
  1672. void TunnelReqStruct :: encode(std::ostream& out) const
  1673. {
  1674. StackLog(<< "Encoding TunnelReqStruct");
  1675. StackLog( << "mApplication =" << std::hex << (unsigned long long) mApplication );
  1676. encode_uintX(out, 16, mApplication);
  1677. encode_uintX(out, 8, mDialogId.size());
  1678. out << mDialogId;
  1679. encode_uintX(out, 24, mApplicationPdu.size());
  1680. out << mApplicationPdu;
  1681. };
  1682. // Classes for DataValueStruct */
  1683. DataValueStruct :: DataValueStruct ()
  1684. {
  1685. mName = "DataValueStruct";
  1686. StackLog(<< "Constructing DataValueStruct");
  1687. mExists=(Boolean)0;
  1688. };
  1689. DataValueStruct :: DataValueStruct (const DataValueStruct &from)
  1690. {
  1691. // World's lamest copy constructor
  1692. if(this==&from) return;
  1693. mName = "DataValueStruct";
  1694. resip::Data dat;
  1695. {
  1696. resip::DataStream strm(dat);
  1697. from.encode(strm);
  1698. }
  1699. {
  1700. resip::DataStream strm(dat);
  1701. decode(strm);
  1702. }
  1703. }
  1704. void DataValueStruct :: print(std::ostream& out, int indent) const
  1705. {
  1706. do_indent(out,indent);
  1707. (out) << "DataValue:\n";
  1708. indent+=2;
  1709. do_indent(out, indent);
  1710. (out) << "exists:" << std::hex << (unsigned long long) mExists << "\n";
  1711. out << mValue.hex();
  1712. };
  1713. void DataValueStruct :: decode(std::istream& in)
  1714. {
  1715. StackLog(<< "Decoding DataValueStruct");
  1716. {
  1717. u_int32 v;
  1718. decode_uintX(in, 8, v);
  1719. mExists=(Boolean)v;
  1720. }
  1721. {
  1722. UInt32 len;
  1723. int c;
  1724. decode_uintX(in, 32, len);
  1725. resip::DataStream strm(mValue);
  1726. while(len--){
  1727. c=in.get();
  1728. if(c==EOF)
  1729. throw resip::ParseException("Premature end of data",
  1730. "value",__FILE__,__LINE__);
  1731. strm.put(c);
  1732. };
  1733. }
  1734. };
  1735. void DataValueStruct :: encode(std::ostream& out) const
  1736. {
  1737. StackLog(<< "Encoding DataValueStruct");
  1738. encode_uintX(out, 8, (u_int64)(mExists));
  1739. encode_uintX(out, 32, mValue.size());
  1740. out << mValue;
  1741. };
  1742. // Classes for ArrayEntryStruct */
  1743. ArrayEntryStruct :: ArrayEntryStruct ()
  1744. {
  1745. mName = "ArrayEntryStruct";
  1746. StackLog(<< "Constructing ArrayEntryStruct");
  1747. mIndex=0;
  1748. mValue=0;
  1749. };
  1750. ArrayEntryStruct :: ArrayEntryStruct (const ArrayEntryStruct &from)
  1751. {
  1752. // World's lamest copy constructor
  1753. if(this==&from) return;
  1754. mName = "ArrayEntryStruct";
  1755. resip::Data dat;
  1756. {
  1757. resip::DataStream strm(dat);
  1758. from.encode(strm);
  1759. }
  1760. {
  1761. resip::DataStream strm(dat);
  1762. decode(strm);
  1763. }
  1764. }
  1765. void ArrayEntryStruct :: print(std::ostream& out, int indent) const
  1766. {
  1767. do_indent(out,indent);
  1768. (out) << "ArrayEntry:\n";
  1769. indent+=2;
  1770. do_indent(out, indent);
  1771. (out) << "index:" << std::hex << (unsigned long long)mIndex << "\n";
  1772. mValue->print(out, indent);
  1773. };
  1774. void ArrayEntryStruct :: decode(std::istream& in)
  1775. {
  1776. StackLog(<< "Decoding ArrayEntryStruct");
  1777. decode_uintX(in, 32, mIndex);
  1778. StackLog( << "mIndex =" << std::hex << (unsigned long long) mIndex );
  1779. mValue = new DataValueStruct();
  1780. mValue->decode(in);
  1781. };
  1782. void ArrayEntryStruct :: encode(std::ostream& out) const
  1783. {
  1784. StackLog(<< "Encoding ArrayEntryStruct");
  1785. StackLog( << "mIndex =" << std::hex << (unsigned long long) mIndex );
  1786. encode_uintX(out, 32, mIndex);
  1787. mValue->encode(out);
  1788. };
  1789. // Classes for DictionaryKeyStruct */
  1790. DictionaryKeyStruct :: DictionaryKeyStruct ()
  1791. {
  1792. mName = "DictionaryKeyStruct";
  1793. StackLog(<< "Constructing DictionaryKeyStruct");
  1794. };
  1795. DictionaryKeyStruct :: DictionaryKeyStruct (const DictionaryKeyStruct &from)
  1796. {
  1797. // World's lamest copy constructor
  1798. if(this==&from) return;
  1799. mName = "DictionaryKeyStruct";
  1800. resip::Data dat;
  1801. {
  1802. resip::DataStream strm(dat);
  1803. from.encode(strm);
  1804. }
  1805. {
  1806. resip::DataStream strm(dat);
  1807. decode(strm);
  1808. }
  1809. }
  1810. void DictionaryKeyStruct :: print(std::ostream& out, int indent) const
  1811. {
  1812. do_indent(out,indent);
  1813. (out) << "DictionaryKey:\n";
  1814. indent+=2;
  1815. out << mKey.hex();
  1816. };
  1817. void DictionaryKeyStruct :: decode(std::istream& in)
  1818. {
  1819. StackLog(<< "Decoding DictionaryKeyStruct");
  1820. {
  1821. UInt32 len;
  1822. int c;
  1823. decode_uintX(in, 16, len);
  1824. resip::DataStream strm(mKey);
  1825. while(len--){
  1826. c=in.get();
  1827. if(c==EOF)
  1828. throw resip::ParseException("Premature end of data",
  1829. "key",__FILE__,__LINE__);
  1830. strm.put(c);
  1831. };
  1832. }
  1833. };
  1834. void DictionaryKeyStruct :: encode(std::ostream& out) const
  1835. {
  1836. StackLog(<< "Encoding DictionaryKeyStruct");
  1837. encode_uintX(out, 16, mKey.size());
  1838. out << mKey;
  1839. };
  1840. // Classes for DictionaryEntryStruct */
  1841. DictionaryEntryStruct :: DictionaryEntryStruct ()
  1842. {
  1843. mName = "DictionaryEntryStruct";
  1844. StackLog(<< "Constructing DictionaryEntryStruct");
  1845. mKey=0;
  1846. mValue=0;
  1847. };
  1848. DictionaryEntryStruct :: DictionaryEntryStruct (const DictionaryEntryStruct &from)
  1849. {
  1850. // World's lamest copy constructor
  1851. if(this==&from) return;
  1852. mName = "DictionaryEntryStruct";
  1853. resip::Data dat;
  1854. {
  1855. resip::DataStream strm(dat);
  1856. from.encode(strm);
  1857. }
  1858. {
  1859. resip::DataStream strm(dat);
  1860. decode(strm);
  1861. }
  1862. }
  1863. void DictionaryEntryStruct :: print(std::ostream& out, int indent) const
  1864. {
  1865. do_indent(out,indent);
  1866. (out) << "DictionaryEntry:\n";
  1867. indent+=2;
  1868. mKey->print(out, indent);
  1869. mValue->print(out, indent);
  1870. };
  1871. void DictionaryEntryStruct :: decode(std::istream& in)
  1872. {
  1873. StackLog(<< "Decoding DictionaryEntryStruct");
  1874. mKey = new DictionaryKeyStruct();
  1875. mKey->decode(in);
  1876. mValue = new DataValueStruct();
  1877. mValue->decode(in);
  1878. };
  1879. void DictionaryEntryStruct :: encode(std::ostream& out) const
  1880. {
  1881. StackLog(<< "Encoding DictionaryEntryStruct");
  1882. mKey->encode(out);
  1883. mValue->encode(out);
  1884. };
  1885. // Classes for StoredDataValueStruct */
  1886. StoredDataValueStruct :: StoredDataValueStruct ()
  1887. {
  1888. mName = "StoredDataValueStruct";
  1889. StackLog(<< "Constructing StoredDataValueStruct");
  1890. mModel=(DataModel)0;
  1891. mSingleValue.mSingleValueEntry=0;
  1892. mArray.mArrayEntry=0;
  1893. mDictionary.mDictionaryEntry=0;
  1894. };
  1895. StoredDataValueStruct :: StoredDataValueStruct (const StoredDataValueStruct &from)
  1896. {
  1897. // World's lamest copy constructor
  1898. if(this==&from) return;
  1899. mName = "StoredDataValueStruct";
  1900. resip::Data dat;
  1901. {
  1902. resip::DataStream strm(dat);
  1903. from.encode(strm);
  1904. }
  1905. {
  1906. resip::DataStream strm(dat);
  1907. decode(strm);
  1908. }
  1909. }
  1910. void StoredDataValueStruct :: print(std::ostream& out, int indent) const
  1911. {
  1912. do_indent(out,indent);
  1913. (out) << "StoredDataValue:\n";
  1914. indent+=2;
  1915. do_indent(out, indent);
  1916. (out) << "model:" << std::hex << (unsigned long long) mModel << "\n";
  1917. };
  1918. void StoredDataValueStruct :: decode(std::istream& in)
  1919. {
  1920. StackLog(<< "Decoding StoredDataValueStruct");
  1921. {
  1922. u_int32 v;
  1923. decode_uintX(in, 8, v);
  1924. mModel=(DataModel)v;
  1925. }
  1926. switch(mModel){
  1927. case 1:
  1928. mSingleValue.mSingleValueEntry = new DataValueStruct();
  1929. mSingleValue.mSingleValueEntry->decode(in);
  1930. break;
  1931. case 2:
  1932. mArray.mArrayEntry = new ArrayEntryStruct();
  1933. mArray.mArrayEntry->decode(in);
  1934. break;
  1935. case 3:
  1936. mDictionary.mDictionaryEntry = new DictionaryEntryStruct();
  1937. mDictionary.mDictionaryEntry->decode(in);
  1938. break;
  1939. default: /* User error */
  1940. assert(1==0);
  1941. }
  1942. };
  1943. void StoredDataValueStruct :: encode(std::ostream& out) const
  1944. {
  1945. StackLog(<< "Encoding StoredDataValueStruct");
  1946. encode_uintX(out, 8, (u_int64)(mModel));
  1947. switch(mModel) {
  1948. case 1:
  1949. mSingleValue.mSingleValueEntry->encode(out);
  1950. break;
  1951. case 2:
  1952. mArray.mArrayEntry->encode(out);
  1953. break;
  1954. case 3:
  1955. mDictionary.mDictionaryEntry->encode(out);
  1956. break;
  1957. default: /* User error */
  1958. assert(1==0);
  1959. }
  1960. };
  1961. // Classes for StoredDataStruct */
  1962. StoredDataStruct :: StoredDataStruct ()
  1963. {
  1964. mName = "StoredDataStruct";
  1965. StackLog(<< "Constructing StoredDataStruct");
  1966. mStorageTime=0;
  1967. mLifetime=0;
  1968. mValue=0;
  1969. mSignature=0;
  1970. };
  1971. StoredDataStruct :: StoredDataStruct (const StoredDataStruct &from)
  1972. {
  1973. // World's lamest copy constructor
  1974. if(this==&from) return;
  1975. mName = "StoredDataStruct";
  1976. resip::Data dat;
  1977. {
  1978. resip::DataStream strm(dat);
  1979. from.encode(strm);
  1980. }
  1981. {
  1982. resip::DataStream strm(dat);
  1983. decode(strm);
  1984. }
  1985. }
  1986. void StoredDataStruct :: print(std::ostream& out, int indent) const
  1987. {
  1988. do_indent(out,indent);
  1989. (out) << "StoredData:\n";
  1990. indent+=2;
  1991. do_indent(out, indent);
  1992. (out) << "storage_time:" << std::hex << (unsigned long long)mStorageTime << "\n";
  1993. do_indent(out, indent);
  1994. (out) << "lifetime:" << std::hex << (unsigned long long)mLifetime << "\n";
  1995. mValue->print(out, indent);
  1996. mSignature->print(out, indent);
  1997. };
  1998. void StoredDataStruct :: decode(std::istream& in)
  1999. {
  2000. StackLog(<< "Decoding StoredDataStruct");
  2001. {
  2002. resip::Data d;
  2003. read_varray1(in, 4, d);
  2004. resip::DataStream in_auto(d);
  2005. decode_uintX(in_auto, 64, mStorageTime);
  2006. StackLog( << "mStorageTime =" << std::hex << (unsigned long long) mStorageTime );
  2007. decode_uintX(in_auto, 32, mLifetime);
  2008. StackLog( << "mLifetime =" << std::hex << (unsigned long long) mLifetime );
  2009. mValue = new StoredDataValueStruct();
  2010. mValue->decode(in_auto);
  2011. mSignature = new SignatureStruct();
  2012. mSignature->decode(in_auto);
  2013. if(in_auto.peek()!=EOF)
  2014. throw resip::ParseException("Inner encoded value too long",
  2015. "StoredData",__FILE__,__LINE__);
  2016. }
  2017. };
  2018. void StoredDataStruct :: encode(std::ostream& out) const
  2019. {
  2020. StackLog(<< "Encoding StoredDataStruct");
  2021. long pos1=TELLP(out);
  2022. for(int i=0;i<4;i++) out.put(0);
  2023. StackLog( << "mStorageTime =" << std::hex << (unsigned long long) mStorageTime );
  2024. encode_uintX(out, 64, mStorageTime);
  2025. StackLog( << "mLifetime =" << std::hex << (unsigned long long) mLifetime );
  2026. encode_uintX(out, 32, mLifetime);
  2027. mValue->encode(out);
  2028. mSignature->encode(out);
  2029. long pos2=TELLP(out);
  2030. SEEKP(out,pos1);
  2031. encode_uintX(out, 32, (pos2 - pos1) - 4);
  2032. SEEKP(out,pos2);
  2033. };
  2034. // Classes for StoreKindDataStruct */
  2035. StoreKindDataStruct :: StoreKindDataStruct ()
  2036. {
  2037. mName = "StoreKindDataStruct";
  2038. StackLog(<< "Constructing StoreKindDataStruct");
  2039. mKind=0;
  2040. mDataModel=(DataModel)0;
  2041. mGenerationCounter=0;
  2042. };
  2043. StoreKindDataStruct :: StoreKindDataStruct (const StoreKindDataStruct &from)
  2044. {
  2045. // World's lamest copy constructor
  2046. if(this==&from) return;
  2047. mName = "StoreKindDataStruct";
  2048. resip::Data dat;
  2049. {
  2050. resip::DataStream strm(dat);
  2051. from.encode(strm);
  2052. }
  2053. {
  2054. resip::DataStream strm(dat);
  2055. decode(strm);
  2056. }
  2057. }
  2058. void StoreKindDataStruct :: print(std::ostream& out, int indent) const
  2059. {
  2060. do_indent(out,indent);
  2061. (out) << "StoreKindData:\n";
  2062. indent+=2;
  2063. do_indent(out, indent);
  2064. (out) << "kind:" << std::hex << (unsigned long long)mKind << "\n";
  2065. do_indent(out, indent);
  2066. (out) << "data_model:" << std::hex << (unsigned long long) mDataModel << "\n";
  2067. do_indent(out, indent);
  2068. (out) << "generation_counter:" << std::hex << (unsigned long long)mGenerationCounter << "\n";
  2069. for(unsigned int i=0;i<mValues.size();i++){
  2070. mValues[i]->print(out, indent);
  2071. }
  2072. };
  2073. void StoreKindDataStruct :: decode(std::istream& in)
  2074. {
  2075. StackLog(<< "Decoding StoreKindDataStruct");
  2076. decode_uintX(in, 32, mKind);
  2077. StackLog( << "mKind =" << std::hex << (unsigned long long) mKind );
  2078. {
  2079. u_int32 v;
  2080. decode_uintX(in, 8, v);
  2081. mDataModel=(DataModel)v;
  2082. }
  2083. decode_uintX(in, 64, mGenerationCounter);
  2084. StackLog( << "mGenerationCounter =" << std::hex << (unsigned long long) mGenerationCounter );
  2085. {
  2086. resip::Data d;
  2087. read_varray1(in, 4, d);
  2088. resip::DataStream in2(d);
  2089. int i=0;
  2090. while(in2.peek()!=EOF){
  2091. mValues.push_back(0);
  2092. mValues[i] = new StoredDataStruct();
  2093. mValues[i]->decode(in2);
  2094. i++;
  2095. }
  2096. ; }
  2097. };
  2098. void StoreKindDataStruct :: encode(std::ostream& out) const
  2099. {
  2100. StackLog(<< "Encoding StoreKindDataStruct");
  2101. StackLog( << "mKind =" << std::hex << (unsigned long long) mKind );
  2102. encode_uintX(out, 32, mKind);
  2103. encode_uintX(out, 8, (u_int64)(mDataModel));
  2104. StackLog( << "mGenerationCounter =" << std::hex << (unsigned long long) mGenerationCounter );
  2105. encode_uintX(out, 64, mGenerationCounter);
  2106. {
  2107. long pos1=TELLP(out);
  2108. for(int i=0;i<4;i++) out.put(0);
  2109. for(unsigned int i=0;i<mValues.size();i++)
  2110. {
  2111. mValues[i]->encode(out);
  2112. }
  2113. long pos2=TELLP(out);
  2114. SEEKP(out,pos1);
  2115. encode_uintX(out, 32, (pos2 - pos1) - 4);
  2116. SEEKP(out,pos2);
  2117. }
  2118. };
  2119. // Classes for StoreReqStruct */
  2120. StoreReqStruct :: StoreReqStruct ()
  2121. {
  2122. mName = "StoreReqStruct";
  2123. StackLog(<< "Constructing StoreReqStruct");
  2124. mResource=0;
  2125. mReplicaNumber=0;
  2126. };
  2127. StoreReqStruct :: StoreReqStruct (const StoreReqStruct &from)
  2128. {
  2129. // World's lamest copy constructor
  2130. if(this==&from) return;
  2131. mName = "StoreReqStruct";
  2132. resip::Data dat;
  2133. {
  2134. resip::DataStream strm(dat);
  2135. from.encode(strm);
  2136. }
  2137. {
  2138. resip::DataStream strm(dat);
  2139. decode(strm);
  2140. }
  2141. }
  2142. void StoreReqStruct :: print(std::ostream& out, int indent) const
  2143. {
  2144. do_indent(out,indent);
  2145. (out) << "StoreReq:\n";
  2146. indent+=2;
  2147. mResource->print(out, indent);
  2148. do_indent(out, indent);
  2149. (out) << "replica_number:" << std::hex << (unsigned long long)mReplicaNumber << "\n";
  2150. for(unsigned int i=0;i<mKindData.size();i++){
  2151. mKindData[i]->print(out, indent);
  2152. }
  2153. };
  2154. void StoreReqStruct :: decode(std::istream& in)
  2155. {
  2156. StackLog(<< "Decoding StoreReqStruct");
  2157. mResource = new ResourceIdStruct();
  2158. mResource->decode(in);
  2159. decode_uintX(in, 8, mReplicaNumber);
  2160. StackLog( << "mReplicaNumber =" << std::hex << (unsigned long long) mReplicaNumber );
  2161. {
  2162. resip::Data d;
  2163. read_varray1(in, 4, d);
  2164. resip::DataStream in2(d);
  2165. int i=0;
  2166. while(in2.peek()!=EOF){
  2167. mKindData.push_back(0);
  2168. mKindData[i] = new StoreKindDataStruct();
  2169. mKindData[i]->decode(in2);
  2170. i++;
  2171. }
  2172. ; }
  2173. };
  2174. void StoreReqStruct :: encode(std::ostream& out) const
  2175. {
  2176. StackLog(<< "Encoding StoreReqStruct");
  2177. mResource->encode(out);
  2178. StackLog( << "mReplicaNumber =" << std::hex << (unsigned long long) mReplicaNumber );
  2179. encode_uintX(out, 8, mReplicaNumber);
  2180. {
  2181. long pos1=TELLP(out);
  2182. for(int i=0;i<4;i++) out.put(0);
  2183. for(unsigned int i=0;i<mKindData.size();i++)
  2184. {
  2185. mKindData[i]->encode(out);
  2186. }
  2187. long pos2=TELLP(out);
  2188. SEEKP(out,pos1);
  2189. encode_uintX(out, 32, (pos2 - pos1) - 4);
  2190. SEEKP(out,pos2);
  2191. }
  2192. };
  2193. // Classes for StoreKindResponseStruct */
  2194. StoreKindResponseStruct :: StoreKindResponseStruct ()
  2195. {
  2196. mName = "StoreKindResponseStruct";
  2197. StackLog(<< "Constructing StoreKindResponseStruct");
  2198. mKind=0;
  2199. mGenerationCounter=0;
  2200. };
  2201. StoreKindResponseStruct :: StoreKindResponseStruct (const StoreKindResponseStruct &from)
  2202. {
  2203. // World's lamest copy constructor
  2204. if(this==&from) return;
  2205. mName = "StoreKindResponseStruct";
  2206. resip::Data dat;
  2207. {
  2208. resip::DataStream strm(dat);
  2209. from.encode(strm);
  2210. }
  2211. {
  2212. resip::DataStream strm(dat);
  2213. decode(strm);
  2214. }
  2215. }
  2216. void StoreKindResponseStruct :: print(std::ostream& out, int indent) const
  2217. {
  2218. do_indent(out,indent);
  2219. (out) << "StoreKindResponse:\n";
  2220. indent+=2;
  2221. do_indent(out, indent);
  2222. (out) << "kind:" << std::hex << (unsigned long long)mKind << "\n";
  2223. do_indent(out, indent);
  2224. (out) << "generation_counter:" << std::hex << (unsigned long long)mGenerationCounter << "\n";
  2225. for(unsigned int i=0;i<mReplicas.size();i++){
  2226. mReplicas[i]->print(out, indent);
  2227. }
  2228. };
  2229. void StoreKindResponseStruct :: decode(std::istream& in)
  2230. {
  2231. StackLog(<< "Decoding StoreKindResponseStruct");
  2232. decode_uintX(in, 32, mKind);
  2233. StackLog( << "mKind =" << std::hex << (unsigned long long) mKind );
  2234. decode_uintX(in, 64, mGenerationCounter);
  2235. StackLog( << "mGenerationCounter =" << std::hex << (unsigned long long) mGenerationCounter );
  2236. {
  2237. resip::Data d;
  2238. read_varray1(in, 2, d);
  2239. resip::DataStream in2(d);
  2240. int i=0;
  2241. while(in2.peek()!=EOF){
  2242. mReplicas.push_back(0);
  2243. mReplicas[i] = new NodeIdStruct();
  2244. mReplicas[i]->decode(in2);
  2245. i++;
  2246. }
  2247. ; }
  2248. };
  2249. void StoreKindResponseStruct :: encode(std::ostream& out) const
  2250. {
  2251. StackLog(<< "Encoding StoreKindResponseStruct");
  2252. StackLog( << "mKind =" << std::hex << (unsigned long long) mKind );
  2253. encode_uintX(out, 32, mKind);
  2254. StackLog( << "mGenerationCounter =" << std::hex << (unsigned long long) mGenerationCounter );
  2255. encode_uintX(out, 64, mGenerationCounter);
  2256. {
  2257. long pos1=TELLP(out);
  2258. for(int i=0;i<2;i++) out.put(0);
  2259. for(unsigned int i=0;i<mReplicas.size();i++)
  2260. {
  2261. mReplicas[i]->encode(out);
  2262. }
  2263. long pos2=TELLP(out);
  2264. SEEKP(out,pos1);
  2265. encode_uintX(out, 16, (pos2 - pos1) - 2);
  2266. SEEKP(out,pos2);
  2267. }
  2268. };
  2269. // Classes for StoreAnsStruct */
  2270. StoreAnsStruct :: StoreAnsStruct ()
  2271. {
  2272. mName = "StoreAnsStruct";
  2273. StackLog(<< "Constructing StoreAnsStruct");
  2274. };
  2275. StoreAnsStruct :: StoreAnsStruct (const StoreAnsStruct &from)
  2276. {
  2277. // World's lamest copy constructor
  2278. if(this==&from) return;
  2279. mName = "StoreAnsStruct";
  2280. resip::Data dat;
  2281. {
  2282. resip::DataStream strm(dat);
  2283. from.encode(strm);
  2284. }
  2285. {
  2286. resip::DataStream strm(dat);
  2287. decode(strm);
  2288. }
  2289. }
  2290. void StoreAnsStruct :: print(std::ostream& out, int indent) const
  2291. {
  2292. do_indent(out,indent);
  2293. (out) << "StoreAns:\n";
  2294. indent+=2;
  2295. for(unsigned int i=0;i<mKindResponses.size();i++){
  2296. mKindResponses[i]->print(out, indent);
  2297. }
  2298. };
  2299. void StoreAnsStruct :: decode(std::istream& in)
  2300. {
  2301. StackLog(<< "Decoding StoreAnsStruct");
  2302. {
  2303. resip::Data d;
  2304. read_varray1(in, 2, d);
  2305. resip::DataStream in2(d);
  2306. int i=0;
  2307. while(in2.peek()!=EOF){
  2308. mKindResponses.push_back(0);
  2309. mKindResponses[i] = new StoreKindResponseStruct();
  2310. mKindResponses[i]->decode(in2);
  2311. i++;
  2312. }
  2313. ; }
  2314. };
  2315. void St