message_xdr.go 39 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309
  1. // ************************************************************
  2. // This file is automatically generated by genxdr. Do not edit.
  3. // ************************************************************
  4. package protocol
  5. import (
  6. "github.com/calmh/xdr"
  7. )
  8. /*
  9. IndexMessage Structure:
  10. 0 1 2 3
  11. 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
  12. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  13. / /
  14. \ Folder (length + padded data) \
  15. / /
  16. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  17. | Number of Files |
  18. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  19. / /
  20. \ Zero or more FileInfo Structures \
  21. / /
  22. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  23. | Flags |
  24. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  25. | Number of Options |
  26. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  27. / /
  28. \ Zero or more Option Structures \
  29. / /
  30. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  31. struct IndexMessage {
  32. string Folder<256>;
  33. FileInfo Files<1000000>;
  34. unsigned int Flags;
  35. Option Options<64>;
  36. }
  37. */
  38. func (o IndexMessage) XDRSize() int {
  39. return 4 + len(o.Folder) + xdr.Padding(len(o.Folder)) +
  40. 4 + xdr.SizeOfSlice(o.Files) + 4 +
  41. 4 + xdr.SizeOfSlice(o.Options)
  42. }
  43. func (o IndexMessage) MarshalXDR() ([]byte, error) {
  44. buf := make([]byte, o.XDRSize())
  45. m := &xdr.Marshaller{Data: buf}
  46. return buf, o.MarshalXDRInto(m)
  47. }
  48. func (o IndexMessage) MustMarshalXDR() []byte {
  49. bs, err := o.MarshalXDR()
  50. if err != nil {
  51. panic(err)
  52. }
  53. return bs
  54. }
  55. func (o IndexMessage) MarshalXDRInto(m *xdr.Marshaller) error {
  56. if l := len(o.Folder); l > 256 {
  57. return xdr.ElementSizeExceeded("Folder", l, 256)
  58. }
  59. m.MarshalString(o.Folder)
  60. if l := len(o.Files); l > 1000000 {
  61. return xdr.ElementSizeExceeded("Files", l, 1000000)
  62. }
  63. m.MarshalUint32(uint32(len(o.Files)))
  64. for i := range o.Files {
  65. if err := o.Files[i].MarshalXDRInto(m); err != nil {
  66. return err
  67. }
  68. }
  69. m.MarshalUint32(o.Flags)
  70. if l := len(o.Options); l > 64 {
  71. return xdr.ElementSizeExceeded("Options", l, 64)
  72. }
  73. m.MarshalUint32(uint32(len(o.Options)))
  74. for i := range o.Options {
  75. if err := o.Options[i].MarshalXDRInto(m); err != nil {
  76. return err
  77. }
  78. }
  79. return m.Error
  80. }
  81. func (o *IndexMessage) UnmarshalXDR(bs []byte) error {
  82. u := &xdr.Unmarshaller{Data: bs}
  83. return o.UnmarshalXDRFrom(u)
  84. }
  85. func (o *IndexMessage) UnmarshalXDRFrom(u *xdr.Unmarshaller) error {
  86. o.Folder = u.UnmarshalStringMax(256)
  87. _FilesSize := int(u.UnmarshalUint32())
  88. if _FilesSize < 0 {
  89. return xdr.ElementSizeExceeded("Files", _FilesSize, 1000000)
  90. } else if _FilesSize == 0 {
  91. o.Files = nil
  92. } else {
  93. if _FilesSize > 1000000 {
  94. return xdr.ElementSizeExceeded("Files", _FilesSize, 1000000)
  95. }
  96. if _FilesSize <= len(o.Files) {
  97. o.Files = o.Files[:_FilesSize]
  98. } else {
  99. o.Files = make([]FileInfo, _FilesSize)
  100. }
  101. for i := range o.Files {
  102. (&o.Files[i]).UnmarshalXDRFrom(u)
  103. }
  104. }
  105. o.Flags = u.UnmarshalUint32()
  106. _OptionsSize := int(u.UnmarshalUint32())
  107. if _OptionsSize < 0 {
  108. return xdr.ElementSizeExceeded("Options", _OptionsSize, 64)
  109. } else if _OptionsSize == 0 {
  110. o.Options = nil
  111. } else {
  112. if _OptionsSize > 64 {
  113. return xdr.ElementSizeExceeded("Options", _OptionsSize, 64)
  114. }
  115. if _OptionsSize <= len(o.Options) {
  116. o.Options = o.Options[:_OptionsSize]
  117. } else {
  118. o.Options = make([]Option, _OptionsSize)
  119. }
  120. for i := range o.Options {
  121. (&o.Options[i]).UnmarshalXDRFrom(u)
  122. }
  123. }
  124. return u.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. / /
  132. \ Name (length + padded data) \
  133. / /
  134. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  135. | Flags |
  136. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  137. | |
  138. + Modified (64 bits) +
  139. | |
  140. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  141. / /
  142. \ Vector Structure \
  143. / /
  144. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  145. | |
  146. + Local Version (64 bits) +
  147. | |
  148. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  149. | Number of Blocks |
  150. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  151. / /
  152. \ Zero or more BlockInfo Structures \
  153. / /
  154. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  155. struct FileInfo {
  156. string Name<8192>;
  157. unsigned int Flags;
  158. hyper Modified;
  159. Vector Version;
  160. hyper LocalVersion;
  161. BlockInfo Blocks<10000000>;
  162. }
  163. */
  164. func (o FileInfo) XDRSize() int {
  165. return 4 + len(o.Name) + xdr.Padding(len(o.Name)) + 4 + 8 +
  166. o.Version.XDRSize() + 8 +
  167. 4 + xdr.SizeOfSlice(o.Blocks)
  168. }
  169. func (o FileInfo) MarshalXDR() ([]byte, error) {
  170. buf := make([]byte, o.XDRSize())
  171. m := &xdr.Marshaller{Data: buf}
  172. return buf, o.MarshalXDRInto(m)
  173. }
  174. func (o FileInfo) MustMarshalXDR() []byte {
  175. bs, err := o.MarshalXDR()
  176. if err != nil {
  177. panic(err)
  178. }
  179. return bs
  180. }
  181. func (o FileInfo) MarshalXDRInto(m *xdr.Marshaller) error {
  182. if l := len(o.Name); l > 8192 {
  183. return xdr.ElementSizeExceeded("Name", l, 8192)
  184. }
  185. m.MarshalString(o.Name)
  186. m.MarshalUint32(o.Flags)
  187. m.MarshalUint64(uint64(o.Modified))
  188. if err := o.Version.MarshalXDRInto(m); err != nil {
  189. return err
  190. }
  191. m.MarshalUint64(uint64(o.LocalVersion))
  192. if l := len(o.Blocks); l > 10000000 {
  193. return xdr.ElementSizeExceeded("Blocks", l, 10000000)
  194. }
  195. m.MarshalUint32(uint32(len(o.Blocks)))
  196. for i := range o.Blocks {
  197. if err := o.Blocks[i].MarshalXDRInto(m); err != nil {
  198. return err
  199. }
  200. }
  201. return m.Error
  202. }
  203. func (o *FileInfo) UnmarshalXDR(bs []byte) error {
  204. u := &xdr.Unmarshaller{Data: bs}
  205. return o.UnmarshalXDRFrom(u)
  206. }
  207. func (o *FileInfo) UnmarshalXDRFrom(u *xdr.Unmarshaller) error {
  208. o.Name = u.UnmarshalStringMax(8192)
  209. o.Flags = u.UnmarshalUint32()
  210. o.Modified = int64(u.UnmarshalUint64())
  211. (&o.Version).UnmarshalXDRFrom(u)
  212. o.LocalVersion = int64(u.UnmarshalUint64())
  213. _BlocksSize := int(u.UnmarshalUint32())
  214. if _BlocksSize < 0 {
  215. return xdr.ElementSizeExceeded("Blocks", _BlocksSize, 10000000)
  216. } else if _BlocksSize == 0 {
  217. o.Blocks = nil
  218. } else {
  219. if _BlocksSize > 10000000 {
  220. return xdr.ElementSizeExceeded("Blocks", _BlocksSize, 10000000)
  221. }
  222. if _BlocksSize <= len(o.Blocks) {
  223. o.Blocks = o.Blocks[:_BlocksSize]
  224. } else {
  225. o.Blocks = make([]BlockInfo, _BlocksSize)
  226. }
  227. for i := range o.Blocks {
  228. (&o.Blocks[i]).UnmarshalXDRFrom(u)
  229. }
  230. }
  231. return u.Error
  232. }
  233. /*
  234. BlockInfo Structure:
  235. 0 1 2 3
  236. 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
  237. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  238. | Size |
  239. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  240. / /
  241. \ Hash (length + padded data) \
  242. / /
  243. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  244. struct BlockInfo {
  245. int Size;
  246. opaque Hash<64>;
  247. }
  248. */
  249. func (o BlockInfo) XDRSize() int {
  250. return 4 +
  251. 4 + len(o.Hash) + xdr.Padding(len(o.Hash))
  252. }
  253. func (o BlockInfo) MarshalXDR() ([]byte, error) {
  254. buf := make([]byte, o.XDRSize())
  255. m := &xdr.Marshaller{Data: buf}
  256. return buf, o.MarshalXDRInto(m)
  257. }
  258. func (o BlockInfo) MustMarshalXDR() []byte {
  259. bs, err := o.MarshalXDR()
  260. if err != nil {
  261. panic(err)
  262. }
  263. return bs
  264. }
  265. func (o BlockInfo) MarshalXDRInto(m *xdr.Marshaller) error {
  266. m.MarshalUint32(uint32(o.Size))
  267. if l := len(o.Hash); l > 64 {
  268. return xdr.ElementSizeExceeded("Hash", l, 64)
  269. }
  270. m.MarshalBytes(o.Hash)
  271. return m.Error
  272. }
  273. func (o *BlockInfo) UnmarshalXDR(bs []byte) error {
  274. u := &xdr.Unmarshaller{Data: bs}
  275. return o.UnmarshalXDRFrom(u)
  276. }
  277. func (o *BlockInfo) UnmarshalXDRFrom(u *xdr.Unmarshaller) error {
  278. o.Size = int32(u.UnmarshalUint32())
  279. o.Hash = u.UnmarshalBytesMax(64)
  280. return u.Error
  281. }
  282. /*
  283. RequestMessage Structure:
  284. 0 1 2 3
  285. 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
  286. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  287. / /
  288. \ Folder (length + padded data) \
  289. / /
  290. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  291. / /
  292. \ Name (length + padded data) \
  293. / /
  294. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  295. | |
  296. + Offset (64 bits) +
  297. | |
  298. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  299. | Size |
  300. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  301. / /
  302. \ Hash (length + padded data) \
  303. / /
  304. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  305. | Flags |
  306. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  307. | Number of Options |
  308. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  309. / /
  310. \ Zero or more Option Structures \
  311. / /
  312. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  313. struct RequestMessage {
  314. string Folder<256>;
  315. string Name<8192>;
  316. hyper Offset;
  317. int Size;
  318. opaque Hash<64>;
  319. unsigned int Flags;
  320. Option Options<64>;
  321. }
  322. */
  323. func (o RequestMessage) XDRSize() int {
  324. return 4 + len(o.Folder) + xdr.Padding(len(o.Folder)) +
  325. 4 + len(o.Name) + xdr.Padding(len(o.Name)) + 8 + 4 +
  326. 4 + len(o.Hash) + xdr.Padding(len(o.Hash)) + 4 +
  327. 4 + xdr.SizeOfSlice(o.Options)
  328. }
  329. func (o RequestMessage) MarshalXDR() ([]byte, error) {
  330. buf := make([]byte, o.XDRSize())
  331. m := &xdr.Marshaller{Data: buf}
  332. return buf, o.MarshalXDRInto(m)
  333. }
  334. func (o RequestMessage) MustMarshalXDR() []byte {
  335. bs, err := o.MarshalXDR()
  336. if err != nil {
  337. panic(err)
  338. }
  339. return bs
  340. }
  341. func (o RequestMessage) MarshalXDRInto(m *xdr.Marshaller) error {
  342. if l := len(o.Folder); l > 256 {
  343. return xdr.ElementSizeExceeded("Folder", l, 256)
  344. }
  345. m.MarshalString(o.Folder)
  346. if l := len(o.Name); l > 8192 {
  347. return xdr.ElementSizeExceeded("Name", l, 8192)
  348. }
  349. m.MarshalString(o.Name)
  350. m.MarshalUint64(uint64(o.Offset))
  351. m.MarshalUint32(uint32(o.Size))
  352. if l := len(o.Hash); l > 64 {
  353. return xdr.ElementSizeExceeded("Hash", l, 64)
  354. }
  355. m.MarshalBytes(o.Hash)
  356. m.MarshalUint32(o.Flags)
  357. if l := len(o.Options); l > 64 {
  358. return xdr.ElementSizeExceeded("Options", l, 64)
  359. }
  360. m.MarshalUint32(uint32(len(o.Options)))
  361. for i := range o.Options {
  362. if err := o.Options[i].MarshalXDRInto(m); err != nil {
  363. return err
  364. }
  365. }
  366. return m.Error
  367. }
  368. func (o *RequestMessage) UnmarshalXDR(bs []byte) error {
  369. u := &xdr.Unmarshaller{Data: bs}
  370. return o.UnmarshalXDRFrom(u)
  371. }
  372. func (o *RequestMessage) UnmarshalXDRFrom(u *xdr.Unmarshaller) error {
  373. o.Folder = u.UnmarshalStringMax(256)
  374. o.Name = u.UnmarshalStringMax(8192)
  375. o.Offset = int64(u.UnmarshalUint64())
  376. o.Size = int32(u.UnmarshalUint32())
  377. o.Hash = u.UnmarshalBytesMax(64)
  378. o.Flags = u.UnmarshalUint32()
  379. _OptionsSize := int(u.UnmarshalUint32())
  380. if _OptionsSize < 0 {
  381. return xdr.ElementSizeExceeded("Options", _OptionsSize, 64)
  382. } else if _OptionsSize == 0 {
  383. o.Options = nil
  384. } else {
  385. if _OptionsSize > 64 {
  386. return xdr.ElementSizeExceeded("Options", _OptionsSize, 64)
  387. }
  388. if _OptionsSize <= len(o.Options) {
  389. o.Options = o.Options[:_OptionsSize]
  390. } else {
  391. o.Options = make([]Option, _OptionsSize)
  392. }
  393. for i := range o.Options {
  394. (&o.Options[i]).UnmarshalXDRFrom(u)
  395. }
  396. }
  397. return u.Error
  398. }
  399. /*
  400. ResponseMessage Structure:
  401. 0 1 2 3
  402. 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
  403. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  404. / /
  405. \ Data (length + padded data) \
  406. / /
  407. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  408. | Code |
  409. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  410. struct ResponseMessage {
  411. opaque Data<>;
  412. int Code;
  413. }
  414. */
  415. func (o ResponseMessage) XDRSize() int {
  416. return 4 + len(o.Data) + xdr.Padding(len(o.Data)) + 4
  417. }
  418. func (o ResponseMessage) MarshalXDR() ([]byte, error) {
  419. buf := make([]byte, o.XDRSize())
  420. m := &xdr.Marshaller{Data: buf}
  421. return buf, o.MarshalXDRInto(m)
  422. }
  423. func (o ResponseMessage) MustMarshalXDR() []byte {
  424. bs, err := o.MarshalXDR()
  425. if err != nil {
  426. panic(err)
  427. }
  428. return bs
  429. }
  430. func (o ResponseMessage) MarshalXDRInto(m *xdr.Marshaller) error {
  431. m.MarshalBytes(o.Data)
  432. m.MarshalUint32(uint32(o.Code))
  433. return m.Error
  434. }
  435. func (o *ResponseMessage) UnmarshalXDR(bs []byte) error {
  436. u := &xdr.Unmarshaller{Data: bs}
  437. return o.UnmarshalXDRFrom(u)
  438. }
  439. func (o *ResponseMessage) UnmarshalXDRFrom(u *xdr.Unmarshaller) error {
  440. o.Data = u.UnmarshalBytes()
  441. o.Code = int32(u.UnmarshalUint32())
  442. return u.Error
  443. }
  444. /*
  445. ClusterConfigMessage Structure:
  446. 0 1 2 3
  447. 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
  448. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  449. | Number of Folders |
  450. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  451. / /
  452. \ Zero or more Folder Structures \
  453. / /
  454. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  455. | Number of Options |
  456. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  457. / /
  458. \ Zero or more Option Structures \
  459. / /
  460. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  461. struct ClusterConfigMessage {
  462. Folder Folders<1000000>;
  463. Option Options<64>;
  464. }
  465. */
  466. func (o ClusterConfigMessage) XDRSize() int {
  467. return 4 + xdr.SizeOfSlice(o.Folders) +
  468. 4 + xdr.SizeOfSlice(o.Options)
  469. }
  470. func (o ClusterConfigMessage) MarshalXDR() ([]byte, error) {
  471. buf := make([]byte, o.XDRSize())
  472. m := &xdr.Marshaller{Data: buf}
  473. return buf, o.MarshalXDRInto(m)
  474. }
  475. func (o ClusterConfigMessage) MustMarshalXDR() []byte {
  476. bs, err := o.MarshalXDR()
  477. if err != nil {
  478. panic(err)
  479. }
  480. return bs
  481. }
  482. func (o ClusterConfigMessage) MarshalXDRInto(m *xdr.Marshaller) error {
  483. if l := len(o.Folders); l > 1000000 {
  484. return xdr.ElementSizeExceeded("Folders", l, 1000000)
  485. }
  486. m.MarshalUint32(uint32(len(o.Folders)))
  487. for i := range o.Folders {
  488. if err := o.Folders[i].MarshalXDRInto(m); err != nil {
  489. return err
  490. }
  491. }
  492. if l := len(o.Options); l > 64 {
  493. return xdr.ElementSizeExceeded("Options", l, 64)
  494. }
  495. m.MarshalUint32(uint32(len(o.Options)))
  496. for i := range o.Options {
  497. if err := o.Options[i].MarshalXDRInto(m); err != nil {
  498. return err
  499. }
  500. }
  501. return m.Error
  502. }
  503. func (o *ClusterConfigMessage) UnmarshalXDR(bs []byte) error {
  504. u := &xdr.Unmarshaller{Data: bs}
  505. return o.UnmarshalXDRFrom(u)
  506. }
  507. func (o *ClusterConfigMessage) UnmarshalXDRFrom(u *xdr.Unmarshaller) error {
  508. _FoldersSize := int(u.UnmarshalUint32())
  509. if _FoldersSize < 0 {
  510. return xdr.ElementSizeExceeded("Folders", _FoldersSize, 1000000)
  511. } else if _FoldersSize == 0 {
  512. o.Folders = nil
  513. } else {
  514. if _FoldersSize > 1000000 {
  515. return xdr.ElementSizeExceeded("Folders", _FoldersSize, 1000000)
  516. }
  517. if _FoldersSize <= len(o.Folders) {
  518. o.Folders = o.Folders[:_FoldersSize]
  519. } else {
  520. o.Folders = make([]Folder, _FoldersSize)
  521. }
  522. for i := range o.Folders {
  523. (&o.Folders[i]).UnmarshalXDRFrom(u)
  524. }
  525. }
  526. _OptionsSize := int(u.UnmarshalUint32())
  527. if _OptionsSize < 0 {
  528. return xdr.ElementSizeExceeded("Options", _OptionsSize, 64)
  529. } else if _OptionsSize == 0 {
  530. o.Options = nil
  531. } else {
  532. if _OptionsSize > 64 {
  533. return xdr.ElementSizeExceeded("Options", _OptionsSize, 64)
  534. }
  535. if _OptionsSize <= len(o.Options) {
  536. o.Options = o.Options[:_OptionsSize]
  537. } else {
  538. o.Options = make([]Option, _OptionsSize)
  539. }
  540. for i := range o.Options {
  541. (&o.Options[i]).UnmarshalXDRFrom(u)
  542. }
  543. }
  544. return u.Error
  545. }
  546. /*
  547. DownloadProgressMessage Structure:
  548. 0 1 2 3
  549. 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
  550. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  551. / /
  552. \ Folder (length + padded data) \
  553. / /
  554. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  555. | Number of Updates |
  556. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  557. / /
  558. \ Zero or more FileDownloadProgressUpdate Structures \
  559. / /
  560. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  561. | Flags |
  562. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  563. | Number of Options |
  564. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  565. / /
  566. \ Zero or more Option Structures \
  567. / /
  568. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  569. struct DownloadProgressMessage {
  570. string Folder<64>;
  571. FileDownloadProgressUpdate Updates<1000000>;
  572. unsigned int Flags;
  573. Option Options<64>;
  574. }
  575. */
  576. func (o DownloadProgressMessage) XDRSize() int {
  577. return 4 + len(o.Folder) + xdr.Padding(len(o.Folder)) +
  578. 4 + xdr.SizeOfSlice(o.Updates) + 4 +
  579. 4 + xdr.SizeOfSlice(o.Options)
  580. }
  581. func (o DownloadProgressMessage) MarshalXDR() ([]byte, error) {
  582. buf := make([]byte, o.XDRSize())
  583. m := &xdr.Marshaller{Data: buf}
  584. return buf, o.MarshalXDRInto(m)
  585. }
  586. func (o DownloadProgressMessage) MustMarshalXDR() []byte {
  587. bs, err := o.MarshalXDR()
  588. if err != nil {
  589. panic(err)
  590. }
  591. return bs
  592. }
  593. func (o DownloadProgressMessage) MarshalXDRInto(m *xdr.Marshaller) error {
  594. if l := len(o.Folder); l > 64 {
  595. return xdr.ElementSizeExceeded("Folder", l, 64)
  596. }
  597. m.MarshalString(o.Folder)
  598. if l := len(o.Updates); l > 1000000 {
  599. return xdr.ElementSizeExceeded("Updates", l, 1000000)
  600. }
  601. m.MarshalUint32(uint32(len(o.Updates)))
  602. for i := range o.Updates {
  603. if err := o.Updates[i].MarshalXDRInto(m); err != nil {
  604. return err
  605. }
  606. }
  607. m.MarshalUint32(o.Flags)
  608. if l := len(o.Options); l > 64 {
  609. return xdr.ElementSizeExceeded("Options", l, 64)
  610. }
  611. m.MarshalUint32(uint32(len(o.Options)))
  612. for i := range o.Options {
  613. if err := o.Options[i].MarshalXDRInto(m); err != nil {
  614. return err
  615. }
  616. }
  617. return m.Error
  618. }
  619. func (o *DownloadProgressMessage) UnmarshalXDR(bs []byte) error {
  620. u := &xdr.Unmarshaller{Data: bs}
  621. return o.UnmarshalXDRFrom(u)
  622. }
  623. func (o *DownloadProgressMessage) UnmarshalXDRFrom(u *xdr.Unmarshaller) error {
  624. o.Folder = u.UnmarshalStringMax(64)
  625. _UpdatesSize := int(u.UnmarshalUint32())
  626. if _UpdatesSize < 0 {
  627. return xdr.ElementSizeExceeded("Updates", _UpdatesSize, 1000000)
  628. } else if _UpdatesSize == 0 {
  629. o.Updates = nil
  630. } else {
  631. if _UpdatesSize > 1000000 {
  632. return xdr.ElementSizeExceeded("Updates", _UpdatesSize, 1000000)
  633. }
  634. if _UpdatesSize <= len(o.Updates) {
  635. o.Updates = o.Updates[:_UpdatesSize]
  636. } else {
  637. o.Updates = make([]FileDownloadProgressUpdate, _UpdatesSize)
  638. }
  639. for i := range o.Updates {
  640. (&o.Updates[i]).UnmarshalXDRFrom(u)
  641. }
  642. }
  643. o.Flags = u.UnmarshalUint32()
  644. _OptionsSize := int(u.UnmarshalUint32())
  645. if _OptionsSize < 0 {
  646. return xdr.ElementSizeExceeded("Options", _OptionsSize, 64)
  647. } else if _OptionsSize == 0 {
  648. o.Options = nil
  649. } else {
  650. if _OptionsSize > 64 {
  651. return xdr.ElementSizeExceeded("Options", _OptionsSize, 64)
  652. }
  653. if _OptionsSize <= len(o.Options) {
  654. o.Options = o.Options[:_OptionsSize]
  655. } else {
  656. o.Options = make([]Option, _OptionsSize)
  657. }
  658. for i := range o.Options {
  659. (&o.Options[i]).UnmarshalXDRFrom(u)
  660. }
  661. }
  662. return u.Error
  663. }
  664. /*
  665. Folder Structure:
  666. 0 1 2 3
  667. 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
  668. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  669. / /
  670. \ ID (length + padded data) \
  671. / /
  672. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  673. / /
  674. \ Label (length + padded data) \
  675. / /
  676. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  677. | Number of Devices |
  678. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  679. / /
  680. \ Zero or more Device Structures \
  681. / /
  682. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  683. | Flags |
  684. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  685. | Number of Options |
  686. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  687. / /
  688. \ Zero or more Option Structures \
  689. / /
  690. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  691. struct Folder {
  692. string ID<256>;
  693. string Label<256>;
  694. Device Devices<1000000>;
  695. unsigned int Flags;
  696. Option Options<64>;
  697. }
  698. */
  699. func (o Folder) XDRSize() int {
  700. return 4 + len(o.ID) + xdr.Padding(len(o.ID)) +
  701. 4 + len(o.Label) + xdr.Padding(len(o.Label)) +
  702. 4 + xdr.SizeOfSlice(o.Devices) + 4 +
  703. 4 + xdr.SizeOfSlice(o.Options)
  704. }
  705. func (o Folder) MarshalXDR() ([]byte, error) {
  706. buf := make([]byte, o.XDRSize())
  707. m := &xdr.Marshaller{Data: buf}
  708. return buf, o.MarshalXDRInto(m)
  709. }
  710. func (o Folder) MustMarshalXDR() []byte {
  711. bs, err := o.MarshalXDR()
  712. if err != nil {
  713. panic(err)
  714. }
  715. return bs
  716. }
  717. func (o Folder) MarshalXDRInto(m *xdr.Marshaller) error {
  718. if l := len(o.ID); l > 256 {
  719. return xdr.ElementSizeExceeded("ID", l, 256)
  720. }
  721. m.MarshalString(o.ID)
  722. if l := len(o.Label); l > 256 {
  723. return xdr.ElementSizeExceeded("Label", l, 256)
  724. }
  725. m.MarshalString(o.Label)
  726. if l := len(o.Devices); l > 1000000 {
  727. return xdr.ElementSizeExceeded("Devices", l, 1000000)
  728. }
  729. m.MarshalUint32(uint32(len(o.Devices)))
  730. for i := range o.Devices {
  731. if err := o.Devices[i].MarshalXDRInto(m); err != nil {
  732. return err
  733. }
  734. }
  735. m.MarshalUint32(o.Flags)
  736. if l := len(o.Options); l > 64 {
  737. return xdr.ElementSizeExceeded("Options", l, 64)
  738. }
  739. m.MarshalUint32(uint32(len(o.Options)))
  740. for i := range o.Options {
  741. if err := o.Options[i].MarshalXDRInto(m); err != nil {
  742. return err
  743. }
  744. }
  745. return m.Error
  746. }
  747. func (o *Folder) UnmarshalXDR(bs []byte) error {
  748. u := &xdr.Unmarshaller{Data: bs}
  749. return o.UnmarshalXDRFrom(u)
  750. }
  751. func (o *Folder) UnmarshalXDRFrom(u *xdr.Unmarshaller) error {
  752. o.ID = u.UnmarshalStringMax(256)
  753. o.Label = u.UnmarshalStringMax(256)
  754. _DevicesSize := int(u.UnmarshalUint32())
  755. if _DevicesSize < 0 {
  756. return xdr.ElementSizeExceeded("Devices", _DevicesSize, 1000000)
  757. } else if _DevicesSize == 0 {
  758. o.Devices = nil
  759. } else {
  760. if _DevicesSize > 1000000 {
  761. return xdr.ElementSizeExceeded("Devices", _DevicesSize, 1000000)
  762. }
  763. if _DevicesSize <= len(o.Devices) {
  764. o.Devices = o.Devices[:_DevicesSize]
  765. } else {
  766. o.Devices = make([]Device, _DevicesSize)
  767. }
  768. for i := range o.Devices {
  769. (&o.Devices[i]).UnmarshalXDRFrom(u)
  770. }
  771. }
  772. o.Flags = u.UnmarshalUint32()
  773. _OptionsSize := int(u.UnmarshalUint32())
  774. if _OptionsSize < 0 {
  775. return xdr.ElementSizeExceeded("Options", _OptionsSize, 64)
  776. } else if _OptionsSize == 0 {
  777. o.Options = nil
  778. } else {
  779. if _OptionsSize > 64 {
  780. return xdr.ElementSizeExceeded("Options", _OptionsSize, 64)
  781. }
  782. if _OptionsSize <= len(o.Options) {
  783. o.Options = o.Options[:_OptionsSize]
  784. } else {
  785. o.Options = make([]Option, _OptionsSize)
  786. }
  787. for i := range o.Options {
  788. (&o.Options[i]).UnmarshalXDRFrom(u)
  789. }
  790. }
  791. return u.Error
  792. }
  793. /*
  794. Device Structure:
  795. 0 1 2 3
  796. 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
  797. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  798. / /
  799. \ ID (length + padded data) \
  800. / /
  801. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  802. / /
  803. \ Name (length + padded data) \
  804. / /
  805. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  806. | Number of Addresses |
  807. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  808. / /
  809. / /
  810. \ Addresses (length + padded data) \
  811. / /
  812. / /
  813. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  814. | Compression |
  815. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  816. / /
  817. \ Cert Name (length + padded data) \
  818. / /
  819. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  820. | |
  821. + Max Local Version (64 bits) +
  822. | |
  823. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  824. | Flags |
  825. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  826. | Number of Options |
  827. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  828. / /
  829. \ Zero or more Option Structures \
  830. / /
  831. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  832. struct Device {
  833. opaque ID<32>;
  834. string Name<64>;
  835. string Addresses<64>;
  836. unsigned int Compression;
  837. string CertName<64>;
  838. hyper MaxLocalVersion;
  839. unsigned int Flags;
  840. Option Options<64>;
  841. }
  842. */
  843. func (o Device) XDRSize() int {
  844. return 4 + len(o.ID) + xdr.Padding(len(o.ID)) +
  845. 4 + len(o.Name) + xdr.Padding(len(o.Name)) +
  846. 4 + xdr.SizeOfSlice(o.Addresses) + 4 +
  847. 4 + len(o.CertName) + xdr.Padding(len(o.CertName)) + 8 + 4 +
  848. 4 + xdr.SizeOfSlice(o.Options)
  849. }
  850. func (o Device) MarshalXDR() ([]byte, error) {
  851. buf := make([]byte, o.XDRSize())
  852. m := &xdr.Marshaller{Data: buf}
  853. return buf, o.MarshalXDRInto(m)
  854. }
  855. func (o Device) MustMarshalXDR() []byte {
  856. bs, err := o.MarshalXDR()
  857. if err != nil {
  858. panic(err)
  859. }
  860. return bs
  861. }
  862. func (o Device) MarshalXDRInto(m *xdr.Marshaller) error {
  863. if l := len(o.ID); l > 32 {
  864. return xdr.ElementSizeExceeded("ID", l, 32)
  865. }
  866. m.MarshalBytes(o.ID)
  867. if l := len(o.Name); l > 64 {
  868. return xdr.ElementSizeExceeded("Name", l, 64)
  869. }
  870. m.MarshalString(o.Name)
  871. if l := len(o.Addresses); l > 64 {
  872. return xdr.ElementSizeExceeded("Addresses", l, 64)
  873. }
  874. m.MarshalUint32(uint32(len(o.Addresses)))
  875. for i := range o.Addresses {
  876. m.MarshalString(o.Addresses[i])
  877. }
  878. m.MarshalUint32(o.Compression)
  879. if l := len(o.CertName); l > 64 {
  880. return xdr.ElementSizeExceeded("CertName", l, 64)
  881. }
  882. m.MarshalString(o.CertName)
  883. m.MarshalUint64(uint64(o.MaxLocalVersion))
  884. m.MarshalUint32(o.Flags)
  885. if l := len(o.Options); l > 64 {
  886. return xdr.ElementSizeExceeded("Options", l, 64)
  887. }
  888. m.MarshalUint32(uint32(len(o.Options)))
  889. for i := range o.Options {
  890. if err := o.Options[i].MarshalXDRInto(m); err != nil {
  891. return err
  892. }
  893. }
  894. return m.Error
  895. }
  896. func (o *Device) UnmarshalXDR(bs []byte) error {
  897. u := &xdr.Unmarshaller{Data: bs}
  898. return o.UnmarshalXDRFrom(u)
  899. }
  900. func (o *Device) UnmarshalXDRFrom(u *xdr.Unmarshaller) error {
  901. o.ID = u.UnmarshalBytesMax(32)
  902. o.Name = u.UnmarshalStringMax(64)
  903. _AddressesSize := int(u.UnmarshalUint32())
  904. if _AddressesSize < 0 {
  905. return xdr.ElementSizeExceeded("Addresses", _AddressesSize, 64)
  906. } else if _AddressesSize == 0 {
  907. o.Addresses = nil
  908. } else {
  909. if _AddressesSize > 64 {
  910. return xdr.ElementSizeExceeded("Addresses", _AddressesSize, 64)
  911. }
  912. if _AddressesSize <= len(o.Addresses) {
  913. for i := _AddressesSize; i < len(o.Addresses); i++ {
  914. o.Addresses[i] = ""
  915. }
  916. o.Addresses = o.Addresses[:_AddressesSize]
  917. } else {
  918. o.Addresses = make([]string, _AddressesSize)
  919. }
  920. for i := range o.Addresses {
  921. o.Addresses[i] = u.UnmarshalStringMax(2083)
  922. }
  923. }
  924. o.Compression = u.UnmarshalUint32()
  925. o.CertName = u.UnmarshalStringMax(64)
  926. o.MaxLocalVersion = int64(u.UnmarshalUint64())
  927. o.Flags = u.UnmarshalUint32()
  928. _OptionsSize := int(u.UnmarshalUint32())
  929. if _OptionsSize < 0 {
  930. return xdr.ElementSizeExceeded("Options", _OptionsSize, 64)
  931. } else if _OptionsSize == 0 {
  932. o.Options = nil
  933. } else {
  934. if _OptionsSize > 64 {
  935. return xdr.ElementSizeExceeded("Options", _OptionsSize, 64)
  936. }
  937. if _OptionsSize <= len(o.Options) {
  938. o.Options = o.Options[:_OptionsSize]
  939. } else {
  940. o.Options = make([]Option, _OptionsSize)
  941. }
  942. for i := range o.Options {
  943. (&o.Options[i]).UnmarshalXDRFrom(u)
  944. }
  945. }
  946. return u.Error
  947. }
  948. /*
  949. FileDownloadProgressUpdate Structure:
  950. 0 1 2 3
  951. 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
  952. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  953. | Update Type |
  954. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  955. / /
  956. \ Name (length + padded data) \
  957. / /
  958. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  959. / /
  960. \ Vector Structure \
  961. / /
  962. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  963. | Number of Block Indexes |
  964. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  965. / /
  966. | Block Indexes (n items) |
  967. / /
  968. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  969. struct FileDownloadProgressUpdate {
  970. unsigned int UpdateType;
  971. string Name<8192>;
  972. Vector Version;
  973. int BlockIndexes<1000000>;
  974. }
  975. */
  976. func (o FileDownloadProgressUpdate) XDRSize() int {
  977. return 4 +
  978. 4 + len(o.Name) + xdr.Padding(len(o.Name)) +
  979. o.Version.XDRSize() +
  980. 4 + len(o.BlockIndexes)*4
  981. }
  982. func (o FileDownloadProgressUpdate) MarshalXDR() ([]byte, error) {
  983. buf := make([]byte, o.XDRSize())
  984. m := &xdr.Marshaller{Data: buf}
  985. return buf, o.MarshalXDRInto(m)
  986. }
  987. func (o FileDownloadProgressUpdate) MustMarshalXDR() []byte {
  988. bs, err := o.MarshalXDR()
  989. if err != nil {
  990. panic(err)
  991. }
  992. return bs
  993. }
  994. func (o FileDownloadProgressUpdate) MarshalXDRInto(m *xdr.Marshaller) error {
  995. m.MarshalUint32(o.UpdateType)
  996. if l := len(o.Name); l > 8192 {
  997. return xdr.ElementSizeExceeded("Name", l, 8192)
  998. }
  999. m.MarshalString(o.Name)
  1000. if err := o.Version.MarshalXDRInto(m); err != nil {
  1001. return err
  1002. }
  1003. if l := len(o.BlockIndexes); l > 1000000 {
  1004. return xdr.ElementSizeExceeded("BlockIndexes", l, 1000000)
  1005. }
  1006. m.MarshalUint32(uint32(len(o.BlockIndexes)))
  1007. for i := range o.BlockIndexes {
  1008. m.MarshalUint32(uint32(o.BlockIndexes[i]))
  1009. }
  1010. return m.Error
  1011. }
  1012. func (o *FileDownloadProgressUpdate) UnmarshalXDR(bs []byte) error {
  1013. u := &xdr.Unmarshaller{Data: bs}
  1014. return o.UnmarshalXDRFrom(u)
  1015. }
  1016. func (o *FileDownloadProgressUpdate) UnmarshalXDRFrom(u *xdr.Unmarshaller) error {
  1017. o.UpdateType = u.UnmarshalUint32()
  1018. o.Name = u.UnmarshalStringMax(8192)
  1019. (&o.Version).UnmarshalXDRFrom(u)
  1020. _BlockIndexesSize := int(u.UnmarshalUint32())
  1021. if _BlockIndexesSize < 0 {
  1022. return xdr.ElementSizeExceeded("BlockIndexes", _BlockIndexesSize, 1000000)
  1023. } else if _BlockIndexesSize == 0 {
  1024. o.BlockIndexes = nil
  1025. } else {
  1026. if _BlockIndexesSize > 1000000 {
  1027. return xdr.ElementSizeExceeded("BlockIndexes", _BlockIndexesSize, 1000000)
  1028. }
  1029. if _BlockIndexesSize <= len(o.BlockIndexes) {
  1030. o.BlockIndexes = o.BlockIndexes[:_BlockIndexesSize]
  1031. } else {
  1032. o.BlockIndexes = make([]int32, _BlockIndexesSize)
  1033. }
  1034. for i := range o.BlockIndexes {
  1035. o.BlockIndexes[i] = int32(u.UnmarshalUint32())
  1036. }
  1037. }
  1038. return u.Error
  1039. }
  1040. /*
  1041. Option Structure:
  1042. 0 1 2 3
  1043. 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
  1044. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1045. / /
  1046. \ Key (length + padded data) \
  1047. / /
  1048. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1049. / /
  1050. \ Value (length + padded data) \
  1051. / /
  1052. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1053. struct Option {
  1054. string Key<64>;
  1055. string Value<1024>;
  1056. }
  1057. */
  1058. func (o Option) XDRSize() int {
  1059. return 4 + len(o.Key) + xdr.Padding(len(o.Key)) +
  1060. 4 + len(o.Value) + xdr.Padding(len(o.Value))
  1061. }
  1062. func (o Option) MarshalXDR() ([]byte, error) {
  1063. buf := make([]byte, o.XDRSize())
  1064. m := &xdr.Marshaller{Data: buf}
  1065. return buf, o.MarshalXDRInto(m)
  1066. }
  1067. func (o Option) MustMarshalXDR() []byte {
  1068. bs, err := o.MarshalXDR()
  1069. if err != nil {
  1070. panic(err)
  1071. }
  1072. return bs
  1073. }
  1074. func (o Option) MarshalXDRInto(m *xdr.Marshaller) error {
  1075. if l := len(o.Key); l > 64 {
  1076. return xdr.ElementSizeExceeded("Key", l, 64)
  1077. }
  1078. m.MarshalString(o.Key)
  1079. if l := len(o.Value); l > 1024 {
  1080. return xdr.ElementSizeExceeded("Value", l, 1024)
  1081. }
  1082. m.MarshalString(o.Value)
  1083. return m.Error
  1084. }
  1085. func (o *Option) UnmarshalXDR(bs []byte) error {
  1086. u := &xdr.Unmarshaller{Data: bs}
  1087. return o.UnmarshalXDRFrom(u)
  1088. }
  1089. func (o *Option) UnmarshalXDRFrom(u *xdr.Unmarshaller) error {
  1090. o.Key = u.UnmarshalStringMax(64)
  1091. o.Value = u.UnmarshalStringMax(1024)
  1092. return u.Error
  1093. }
  1094. /*
  1095. CloseMessage Structure:
  1096. 0 1 2 3
  1097. 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
  1098. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1099. / /
  1100. \ Reason (length + padded data) \
  1101. / /
  1102. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1103. | Code |
  1104. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1105. struct CloseMessage {
  1106. string Reason<1024>;
  1107. int Code;
  1108. }
  1109. */
  1110. func (o CloseMessage) XDRSize() int {
  1111. return 4 + len(o.Reason) + xdr.Padding(len(o.Reason)) + 4
  1112. }
  1113. func (o CloseMessage) MarshalXDR() ([]byte, error) {
  1114. buf := make([]byte, o.XDRSize())
  1115. m := &xdr.Marshaller{Data: buf}
  1116. return buf, o.MarshalXDRInto(m)
  1117. }
  1118. func (o CloseMessage) MustMarshalXDR() []byte {
  1119. bs, err := o.MarshalXDR()
  1120. if err != nil {
  1121. panic(err)
  1122. }
  1123. return bs
  1124. }
  1125. func (o CloseMessage) MarshalXDRInto(m *xdr.Marshaller) error {
  1126. if l := len(o.Reason); l > 1024 {
  1127. return xdr.ElementSizeExceeded("Reason", l, 1024)
  1128. }
  1129. m.MarshalString(o.Reason)
  1130. m.MarshalUint32(uint32(o.Code))
  1131. return m.Error
  1132. }
  1133. func (o *CloseMessage) UnmarshalXDR(bs []byte) error {
  1134. u := &xdr.Unmarshaller{Data: bs}
  1135. return o.UnmarshalXDRFrom(u)
  1136. }
  1137. func (o *CloseMessage) UnmarshalXDRFrom(u *xdr.Unmarshaller) error {
  1138. o.Reason = u.UnmarshalStringMax(1024)
  1139. o.Code = int32(u.UnmarshalUint32())
  1140. return u.Error
  1141. }
  1142. /*
  1143. EmptyMessage Structure:
  1144. (contains no fields)
  1145. struct EmptyMessage {
  1146. }
  1147. */
  1148. func (o EmptyMessage) XDRSize() int {
  1149. return 0
  1150. }
  1151. func (o EmptyMessage) MarshalXDR() ([]byte, error) {
  1152. return nil, nil
  1153. }
  1154. func (o EmptyMessage) MustMarshalXDR() []byte {
  1155. return nil
  1156. }
  1157. func (o EmptyMessage) MarshalXDRInto(m *xdr.Marshaller) error {
  1158. return nil
  1159. }
  1160. func (o *EmptyMessage) UnmarshalXDR(bs []byte) error {
  1161. return nil
  1162. }
  1163. func (o *EmptyMessage) UnmarshalXDRFrom(u *xdr.Unmarshaller) error {
  1164. return nil
  1165. }