message_xdr.go 34 KB

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