message_xdr.go 33 KB

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