message_xdr.go 33 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136
  1. // ************************************************************
  2. // This file is automatically generated by genxdr. Do not edit.
  3. // ************************************************************
  4. package protocol
  5. import (
  6. "bytes"
  7. "io"
  8. "github.com/calmh/xdr"
  9. )
  10. /*
  11. IndexMessage Structure:
  12. 0 1 2 3
  13. 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
  14. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  15. | Length of Folder |
  16. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  17. / /
  18. \ Folder (variable length) \
  19. / /
  20. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  21. | Number of Files |
  22. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  23. / /
  24. \ Zero or more FileInfo Structures \
  25. / /
  26. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  27. | Flags |
  28. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  29. | Number of Options |
  30. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  31. / /
  32. \ Zero or more Option Structures \
  33. / /
  34. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  35. struct IndexMessage {
  36. string Folder<64>;
  37. FileInfo Files<>;
  38. unsigned int Flags;
  39. Option Options<64>;
  40. }
  41. */
  42. func (o IndexMessage) EncodeXDR(w io.Writer) (int, error) {
  43. var xw = xdr.NewWriter(w)
  44. return o.encodeXDR(xw)
  45. }
  46. func (o IndexMessage) MarshalXDR() ([]byte, error) {
  47. return o.AppendXDR(make([]byte, 0, 128))
  48. }
  49. func (o IndexMessage) MustMarshalXDR() []byte {
  50. bs, err := o.MarshalXDR()
  51. if err != nil {
  52. panic(err)
  53. }
  54. return bs
  55. }
  56. func (o IndexMessage) AppendXDR(bs []byte) ([]byte, error) {
  57. var aw = xdr.AppendWriter(bs)
  58. var xw = xdr.NewWriter(&aw)
  59. _, err := o.encodeXDR(xw)
  60. return []byte(aw), err
  61. }
  62. func (o IndexMessage) encodeXDR(xw *xdr.Writer) (int, error) {
  63. if l := len(o.Folder); l > 64 {
  64. return xw.Tot(), xdr.ElementSizeExceeded("Folder", l, 64)
  65. }
  66. xw.WriteString(o.Folder)
  67. xw.WriteUint32(uint32(len(o.Files)))
  68. for i := range o.Files {
  69. _, err := o.Files[i].encodeXDR(xw)
  70. if err != nil {
  71. return xw.Tot(), err
  72. }
  73. }
  74. xw.WriteUint32(o.Flags)
  75. if l := len(o.Options); l > 64 {
  76. return xw.Tot(), xdr.ElementSizeExceeded("Options", l, 64)
  77. }
  78. xw.WriteUint32(uint32(len(o.Options)))
  79. for i := range o.Options {
  80. _, err := o.Options[i].encodeXDR(xw)
  81. if err != nil {
  82. return xw.Tot(), err
  83. }
  84. }
  85. return xw.Tot(), xw.Error()
  86. }
  87. func (o *IndexMessage) DecodeXDR(r io.Reader) error {
  88. xr := xdr.NewReader(r)
  89. return o.decodeXDR(xr)
  90. }
  91. func (o *IndexMessage) UnmarshalXDR(bs []byte) error {
  92. var br = bytes.NewReader(bs)
  93. var xr = xdr.NewReader(br)
  94. return o.decodeXDR(xr)
  95. }
  96. func (o *IndexMessage) decodeXDR(xr *xdr.Reader) error {
  97. o.Folder = xr.ReadStringMax(64)
  98. _FilesSize := int(xr.ReadUint32())
  99. o.Files = make([]FileInfo, _FilesSize)
  100. for i := range o.Files {
  101. (&o.Files[i]).decodeXDR(xr)
  102. }
  103. o.Flags = xr.ReadUint32()
  104. _OptionsSize := int(xr.ReadUint32())
  105. if _OptionsSize > 64 {
  106. return xdr.ElementSizeExceeded("Options", _OptionsSize, 64)
  107. }
  108. o.Options = make([]Option, _OptionsSize)
  109. for i := range o.Options {
  110. (&o.Options[i]).decodeXDR(xr)
  111. }
  112. return xr.Error()
  113. }
  114. /*
  115. FileInfo Structure:
  116. 0 1 2 3
  117. 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
  118. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  119. | Length of Name |
  120. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  121. / /
  122. \ Name (variable length) \
  123. / /
  124. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  125. | Flags |
  126. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  127. | |
  128. + Modified (64 bits) +
  129. | |
  130. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  131. | |
  132. + Version (64 bits) +
  133. | |
  134. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  135. | |
  136. + Local Version (64 bits) +
  137. | |
  138. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  139. | Number of Blocks |
  140. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  141. / /
  142. \ Zero or more BlockInfo Structures \
  143. / /
  144. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  145. struct FileInfo {
  146. string Name<8192>;
  147. unsigned int Flags;
  148. hyper Modified;
  149. unsigned hyper Version;
  150. unsigned hyper LocalVersion;
  151. BlockInfo Blocks<>;
  152. }
  153. */
  154. func (o FileInfo) EncodeXDR(w io.Writer) (int, error) {
  155. var xw = xdr.NewWriter(w)
  156. return o.encodeXDR(xw)
  157. }
  158. func (o FileInfo) MarshalXDR() ([]byte, error) {
  159. return o.AppendXDR(make([]byte, 0, 128))
  160. }
  161. func (o FileInfo) MustMarshalXDR() []byte {
  162. bs, err := o.MarshalXDR()
  163. if err != nil {
  164. panic(err)
  165. }
  166. return bs
  167. }
  168. func (o FileInfo) AppendXDR(bs []byte) ([]byte, error) {
  169. var aw = xdr.AppendWriter(bs)
  170. var xw = xdr.NewWriter(&aw)
  171. _, err := o.encodeXDR(xw)
  172. return []byte(aw), err
  173. }
  174. func (o FileInfo) encodeXDR(xw *xdr.Writer) (int, error) {
  175. if l := len(o.Name); l > 8192 {
  176. return xw.Tot(), xdr.ElementSizeExceeded("Name", l, 8192)
  177. }
  178. xw.WriteString(o.Name)
  179. xw.WriteUint32(o.Flags)
  180. xw.WriteUint64(uint64(o.Modified))
  181. xw.WriteUint64(o.Version)
  182. xw.WriteUint64(o.LocalVersion)
  183. xw.WriteUint32(uint32(len(o.Blocks)))
  184. for i := range o.Blocks {
  185. _, err := o.Blocks[i].encodeXDR(xw)
  186. if err != nil {
  187. return xw.Tot(), err
  188. }
  189. }
  190. return xw.Tot(), xw.Error()
  191. }
  192. func (o *FileInfo) DecodeXDR(r io.Reader) error {
  193. xr := xdr.NewReader(r)
  194. return o.decodeXDR(xr)
  195. }
  196. func (o *FileInfo) UnmarshalXDR(bs []byte) error {
  197. var br = bytes.NewReader(bs)
  198. var xr = xdr.NewReader(br)
  199. return o.decodeXDR(xr)
  200. }
  201. func (o *FileInfo) decodeXDR(xr *xdr.Reader) error {
  202. o.Name = xr.ReadStringMax(8192)
  203. o.Flags = xr.ReadUint32()
  204. o.Modified = int64(xr.ReadUint64())
  205. o.Version = xr.ReadUint64()
  206. o.LocalVersion = xr.ReadUint64()
  207. _BlocksSize := int(xr.ReadUint32())
  208. o.Blocks = make([]BlockInfo, _BlocksSize)
  209. for i := range o.Blocks {
  210. (&o.Blocks[i]).decodeXDR(xr)
  211. }
  212. return xr.Error()
  213. }
  214. /*
  215. FileInfoTruncated Structure:
  216. 0 1 2 3
  217. 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
  218. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  219. | Length of Name |
  220. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  221. / /
  222. \ Name (variable length) \
  223. / /
  224. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  225. | Flags |
  226. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  227. | |
  228. + Modified (64 bits) +
  229. | |
  230. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  231. | |
  232. + Version (64 bits) +
  233. | |
  234. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  235. | |
  236. + Local Version (64 bits) +
  237. | |
  238. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  239. | Num Blocks |
  240. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  241. struct FileInfoTruncated {
  242. string Name<8192>;
  243. unsigned int Flags;
  244. hyper Modified;
  245. unsigned hyper Version;
  246. unsigned hyper LocalVersion;
  247. unsigned int NumBlocks;
  248. }
  249. */
  250. func (o FileInfoTruncated) EncodeXDR(w io.Writer) (int, error) {
  251. var xw = xdr.NewWriter(w)
  252. return o.encodeXDR(xw)
  253. }
  254. func (o FileInfoTruncated) MarshalXDR() ([]byte, error) {
  255. return o.AppendXDR(make([]byte, 0, 128))
  256. }
  257. func (o FileInfoTruncated) MustMarshalXDR() []byte {
  258. bs, err := o.MarshalXDR()
  259. if err != nil {
  260. panic(err)
  261. }
  262. return bs
  263. }
  264. func (o FileInfoTruncated) AppendXDR(bs []byte) ([]byte, error) {
  265. var aw = xdr.AppendWriter(bs)
  266. var xw = xdr.NewWriter(&aw)
  267. _, err := o.encodeXDR(xw)
  268. return []byte(aw), err
  269. }
  270. func (o FileInfoTruncated) encodeXDR(xw *xdr.Writer) (int, error) {
  271. if l := len(o.Name); l > 8192 {
  272. return xw.Tot(), xdr.ElementSizeExceeded("Name", l, 8192)
  273. }
  274. xw.WriteString(o.Name)
  275. xw.WriteUint32(o.Flags)
  276. xw.WriteUint64(uint64(o.Modified))
  277. xw.WriteUint64(o.Version)
  278. xw.WriteUint64(o.LocalVersion)
  279. xw.WriteUint32(o.NumBlocks)
  280. return xw.Tot(), xw.Error()
  281. }
  282. func (o *FileInfoTruncated) DecodeXDR(r io.Reader) error {
  283. xr := xdr.NewReader(r)
  284. return o.decodeXDR(xr)
  285. }
  286. func (o *FileInfoTruncated) UnmarshalXDR(bs []byte) error {
  287. var br = bytes.NewReader(bs)
  288. var xr = xdr.NewReader(br)
  289. return o.decodeXDR(xr)
  290. }
  291. func (o *FileInfoTruncated) decodeXDR(xr *xdr.Reader) error {
  292. o.Name = xr.ReadStringMax(8192)
  293. o.Flags = xr.ReadUint32()
  294. o.Modified = int64(xr.ReadUint64())
  295. o.Version = xr.ReadUint64()
  296. o.LocalVersion = xr.ReadUint64()
  297. o.NumBlocks = xr.ReadUint32()
  298. return xr.Error()
  299. }
  300. /*
  301. BlockInfo Structure:
  302. 0 1 2 3
  303. 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
  304. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  305. | Size |
  306. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  307. | Length of Hash |
  308. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  309. / /
  310. \ Hash (variable length) \
  311. / /
  312. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  313. struct BlockInfo {
  314. unsigned int Size;
  315. opaque Hash<64>;
  316. }
  317. */
  318. func (o BlockInfo) EncodeXDR(w io.Writer) (int, error) {
  319. var xw = xdr.NewWriter(w)
  320. return o.encodeXDR(xw)
  321. }
  322. func (o BlockInfo) MarshalXDR() ([]byte, error) {
  323. return o.AppendXDR(make([]byte, 0, 128))
  324. }
  325. func (o BlockInfo) MustMarshalXDR() []byte {
  326. bs, err := o.MarshalXDR()
  327. if err != nil {
  328. panic(err)
  329. }
  330. return bs
  331. }
  332. func (o BlockInfo) AppendXDR(bs []byte) ([]byte, error) {
  333. var aw = xdr.AppendWriter(bs)
  334. var xw = xdr.NewWriter(&aw)
  335. _, err := o.encodeXDR(xw)
  336. return []byte(aw), err
  337. }
  338. func (o BlockInfo) encodeXDR(xw *xdr.Writer) (int, error) {
  339. xw.WriteUint32(o.Size)
  340. if l := len(o.Hash); l > 64 {
  341. return xw.Tot(), xdr.ElementSizeExceeded("Hash", l, 64)
  342. }
  343. xw.WriteBytes(o.Hash)
  344. return xw.Tot(), xw.Error()
  345. }
  346. func (o *BlockInfo) DecodeXDR(r io.Reader) error {
  347. xr := xdr.NewReader(r)
  348. return o.decodeXDR(xr)
  349. }
  350. func (o *BlockInfo) UnmarshalXDR(bs []byte) error {
  351. var br = bytes.NewReader(bs)
  352. var xr = xdr.NewReader(br)
  353. return o.decodeXDR(xr)
  354. }
  355. func (o *BlockInfo) decodeXDR(xr *xdr.Reader) error {
  356. o.Size = xr.ReadUint32()
  357. o.Hash = xr.ReadBytesMax(64)
  358. return xr.Error()
  359. }
  360. /*
  361. RequestMessage Structure:
  362. 0 1 2 3
  363. 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
  364. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  365. | Length of Folder |
  366. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  367. / /
  368. \ Folder (variable length) \
  369. / /
  370. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  371. | Length of Name |
  372. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  373. / /
  374. \ Name (variable length) \
  375. / /
  376. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  377. | |
  378. + Offset (64 bits) +
  379. | |
  380. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  381. | Size |
  382. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  383. | Length of Hash |
  384. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  385. / /
  386. \ Hash (variable length) \
  387. / /
  388. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  389. | Flags |
  390. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  391. | Number of Options |
  392. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  393. / /
  394. \ Zero or more Option Structures \
  395. / /
  396. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  397. struct RequestMessage {
  398. string Folder<64>;
  399. string Name<8192>;
  400. unsigned hyper Offset;
  401. unsigned int Size;
  402. opaque Hash<64>;
  403. unsigned int Flags;
  404. Option Options<64>;
  405. }
  406. */
  407. func (o RequestMessage) EncodeXDR(w io.Writer) (int, error) {
  408. var xw = xdr.NewWriter(w)
  409. return o.encodeXDR(xw)
  410. }
  411. func (o RequestMessage) MarshalXDR() ([]byte, error) {
  412. return o.AppendXDR(make([]byte, 0, 128))
  413. }
  414. func (o RequestMessage) MustMarshalXDR() []byte {
  415. bs, err := o.MarshalXDR()
  416. if err != nil {
  417. panic(err)
  418. }
  419. return bs
  420. }
  421. func (o RequestMessage) AppendXDR(bs []byte) ([]byte, error) {
  422. var aw = xdr.AppendWriter(bs)
  423. var xw = xdr.NewWriter(&aw)
  424. _, err := o.encodeXDR(xw)
  425. return []byte(aw), err
  426. }
  427. func (o RequestMessage) encodeXDR(xw *xdr.Writer) (int, error) {
  428. if l := len(o.Folder); l > 64 {
  429. return xw.Tot(), xdr.ElementSizeExceeded("Folder", l, 64)
  430. }
  431. xw.WriteString(o.Folder)
  432. if l := len(o.Name); l > 8192 {
  433. return xw.Tot(), xdr.ElementSizeExceeded("Name", l, 8192)
  434. }
  435. xw.WriteString(o.Name)
  436. xw.WriteUint64(o.Offset)
  437. xw.WriteUint32(o.Size)
  438. if l := len(o.Hash); l > 64 {
  439. return xw.Tot(), xdr.ElementSizeExceeded("Hash", l, 64)
  440. }
  441. xw.WriteBytes(o.Hash)
  442. xw.WriteUint32(o.Flags)
  443. if l := len(o.Options); l > 64 {
  444. return xw.Tot(), xdr.ElementSizeExceeded("Options", l, 64)
  445. }
  446. xw.WriteUint32(uint32(len(o.Options)))
  447. for i := range o.Options {
  448. _, err := o.Options[i].encodeXDR(xw)
  449. if err != nil {
  450. return xw.Tot(), err
  451. }
  452. }
  453. return xw.Tot(), xw.Error()
  454. }
  455. func (o *RequestMessage) DecodeXDR(r io.Reader) error {
  456. xr := xdr.NewReader(r)
  457. return o.decodeXDR(xr)
  458. }
  459. func (o *RequestMessage) UnmarshalXDR(bs []byte) error {
  460. var br = bytes.NewReader(bs)
  461. var xr = xdr.NewReader(br)
  462. return o.decodeXDR(xr)
  463. }
  464. func (o *RequestMessage) decodeXDR(xr *xdr.Reader) error {
  465. o.Folder = xr.ReadStringMax(64)
  466. o.Name = xr.ReadStringMax(8192)
  467. o.Offset = xr.ReadUint64()
  468. o.Size = xr.ReadUint32()
  469. o.Hash = xr.ReadBytesMax(64)
  470. o.Flags = xr.ReadUint32()
  471. _OptionsSize := int(xr.ReadUint32())
  472. if _OptionsSize > 64 {
  473. return xdr.ElementSizeExceeded("Options", _OptionsSize, 64)
  474. }
  475. o.Options = make([]Option, _OptionsSize)
  476. for i := range o.Options {
  477. (&o.Options[i]).decodeXDR(xr)
  478. }
  479. return xr.Error()
  480. }
  481. /*
  482. ResponseMessage Structure:
  483. 0 1 2 3
  484. 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
  485. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  486. | Length of Data |
  487. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  488. / /
  489. \ Data (variable length) \
  490. / /
  491. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  492. | Error |
  493. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  494. struct ResponseMessage {
  495. opaque Data<>;
  496. unsigned int Error;
  497. }
  498. */
  499. func (o ResponseMessage) EncodeXDR(w io.Writer) (int, error) {
  500. var xw = xdr.NewWriter(w)
  501. return o.encodeXDR(xw)
  502. }
  503. func (o ResponseMessage) MarshalXDR() ([]byte, error) {
  504. return o.AppendXDR(make([]byte, 0, 128))
  505. }
  506. func (o ResponseMessage) MustMarshalXDR() []byte {
  507. bs, err := o.MarshalXDR()
  508. if err != nil {
  509. panic(err)
  510. }
  511. return bs
  512. }
  513. func (o ResponseMessage) AppendXDR(bs []byte) ([]byte, error) {
  514. var aw = xdr.AppendWriter(bs)
  515. var xw = xdr.NewWriter(&aw)
  516. _, err := o.encodeXDR(xw)
  517. return []byte(aw), err
  518. }
  519. func (o ResponseMessage) encodeXDR(xw *xdr.Writer) (int, error) {
  520. xw.WriteBytes(o.Data)
  521. xw.WriteUint32(o.Error)
  522. return xw.Tot(), xw.Error()
  523. }
  524. func (o *ResponseMessage) DecodeXDR(r io.Reader) error {
  525. xr := xdr.NewReader(r)
  526. return o.decodeXDR(xr)
  527. }
  528. func (o *ResponseMessage) UnmarshalXDR(bs []byte) error {
  529. var br = bytes.NewReader(bs)
  530. var xr = xdr.NewReader(br)
  531. return o.decodeXDR(xr)
  532. }
  533. func (o *ResponseMessage) decodeXDR(xr *xdr.Reader) error {
  534. o.Data = xr.ReadBytes()
  535. o.Error = xr.ReadUint32()
  536. return xr.Error()
  537. }
  538. /*
  539. ClusterConfigMessage Structure:
  540. 0 1 2 3
  541. 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
  542. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  543. | Length of Client Name |
  544. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  545. / /
  546. \ Client Name (variable length) \
  547. / /
  548. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  549. | Length of Client Version |
  550. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  551. / /
  552. \ Client Version (variable length) \
  553. / /
  554. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  555. | Number of Folders |
  556. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  557. / /
  558. \ Zero or more Folder Structures \
  559. / /
  560. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  561. | Number of Options |
  562. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  563. / /
  564. \ Zero or more Option Structures \
  565. / /
  566. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  567. struct ClusterConfigMessage {
  568. string ClientName<64>;
  569. string ClientVersion<64>;
  570. Folder Folders<64>;
  571. Option Options<64>;
  572. }
  573. */
  574. func (o ClusterConfigMessage) EncodeXDR(w io.Writer) (int, error) {
  575. var xw = xdr.NewWriter(w)
  576. return o.encodeXDR(xw)
  577. }
  578. func (o ClusterConfigMessage) MarshalXDR() ([]byte, error) {
  579. return o.AppendXDR(make([]byte, 0, 128))
  580. }
  581. func (o ClusterConfigMessage) MustMarshalXDR() []byte {
  582. bs, err := o.MarshalXDR()
  583. if err != nil {
  584. panic(err)
  585. }
  586. return bs
  587. }
  588. func (o ClusterConfigMessage) AppendXDR(bs []byte) ([]byte, error) {
  589. var aw = xdr.AppendWriter(bs)
  590. var xw = xdr.NewWriter(&aw)
  591. _, err := o.encodeXDR(xw)
  592. return []byte(aw), err
  593. }
  594. func (o ClusterConfigMessage) encodeXDR(xw *xdr.Writer) (int, error) {
  595. if l := len(o.ClientName); l > 64 {
  596. return xw.Tot(), xdr.ElementSizeExceeded("ClientName", l, 64)
  597. }
  598. xw.WriteString(o.ClientName)
  599. if l := len(o.ClientVersion); l > 64 {
  600. return xw.Tot(), xdr.ElementSizeExceeded("ClientVersion", l, 64)
  601. }
  602. xw.WriteString(o.ClientVersion)
  603. if l := len(o.Folders); l > 64 {
  604. return xw.Tot(), xdr.ElementSizeExceeded("Folders", l, 64)
  605. }
  606. xw.WriteUint32(uint32(len(o.Folders)))
  607. for i := range o.Folders {
  608. _, err := o.Folders[i].encodeXDR(xw)
  609. if err != nil {
  610. return xw.Tot(), err
  611. }
  612. }
  613. if l := len(o.Options); l > 64 {
  614. return xw.Tot(), xdr.ElementSizeExceeded("Options", l, 64)
  615. }
  616. xw.WriteUint32(uint32(len(o.Options)))
  617. for i := range o.Options {
  618. _, err := o.Options[i].encodeXDR(xw)
  619. if err != nil {
  620. return xw.Tot(), err
  621. }
  622. }
  623. return xw.Tot(), xw.Error()
  624. }
  625. func (o *ClusterConfigMessage) DecodeXDR(r io.Reader) error {
  626. xr := xdr.NewReader(r)
  627. return o.decodeXDR(xr)
  628. }
  629. func (o *ClusterConfigMessage) UnmarshalXDR(bs []byte) error {
  630. var br = bytes.NewReader(bs)
  631. var xr = xdr.NewReader(br)
  632. return o.decodeXDR(xr)
  633. }
  634. func (o *ClusterConfigMessage) decodeXDR(xr *xdr.Reader) error {
  635. o.ClientName = xr.ReadStringMax(64)
  636. o.ClientVersion = xr.ReadStringMax(64)
  637. _FoldersSize := int(xr.ReadUint32())
  638. if _FoldersSize > 64 {
  639. return xdr.ElementSizeExceeded("Folders", _FoldersSize, 64)
  640. }
  641. o.Folders = make([]Folder, _FoldersSize)
  642. for i := range o.Folders {
  643. (&o.Folders[i]).decodeXDR(xr)
  644. }
  645. _OptionsSize := int(xr.ReadUint32())
  646. if _OptionsSize > 64 {
  647. return xdr.ElementSizeExceeded("Options", _OptionsSize, 64)
  648. }
  649. o.Options = make([]Option, _OptionsSize)
  650. for i := range o.Options {
  651. (&o.Options[i]).decodeXDR(xr)
  652. }
  653. return xr.Error()
  654. }
  655. /*
  656. Folder Structure:
  657. 0 1 2 3
  658. 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
  659. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  660. | Length of ID |
  661. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  662. / /
  663. \ ID (variable length) \
  664. / /
  665. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  666. | Number of Devices |
  667. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  668. / /
  669. \ Zero or more Device Structures \
  670. / /
  671. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  672. struct Folder {
  673. string ID<64>;
  674. Device Devices<>;
  675. }
  676. */
  677. func (o Folder) EncodeXDR(w io.Writer) (int, error) {
  678. var xw = xdr.NewWriter(w)
  679. return o.encodeXDR(xw)
  680. }
  681. func (o Folder) MarshalXDR() ([]byte, error) {
  682. return o.AppendXDR(make([]byte, 0, 128))
  683. }
  684. func (o Folder) MustMarshalXDR() []byte {
  685. bs, err := o.MarshalXDR()
  686. if err != nil {
  687. panic(err)
  688. }
  689. return bs
  690. }
  691. func (o Folder) AppendXDR(bs []byte) ([]byte, error) {
  692. var aw = xdr.AppendWriter(bs)
  693. var xw = xdr.NewWriter(&aw)
  694. _, err := o.encodeXDR(xw)
  695. return []byte(aw), err
  696. }
  697. func (o Folder) encodeXDR(xw *xdr.Writer) (int, error) {
  698. if l := len(o.ID); l > 64 {
  699. return xw.Tot(), xdr.ElementSizeExceeded("ID", l, 64)
  700. }
  701. xw.WriteString(o.ID)
  702. xw.WriteUint32(uint32(len(o.Devices)))
  703. for i := range o.Devices {
  704. _, err := o.Devices[i].encodeXDR(xw)
  705. if err != nil {
  706. return xw.Tot(), err
  707. }
  708. }
  709. return xw.Tot(), xw.Error()
  710. }
  711. func (o *Folder) DecodeXDR(r io.Reader) error {
  712. xr := xdr.NewReader(r)
  713. return o.decodeXDR(xr)
  714. }
  715. func (o *Folder) UnmarshalXDR(bs []byte) error {
  716. var br = bytes.NewReader(bs)
  717. var xr = xdr.NewReader(br)
  718. return o.decodeXDR(xr)
  719. }
  720. func (o *Folder) decodeXDR(xr *xdr.Reader) error {
  721. o.ID = xr.ReadStringMax(64)
  722. _DevicesSize := int(xr.ReadUint32())
  723. o.Devices = make([]Device, _DevicesSize)
  724. for i := range o.Devices {
  725. (&o.Devices[i]).decodeXDR(xr)
  726. }
  727. return xr.Error()
  728. }
  729. /*
  730. Device Structure:
  731. 0 1 2 3
  732. 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
  733. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  734. | Length of ID |
  735. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  736. / /
  737. \ ID (variable length) \
  738. / /
  739. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  740. | Flags |
  741. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  742. | |
  743. + Max Local Version (64 bits) +
  744. | |
  745. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  746. struct Device {
  747. opaque ID<32>;
  748. unsigned int Flags;
  749. unsigned hyper MaxLocalVersion;
  750. }
  751. */
  752. func (o Device) EncodeXDR(w io.Writer) (int, error) {
  753. var xw = xdr.NewWriter(w)
  754. return o.encodeXDR(xw)
  755. }
  756. func (o Device) MarshalXDR() ([]byte, error) {
  757. return o.AppendXDR(make([]byte, 0, 128))
  758. }
  759. func (o Device) MustMarshalXDR() []byte {
  760. bs, err := o.MarshalXDR()
  761. if err != nil {
  762. panic(err)
  763. }
  764. return bs
  765. }
  766. func (o Device) AppendXDR(bs []byte) ([]byte, error) {
  767. var aw = xdr.AppendWriter(bs)
  768. var xw = xdr.NewWriter(&aw)
  769. _, err := o.encodeXDR(xw)
  770. return []byte(aw), err
  771. }
  772. func (o Device) encodeXDR(xw *xdr.Writer) (int, error) {
  773. if l := len(o.ID); l > 32 {
  774. return xw.Tot(), xdr.ElementSizeExceeded("ID", l, 32)
  775. }
  776. xw.WriteBytes(o.ID)
  777. xw.WriteUint32(o.Flags)
  778. xw.WriteUint64(o.MaxLocalVersion)
  779. return xw.Tot(), xw.Error()
  780. }
  781. func (o *Device) DecodeXDR(r io.Reader) error {
  782. xr := xdr.NewReader(r)
  783. return o.decodeXDR(xr)
  784. }
  785. func (o *Device) UnmarshalXDR(bs []byte) error {
  786. var br = bytes.NewReader(bs)
  787. var xr = xdr.NewReader(br)
  788. return o.decodeXDR(xr)
  789. }
  790. func (o *Device) decodeXDR(xr *xdr.Reader) error {
  791. o.ID = xr.ReadBytesMax(32)
  792. o.Flags = xr.ReadUint32()
  793. o.MaxLocalVersion = xr.ReadUint64()
  794. return xr.Error()
  795. }
  796. /*
  797. Option Structure:
  798. 0 1 2 3
  799. 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
  800. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  801. | Length of Key |
  802. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  803. / /
  804. \ Key (variable length) \
  805. / /
  806. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  807. | Length of Value |
  808. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  809. / /
  810. \ Value (variable length) \
  811. / /
  812. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  813. struct Option {
  814. string Key<64>;
  815. string Value<1024>;
  816. }
  817. */
  818. func (o Option) EncodeXDR(w io.Writer) (int, error) {
  819. var xw = xdr.NewWriter(w)
  820. return o.encodeXDR(xw)
  821. }
  822. func (o Option) MarshalXDR() ([]byte, error) {
  823. return o.AppendXDR(make([]byte, 0, 128))
  824. }
  825. func (o Option) MustMarshalXDR() []byte {
  826. bs, err := o.MarshalXDR()
  827. if err != nil {
  828. panic(err)
  829. }
  830. return bs
  831. }
  832. func (o Option) AppendXDR(bs []byte) ([]byte, error) {
  833. var aw = xdr.AppendWriter(bs)
  834. var xw = xdr.NewWriter(&aw)
  835. _, err := o.encodeXDR(xw)
  836. return []byte(aw), err
  837. }
  838. func (o Option) encodeXDR(xw *xdr.Writer) (int, error) {
  839. if l := len(o.Key); l > 64 {
  840. return xw.Tot(), xdr.ElementSizeExceeded("Key", l, 64)
  841. }
  842. xw.WriteString(o.Key)
  843. if l := len(o.Value); l > 1024 {
  844. return xw.Tot(), xdr.ElementSizeExceeded("Value", l, 1024)
  845. }
  846. xw.WriteString(o.Value)
  847. return xw.Tot(), xw.Error()
  848. }
  849. func (o *Option) DecodeXDR(r io.Reader) error {
  850. xr := xdr.NewReader(r)
  851. return o.decodeXDR(xr)
  852. }
  853. func (o *Option) UnmarshalXDR(bs []byte) error {
  854. var br = bytes.NewReader(bs)
  855. var xr = xdr.NewReader(br)
  856. return o.decodeXDR(xr)
  857. }
  858. func (o *Option) decodeXDR(xr *xdr.Reader) error {
  859. o.Key = xr.ReadStringMax(64)
  860. o.Value = xr.ReadStringMax(1024)
  861. return xr.Error()
  862. }
  863. /*
  864. CloseMessage Structure:
  865. 0 1 2 3
  866. 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
  867. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  868. | Length of Reason |
  869. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  870. / /
  871. \ Reason (variable length) \
  872. / /
  873. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  874. | Code |
  875. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  876. struct CloseMessage {
  877. string Reason<1024>;
  878. unsigned int Code;
  879. }
  880. */
  881. func (o CloseMessage) EncodeXDR(w io.Writer) (int, error) {
  882. var xw = xdr.NewWriter(w)
  883. return o.encodeXDR(xw)
  884. }
  885. func (o CloseMessage) MarshalXDR() ([]byte, error) {
  886. return o.AppendXDR(make([]byte, 0, 128))
  887. }
  888. func (o CloseMessage) MustMarshalXDR() []byte {
  889. bs, err := o.MarshalXDR()
  890. if err != nil {
  891. panic(err)
  892. }
  893. return bs
  894. }
  895. func (o CloseMessage) AppendXDR(bs []byte) ([]byte, error) {
  896. var aw = xdr.AppendWriter(bs)
  897. var xw = xdr.NewWriter(&aw)
  898. _, err := o.encodeXDR(xw)
  899. return []byte(aw), err
  900. }
  901. func (o CloseMessage) encodeXDR(xw *xdr.Writer) (int, error) {
  902. if l := len(o.Reason); l > 1024 {
  903. return xw.Tot(), xdr.ElementSizeExceeded("Reason", l, 1024)
  904. }
  905. xw.WriteString(o.Reason)
  906. xw.WriteUint32(o.Code)
  907. return xw.Tot(), xw.Error()
  908. }
  909. func (o *CloseMessage) DecodeXDR(r io.Reader) error {
  910. xr := xdr.NewReader(r)
  911. return o.decodeXDR(xr)
  912. }
  913. func (o *CloseMessage) UnmarshalXDR(bs []byte) error {
  914. var br = bytes.NewReader(bs)
  915. var xr = xdr.NewReader(br)
  916. return o.decodeXDR(xr)
  917. }
  918. func (o *CloseMessage) decodeXDR(xr *xdr.Reader) error {
  919. o.Reason = xr.ReadStringMax(1024)
  920. o.Code = xr.ReadUint32()
  921. return xr.Error()
  922. }
  923. /*
  924. EmptyMessage Structure:
  925. 0 1 2 3
  926. 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
  927. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  928. struct EmptyMessage {
  929. }
  930. */
  931. func (o EmptyMessage) EncodeXDR(w io.Writer) (int, error) {
  932. var xw = xdr.NewWriter(w)
  933. return o.encodeXDR(xw)
  934. }
  935. func (o EmptyMessage) MarshalXDR() ([]byte, error) {
  936. return o.AppendXDR(make([]byte, 0, 128))
  937. }
  938. func (o EmptyMessage) MustMarshalXDR() []byte {
  939. bs, err := o.MarshalXDR()
  940. if err != nil {
  941. panic(err)
  942. }
  943. return bs
  944. }
  945. func (o EmptyMessage) AppendXDR(bs []byte) ([]byte, error) {
  946. var aw = xdr.AppendWriter(bs)
  947. var xw = xdr.NewWriter(&aw)
  948. _, err := o.encodeXDR(xw)
  949. return []byte(aw), err
  950. }
  951. func (o EmptyMessage) encodeXDR(xw *xdr.Writer) (int, error) {
  952. return xw.Tot(), xw.Error()
  953. }
  954. func (o *EmptyMessage) DecodeXDR(r io.Reader) error {
  955. xr := xdr.NewReader(r)
  956. return o.decodeXDR(xr)
  957. }
  958. func (o *EmptyMessage) UnmarshalXDR(bs []byte) error {
  959. var br = bytes.NewReader(bs)
  960. var xr = xdr.NewReader(br)
  961. return o.decodeXDR(xr)
  962. }
  963. func (o *EmptyMessage) decodeXDR(xr *xdr.Reader) error {
  964. return xr.Error()
  965. }