PageRenderTime 149ms CodeModel.GetById 29ms RepoModel.GetById 1ms app.codeStats 0ms

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

http://openqwaq.googlecode.com/
C++ | 2889 lines | 2246 code | 574 blank | 69 comment | 88 complexity | 4b5b7b265fe760ba106131c7b248949d MD5 | raw file
Possible License(s): GPL-2.0, LGPL-2.1, LGPL-2.0, BSD-3-Clause

Large files files are truncated, but you can click here to view the full file

  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(s

Large files files are truncated, but you can click here to view the full file