PageRenderTime 60ms CodeModel.GetById 12ms RepoModel.GetById 0ms app.codeStats 1ms

/Libs/resiprocate/p2p/MessageStructsGen.cxx

https://bitbucket.org/voipobjects/iceimpl
C++ | 4228 lines | 3334 code | 797 blank | 97 comment | 147 complexity | 4b5b7b265fe760ba106131c7b248949d MD5 | raw file
Possible License(s): 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 StoreAnsStruct :: encode(std::ostream& out) const
  2316. {
  2317. StackLog(<< "Encoding StoreAnsStruct");
  2318. {
  2319. long pos1=TELLP(out);
  2320. for(int i=0;i<2;i++) out.put(0);
  2321. for(unsigned int i=0;i<mKindResponses.size();i++)
  2322. {
  2323. mKindResponses[i]->encode(out);
  2324. }
  2325. long pos2=TELLP(out);
  2326. SEEKP(out,pos1);
  2327. encode_uintX(out, 16, (pos2 - pos1) - 2);
  2328. SEEKP(out,pos2);
  2329. }
  2330. };
  2331. // Classes for ArrayRangeStruct */
  2332. ArrayRangeStruct :: ArrayRangeStruct ()
  2333. {
  2334. mName = "ArrayRangeStruct";
  2335. StackLog(<< "Constructing ArrayRangeStruct");
  2336. mFirst=0;
  2337. mLast=0;
  2338. };
  2339. ArrayRangeStruct :: ArrayRangeStruct (const ArrayRangeStruct &from)
  2340. {
  2341. // World's lamest copy constructor
  2342. if(this==&from) return;
  2343. mName = "ArrayRangeStruct";
  2344. resip::Data dat;
  2345. {
  2346. resip::DataStream strm(dat);
  2347. from.encode(strm);
  2348. }
  2349. {
  2350. resip::DataStream strm(dat);
  2351. decode(strm);
  2352. }
  2353. }
  2354. void ArrayRangeStruct :: print(std::ostream& out, int indent) const
  2355. {
  2356. do_indent(out,indent);
  2357. (out) << "ArrayRange:\n";
  2358. indent+=2;
  2359. do_indent(out, indent);
  2360. (out) << "first:" << std::hex << (unsigned long long)mFirst << "\n";
  2361. do_indent(out, indent);
  2362. (out) << "last:" << std::hex << (unsigned long long)mLast << "\n";
  2363. };
  2364. void ArrayRangeStruct :: decode(std::istream& in)
  2365. {
  2366. StackLog(<< "Decoding ArrayRangeStruct");
  2367. decode_uintX(in, 32, mFirst);
  2368. StackLog( << "mFirst =" << std::hex << (unsigned long long) mFirst );
  2369. decode_uintX(in, 32, mLast);
  2370. StackLog( << "mLast =" << std::hex << (unsigned long long) mLast );
  2371. };
  2372. void ArrayRangeStruct :: encode(std::ostream& out) const
  2373. {
  2374. StackLog(<< "Encoding ArrayRangeStruct");
  2375. StackLog( << "mFirst =" << std::hex << (unsigned long long) mFirst );
  2376. encode_uintX(out, 32, mFirst);
  2377. StackLog( << "mLast =" << std::hex << (unsigned long long) mLast );
  2378. encode_uintX(out, 32, mLast);
  2379. };
  2380. // Classes for StoredDataSpecifierStruct */
  2381. StoredDataSpecifierStruct :: StoredDataSpecifierStruct ()
  2382. {
  2383. mName = "StoredDataSpecifierStruct";
  2384. StackLog(<< "Constructing StoredDataSpecifierStruct");
  2385. mKind=0;
  2386. mModel=(DataModel)0;
  2387. mGeneration=0;
  2388. };
  2389. StoredDataSpecifierStruct :: StoredDataSpecifierStruct (const StoredDataSpecifierStruct &from)
  2390. {
  2391. // World's lamest copy constructor
  2392. if(this==&from) return;
  2393. mName = "StoredDataSpecifierStruct";
  2394. resip::Data dat;
  2395. {
  2396. resip::DataStream strm(dat);
  2397. from.encode(strm);
  2398. }
  2399. {
  2400. resip::DataStream strm(dat);
  2401. decode(strm);
  2402. }
  2403. }
  2404. void StoredDataSpecifierStruct :: print(std::ostream& out, int indent) const
  2405. {
  2406. do_indent(out,indent);
  2407. (out) << "StoredDataSpecifier:\n";
  2408. indent+=2;
  2409. do_indent(out, indent);
  2410. (out) << "kind:" << std::hex << (unsigned long long)mKind << "\n";
  2411. do_indent(out, indent);
  2412. (out) << "model:" << std::hex << (unsigned long long) mModel << "\n";
  2413. do_indent(out, indent);
  2414. (out) << "generation:" << std::hex << (unsigned long long)mGeneration << "\n";
  2415. };
  2416. void StoredDataSpecifierStruct :: decode(std::istream& in)
  2417. {
  2418. StackLog(<< "Decoding StoredDataSpecifierStruct");
  2419. decode_uintX(in, 32, mKind);
  2420. StackLog( << "mKind =" << std::hex << (unsigned long long) mKind );
  2421. {
  2422. u_int32 v;
  2423. decode_uintX(in, 8, v);
  2424. mModel=(DataModel)v;
  2425. }
  2426. decode_uintX(in, 64, mGeneration);
  2427. StackLog( << "mGeneration =" << std::hex << (unsigned long long) mGeneration );
  2428. {
  2429. resip::Data d;
  2430. read_varray1(in, 2, d);
  2431. resip::DataStream in_auto(d);
  2432. switch(mModel){
  2433. case 1:
  2434. break;
  2435. case 2:
  2436. {
  2437. resip::Data d;
  2438. read_varray1(in, 2, d);
  2439. resip::DataStream in2(d);
  2440. int i=0;
  2441. while(in2.peek()!=EOF){
  2442. mArray.mIndices.push_back(0);
  2443. mArray.mIndices[i] = new ArrayRangeStruct();
  2444. mArray.mIndices[i]->decode(in2);
  2445. i++;
  2446. }
  2447. ; }
  2448. break;
  2449. case 3:
  2450. {
  2451. resip::Data d;
  2452. read_varray1(in, 2, d);
  2453. resip::DataStream in2(d);
  2454. int i=0;
  2455. while(in2.peek()!=EOF){
  2456. mDictionary.mKeys.push_back(0);
  2457. mDictionary.mKeys[i] = new DictionaryKeyStruct();
  2458. mDictionary.mKeys[i]->decode(in2);
  2459. i++;
  2460. }
  2461. ; }
  2462. break;
  2463. default: /* User error */
  2464. assert(1==0);
  2465. }
  2466. if(in_auto.peek()!=EOF)
  2467. throw resip::ParseException("Inner encoded value too long",
  2468. "StoredDataSpecifier",__FILE__,__LINE__);
  2469. }
  2470. };
  2471. void StoredDataSpecifierStruct :: encode(std::ostream& out) const
  2472. {
  2473. StackLog(<< "Encoding StoredDataSpecifierStruct");
  2474. StackLog( << "mKind =" << std::hex << (unsigned long long) mKind );
  2475. encode_uintX(out, 32, mKind);
  2476. encode_uintX(out, 8, (u_int64)(mModel));
  2477. StackLog( << "mGeneration =" << std::hex << (unsigned long long) mGeneration );
  2478. encode_uintX(out, 64, mGeneration);
  2479. long pos1=TELLP(out);
  2480. for(int i=0;i<2;i++) out.put(0);
  2481. switch(mModel) {
  2482. case 1:
  2483. break;
  2484. case 2:
  2485. {
  2486. long pos1=TELLP(out);
  2487. for(int i=0;i<2;i++) out.put(0);
  2488. for(unsigned int i=0;i<mArray.mIndices.size();i++)
  2489. {
  2490. mArray.mIndices[i]->encode(out);
  2491. }
  2492. long pos2=TELLP(out);
  2493. SEEKP(out,pos1);
  2494. encode_uintX(out, 16, (pos2 - pos1) - 2);
  2495. SEEKP(out,pos2);
  2496. }
  2497. break;
  2498. case 3:
  2499. {
  2500. long pos1=TELLP(out);
  2501. for(int i=0;i<2;i++) out.put(0);
  2502. for(unsigned int i=0;i<mDictionary.mKeys.size();i++)
  2503. {
  2504. mDictionary.mKeys[i]->encode(out);
  2505. }
  2506. long pos2=TELLP(out);
  2507. SEEKP(out,pos1);
  2508. encode_uintX(out, 16, (pos2 - pos1) - 2);
  2509. SEEKP(out,pos2);
  2510. }
  2511. break;
  2512. default: /* User error */
  2513. assert(1==0);
  2514. }
  2515. long pos2=TELLP(out);
  2516. SEEKP(out,pos1);
  2517. encode_uintX(out, 16, (pos2 - pos1) - 2);
  2518. SEEKP(out,pos2);
  2519. };
  2520. // Classes for FetchReqStruct */
  2521. FetchReqStruct :: FetchReqStruct ()
  2522. {
  2523. mName = "FetchReqStruct";
  2524. StackLog(<< "Constructing FetchReqStruct");
  2525. mResource=0;
  2526. };
  2527. FetchReqStruct :: FetchReqStruct (const FetchReqStruct &from)
  2528. {
  2529. // World's lamest copy constructor
  2530. if(this==&from) return;
  2531. mName = "FetchReqStruct";
  2532. resip::Data dat;
  2533. {
  2534. resip::DataStream strm(dat);
  2535. from.encode(strm);
  2536. }
  2537. {
  2538. resip::DataStream strm(dat);
  2539. decode(strm);
  2540. }
  2541. }
  2542. void FetchReqStruct :: print(std::ostream& out, int indent) const
  2543. {
  2544. do_indent(out,indent);
  2545. (out) << "FetchReq:\n";
  2546. indent+=2;
  2547. mResource->print(out, indent);
  2548. for(unsigned int i=0;i<mSpecifiers.size();i++){
  2549. mSpecifiers[i]->print(out, indent);
  2550. }
  2551. };
  2552. void FetchReqStruct :: decode(std::istream& in)
  2553. {
  2554. StackLog(<< "Decoding FetchReqStruct");
  2555. mResource = new ResourceIdStruct();
  2556. mResource->decode(in);
  2557. {
  2558. resip::Data d;
  2559. read_varray1(in, 2, d);
  2560. resip::DataStream in2(d);
  2561. int i=0;
  2562. while(in2.peek()!=EOF){
  2563. mSpecifiers.push_back(0);
  2564. mSpecifiers[i] = new StoredDataSpecifierStruct();
  2565. mSpecifiers[i]->decode(in2);
  2566. i++;
  2567. }
  2568. ; }
  2569. };
  2570. void FetchReqStruct :: encode(std::ostream& out) const
  2571. {
  2572. StackLog(<< "Encoding FetchReqStruct");
  2573. mResource->encode(out);
  2574. {
  2575. long pos1=TELLP(out);
  2576. for(int i=0;i<2;i++) out.put(0);
  2577. for(unsigned int i=0;i<mSpecifiers.size();i++)
  2578. {
  2579. mSpecifiers[i]->encode(out);
  2580. }
  2581. long pos2=TELLP(out);
  2582. SEEKP(out,pos1);
  2583. encode_uintX(out, 16, (pos2 - pos1) - 2);
  2584. SEEKP(out,pos2);
  2585. }
  2586. };
  2587. // Classes for FetchKindResponseStruct */
  2588. FetchKindResponseStruct :: FetchKindResponseStruct ()
  2589. {
  2590. mName = "FetchKindResponseStruct";
  2591. StackLog(<< "Constructing FetchKindResponseStruct");
  2592. mKind=0;
  2593. mGeneration=0;
  2594. };
  2595. FetchKindResponseStruct :: FetchKindResponseStruct (const FetchKindResponseStruct &from)
  2596. {
  2597. // World's lamest copy constructor
  2598. if(this==&from) return;
  2599. mName = "FetchKindResponseStruct";
  2600. resip::Data dat;
  2601. {
  2602. resip::DataStream strm(dat);
  2603. from.encode(strm);
  2604. }
  2605. {
  2606. resip::DataStream strm(dat);
  2607. decode(strm);
  2608. }
  2609. }
  2610. void FetchKindResponseStruct :: print(std::ostream& out, int indent) const
  2611. {
  2612. do_indent(out,indent);
  2613. (out) << "FetchKindResponse:\n";
  2614. indent+=2;
  2615. do_indent(out, indent);
  2616. (out) << "kind:" << std::hex << (unsigned long long)mKind << "\n";
  2617. do_indent(out, indent);
  2618. (out) << "generation:" << std::hex << (unsigned long long)mGeneration << "\n";
  2619. for(unsigned int i=0;i<mValues.size();i++){
  2620. mValues[i]->print(out, indent);
  2621. }
  2622. };
  2623. void FetchKindResponseStruct :: decode(std::istream& in)
  2624. {
  2625. StackLog(<< "Decoding FetchKindResponseStruct");
  2626. decode_uintX(in, 32, mKind);
  2627. StackLog( << "mKind =" << std::hex << (unsigned long long) mKind );
  2628. decode_uintX(in, 64, mGeneration);
  2629. StackLog( << "mGeneration =" << std::hex << (unsigned long long) mGeneration );
  2630. {
  2631. resip::Data d;
  2632. read_varray1(in, 4, d);
  2633. resip::DataStream in2(d);
  2634. int i=0;
  2635. while(in2.peek()!=EOF){
  2636. mValues.push_back(0);
  2637. mValues[i] = new StoredDataStruct();
  2638. mValues[i]->decode(in2);
  2639. i++;
  2640. }
  2641. ; }
  2642. };
  2643. void FetchKindResponseStruct :: encode(std::ostream& out) const
  2644. {
  2645. StackLog(<< "Encoding FetchKindResponseStruct");
  2646. StackLog( << "mKind =" << std::hex << (unsigned long long) mKind );
  2647. encode_uintX(out, 32, mKind);
  2648. StackLog( << "mGeneration =" << std::hex << (unsigned long long) mGeneration );
  2649. encode_uintX(out, 64, mGeneration);
  2650. {
  2651. long pos1=TELLP(out);
  2652. for(int i=0;i<4;i++) out.put(0);
  2653. for(unsigned int i=0;i<mValues.size();i++)
  2654. {
  2655. mValues[i]->encode(out);
  2656. }
  2657. long pos2=TELLP(out);
  2658. SEEKP(out,pos1);
  2659. encode_uintX(out, 32, (pos2 - pos1) - 4);
  2660. SEEKP(out,pos2);
  2661. }
  2662. };
  2663. // Classes for FetchAnsStruct */
  2664. FetchAnsStruct :: FetchAnsStruct ()
  2665. {
  2666. mName = "FetchAnsStruct";
  2667. StackLog(<< "Constructing FetchAnsStruct");
  2668. };
  2669. FetchAnsStruct :: FetchAnsStruct (const FetchAnsStruct &from)
  2670. {
  2671. // World's lamest copy constructor
  2672. if(this==&from) return;
  2673. mName = "FetchAnsStruct";
  2674. resip::Data dat;
  2675. {
  2676. resip::DataStream strm(dat);
  2677. from.encode(strm);
  2678. }
  2679. {
  2680. resip::DataStream strm(dat);
  2681. decode(strm);
  2682. }
  2683. }
  2684. void FetchAnsStruct :: print(std::ostream& out, int indent) const
  2685. {
  2686. do_indent(out,indent);
  2687. (out) << "FetchAns:\n";
  2688. indent+=2;
  2689. for(unsigned int i=0;i<mKindResponses.size();i++){
  2690. mKindResponses[i]->print(out, indent);
  2691. }
  2692. };
  2693. void FetchAnsStruct :: decode(std::istream& in)
  2694. {
  2695. StackLog(<< "Decoding FetchAnsStruct");
  2696. {
  2697. resip::Data d;
  2698. read_varray1(in, 4, d);
  2699. resip::DataStream in2(d);
  2700. int i=0;
  2701. while(in2.peek()!=EOF){
  2702. mKindResponses.push_back(0);
  2703. mKindResponses[i] = new FetchKindResponseStruct();
  2704. mKindResponses[i]->decode(in2);
  2705. i++;
  2706. }
  2707. ; }
  2708. };
  2709. void FetchAnsStruct :: encode(std::ostream& out) const
  2710. {
  2711. StackLog(<< "Encoding FetchAnsStruct");
  2712. {
  2713. long pos1=TELLP(out);
  2714. for(int i=0;i<4;i++) out.put(0);
  2715. for(unsigned int i=0;i<mKindResponses.size();i++)
  2716. {
  2717. mKindResponses[i]->encode(out);
  2718. }
  2719. long pos2=TELLP(out);
  2720. SEEKP(out,pos1);
  2721. encode_uintX(out, 32, (pos2 - pos1) - 4);
  2722. SEEKP(out,pos2);
  2723. }
  2724. };
  2725. // Classes for RemoveReqStruct */
  2726. RemoveReqStruct :: RemoveReqStruct ()
  2727. {
  2728. mName = "RemoveReqStruct";
  2729. StackLog(<< "Constructing RemoveReqStruct");
  2730. mResource=0;
  2731. };
  2732. RemoveReqStruct :: RemoveReqStruct (const RemoveReqStruct &from)
  2733. {
  2734. // World's lamest copy constructor
  2735. if(this==&from) return;
  2736. mName = "RemoveReqStruct";
  2737. resip::Data dat;
  2738. {
  2739. resip::DataStream strm(dat);
  2740. from.encode(strm);
  2741. }
  2742. {
  2743. resip::DataStream strm(dat);
  2744. decode(strm);
  2745. }
  2746. }
  2747. void RemoveReqStruct :: print(std::ostream& out, int indent) const
  2748. {
  2749. do_indent(out,indent);
  2750. (out) << "RemoveReq:\n";
  2751. indent+=2;
  2752. mResource->print(out, indent);
  2753. for(unsigned int i=0;i<mSpecifiers.size();i++){
  2754. mSpecifiers[i]->print(out, indent);
  2755. }
  2756. };
  2757. void RemoveReqStruct :: decode(std::istream& in)
  2758. {
  2759. StackLog(<< "Decoding RemoveReqStruct");
  2760. mResource = new ResourceIdStruct();
  2761. mResource->decode(in);
  2762. {
  2763. resip::Data d;
  2764. read_varray1(in, 2, d);
  2765. resip::DataStream in2(d);
  2766. int i=0;
  2767. while(in2.peek()!=EOF){
  2768. mSpecifiers.push_back(0);
  2769. mSpecifiers[i] = new StoredDataSpecifierStruct();
  2770. mSpecifiers[i]->decode(in2);
  2771. i++;
  2772. }
  2773. ; }
  2774. };
  2775. void RemoveReqStruct :: encode(std::ostream& out) const
  2776. {
  2777. StackLog(<< "Encoding RemoveReqStruct");
  2778. mResource->encode(out);
  2779. {
  2780. long pos1=TELLP(out);
  2781. for(int i=0;i<2;i++) out.put(0);
  2782. for(unsigned int i=0;i<mSpecifiers.size();i++)
  2783. {
  2784. mSpecifiers[i]->encode(out);
  2785. }
  2786. long pos2=TELLP(out);
  2787. SEEKP(out,pos1);
  2788. encode_uintX(out, 16, (pos2 - pos1) - 2);
  2789. SEEKP(out,pos2);
  2790. }
  2791. };
  2792. // Classes for RemoveAnsStruct */
  2793. RemoveAnsStruct :: RemoveAnsStruct ()
  2794. {
  2795. mName = "RemoveAnsStruct";
  2796. StackLog(<< "Constructing RemoveAnsStruct");
  2797. };
  2798. RemoveAnsStruct :: RemoveAnsStruct (const RemoveAnsStruct &from)
  2799. {
  2800. // World's lamest copy constructor
  2801. if(this==&from) return;
  2802. mName = "RemoveAnsStruct";
  2803. resip::Data dat;
  2804. {
  2805. resip::DataStream strm(dat);
  2806. from.encode(strm);
  2807. }
  2808. {
  2809. resip::DataStream strm(dat);
  2810. decode(strm);
  2811. }
  2812. }
  2813. void RemoveAnsStruct :: print(std::ostream& out, int indent) const
  2814. {
  2815. do_indent(out,indent);
  2816. (out) << "RemoveAns:\n";
  2817. indent+=2;
  2818. for(unsigned int i=0;i<mKindResponses.size();i++){
  2819. mKindResponses[i]->print(out, indent);
  2820. }
  2821. };
  2822. void RemoveAnsStruct :: decode(std::istream& in)
  2823. {
  2824. StackLog(<< "Decoding RemoveAnsStruct");
  2825. {
  2826. resip::Data d;
  2827. read_varray1(in, 2, d);
  2828. resip::DataStream in2(d);
  2829. int i=0;
  2830. while(in2.peek()!=EOF){
  2831. mKindResponses.push_back(0);
  2832. mKindResponses[i] = new StoreKindResponseStruct();
  2833. mKindResponses[i]->decode(in2);
  2834. i++;
  2835. }
  2836. ; }
  2837. };
  2838. void RemoveAnsStruct :: encode(std::ostream& out) const
  2839. {
  2840. StackLog(<< "Encoding RemoveAnsStruct");
  2841. {
  2842. long pos1=TELLP(out);
  2843. for(int i=0;i<2;i++) out.put(0);
  2844. for(unsigned int i=0;i<mKindResponses.size();i++)
  2845. {
  2846. mKindResponses[i]->encode(out);
  2847. }
  2848. long pos2=TELLP(out);
  2849. SEEKP(out,pos1);
  2850. encode_uintX(out, 16, (pos2 - pos1) - 2);
  2851. SEEKP(out,pos2);
  2852. }
  2853. };
  2854. // Classes for FindReqStruct */
  2855. FindReqStruct :: FindReqStruct ()
  2856. {
  2857. mName = "FindReqStruct";
  2858. StackLog(<< "Constructing FindReqStruct");
  2859. mResource=0;
  2860. };
  2861. FindReqStruct :: FindReqStruct (const FindReqStruct &from)
  2862. {
  2863. // World's lamest copy constructor
  2864. if(this==&from) return;
  2865. mName = "FindReqStruct";
  2866. resip::Data dat;
  2867. {
  2868. resip::DataStream strm(dat);
  2869. from.encode(strm);
  2870. }
  2871. {
  2872. resip::DataStream strm(dat);
  2873. decode(strm);
  2874. }
  2875. }
  2876. void FindReqStruct :: print(std::ostream& out, int indent) const
  2877. {
  2878. do_indent(out,indent);
  2879. (out) << "FindReq:\n";
  2880. indent+=2;
  2881. mResource->print(out, indent);
  2882. for(unsigned int i=0;i<mKinds.size();i++){
  2883. do_indent(out, indent);
  2884. (out) << "KindId:" << std::hex << (unsigned long long) mKinds[i] << "\n";
  2885. }
  2886. };
  2887. void FindReqStruct :: decode(std::istream& in)
  2888. {
  2889. StackLog(<< "Decoding FindReqStruct");
  2890. mResource = new ResourceIdStruct();
  2891. mResource->decode(in);
  2892. {
  2893. resip::Data d;
  2894. read_varray1(in, 1, d);
  2895. resip::DataStream in2(d);
  2896. int i=0;
  2897. while(in2.peek()!=EOF){
  2898. mKinds.push_back(0);
  2899. decode_uintX(in2, 32, mKinds[i]);
  2900. StackLog( << "mKinds[i] =" << std::hex << (unsigned long long) mKinds[i] );
  2901. i++;
  2902. }
  2903. ; }
  2904. };
  2905. void FindReqStruct :: encode(std::ostream& out) const
  2906. {
  2907. StackLog(<< "Encoding FindReqStruct");
  2908. mResource->encode(out);
  2909. {
  2910. long pos1=TELLP(out);
  2911. for(int i=0;i<1;i++) out.put(0);
  2912. for(unsigned int i=0;i<mKinds.size();i++)
  2913. {
  2914. StackLog( << "mKinds[i] =" << std::hex << (unsigned long long) mKinds[i] );
  2915. encode_uintX(out, 32, mKinds[i]);
  2916. }
  2917. long pos2=TELLP(out);
  2918. SEEKP(out,pos1);
  2919. encode_uintX(out, 8, (pos2 - pos1) - 1);
  2920. SEEKP(out,pos2);
  2921. }
  2922. };
  2923. // Classes for FindKindDataStruct */
  2924. FindKindDataStruct :: FindKindDataStruct ()
  2925. {
  2926. mName = "FindKindDataStruct";
  2927. StackLog(<< "Constructing FindKindDataStruct");
  2928. mKind=0;
  2929. mClosest=0;
  2930. };
  2931. FindKindDataStruct :: FindKindDataStruct (const FindKindDataStruct &from)
  2932. {
  2933. // World's lamest copy constructor
  2934. if(this==&from) return;
  2935. mName = "FindKindDataStruct";
  2936. resip::Data dat;
  2937. {
  2938. resip::DataStream strm(dat);
  2939. from.encode(strm);
  2940. }
  2941. {
  2942. resip::DataStream strm(dat);
  2943. decode(strm);
  2944. }
  2945. }
  2946. void FindKindDataStruct :: print(std::ostream& out, int indent) const
  2947. {
  2948. do_indent(out,indent);
  2949. (out) << "FindKindData:\n";
  2950. indent+=2;
  2951. do_indent(out, indent);
  2952. (out) << "kind:" << std::hex << (unsigned long long)mKind << "\n";
  2953. mClosest->print(out, indent);
  2954. };
  2955. void FindKindDataStruct :: decode(std::istream& in)
  2956. {
  2957. StackLog(<< "Decoding FindKindDataStruct");
  2958. decode_uintX(in, 32, mKind);
  2959. StackLog( << "mKind =" << std::hex << (unsigned long long) mKind );
  2960. mClosest = new ResourceIdStruct();
  2961. mClosest->decode(in);
  2962. };
  2963. void FindKindDataStruct :: encode(std::ostream& out) const
  2964. {
  2965. StackLog(<< "Encoding FindKindDataStruct");
  2966. StackLog( << "mKind =" << std::hex << (unsigned long long) mKind );
  2967. encode_uintX(out, 32, mKind);
  2968. mClosest->encode(out);
  2969. };
  2970. // Classes for FindAnsStruct */
  2971. FindAnsStruct :: FindAnsStruct ()
  2972. {
  2973. mName = "FindAnsStruct";
  2974. StackLog(<< "Constructing FindAnsStruct");
  2975. };
  2976. FindAnsStruct :: FindAnsStruct (const FindAnsStruct &from)
  2977. {
  2978. // World's lamest copy constructor
  2979. if(this==&from) return;
  2980. mName = "FindAnsStruct";
  2981. resip::Data dat;
  2982. {
  2983. resip::DataStream strm(dat);
  2984. from.encode(strm);
  2985. }
  2986. {
  2987. resip::DataStream strm(dat);
  2988. decode(strm);
  2989. }
  2990. }
  2991. void FindAnsStruct :: print(std::ostream& out, int indent) const
  2992. {
  2993. do_indent(out,indent);
  2994. (out) << "FindAns:\n";
  2995. indent+=2;
  2996. for(unsigned int i=0;i<mResults.size();i++){
  2997. mResults[i]->print(out, indent);
  2998. }
  2999. };
  3000. void FindAnsStruct :: decode(std::istream& in)
  3001. {
  3002. StackLog(<< "Decoding FindAnsStruct");
  3003. {
  3004. resip::Data d;
  3005. read_varray1(in, 2, d);
  3006. resip::DataStream in2(d);
  3007. int i=0;
  3008. while(in2.peek()!=EOF){
  3009. mResults.push_back(0);
  3010. mResults[i] = new FindKindDataStruct();
  3011. mResults[i]->decode(in2);
  3012. i++;
  3013. }
  3014. ; }
  3015. };
  3016. void FindAnsStruct :: encode(std::ostream& out) const
  3017. {
  3018. StackLog(<< "Encoding FindAnsStruct");
  3019. {
  3020. long pos1=TELLP(out);
  3021. for(int i=0;i<2;i++) out.put(0);
  3022. for(unsigned int i=0;i<mResults.size();i++)
  3023. {
  3024. mResults[i]->encode(out);
  3025. }
  3026. long pos2=TELLP(out);
  3027. SEEKP(out,pos1);
  3028. encode_uintX(out, 16, (pos2 - pos1) - 2);
  3029. SEEKP(out,pos2);
  3030. }
  3031. };
  3032. // Classes for TurnServerStruct */
  3033. TurnServerStruct :: TurnServerStruct ()
  3034. {
  3035. mName = "TurnServerStruct";
  3036. StackLog(<< "Constructing TurnServerStruct");
  3037. mIteration=0;
  3038. mServerAddress=0;
  3039. };
  3040. TurnServerStruct :: TurnServerStruct (const TurnServerStruct &from)
  3041. {
  3042. // World's lamest copy constructor
  3043. if(this==&from) return;
  3044. mName = "TurnServerStruct";
  3045. resip::Data dat;
  3046. {
  3047. resip::DataStream strm(dat);
  3048. from.encode(strm);
  3049. }
  3050. {
  3051. resip::DataStream strm(dat);
  3052. decode(strm);
  3053. }
  3054. }
  3055. void TurnServerStruct :: print(std::ostream& out, int indent) const
  3056. {
  3057. do_indent(out,indent);
  3058. (out) << "TurnServer:\n";
  3059. indent+=2;
  3060. do_indent(out, indent);
  3061. (out) << "iteration:" << std::hex << (unsigned long long)mIteration << "\n";
  3062. mServerAddress->print(out, indent);
  3063. };
  3064. void TurnServerStruct :: decode(std::istream& in)
  3065. {
  3066. StackLog(<< "Decoding TurnServerStruct");
  3067. decode_uintX(in, 8, mIteration);
  3068. StackLog( << "mIteration =" << std::hex << (unsigned long long) mIteration );
  3069. mServerAddress = new IpAddressAndPortStruct();
  3070. mServerAddress->decode(in);
  3071. };
  3072. void TurnServerStruct :: encode(std::ostream& out) const
  3073. {
  3074. StackLog(<< "Encoding TurnServerStruct");
  3075. StackLog( << "mIteration =" << std::hex << (unsigned long long) mIteration );
  3076. encode_uintX(out, 8, mIteration);
  3077. mServerAddress->encode(out);
  3078. };
  3079. // Classes for SipRegistrationStruct */
  3080. SipRegistrationStruct :: SipRegistrationStruct ()
  3081. {
  3082. mName = "SipRegistrationStruct";
  3083. StackLog(<< "Constructing SipRegistrationStruct");
  3084. mType=(SipRegistrationType)0;
  3085. };
  3086. SipRegistrationStruct :: SipRegistrationStruct (const SipRegistrationStruct &from)
  3087. {
  3088. // World's lamest copy constructor
  3089. if(this==&from) return;
  3090. mName = "SipRegistrationStruct";
  3091. resip::Data dat;
  3092. {
  3093. resip::DataStream strm(dat);
  3094. from.encode(strm);
  3095. }
  3096. {
  3097. resip::DataStream strm(dat);
  3098. decode(strm);
  3099. }
  3100. }
  3101. void SipRegistrationStruct :: print(std::ostream& out, int indent) const
  3102. {
  3103. do_indent(out,indent);
  3104. (out) << "SipRegistration:\n";
  3105. indent+=2;
  3106. do_indent(out, indent);
  3107. (out) << "type:" << std::hex << (unsigned long long) mType << "\n";
  3108. };
  3109. void SipRegistrationStruct :: decode(std::istream& in)
  3110. {
  3111. StackLog(<< "Decoding SipRegistrationStruct");
  3112. {
  3113. u_int32 v;
  3114. decode_uintX(in, 8, v);
  3115. mType=(SipRegistrationType)v;
  3116. }
  3117. {
  3118. resip::Data d;
  3119. read_varray1(in, 2, d);
  3120. resip::DataStream in_auto(d);
  3121. switch(mType){
  3122. case 1:
  3123. {
  3124. UInt32 len;
  3125. int c;
  3126. decode_uintX(in_auto, 16, len);
  3127. resip::DataStream strm(mSipRegistrationUri.mUri);
  3128. while(len--){
  3129. c=in_auto.get();
  3130. if(c==EOF)
  3131. throw resip::ParseException("Premature end of data",
  3132. "uri",__FILE__,__LINE__);
  3133. strm.put(c);
  3134. };
  3135. }
  3136. break;
  3137. case 2:
  3138. {
  3139. UInt32 len;
  3140. int c;
  3141. decode_uintX(in_auto, 16, len);
  3142. resip::DataStream strm(mSipRegistrationRoute.mContactPrefs);
  3143. while(len--){
  3144. c=in_auto.get();
  3145. if(c==EOF)
  3146. throw resip::ParseException("Premature end of data",
  3147. "contact_prefs",__FILE__,__LINE__);
  3148. strm.put(c);
  3149. };
  3150. }
  3151. {
  3152. resip::Data d;
  3153. read_varray1(in, 2, d);
  3154. resip::DataStream in2(d);
  3155. int i=0;
  3156. while(in2.peek()!=EOF){
  3157. mSipRegistrationRoute.mDestinationList.push_back(0);
  3158. mSipRegistrationRoute.mDestinationList[i] = new DestinationStruct();
  3159. mSipRegistrationRoute.mDestinationList[i]->decode(in2);
  3160. i++;
  3161. }
  3162. ; }
  3163. break;
  3164. default: /* User error */
  3165. assert(1==0);
  3166. }
  3167. if(in_auto.peek()!=EOF)
  3168. throw resip::ParseException("Inner encoded value too long",
  3169. "SipRegistration",__FILE__,__LINE__);
  3170. }
  3171. };
  3172. void SipRegistrationStruct :: encode(std::ostream& out) const
  3173. {
  3174. StackLog(<< "Encoding SipRegistrationStruct");
  3175. encode_uintX(out, 8, (u_int64)(mType));
  3176. long pos1=TELLP(out);
  3177. for(int i=0;i<2;i++) out.put(0);
  3178. switch(mType) {
  3179. case 1:
  3180. encode_uintX(out, 16, mSipRegistrationUri.mUri.size());
  3181. out << mSipRegistrationUri.mUri;
  3182. break;
  3183. case 2:
  3184. encode_uintX(out, 16, mSipRegistrationRoute.mContactPrefs.size());
  3185. out << mSipRegistrationRoute.mContactPrefs;
  3186. {
  3187. long pos1=TELLP(out);
  3188. for(int i=0;i<2;i++) out.put(0);
  3189. for(unsigned int i=0;i<mSipRegistrationRoute.mDestinationList.size();i++)
  3190. {
  3191. mSipRegistrationRoute.mDestinationList[i]->encode(out);
  3192. }
  3193. long pos2=TELLP(out);
  3194. SEEKP(out,pos1);
  3195. encode_uintX(out, 16, (pos2 - pos1) - 2);
  3196. SEEKP(out,pos2);
  3197. }
  3198. break;
  3199. default: /* User error */
  3200. assert(1==0);
  3201. }
  3202. long pos2=TELLP(out);
  3203. SEEKP(out,pos1);
  3204. encode_uintX(out, 16, (pos2 - pos1) - 2);
  3205. SEEKP(out,pos2);
  3206. };
  3207. // Classes for ChordUpdateStruct */
  3208. ChordUpdateStruct :: ChordUpdateStruct ()
  3209. {
  3210. mName = "ChordUpdateStruct";
  3211. StackLog(<< "Constructing ChordUpdateStruct");
  3212. mType=(ChordUpdateType)0;
  3213. };
  3214. ChordUpdateStruct :: ChordUpdateStruct (const ChordUpdateStruct &from)
  3215. {
  3216. // World's lamest copy constructor
  3217. if(this==&from) return;
  3218. mName = "ChordUpdateStruct";
  3219. resip::Data dat;
  3220. {
  3221. resip::DataStream strm(dat);
  3222. from.encode(strm);
  3223. }
  3224. {
  3225. resip::DataStream strm(dat);
  3226. decode(strm);
  3227. }
  3228. }
  3229. void ChordUpdateStruct :: print(std::ostream& out, int indent) const
  3230. {
  3231. do_indent(out,indent);
  3232. (out) << "ChordUpdate:\n";
  3233. indent+=2;
  3234. do_indent(out, indent);
  3235. (out) << "type:" << std::hex << (unsigned long long) mType << "\n";
  3236. };
  3237. void ChordUpdateStruct :: decode(std::istream& in)
  3238. {
  3239. StackLog(<< "Decoding ChordUpdateStruct");
  3240. {
  3241. u_int32 v;
  3242. decode_uintX(in, 8, v);
  3243. mType=(ChordUpdateType)v;
  3244. }
  3245. switch(mType){
  3246. case 1:
  3247. break;
  3248. case 2:
  3249. {
  3250. resip::Data d;
  3251. read_varray1(in, 2, d);
  3252. resip::DataStream in2(d);
  3253. int i=0;
  3254. while(in2.peek()!=EOF){
  3255. mNeighbors.mPredecessors.push_back(0);
  3256. mNeighbors.mPredecessors[i] = new NodeIdStruct();
  3257. mNeighbors.mPredecessors[i]->decode(in2);
  3258. i++;
  3259. }
  3260. ; }
  3261. {
  3262. resip::Data d;
  3263. read_varray1(in, 2, d);
  3264. resip::DataStream in2(d);
  3265. int i=0;
  3266. while(in2.peek()!=EOF){
  3267. mNeighbors.mSuccessors.push_back(0);
  3268. mNeighbors.mSuccessors[i] = new NodeIdStruct();
  3269. mNeighbors.mSuccessors[i]->decode(in2);
  3270. i++;
  3271. }
  3272. ; }
  3273. break;
  3274. case 3:
  3275. {
  3276. resip::Data d;
  3277. read_varray1(in, 2, d);
  3278. resip::DataStream in2(d);
  3279. int i=0;
  3280. while(in2.peek()!=EOF){
  3281. mFull.mPredecessors.push_back(0);
  3282. mFull.mPredecessors[i] = new NodeIdStruct();
  3283. mFull.mPredecessors[i]->decode(in2);
  3284. i++;
  3285. }
  3286. ; }
  3287. {
  3288. resip::Data d;
  3289. read_varray1(in, 2, d);
  3290. resip::DataStream in2(d);
  3291. int i=0;
  3292. while(in2.peek()!=EOF){
  3293. mFull.mSuccessors.push_back(0);
  3294. mFull.mSuccessors[i] = new NodeIdStruct();
  3295. mFull.mSuccessors[i]->decode(in2);
  3296. i++;
  3297. }
  3298. ; }
  3299. {
  3300. resip::Data d;
  3301. read_varray1(in, 2, d);
  3302. resip::DataStream in2(d);
  3303. int i=0;
  3304. while(in2.peek()!=EOF){
  3305. mFull.mFingers.push_back(0);
  3306. mFull.mFingers[i] = new NodeIdStruct();
  3307. mFull.mFingers[i]->decode(in2);
  3308. i++;
  3309. }
  3310. ; }
  3311. break;
  3312. default: /* User error */
  3313. assert(1==0);
  3314. }
  3315. };
  3316. void ChordUpdateStruct :: encode(std::ostream& out) const
  3317. {
  3318. StackLog(<< "Encoding ChordUpdateStruct");
  3319. encode_uintX(out, 8, (u_int64)(mType));
  3320. switch(mType) {
  3321. case 1:
  3322. break;
  3323. case 2:
  3324. {
  3325. long pos1=TELLP(out);
  3326. for(int i=0;i<2;i++) out.put(0);
  3327. for(unsigned int i=0;i<mNeighbors.mPredecessors.size();i++)
  3328. {
  3329. mNeighbors.mPredecessors[i]->encode(out);
  3330. }
  3331. long pos2=TELLP(out);
  3332. SEEKP(out,pos1);
  3333. encode_uintX(out, 16, (pos2 - pos1) - 2);
  3334. SEEKP(out,pos2);
  3335. }
  3336. {
  3337. long pos1=TELLP(out);
  3338. for(int i=0;i<2;i++) out.put(0);
  3339. for(unsigned int i=0;i<mNeighbors.mSuccessors.size();i++)
  3340. {
  3341. mNeighbors.mSuccessors[i]->encode(out);
  3342. }
  3343. long pos2=TELLP(out);
  3344. SEEKP(out,pos1);
  3345. encode_uintX(out, 16, (pos2 - pos1) - 2);
  3346. SEEKP(out,pos2);
  3347. }
  3348. break;
  3349. case 3:
  3350. {
  3351. long pos1=TELLP(out);
  3352. for(int i=0;i<2;i++) out.put(0);
  3353. for(unsigned int i=0;i<mFull.mPredecessors.size();i++)
  3354. {
  3355. mFull.mPredecessors[i]->encode(out);
  3356. }
  3357. long pos2=TELLP(out);
  3358. SEEKP(out,pos1);
  3359. encode_uintX(out, 16, (pos2 - pos1) - 2);
  3360. SEEKP(out,pos2);
  3361. }
  3362. {
  3363. long pos1=TELLP(out);
  3364. for(int i=0;i<2;i++) out.put(0);
  3365. for(unsigned int i=0;i<mFull.mSuccessors.size();i++)
  3366. {
  3367. mFull.mSuccessors[i]->encode(out);
  3368. }
  3369. long pos2=TELLP(out);
  3370. SEEKP(out,pos1);
  3371. encode_uintX(out, 16, (pos2 - pos1) - 2);
  3372. SEEKP(out,pos2);
  3373. }
  3374. {
  3375. long pos1=TELLP(out);
  3376. for(int i=0;i<2;i++) out.put(0);
  3377. for(unsigned int i=0;i<mFull.mFingers.size();i++)
  3378. {
  3379. mFull.mFingers[i]->encode(out);
  3380. }
  3381. long pos2=TELLP(out);
  3382. SEEKP(out,pos1);
  3383. encode_uintX(out, 16, (pos2 - pos1) - 2);
  3384. SEEKP(out,pos2);
  3385. }
  3386. break;
  3387. default: /* User error */
  3388. assert(1==0);
  3389. }
  3390. };
  3391. // Classes for ChordRouteQueryAnsStruct */
  3392. ChordRouteQueryAnsStruct :: ChordRouteQueryAnsStruct ()
  3393. {
  3394. mName = "ChordRouteQueryAnsStruct";
  3395. StackLog(<< "Constructing ChordRouteQueryAnsStruct");
  3396. mNextId=0;
  3397. };
  3398. ChordRouteQueryAnsStruct :: ChordRouteQueryAnsStruct (const ChordRouteQueryAnsStruct &from)
  3399. {
  3400. // World's lamest copy constructor
  3401. if(this==&from) return;
  3402. mName = "ChordRouteQueryAnsStruct";
  3403. resip::Data dat;
  3404. {
  3405. resip::DataStream strm(dat);
  3406. from.encode(strm);
  3407. }
  3408. {
  3409. resip::DataStream strm(dat);
  3410. decode(strm);
  3411. }
  3412. }
  3413. void ChordRouteQueryAnsStruct :: print(std::ostream& out, int indent) const
  3414. {
  3415. do_indent(out,indent);
  3416. (out) << "ChordRouteQueryAns:\n";
  3417. indent+=2;
  3418. mNextId->print(out, indent);
  3419. };
  3420. void ChordRouteQueryAnsStruct :: decode(std::istream& in)
  3421. {
  3422. StackLog(<< "Decoding ChordRouteQueryAnsStruct");
  3423. mNextId = new NodeIdStruct();
  3424. mNextId->decode(in);
  3425. };
  3426. void ChordRouteQueryAnsStruct :: encode(std::ostream& out) const
  3427. {
  3428. StackLog(<< "Encoding ChordRouteQueryAnsStruct");
  3429. mNextId->encode(out);
  3430. };
  3431. }