message_xdr.go 41 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385
  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. DownloadProgressMessage 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. \ Folder (length + padded data) \
  618. / /
  619. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  620. | Number of Updates |
  621. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  622. / /
  623. \ Zero or more FileDownloadProgressUpdate Structures \
  624. / /
  625. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  626. | Flags |
  627. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  628. | Number of Options |
  629. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  630. / /
  631. \ Zero or more Option Structures \
  632. / /
  633. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  634. struct DownloadProgressMessage {
  635. string Folder<64>;
  636. FileDownloadProgressUpdate Updates<1000000>;
  637. unsigned int Flags;
  638. Option Options<64>;
  639. }
  640. */
  641. func (o DownloadProgressMessage) XDRSize() int {
  642. return 4 + len(o.Folder) + xdr.Padding(len(o.Folder)) +
  643. 4 + xdr.SizeOfSlice(o.Updates) + 4 +
  644. 4 + xdr.SizeOfSlice(o.Options)
  645. }
  646. func (o DownloadProgressMessage) MarshalXDR() ([]byte, error) {
  647. buf := make([]byte, o.XDRSize())
  648. m := &xdr.Marshaller{Data: buf}
  649. return buf, o.MarshalXDRInto(m)
  650. }
  651. func (o DownloadProgressMessage) MustMarshalXDR() []byte {
  652. bs, err := o.MarshalXDR()
  653. if err != nil {
  654. panic(err)
  655. }
  656. return bs
  657. }
  658. func (o DownloadProgressMessage) MarshalXDRInto(m *xdr.Marshaller) error {
  659. if l := len(o.Folder); l > 64 {
  660. return xdr.ElementSizeExceeded("Folder", l, 64)
  661. }
  662. m.MarshalString(o.Folder)
  663. if l := len(o.Updates); l > 1000000 {
  664. return xdr.ElementSizeExceeded("Updates", l, 1000000)
  665. }
  666. m.MarshalUint32(uint32(len(o.Updates)))
  667. for i := range o.Updates {
  668. if err := o.Updates[i].MarshalXDRInto(m); err != nil {
  669. return err
  670. }
  671. }
  672. m.MarshalUint32(o.Flags)
  673. if l := len(o.Options); l > 64 {
  674. return xdr.ElementSizeExceeded("Options", l, 64)
  675. }
  676. m.MarshalUint32(uint32(len(o.Options)))
  677. for i := range o.Options {
  678. if err := o.Options[i].MarshalXDRInto(m); err != nil {
  679. return err
  680. }
  681. }
  682. return m.Error
  683. }
  684. func (o *DownloadProgressMessage) UnmarshalXDR(bs []byte) error {
  685. u := &xdr.Unmarshaller{Data: bs}
  686. return o.UnmarshalXDRFrom(u)
  687. }
  688. func (o *DownloadProgressMessage) UnmarshalXDRFrom(u *xdr.Unmarshaller) error {
  689. o.Folder = u.UnmarshalStringMax(64)
  690. _UpdatesSize := int(u.UnmarshalUint32())
  691. if _UpdatesSize < 0 {
  692. return xdr.ElementSizeExceeded("Updates", _UpdatesSize, 1000000)
  693. } else if _UpdatesSize == 0 {
  694. o.Updates = nil
  695. } else {
  696. if _UpdatesSize > 1000000 {
  697. return xdr.ElementSizeExceeded("Updates", _UpdatesSize, 1000000)
  698. }
  699. if _UpdatesSize <= len(o.Updates) {
  700. o.Updates = o.Updates[:_UpdatesSize]
  701. } else {
  702. o.Updates = make([]FileDownloadProgressUpdate, _UpdatesSize)
  703. }
  704. for i := range o.Updates {
  705. (&o.Updates[i]).UnmarshalXDRFrom(u)
  706. }
  707. }
  708. o.Flags = u.UnmarshalUint32()
  709. _OptionsSize := int(u.UnmarshalUint32())
  710. if _OptionsSize < 0 {
  711. return xdr.ElementSizeExceeded("Options", _OptionsSize, 64)
  712. } else if _OptionsSize == 0 {
  713. o.Options = nil
  714. } else {
  715. if _OptionsSize > 64 {
  716. return xdr.ElementSizeExceeded("Options", _OptionsSize, 64)
  717. }
  718. if _OptionsSize <= len(o.Options) {
  719. o.Options = o.Options[:_OptionsSize]
  720. } else {
  721. o.Options = make([]Option, _OptionsSize)
  722. }
  723. for i := range o.Options {
  724. (&o.Options[i]).UnmarshalXDRFrom(u)
  725. }
  726. }
  727. return u.Error
  728. }
  729. /*
  730. Folder Structure:
  731. 0 1 2 3
  732. 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
  733. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  734. / /
  735. \ ID (length + padded data) \
  736. / /
  737. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  738. / /
  739. \ Label (length + padded data) \
  740. / /
  741. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  742. | Number of Devices |
  743. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  744. / /
  745. \ Zero or more Device Structures \
  746. / /
  747. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  748. | Flags |
  749. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  750. | Number of Options |
  751. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  752. / /
  753. \ Zero or more Option Structures \
  754. / /
  755. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  756. struct Folder {
  757. string ID<256>;
  758. string Label<256>;
  759. Device Devices<1000000>;
  760. unsigned int Flags;
  761. Option Options<64>;
  762. }
  763. */
  764. func (o Folder) XDRSize() int {
  765. return 4 + len(o.ID) + xdr.Padding(len(o.ID)) +
  766. 4 + len(o.Label) + xdr.Padding(len(o.Label)) +
  767. 4 + xdr.SizeOfSlice(o.Devices) + 4 +
  768. 4 + xdr.SizeOfSlice(o.Options)
  769. }
  770. func (o Folder) MarshalXDR() ([]byte, error) {
  771. buf := make([]byte, o.XDRSize())
  772. m := &xdr.Marshaller{Data: buf}
  773. return buf, o.MarshalXDRInto(m)
  774. }
  775. func (o Folder) MustMarshalXDR() []byte {
  776. bs, err := o.MarshalXDR()
  777. if err != nil {
  778. panic(err)
  779. }
  780. return bs
  781. }
  782. func (o Folder) MarshalXDRInto(m *xdr.Marshaller) error {
  783. if l := len(o.ID); l > 256 {
  784. return xdr.ElementSizeExceeded("ID", l, 256)
  785. }
  786. m.MarshalString(o.ID)
  787. if l := len(o.Label); l > 256 {
  788. return xdr.ElementSizeExceeded("Label", l, 256)
  789. }
  790. m.MarshalString(o.Label)
  791. if l := len(o.Devices); l > 1000000 {
  792. return xdr.ElementSizeExceeded("Devices", l, 1000000)
  793. }
  794. m.MarshalUint32(uint32(len(o.Devices)))
  795. for i := range o.Devices {
  796. if err := o.Devices[i].MarshalXDRInto(m); err != nil {
  797. return err
  798. }
  799. }
  800. m.MarshalUint32(o.Flags)
  801. if l := len(o.Options); l > 64 {
  802. return xdr.ElementSizeExceeded("Options", l, 64)
  803. }
  804. m.MarshalUint32(uint32(len(o.Options)))
  805. for i := range o.Options {
  806. if err := o.Options[i].MarshalXDRInto(m); err != nil {
  807. return err
  808. }
  809. }
  810. return m.Error
  811. }
  812. func (o *Folder) UnmarshalXDR(bs []byte) error {
  813. u := &xdr.Unmarshaller{Data: bs}
  814. return o.UnmarshalXDRFrom(u)
  815. }
  816. func (o *Folder) UnmarshalXDRFrom(u *xdr.Unmarshaller) error {
  817. o.ID = u.UnmarshalStringMax(256)
  818. o.Label = u.UnmarshalStringMax(256)
  819. _DevicesSize := int(u.UnmarshalUint32())
  820. if _DevicesSize < 0 {
  821. return xdr.ElementSizeExceeded("Devices", _DevicesSize, 1000000)
  822. } else if _DevicesSize == 0 {
  823. o.Devices = nil
  824. } else {
  825. if _DevicesSize > 1000000 {
  826. return xdr.ElementSizeExceeded("Devices", _DevicesSize, 1000000)
  827. }
  828. if _DevicesSize <= len(o.Devices) {
  829. o.Devices = o.Devices[:_DevicesSize]
  830. } else {
  831. o.Devices = make([]Device, _DevicesSize)
  832. }
  833. for i := range o.Devices {
  834. (&o.Devices[i]).UnmarshalXDRFrom(u)
  835. }
  836. }
  837. o.Flags = u.UnmarshalUint32()
  838. _OptionsSize := int(u.UnmarshalUint32())
  839. if _OptionsSize < 0 {
  840. return xdr.ElementSizeExceeded("Options", _OptionsSize, 64)
  841. } else if _OptionsSize == 0 {
  842. o.Options = nil
  843. } else {
  844. if _OptionsSize > 64 {
  845. return xdr.ElementSizeExceeded("Options", _OptionsSize, 64)
  846. }
  847. if _OptionsSize <= len(o.Options) {
  848. o.Options = o.Options[:_OptionsSize]
  849. } else {
  850. o.Options = make([]Option, _OptionsSize)
  851. }
  852. for i := range o.Options {
  853. (&o.Options[i]).UnmarshalXDRFrom(u)
  854. }
  855. }
  856. return u.Error
  857. }
  858. /*
  859. Device Structure:
  860. 0 1 2 3
  861. 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
  862. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  863. / /
  864. \ ID (length + padded data) \
  865. / /
  866. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  867. / /
  868. \ Name (length + padded data) \
  869. / /
  870. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  871. | Number of Addresses |
  872. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  873. / /
  874. / /
  875. \ Addresses (length + padded data) \
  876. / /
  877. / /
  878. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  879. | Compression |
  880. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  881. / /
  882. \ Cert Name (length + padded data) \
  883. / /
  884. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  885. | |
  886. + Max Local Version (64 bits) +
  887. | |
  888. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  889. | Flags |
  890. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  891. | Number of Options |
  892. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  893. / /
  894. \ Zero or more Option Structures \
  895. / /
  896. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  897. struct Device {
  898. opaque ID<32>;
  899. string Name<64>;
  900. string Addresses<64>;
  901. unsigned int Compression;
  902. string CertName<64>;
  903. hyper MaxLocalVersion;
  904. unsigned int Flags;
  905. Option Options<64>;
  906. }
  907. */
  908. func (o Device) XDRSize() int {
  909. return 4 + len(o.ID) + xdr.Padding(len(o.ID)) +
  910. 4 + len(o.Name) + xdr.Padding(len(o.Name)) +
  911. 4 + xdr.SizeOfSlice(o.Addresses) + 4 +
  912. 4 + len(o.CertName) + xdr.Padding(len(o.CertName)) + 8 + 4 +
  913. 4 + xdr.SizeOfSlice(o.Options)
  914. }
  915. func (o Device) MarshalXDR() ([]byte, error) {
  916. buf := make([]byte, o.XDRSize())
  917. m := &xdr.Marshaller{Data: buf}
  918. return buf, o.MarshalXDRInto(m)
  919. }
  920. func (o Device) MustMarshalXDR() []byte {
  921. bs, err := o.MarshalXDR()
  922. if err != nil {
  923. panic(err)
  924. }
  925. return bs
  926. }
  927. func (o Device) MarshalXDRInto(m *xdr.Marshaller) error {
  928. if l := len(o.ID); l > 32 {
  929. return xdr.ElementSizeExceeded("ID", l, 32)
  930. }
  931. m.MarshalBytes(o.ID)
  932. if l := len(o.Name); l > 64 {
  933. return xdr.ElementSizeExceeded("Name", l, 64)
  934. }
  935. m.MarshalString(o.Name)
  936. if l := len(o.Addresses); l > 64 {
  937. return xdr.ElementSizeExceeded("Addresses", l, 64)
  938. }
  939. m.MarshalUint32(uint32(len(o.Addresses)))
  940. for i := range o.Addresses {
  941. m.MarshalString(o.Addresses[i])
  942. }
  943. m.MarshalUint32(o.Compression)
  944. if l := len(o.CertName); l > 64 {
  945. return xdr.ElementSizeExceeded("CertName", l, 64)
  946. }
  947. m.MarshalString(o.CertName)
  948. m.MarshalUint64(uint64(o.MaxLocalVersion))
  949. m.MarshalUint32(o.Flags)
  950. if l := len(o.Options); l > 64 {
  951. return xdr.ElementSizeExceeded("Options", l, 64)
  952. }
  953. m.MarshalUint32(uint32(len(o.Options)))
  954. for i := range o.Options {
  955. if err := o.Options[i].MarshalXDRInto(m); err != nil {
  956. return err
  957. }
  958. }
  959. return m.Error
  960. }
  961. func (o *Device) UnmarshalXDR(bs []byte) error {
  962. u := &xdr.Unmarshaller{Data: bs}
  963. return o.UnmarshalXDRFrom(u)
  964. }
  965. func (o *Device) UnmarshalXDRFrom(u *xdr.Unmarshaller) error {
  966. o.ID = u.UnmarshalBytesMax(32)
  967. o.Name = u.UnmarshalStringMax(64)
  968. _AddressesSize := int(u.UnmarshalUint32())
  969. if _AddressesSize < 0 {
  970. return xdr.ElementSizeExceeded("Addresses", _AddressesSize, 64)
  971. } else if _AddressesSize == 0 {
  972. o.Addresses = nil
  973. } else {
  974. if _AddressesSize > 64 {
  975. return xdr.ElementSizeExceeded("Addresses", _AddressesSize, 64)
  976. }
  977. if _AddressesSize <= len(o.Addresses) {
  978. for i := _AddressesSize; i < len(o.Addresses); i++ {
  979. o.Addresses[i] = ""
  980. }
  981. o.Addresses = o.Addresses[:_AddressesSize]
  982. } else {
  983. o.Addresses = make([]string, _AddressesSize)
  984. }
  985. for i := range o.Addresses {
  986. o.Addresses[i] = u.UnmarshalStringMax(2083)
  987. }
  988. }
  989. o.Compression = u.UnmarshalUint32()
  990. o.CertName = u.UnmarshalStringMax(64)
  991. o.MaxLocalVersion = int64(u.UnmarshalUint64())
  992. o.Flags = u.UnmarshalUint32()
  993. _OptionsSize := int(u.UnmarshalUint32())
  994. if _OptionsSize < 0 {
  995. return xdr.ElementSizeExceeded("Options", _OptionsSize, 64)
  996. } else if _OptionsSize == 0 {
  997. o.Options = nil
  998. } else {
  999. if _OptionsSize > 64 {
  1000. return xdr.ElementSizeExceeded("Options", _OptionsSize, 64)
  1001. }
  1002. if _OptionsSize <= len(o.Options) {
  1003. o.Options = o.Options[:_OptionsSize]
  1004. } else {
  1005. o.Options = make([]Option, _OptionsSize)
  1006. }
  1007. for i := range o.Options {
  1008. (&o.Options[i]).UnmarshalXDRFrom(u)
  1009. }
  1010. }
  1011. return u.Error
  1012. }
  1013. /*
  1014. FileDownloadProgressUpdate Structure:
  1015. 0 1 2 3
  1016. 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
  1017. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1018. | Update Type |
  1019. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1020. / /
  1021. \ Name (length + padded data) \
  1022. / /
  1023. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1024. / /
  1025. \ Vector Structure \
  1026. / /
  1027. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1028. | Number of Block Indexes |
  1029. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1030. / /
  1031. | Block Indexes (n items) |
  1032. / /
  1033. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1034. struct FileDownloadProgressUpdate {
  1035. unsigned int UpdateType;
  1036. string Name<8192>;
  1037. Vector Version;
  1038. int BlockIndexes<1000000>;
  1039. }
  1040. */
  1041. func (o FileDownloadProgressUpdate) XDRSize() int {
  1042. return 4 +
  1043. 4 + len(o.Name) + xdr.Padding(len(o.Name)) +
  1044. o.Version.XDRSize() +
  1045. 4 + len(o.BlockIndexes)*4
  1046. }
  1047. func (o FileDownloadProgressUpdate) MarshalXDR() ([]byte, error) {
  1048. buf := make([]byte, o.XDRSize())
  1049. m := &xdr.Marshaller{Data: buf}
  1050. return buf, o.MarshalXDRInto(m)
  1051. }
  1052. func (o FileDownloadProgressUpdate) MustMarshalXDR() []byte {
  1053. bs, err := o.MarshalXDR()
  1054. if err != nil {
  1055. panic(err)
  1056. }
  1057. return bs
  1058. }
  1059. func (o FileDownloadProgressUpdate) MarshalXDRInto(m *xdr.Marshaller) error {
  1060. m.MarshalUint32(o.UpdateType)
  1061. if l := len(o.Name); l > 8192 {
  1062. return xdr.ElementSizeExceeded("Name", l, 8192)
  1063. }
  1064. m.MarshalString(o.Name)
  1065. if err := o.Version.MarshalXDRInto(m); err != nil {
  1066. return err
  1067. }
  1068. if l := len(o.BlockIndexes); l > 1000000 {
  1069. return xdr.ElementSizeExceeded("BlockIndexes", l, 1000000)
  1070. }
  1071. m.MarshalUint32(uint32(len(o.BlockIndexes)))
  1072. for i := range o.BlockIndexes {
  1073. m.MarshalUint32(uint32(o.BlockIndexes[i]))
  1074. }
  1075. return m.Error
  1076. }
  1077. func (o *FileDownloadProgressUpdate) UnmarshalXDR(bs []byte) error {
  1078. u := &xdr.Unmarshaller{Data: bs}
  1079. return o.UnmarshalXDRFrom(u)
  1080. }
  1081. func (o *FileDownloadProgressUpdate) UnmarshalXDRFrom(u *xdr.Unmarshaller) error {
  1082. o.UpdateType = u.UnmarshalUint32()
  1083. o.Name = u.UnmarshalStringMax(8192)
  1084. (&o.Version).UnmarshalXDRFrom(u)
  1085. _BlockIndexesSize := int(u.UnmarshalUint32())
  1086. if _BlockIndexesSize < 0 {
  1087. return xdr.ElementSizeExceeded("BlockIndexes", _BlockIndexesSize, 1000000)
  1088. } else if _BlockIndexesSize == 0 {
  1089. o.BlockIndexes = nil
  1090. } else {
  1091. if _BlockIndexesSize > 1000000 {
  1092. return xdr.ElementSizeExceeded("BlockIndexes", _BlockIndexesSize, 1000000)
  1093. }
  1094. if _BlockIndexesSize <= len(o.BlockIndexes) {
  1095. o.BlockIndexes = o.BlockIndexes[:_BlockIndexesSize]
  1096. } else {
  1097. o.BlockIndexes = make([]int32, _BlockIndexesSize)
  1098. }
  1099. for i := range o.BlockIndexes {
  1100. o.BlockIndexes[i] = int32(u.UnmarshalUint32())
  1101. }
  1102. }
  1103. return u.Error
  1104. }
  1105. /*
  1106. Option Structure:
  1107. 0 1 2 3
  1108. 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
  1109. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1110. / /
  1111. \ Key (length + padded data) \
  1112. / /
  1113. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1114. / /
  1115. \ Value (length + padded data) \
  1116. / /
  1117. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1118. struct Option {
  1119. string Key<64>;
  1120. string Value<1024>;
  1121. }
  1122. */
  1123. func (o Option) XDRSize() int {
  1124. return 4 + len(o.Key) + xdr.Padding(len(o.Key)) +
  1125. 4 + len(o.Value) + xdr.Padding(len(o.Value))
  1126. }
  1127. func (o Option) MarshalXDR() ([]byte, error) {
  1128. buf := make([]byte, o.XDRSize())
  1129. m := &xdr.Marshaller{Data: buf}
  1130. return buf, o.MarshalXDRInto(m)
  1131. }
  1132. func (o Option) MustMarshalXDR() []byte {
  1133. bs, err := o.MarshalXDR()
  1134. if err != nil {
  1135. panic(err)
  1136. }
  1137. return bs
  1138. }
  1139. func (o Option) MarshalXDRInto(m *xdr.Marshaller) error {
  1140. if l := len(o.Key); l > 64 {
  1141. return xdr.ElementSizeExceeded("Key", l, 64)
  1142. }
  1143. m.MarshalString(o.Key)
  1144. if l := len(o.Value); l > 1024 {
  1145. return xdr.ElementSizeExceeded("Value", l, 1024)
  1146. }
  1147. m.MarshalString(o.Value)
  1148. return m.Error
  1149. }
  1150. func (o *Option) UnmarshalXDR(bs []byte) error {
  1151. u := &xdr.Unmarshaller{Data: bs}
  1152. return o.UnmarshalXDRFrom(u)
  1153. }
  1154. func (o *Option) UnmarshalXDRFrom(u *xdr.Unmarshaller) error {
  1155. o.Key = u.UnmarshalStringMax(64)
  1156. o.Value = u.UnmarshalStringMax(1024)
  1157. return u.Error
  1158. }
  1159. /*
  1160. CloseMessage Structure:
  1161. 0 1 2 3
  1162. 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
  1163. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1164. / /
  1165. \ Reason (length + padded data) \
  1166. / /
  1167. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1168. | Code |
  1169. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1170. struct CloseMessage {
  1171. string Reason<1024>;
  1172. int Code;
  1173. }
  1174. */
  1175. func (o CloseMessage) XDRSize() int {
  1176. return 4 + len(o.Reason) + xdr.Padding(len(o.Reason)) + 4
  1177. }
  1178. func (o CloseMessage) MarshalXDR() ([]byte, error) {
  1179. buf := make([]byte, o.XDRSize())
  1180. m := &xdr.Marshaller{Data: buf}
  1181. return buf, o.MarshalXDRInto(m)
  1182. }
  1183. func (o CloseMessage) MustMarshalXDR() []byte {
  1184. bs, err := o.MarshalXDR()
  1185. if err != nil {
  1186. panic(err)
  1187. }
  1188. return bs
  1189. }
  1190. func (o CloseMessage) MarshalXDRInto(m *xdr.Marshaller) error {
  1191. if l := len(o.Reason); l > 1024 {
  1192. return xdr.ElementSizeExceeded("Reason", l, 1024)
  1193. }
  1194. m.MarshalString(o.Reason)
  1195. m.MarshalUint32(uint32(o.Code))
  1196. return m.Error
  1197. }
  1198. func (o *CloseMessage) UnmarshalXDR(bs []byte) error {
  1199. u := &xdr.Unmarshaller{Data: bs}
  1200. return o.UnmarshalXDRFrom(u)
  1201. }
  1202. func (o *CloseMessage) UnmarshalXDRFrom(u *xdr.Unmarshaller) error {
  1203. o.Reason = u.UnmarshalStringMax(1024)
  1204. o.Code = int32(u.UnmarshalUint32())
  1205. return u.Error
  1206. }
  1207. /*
  1208. EmptyMessage Structure:
  1209. (contains no fields)
  1210. struct EmptyMessage {
  1211. }
  1212. */
  1213. func (o EmptyMessage) XDRSize() int {
  1214. return 0
  1215. }
  1216. func (o EmptyMessage) MarshalXDR() ([]byte, error) {
  1217. return nil, nil
  1218. }
  1219. func (o EmptyMessage) MustMarshalXDR() []byte {
  1220. return nil
  1221. }
  1222. func (o EmptyMessage) MarshalXDRInto(m *xdr.Marshaller) error {
  1223. return nil
  1224. }
  1225. func (o *EmptyMessage) UnmarshalXDR(bs []byte) error {
  1226. return nil
  1227. }
  1228. func (o *EmptyMessage) UnmarshalXDRFrom(u *xdr.Unmarshaller) error {
  1229. return nil
  1230. }