packets_xdr.go 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472
  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. header 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. | magic |
  14. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  15. | message Type |
  16. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  17. | message Length |
  18. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  19. struct header {
  20. unsigned int magic;
  21. int messageType;
  22. int messageLength;
  23. }
  24. */
  25. func (o header) XDRSize() int {
  26. return 4 + 4 + 4
  27. }
  28. func (o header) MarshalXDR() ([]byte, error) {
  29. buf := make([]byte, o.XDRSize())
  30. m := &xdr.Marshaller{Data: buf}
  31. return buf, o.MarshalXDRInto(m)
  32. }
  33. func (o header) MustMarshalXDR() []byte {
  34. bs, err := o.MarshalXDR()
  35. if err != nil {
  36. panic(err)
  37. }
  38. return bs
  39. }
  40. func (o header) MarshalXDRInto(m *xdr.Marshaller) error {
  41. m.MarshalUint32(o.magic)
  42. m.MarshalUint32(uint32(o.messageType))
  43. m.MarshalUint32(uint32(o.messageLength))
  44. return m.Error
  45. }
  46. func (o *header) UnmarshalXDR(bs []byte) error {
  47. u := &xdr.Unmarshaller{Data: bs}
  48. return o.UnmarshalXDRFrom(u)
  49. }
  50. func (o *header) UnmarshalXDRFrom(u *xdr.Unmarshaller) error {
  51. o.magic = u.UnmarshalUint32()
  52. o.messageType = int32(u.UnmarshalUint32())
  53. o.messageLength = int32(u.UnmarshalUint32())
  54. return u.Error
  55. }
  56. /*
  57. Ping Structure:
  58. (contains no fields)
  59. struct Ping {
  60. }
  61. */
  62. func (o Ping) XDRSize() int {
  63. return 0
  64. }
  65. func (o Ping) MarshalXDR() ([]byte, error) {
  66. return nil, nil
  67. }
  68. func (o Ping) MustMarshalXDR() []byte {
  69. return nil
  70. }
  71. func (o Ping) MarshalXDRInto(m *xdr.Marshaller) error {
  72. return nil
  73. }
  74. func (o *Ping) UnmarshalXDR(bs []byte) error {
  75. return nil
  76. }
  77. func (o *Ping) UnmarshalXDRFrom(u *xdr.Unmarshaller) error {
  78. return nil
  79. }
  80. /*
  81. Pong Structure:
  82. (contains no fields)
  83. struct Pong {
  84. }
  85. */
  86. func (o Pong) XDRSize() int {
  87. return 0
  88. }
  89. func (o Pong) MarshalXDR() ([]byte, error) {
  90. return nil, nil
  91. }
  92. func (o Pong) MustMarshalXDR() []byte {
  93. return nil
  94. }
  95. func (o Pong) MarshalXDRInto(m *xdr.Marshaller) error {
  96. return nil
  97. }
  98. func (o *Pong) UnmarshalXDR(bs []byte) error {
  99. return nil
  100. }
  101. func (o *Pong) UnmarshalXDRFrom(u *xdr.Unmarshaller) error {
  102. return nil
  103. }
  104. /*
  105. RelayFull Structure:
  106. (contains no fields)
  107. struct RelayFull {
  108. }
  109. */
  110. func (o RelayFull) XDRSize() int {
  111. return 0
  112. }
  113. func (o RelayFull) MarshalXDR() ([]byte, error) {
  114. return nil, nil
  115. }
  116. func (o RelayFull) MustMarshalXDR() []byte {
  117. return nil
  118. }
  119. func (o RelayFull) MarshalXDRInto(m *xdr.Marshaller) error {
  120. return nil
  121. }
  122. func (o *RelayFull) UnmarshalXDR(bs []byte) error {
  123. return nil
  124. }
  125. func (o *RelayFull) UnmarshalXDRFrom(u *xdr.Unmarshaller) error {
  126. return nil
  127. }
  128. /*
  129. JoinRelayRequest Structure:
  130. 0 1 2 3
  131. 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
  132. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  133. / /
  134. \ Token (length + padded data) \
  135. / /
  136. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  137. struct JoinRelayRequest {
  138. string Token<>;
  139. }
  140. */
  141. func (o JoinRelayRequest) XDRSize() int {
  142. return 4 + len(o.Token) + xdr.Padding(len(o.Token))
  143. }
  144. func (o JoinRelayRequest) MarshalXDR() ([]byte, error) {
  145. buf := make([]byte, o.XDRSize())
  146. m := &xdr.Marshaller{Data: buf}
  147. return buf, o.MarshalXDRInto(m)
  148. }
  149. func (o JoinRelayRequest) MustMarshalXDR() []byte {
  150. bs, err := o.MarshalXDR()
  151. if err != nil {
  152. panic(err)
  153. }
  154. return bs
  155. }
  156. func (o JoinRelayRequest) MarshalXDRInto(m *xdr.Marshaller) error {
  157. m.MarshalString(o.Token)
  158. return m.Error
  159. }
  160. func (o *JoinRelayRequest) UnmarshalXDR(bs []byte) error {
  161. u := &xdr.Unmarshaller{Data: bs}
  162. return o.UnmarshalXDRFrom(u)
  163. }
  164. func (o *JoinRelayRequest) UnmarshalXDRFrom(u *xdr.Unmarshaller) error {
  165. o.Token = u.UnmarshalString()
  166. return u.Error
  167. }
  168. /*
  169. JoinSessionRequest Structure:
  170. 0 1 2 3
  171. 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
  172. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  173. / /
  174. \ Key (length + padded data) \
  175. / /
  176. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  177. struct JoinSessionRequest {
  178. opaque Key<32>;
  179. }
  180. */
  181. func (o JoinSessionRequest) XDRSize() int {
  182. return 4 + len(o.Key) + xdr.Padding(len(o.Key))
  183. }
  184. func (o JoinSessionRequest) MarshalXDR() ([]byte, error) {
  185. buf := make([]byte, o.XDRSize())
  186. m := &xdr.Marshaller{Data: buf}
  187. return buf, o.MarshalXDRInto(m)
  188. }
  189. func (o JoinSessionRequest) MustMarshalXDR() []byte {
  190. bs, err := o.MarshalXDR()
  191. if err != nil {
  192. panic(err)
  193. }
  194. return bs
  195. }
  196. func (o JoinSessionRequest) MarshalXDRInto(m *xdr.Marshaller) error {
  197. if l := len(o.Key); l > 32 {
  198. return xdr.ElementSizeExceeded("Key", l, 32)
  199. }
  200. m.MarshalBytes(o.Key)
  201. return m.Error
  202. }
  203. func (o *JoinSessionRequest) UnmarshalXDR(bs []byte) error {
  204. u := &xdr.Unmarshaller{Data: bs}
  205. return o.UnmarshalXDRFrom(u)
  206. }
  207. func (o *JoinSessionRequest) UnmarshalXDRFrom(u *xdr.Unmarshaller) error {
  208. o.Key = u.UnmarshalBytesMax(32)
  209. return u.Error
  210. }
  211. /*
  212. Response Structure:
  213. 0 1 2 3
  214. 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
  215. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  216. | Code |
  217. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  218. / /
  219. \ Message (length + padded data) \
  220. / /
  221. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  222. struct Response {
  223. int Code;
  224. string Message<>;
  225. }
  226. */
  227. func (o Response) XDRSize() int {
  228. return 4 +
  229. 4 + len(o.Message) + xdr.Padding(len(o.Message))
  230. }
  231. func (o Response) MarshalXDR() ([]byte, error) {
  232. buf := make([]byte, o.XDRSize())
  233. m := &xdr.Marshaller{Data: buf}
  234. return buf, o.MarshalXDRInto(m)
  235. }
  236. func (o Response) MustMarshalXDR() []byte {
  237. bs, err := o.MarshalXDR()
  238. if err != nil {
  239. panic(err)
  240. }
  241. return bs
  242. }
  243. func (o Response) MarshalXDRInto(m *xdr.Marshaller) error {
  244. m.MarshalUint32(uint32(o.Code))
  245. m.MarshalString(o.Message)
  246. return m.Error
  247. }
  248. func (o *Response) UnmarshalXDR(bs []byte) error {
  249. u := &xdr.Unmarshaller{Data: bs}
  250. return o.UnmarshalXDRFrom(u)
  251. }
  252. func (o *Response) UnmarshalXDRFrom(u *xdr.Unmarshaller) error {
  253. o.Code = int32(u.UnmarshalUint32())
  254. o.Message = u.UnmarshalString()
  255. return u.Error
  256. }
  257. /*
  258. ConnectRequest Structure:
  259. 0 1 2 3
  260. 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
  261. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  262. / /
  263. \ ID (length + padded data) \
  264. / /
  265. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  266. struct ConnectRequest {
  267. opaque ID<32>;
  268. }
  269. */
  270. func (o ConnectRequest) XDRSize() int {
  271. return 4 + len(o.ID) + xdr.Padding(len(o.ID))
  272. }
  273. func (o ConnectRequest) MarshalXDR() ([]byte, error) {
  274. buf := make([]byte, o.XDRSize())
  275. m := &xdr.Marshaller{Data: buf}
  276. return buf, o.MarshalXDRInto(m)
  277. }
  278. func (o ConnectRequest) MustMarshalXDR() []byte {
  279. bs, err := o.MarshalXDR()
  280. if err != nil {
  281. panic(err)
  282. }
  283. return bs
  284. }
  285. func (o ConnectRequest) MarshalXDRInto(m *xdr.Marshaller) error {
  286. if l := len(o.ID); l > 32 {
  287. return xdr.ElementSizeExceeded("ID", l, 32)
  288. }
  289. m.MarshalBytes(o.ID)
  290. return m.Error
  291. }
  292. func (o *ConnectRequest) UnmarshalXDR(bs []byte) error {
  293. u := &xdr.Unmarshaller{Data: bs}
  294. return o.UnmarshalXDRFrom(u)
  295. }
  296. func (o *ConnectRequest) UnmarshalXDRFrom(u *xdr.Unmarshaller) error {
  297. o.ID = u.UnmarshalBytesMax(32)
  298. return u.Error
  299. }
  300. /*
  301. SessionInvitation Structure:
  302. 0 1 2 3
  303. 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
  304. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  305. / /
  306. \ From (length + padded data) \
  307. / /
  308. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  309. / /
  310. \ Key (length + padded data) \
  311. / /
  312. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  313. / /
  314. \ Address (length + padded data) \
  315. / /
  316. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  317. | 16 zero bits | Port |
  318. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  319. | Server Socket (V=0 or 1) |V|
  320. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  321. struct SessionInvitation {
  322. opaque From<32>;
  323. opaque Key<32>;
  324. opaque Address<32>;
  325. unsigned int Port;
  326. bool ServerSocket;
  327. }
  328. */
  329. func (o SessionInvitation) XDRSize() int {
  330. return 4 + len(o.From) + xdr.Padding(len(o.From)) +
  331. 4 + len(o.Key) + xdr.Padding(len(o.Key)) +
  332. 4 + len(o.Address) + xdr.Padding(len(o.Address)) + 4 + 4
  333. }
  334. func (o SessionInvitation) MarshalXDR() ([]byte, error) {
  335. buf := make([]byte, o.XDRSize())
  336. m := &xdr.Marshaller{Data: buf}
  337. return buf, o.MarshalXDRInto(m)
  338. }
  339. func (o SessionInvitation) MustMarshalXDR() []byte {
  340. bs, err := o.MarshalXDR()
  341. if err != nil {
  342. panic(err)
  343. }
  344. return bs
  345. }
  346. func (o SessionInvitation) MarshalXDRInto(m *xdr.Marshaller) error {
  347. if l := len(o.From); l > 32 {
  348. return xdr.ElementSizeExceeded("From", l, 32)
  349. }
  350. m.MarshalBytes(o.From)
  351. if l := len(o.Key); l > 32 {
  352. return xdr.ElementSizeExceeded("Key", l, 32)
  353. }
  354. m.MarshalBytes(o.Key)
  355. if l := len(o.Address); l > 32 {
  356. return xdr.ElementSizeExceeded("Address", l, 32)
  357. }
  358. m.MarshalBytes(o.Address)
  359. m.MarshalUint16(o.Port)
  360. m.MarshalBool(o.ServerSocket)
  361. return m.Error
  362. }
  363. func (o *SessionInvitation) UnmarshalXDR(bs []byte) error {
  364. u := &xdr.Unmarshaller{Data: bs}
  365. return o.UnmarshalXDRFrom(u)
  366. }
  367. func (o *SessionInvitation) UnmarshalXDRFrom(u *xdr.Unmarshaller) error {
  368. o.From = u.UnmarshalBytesMax(32)
  369. o.Key = u.UnmarshalBytesMax(32)
  370. o.Address = u.UnmarshalBytesMax(32)
  371. o.Port = u.UnmarshalUint16()
  372. o.ServerSocket = u.UnmarshalBool()
  373. return u.Error
  374. }