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