forked from oza/zkproxy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
zookeeper.jute.c
1085 lines (1083 loc) · 41.6 KB
/
zookeeper.jute.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <stdlib.h>
#include "zookeeper.jute.h"
int serialize_Id(struct oarchive *out, const char *tag, struct Id *v){
int rc;
rc = out->start_record(out, tag);
rc = rc ? : out->serialize_String(out, "scheme", &v->scheme);
rc = rc ? : out->serialize_String(out, "id", &v->id);
rc = rc ? : out->end_record(out, tag);
return rc;
}
int deserialize_Id(struct iarchive *in, const char *tag, struct Id*v){
int rc;
rc = in->start_record(in, tag);
rc = rc ? : in->deserialize_String(in, "scheme", &v->scheme);
rc = rc ? : in->deserialize_String(in, "id", &v->id);
rc = rc ? : in->end_record(in, tag);
return rc;
}
void deallocate_Id(struct Id*v){
deallocate_String(&v->scheme);
deallocate_String(&v->id);
}
int serialize_ACL(struct oarchive *out, const char *tag, struct ACL *v){
int rc;
rc = out->start_record(out, tag);
rc = rc ? : out->serialize_Int(out, "perms", &v->perms);
rc = rc ? : serialize_Id(out, "id", &v->id);
rc = rc ? : out->end_record(out, tag);
return rc;
}
int deserialize_ACL(struct iarchive *in, const char *tag, struct ACL*v){
int rc;
rc = in->start_record(in, tag);
rc = rc ? : in->deserialize_Int(in, "perms", &v->perms);
rc = rc ? : deserialize_Id(in, "id", &v->id);
rc = rc ? : in->end_record(in, tag);
return rc;
}
void deallocate_ACL(struct ACL*v){
deallocate_Id(&v->id);
}
int serialize_Stat(struct oarchive *out, const char *tag, struct Stat *v){
int rc;
rc = out->start_record(out, tag);
rc = rc ? : out->serialize_Long(out, "czxid", &v->czxid);
rc = rc ? : out->serialize_Long(out, "mzxid", &v->mzxid);
rc = rc ? : out->serialize_Long(out, "ctime", &v->ctime);
rc = rc ? : out->serialize_Long(out, "mtime", &v->mtime);
rc = rc ? : out->serialize_Int(out, "version", &v->version);
rc = rc ? : out->serialize_Int(out, "cversion", &v->cversion);
rc = rc ? : out->serialize_Int(out, "aversion", &v->aversion);
rc = rc ? : out->serialize_Long(out, "ephemeralOwner", &v->ephemeralOwner);
rc = rc ? : out->serialize_Int(out, "dataLength", &v->dataLength);
rc = rc ? : out->serialize_Int(out, "numChildren", &v->numChildren);
rc = rc ? : out->serialize_Long(out, "pzxid", &v->pzxid);
rc = rc ? : out->end_record(out, tag);
return rc;
}
int deserialize_Stat(struct iarchive *in, const char *tag, struct Stat*v){
int rc;
rc = in->start_record(in, tag);
rc = rc ? : in->deserialize_Long(in, "czxid", &v->czxid);
rc = rc ? : in->deserialize_Long(in, "mzxid", &v->mzxid);
rc = rc ? : in->deserialize_Long(in, "ctime", &v->ctime);
rc = rc ? : in->deserialize_Long(in, "mtime", &v->mtime);
rc = rc ? : in->deserialize_Int(in, "version", &v->version);
rc = rc ? : in->deserialize_Int(in, "cversion", &v->cversion);
rc = rc ? : in->deserialize_Int(in, "aversion", &v->aversion);
rc = rc ? : in->deserialize_Long(in, "ephemeralOwner", &v->ephemeralOwner);
rc = rc ? : in->deserialize_Int(in, "dataLength", &v->dataLength);
rc = rc ? : in->deserialize_Int(in, "numChildren", &v->numChildren);
rc = rc ? : in->deserialize_Long(in, "pzxid", &v->pzxid);
rc = rc ? : in->end_record(in, tag);
return rc;
}
void deallocate_Stat(struct Stat*v){
}
int serialize_StatPersisted(struct oarchive *out, const char *tag, struct StatPersisted *v){
int rc;
rc = out->start_record(out, tag);
rc = rc ? : out->serialize_Long(out, "czxid", &v->czxid);
rc = rc ? : out->serialize_Long(out, "mzxid", &v->mzxid);
rc = rc ? : out->serialize_Long(out, "ctime", &v->ctime);
rc = rc ? : out->serialize_Long(out, "mtime", &v->mtime);
rc = rc ? : out->serialize_Int(out, "version", &v->version);
rc = rc ? : out->serialize_Int(out, "cversion", &v->cversion);
rc = rc ? : out->serialize_Int(out, "aversion", &v->aversion);
rc = rc ? : out->serialize_Long(out, "ephemeralOwner", &v->ephemeralOwner);
rc = rc ? : out->serialize_Long(out, "pzxid", &v->pzxid);
rc = rc ? : out->end_record(out, tag);
return rc;
}
int deserialize_StatPersisted(struct iarchive *in, const char *tag, struct StatPersisted*v){
int rc;
rc = in->start_record(in, tag);
rc = rc ? : in->deserialize_Long(in, "czxid", &v->czxid);
rc = rc ? : in->deserialize_Long(in, "mzxid", &v->mzxid);
rc = rc ? : in->deserialize_Long(in, "ctime", &v->ctime);
rc = rc ? : in->deserialize_Long(in, "mtime", &v->mtime);
rc = rc ? : in->deserialize_Int(in, "version", &v->version);
rc = rc ? : in->deserialize_Int(in, "cversion", &v->cversion);
rc = rc ? : in->deserialize_Int(in, "aversion", &v->aversion);
rc = rc ? : in->deserialize_Long(in, "ephemeralOwner", &v->ephemeralOwner);
rc = rc ? : in->deserialize_Long(in, "pzxid", &v->pzxid);
rc = rc ? : in->end_record(in, tag);
return rc;
}
void deallocate_StatPersisted(struct StatPersisted*v){
}
int serialize_StatPersistedV1(struct oarchive *out, const char *tag, struct StatPersistedV1 *v){
int rc;
rc = out->start_record(out, tag);
rc = rc ? : out->serialize_Long(out, "czxid", &v->czxid);
rc = rc ? : out->serialize_Long(out, "mzxid", &v->mzxid);
rc = rc ? : out->serialize_Long(out, "ctime", &v->ctime);
rc = rc ? : out->serialize_Long(out, "mtime", &v->mtime);
rc = rc ? : out->serialize_Int(out, "version", &v->version);
rc = rc ? : out->serialize_Int(out, "cversion", &v->cversion);
rc = rc ? : out->serialize_Int(out, "aversion", &v->aversion);
rc = rc ? : out->serialize_Long(out, "ephemeralOwner", &v->ephemeralOwner);
rc = rc ? : out->end_record(out, tag);
return rc;
}
int deserialize_StatPersistedV1(struct iarchive *in, const char *tag, struct StatPersistedV1*v){
int rc;
rc = in->start_record(in, tag);
rc = rc ? : in->deserialize_Long(in, "czxid", &v->czxid);
rc = rc ? : in->deserialize_Long(in, "mzxid", &v->mzxid);
rc = rc ? : in->deserialize_Long(in, "ctime", &v->ctime);
rc = rc ? : in->deserialize_Long(in, "mtime", &v->mtime);
rc = rc ? : in->deserialize_Int(in, "version", &v->version);
rc = rc ? : in->deserialize_Int(in, "cversion", &v->cversion);
rc = rc ? : in->deserialize_Int(in, "aversion", &v->aversion);
rc = rc ? : in->deserialize_Long(in, "ephemeralOwner", &v->ephemeralOwner);
rc = rc ? : in->end_record(in, tag);
return rc;
}
void deallocate_StatPersistedV1(struct StatPersistedV1*v){
}
int serialize_op_result_t(struct oarchive *out, const char *tag, struct op_result_t *v){
int rc;
rc = out->start_record(out, tag);
rc = rc ? : out->serialize_Int(out, "rc", &v->rc);
rc = rc ? : out->serialize_Int(out, "op", &v->op);
rc = rc ? : out->serialize_Buffer(out, "response", &v->response);
rc = rc ? : out->end_record(out, tag);
return rc;
}
int deserialize_op_result_t(struct iarchive *in, const char *tag, struct op_result_t*v){
int rc;
rc = in->start_record(in, tag);
rc = rc ? : in->deserialize_Int(in, "rc", &v->rc);
rc = rc ? : in->deserialize_Int(in, "op", &v->op);
rc = rc ? : in->deserialize_Buffer(in, "response", &v->response);
rc = rc ? : in->end_record(in, tag);
return rc;
}
void deallocate_op_result_t(struct op_result_t*v){
deallocate_Buffer(&v->response);
}
int serialize_ConnectRequest(struct oarchive *out, const char *tag, struct ConnectRequest *v){
int rc;
rc = out->start_record(out, tag);
rc = rc ? : out->serialize_Int(out, "protocolVersion", &v->protocolVersion);
rc = rc ? : out->serialize_Long(out, "lastZxidSeen", &v->lastZxidSeen);
rc = rc ? : out->serialize_Int(out, "timeOut", &v->timeOut);
rc = rc ? : out->serialize_Long(out, "sessionId", &v->sessionId);
rc = rc ? : out->serialize_Buffer(out, "passwd", &v->passwd);
rc = rc ? : out->end_record(out, tag);
return rc;
}
int deserialize_ConnectRequest(struct iarchive *in, const char *tag, struct ConnectRequest*v){
int rc;
rc = in->start_record(in, tag);
rc = rc ? : in->deserialize_Int(in, "protocolVersion", &v->protocolVersion);
rc = rc ? : in->deserialize_Long(in, "lastZxidSeen", &v->lastZxidSeen);
rc = rc ? : in->deserialize_Int(in, "timeOut", &v->timeOut);
rc = rc ? : in->deserialize_Long(in, "sessionId", &v->sessionId);
rc = rc ? : in->deserialize_Buffer(in, "passwd", &v->passwd);
rc = rc ? : in->end_record(in, tag);
return rc;
}
void deallocate_ConnectRequest(struct ConnectRequest*v){
deallocate_Buffer(&v->passwd);
}
int serialize_ConnectResponse(struct oarchive *out, const char *tag, struct ConnectResponse *v){
int rc;
rc = out->start_record(out, tag);
rc = rc ? : out->serialize_Int(out, "protocolVersion", &v->protocolVersion);
rc = rc ? : out->serialize_Int(out, "timeOut", &v->timeOut);
rc = rc ? : out->serialize_Long(out, "sessionId", &v->sessionId);
rc = rc ? : out->serialize_Buffer(out, "passwd", &v->passwd);
rc = rc ? : out->end_record(out, tag);
return rc;
}
int deserialize_ConnectResponse(struct iarchive *in, const char *tag, struct ConnectResponse*v){
int rc;
rc = in->start_record(in, tag);
rc = rc ? : in->deserialize_Int(in, "protocolVersion", &v->protocolVersion);
rc = rc ? : in->deserialize_Int(in, "timeOut", &v->timeOut);
rc = rc ? : in->deserialize_Long(in, "sessionId", &v->sessionId);
rc = rc ? : in->deserialize_Buffer(in, "passwd", &v->passwd);
rc = rc ? : in->end_record(in, tag);
return rc;
}
void deallocate_ConnectResponse(struct ConnectResponse*v){
deallocate_Buffer(&v->passwd);
}
int allocate_String_vector(struct String_vector *v, int32_t len) {
if (!len) {
v->count = 0;
v->data = 0;
} else {
v->count = len;
v->data = calloc(sizeof(*v->data), len);
}
return 0;
}
int deallocate_String_vector(struct String_vector *v) {
if (v->data) {
int32_t i;
for(i=0;i<v->count; i++) {
deallocate_String(&v->data[i]);
}
free(v->data);
v->data = 0;
}
return 0;
}
int serialize_String_vector(struct oarchive *out, const char *tag, struct String_vector *v)
{
int32_t count = v->count;
int rc = 0;
int32_t i;
rc = out->start_vector(out, tag, &count);
for(i=0;i<v->count;i++) {
rc = rc ? : out->serialize_String(out, "data", &v->data[i]);
}
rc = rc ? : out->end_vector(out, tag);
return rc;
}
int deserialize_String_vector(struct iarchive *in, const char *tag, struct String_vector *v)
{
int rc = 0;
int32_t i;
rc = in->start_vector(in, tag, &v->count);
v->data = calloc(v->count, sizeof(*v->data));
for(i=0;i<v->count;i++) {
rc = rc ? : in->deserialize_String(in, "value", &v->data[i]);
}
rc = in->end_vector(in, tag);
return rc;
}
int serialize_SetWatches(struct oarchive *out, const char *tag, struct SetWatches *v){
int rc;
rc = out->start_record(out, tag);
rc = rc ? : out->serialize_Long(out, "relativeZxid", &v->relativeZxid);
rc = rc ? : serialize_String_vector(out, "dataWatches", &v->dataWatches);
rc = rc ? : serialize_String_vector(out, "existWatches", &v->existWatches);
rc = rc ? : serialize_String_vector(out, "childWatches", &v->childWatches);
rc = rc ? : out->end_record(out, tag);
return rc;
}
int deserialize_SetWatches(struct iarchive *in, const char *tag, struct SetWatches*v){
int rc;
rc = in->start_record(in, tag);
rc = rc ? : in->deserialize_Long(in, "relativeZxid", &v->relativeZxid);
rc = rc ? : deserialize_String_vector(in, "dataWatches", &v->dataWatches);
rc = rc ? : deserialize_String_vector(in, "existWatches", &v->existWatches);
rc = rc ? : deserialize_String_vector(in, "childWatches", &v->childWatches);
rc = rc ? : in->end_record(in, tag);
return rc;
}
void deallocate_SetWatches(struct SetWatches*v){
deallocate_String_vector(&v->dataWatches);
deallocate_String_vector(&v->existWatches);
deallocate_String_vector(&v->childWatches);
}
int serialize_RequestHeader(struct oarchive *out, const char *tag, struct RequestHeader *v){
int rc;
rc = out->start_record(out, tag);
rc = rc ? : out->serialize_Int(out, "xid", &v->xid);
rc = rc ? : out->serialize_Int(out, "type", &v->type);
rc = rc ? : out->end_record(out, tag);
return rc;
}
int deserialize_RequestHeader(struct iarchive *in, const char *tag, struct RequestHeader*v){
int rc;
rc = in->start_record(in, tag);
rc = rc ? : in->deserialize_Int(in, "xid", &v->xid);
rc = rc ? : in->deserialize_Int(in, "type", &v->type);
rc = rc ? : in->end_record(in, tag);
return rc;
}
void deallocate_RequestHeader(struct RequestHeader*v){
}
int serialize_AuthPacket(struct oarchive *out, const char *tag, struct AuthPacket *v){
int rc;
rc = out->start_record(out, tag);
rc = rc ? : out->serialize_Int(out, "type", &v->type);
rc = rc ? : out->serialize_String(out, "scheme", &v->scheme);
rc = rc ? : out->serialize_Buffer(out, "auth", &v->auth);
rc = rc ? : out->end_record(out, tag);
return rc;
}
int deserialize_AuthPacket(struct iarchive *in, const char *tag, struct AuthPacket*v){
int rc;
rc = in->start_record(in, tag);
rc = rc ? : in->deserialize_Int(in, "type", &v->type);
rc = rc ? : in->deserialize_String(in, "scheme", &v->scheme);
rc = rc ? : in->deserialize_Buffer(in, "auth", &v->auth);
rc = rc ? : in->end_record(in, tag);
return rc;
}
void deallocate_AuthPacket(struct AuthPacket*v){
deallocate_String(&v->scheme);
deallocate_Buffer(&v->auth);
}
int serialize_ReplyHeader(struct oarchive *out, const char *tag, struct ReplyHeader *v){
int rc;
rc = out->start_record(out, tag);
rc = rc ? : out->serialize_Int(out, "xid", &v->xid);
rc = rc ? : out->serialize_Long(out, "zxid", &v->zxid);
rc = rc ? : out->serialize_Int(out, "err", &v->err);
rc = rc ? : out->end_record(out, tag);
return rc;
}
int deserialize_ReplyHeader(struct iarchive *in, const char *tag, struct ReplyHeader*v){
int rc;
rc = in->start_record(in, tag);
rc = rc ? : in->deserialize_Int(in, "xid", &v->xid);
rc = rc ? : in->deserialize_Long(in, "zxid", &v->zxid);
rc = rc ? : in->deserialize_Int(in, "err", &v->err);
rc = rc ? : in->end_record(in, tag);
return rc;
}
void deallocate_ReplyHeader(struct ReplyHeader*v){
}
int serialize_GetDataRequest(struct oarchive *out, const char *tag, struct GetDataRequest *v){
int rc;
rc = out->start_record(out, tag);
rc = rc ? : out->serialize_String(out, "path", &v->path);
rc = rc ? : out->serialize_Bool(out, "watch", &v->watch);
rc = rc ? : out->end_record(out, tag);
return rc;
}
int deserialize_GetDataRequest(struct iarchive *in, const char *tag, struct GetDataRequest*v){
int rc;
rc = in->start_record(in, tag);
rc = rc ? : in->deserialize_String(in, "path", &v->path);
rc = rc ? : in->deserialize_Bool(in, "watch", &v->watch);
rc = rc ? : in->end_record(in, tag);
return rc;
}
void deallocate_GetDataRequest(struct GetDataRequest*v){
deallocate_String(&v->path);
}
int serialize_SetDataRequest(struct oarchive *out, const char *tag, struct SetDataRequest *v){
int rc;
rc = out->start_record(out, tag);
rc = rc ? : out->serialize_String(out, "path", &v->path);
rc = rc ? : out->serialize_Buffer(out, "data", &v->data);
rc = rc ? : out->serialize_Int(out, "version", &v->version);
rc = rc ? : out->end_record(out, tag);
return rc;
}
int deserialize_SetDataRequest(struct iarchive *in, const char *tag, struct SetDataRequest*v){
int rc;
rc = in->start_record(in, tag);
rc = rc ? : in->deserialize_String(in, "path", &v->path);
rc = rc ? : in->deserialize_Buffer(in, "data", &v->data);
rc = rc ? : in->deserialize_Int(in, "version", &v->version);
rc = rc ? : in->end_record(in, tag);
return rc;
}
void deallocate_SetDataRequest(struct SetDataRequest*v){
deallocate_String(&v->path);
deallocate_Buffer(&v->data);
}
int serialize_SetDataResponse(struct oarchive *out, const char *tag, struct SetDataResponse *v){
int rc;
rc = out->start_record(out, tag);
rc = rc ? : serialize_Stat(out, "stat", &v->stat);
rc = rc ? : out->end_record(out, tag);
return rc;
}
int deserialize_SetDataResponse(struct iarchive *in, const char *tag, struct SetDataResponse*v){
int rc;
rc = in->start_record(in, tag);
rc = rc ? : deserialize_Stat(in, "stat", &v->stat);
rc = rc ? : in->end_record(in, tag);
return rc;
}
void deallocate_SetDataResponse(struct SetDataResponse*v){
deallocate_Stat(&v->stat);
}
int allocate_ACL_vector(struct ACL_vector *v, int32_t len) {
if (!len) {
v->count = 0;
v->data = 0;
} else {
v->count = len;
v->data = calloc(sizeof(*v->data), len);
}
return 0;
}
int deallocate_ACL_vector(struct ACL_vector *v) {
if (v->data) {
int32_t i;
for(i=0;i<v->count; i++) {
deallocate_ACL(&v->data[i]);
}
free(v->data);
v->data = 0;
}
return 0;
}
int serialize_ACL_vector(struct oarchive *out, const char *tag, struct ACL_vector *v)
{
int32_t count = v->count;
int rc = 0;
int32_t i;
rc = out->start_vector(out, tag, &count);
for(i=0;i<v->count;i++) {
rc = rc ? : serialize_ACL(out, "data", &v->data[i]);
}
rc = rc ? : out->end_vector(out, tag);
return rc;
}
int deserialize_ACL_vector(struct iarchive *in, const char *tag, struct ACL_vector *v)
{
int rc = 0;
int32_t i;
rc = in->start_vector(in, tag, &v->count);
v->data = calloc(v->count, sizeof(*v->data));
for(i=0;i<v->count;i++) {
rc = rc ? : deserialize_ACL(in, "value", &v->data[i]);
}
rc = in->end_vector(in, tag);
return rc;
}
int serialize_CreateRequest(struct oarchive *out, const char *tag, struct CreateRequest *v){
int rc;
rc = out->start_record(out, tag);
rc = rc ? : out->serialize_String(out, "path", &v->path);
rc = rc ? : out->serialize_Buffer(out, "data", &v->data);
rc = rc ? : serialize_ACL_vector(out, "acl", &v->acl);
rc = rc ? : out->serialize_Int(out, "flags", &v->flags);
rc = rc ? : out->end_record(out, tag);
return rc;
}
int deserialize_CreateRequest(struct iarchive *in, const char *tag, struct CreateRequest*v){
int rc;
rc = in->start_record(in, tag);
rc = rc ? : in->deserialize_String(in, "path", &v->path);
rc = rc ? : in->deserialize_Buffer(in, "data", &v->data);
rc = rc ? : deserialize_ACL_vector(in, "acl", &v->acl);
rc = rc ? : in->deserialize_Int(in, "flags", &v->flags);
rc = rc ? : in->end_record(in, tag);
return rc;
}
void deallocate_CreateRequest(struct CreateRequest*v){
deallocate_String(&v->path);
deallocate_Buffer(&v->data);
deallocate_ACL_vector(&v->acl);
}
int serialize_DeleteRequest(struct oarchive *out, const char *tag, struct DeleteRequest *v){
int rc;
rc = out->start_record(out, tag);
rc = rc ? : out->serialize_String(out, "path", &v->path);
rc = rc ? : out->serialize_Int(out, "version", &v->version);
rc = rc ? : out->end_record(out, tag);
return rc;
}
int deserialize_DeleteRequest(struct iarchive *in, const char *tag, struct DeleteRequest*v){
int rc;
rc = in->start_record(in, tag);
rc = rc ? : in->deserialize_String(in, "path", &v->path);
rc = rc ? : in->deserialize_Int(in, "version", &v->version);
rc = rc ? : in->end_record(in, tag);
return rc;
}
void deallocate_DeleteRequest(struct DeleteRequest*v){
deallocate_String(&v->path);
}
int serialize_GetChildrenRequest(struct oarchive *out, const char *tag, struct GetChildrenRequest *v){
int rc;
rc = out->start_record(out, tag);
rc = rc ? : out->serialize_String(out, "path", &v->path);
rc = rc ? : out->serialize_Bool(out, "watch", &v->watch);
rc = rc ? : out->end_record(out, tag);
return rc;
}
int deserialize_GetChildrenRequest(struct iarchive *in, const char *tag, struct GetChildrenRequest*v){
int rc;
rc = in->start_record(in, tag);
rc = rc ? : in->deserialize_String(in, "path", &v->path);
rc = rc ? : in->deserialize_Bool(in, "watch", &v->watch);
rc = rc ? : in->end_record(in, tag);
return rc;
}
void deallocate_GetChildrenRequest(struct GetChildrenRequest*v){
deallocate_String(&v->path);
}
int serialize_GetChildren2Request(struct oarchive *out, const char *tag, struct GetChildren2Request *v){
int rc;
rc = out->start_record(out, tag);
rc = rc ? : out->serialize_String(out, "path", &v->path);
rc = rc ? : out->serialize_Bool(out, "watch", &v->watch);
rc = rc ? : out->end_record(out, tag);
return rc;
}
int deserialize_GetChildren2Request(struct iarchive *in, const char *tag, struct GetChildren2Request*v){
int rc;
rc = in->start_record(in, tag);
rc = rc ? : in->deserialize_String(in, "path", &v->path);
rc = rc ? : in->deserialize_Bool(in, "watch", &v->watch);
rc = rc ? : in->end_record(in, tag);
return rc;
}
void deallocate_GetChildren2Request(struct GetChildren2Request*v){
deallocate_String(&v->path);
}
int serialize_GetMaxChildrenRequest(struct oarchive *out, const char *tag, struct GetMaxChildrenRequest *v){
int rc;
rc = out->start_record(out, tag);
rc = rc ? : out->serialize_String(out, "path", &v->path);
rc = rc ? : out->end_record(out, tag);
return rc;
}
int deserialize_GetMaxChildrenRequest(struct iarchive *in, const char *tag, struct GetMaxChildrenRequest*v){
int rc;
rc = in->start_record(in, tag);
rc = rc ? : in->deserialize_String(in, "path", &v->path);
rc = rc ? : in->end_record(in, tag);
return rc;
}
void deallocate_GetMaxChildrenRequest(struct GetMaxChildrenRequest*v){
deallocate_String(&v->path);
}
int serialize_GetMaxChildrenResponse(struct oarchive *out, const char *tag, struct GetMaxChildrenResponse *v){
int rc;
rc = out->start_record(out, tag);
rc = rc ? : out->serialize_Int(out, "max", &v->max);
rc = rc ? : out->end_record(out, tag);
return rc;
}
int deserialize_GetMaxChildrenResponse(struct iarchive *in, const char *tag, struct GetMaxChildrenResponse*v){
int rc;
rc = in->start_record(in, tag);
rc = rc ? : in->deserialize_Int(in, "max", &v->max);
rc = rc ? : in->end_record(in, tag);
return rc;
}
void deallocate_GetMaxChildrenResponse(struct GetMaxChildrenResponse*v){
}
int serialize_SetMaxChildrenRequest(struct oarchive *out, const char *tag, struct SetMaxChildrenRequest *v){
int rc;
rc = out->start_record(out, tag);
rc = rc ? : out->serialize_String(out, "path", &v->path);
rc = rc ? : out->serialize_Int(out, "max", &v->max);
rc = rc ? : out->end_record(out, tag);
return rc;
}
int deserialize_SetMaxChildrenRequest(struct iarchive *in, const char *tag, struct SetMaxChildrenRequest*v){
int rc;
rc = in->start_record(in, tag);
rc = rc ? : in->deserialize_String(in, "path", &v->path);
rc = rc ? : in->deserialize_Int(in, "max", &v->max);
rc = rc ? : in->end_record(in, tag);
return rc;
}
void deallocate_SetMaxChildrenRequest(struct SetMaxChildrenRequest*v){
deallocate_String(&v->path);
}
int serialize_SyncRequest(struct oarchive *out, const char *tag, struct SyncRequest *v){
int rc;
rc = out->start_record(out, tag);
rc = rc ? : out->serialize_String(out, "path", &v->path);
rc = rc ? : out->end_record(out, tag);
return rc;
}
int deserialize_SyncRequest(struct iarchive *in, const char *tag, struct SyncRequest*v){
int rc;
rc = in->start_record(in, tag);
rc = rc ? : in->deserialize_String(in, "path", &v->path);
rc = rc ? : in->end_record(in, tag);
return rc;
}
void deallocate_SyncRequest(struct SyncRequest*v){
deallocate_String(&v->path);
}
int serialize_SyncResponse(struct oarchive *out, const char *tag, struct SyncResponse *v){
int rc;
rc = out->start_record(out, tag);
rc = rc ? : out->serialize_String(out, "path", &v->path);
rc = rc ? : out->end_record(out, tag);
return rc;
}
int deserialize_SyncResponse(struct iarchive *in, const char *tag, struct SyncResponse*v){
int rc;
rc = in->start_record(in, tag);
rc = rc ? : in->deserialize_String(in, "path", &v->path);
rc = rc ? : in->end_record(in, tag);
return rc;
}
void deallocate_SyncResponse(struct SyncResponse*v){
deallocate_String(&v->path);
}
int serialize_GetACLRequest(struct oarchive *out, const char *tag, struct GetACLRequest *v){
int rc;
rc = out->start_record(out, tag);
rc = rc ? : out->serialize_String(out, "path", &v->path);
rc = rc ? : out->end_record(out, tag);
return rc;
}
int deserialize_GetACLRequest(struct iarchive *in, const char *tag, struct GetACLRequest*v){
int rc;
rc = in->start_record(in, tag);
rc = rc ? : in->deserialize_String(in, "path", &v->path);
rc = rc ? : in->end_record(in, tag);
return rc;
}
void deallocate_GetACLRequest(struct GetACLRequest*v){
deallocate_String(&v->path);
}
int serialize_SetACLRequest(struct oarchive *out, const char *tag, struct SetACLRequest *v){
int rc;
rc = out->start_record(out, tag);
rc = rc ? : out->serialize_String(out, "path", &v->path);
rc = rc ? : serialize_ACL_vector(out, "acl", &v->acl);
rc = rc ? : out->serialize_Int(out, "version", &v->version);
rc = rc ? : out->end_record(out, tag);
return rc;
}
int deserialize_SetACLRequest(struct iarchive *in, const char *tag, struct SetACLRequest*v){
int rc;
rc = in->start_record(in, tag);
rc = rc ? : in->deserialize_String(in, "path", &v->path);
rc = rc ? : deserialize_ACL_vector(in, "acl", &v->acl);
rc = rc ? : in->deserialize_Int(in, "version", &v->version);
rc = rc ? : in->end_record(in, tag);
return rc;
}
void deallocate_SetACLRequest(struct SetACLRequest*v){
deallocate_String(&v->path);
deallocate_ACL_vector(&v->acl);
}
int serialize_SetACLResponse(struct oarchive *out, const char *tag, struct SetACLResponse *v){
int rc;
rc = out->start_record(out, tag);
rc = rc ? : serialize_Stat(out, "stat", &v->stat);
rc = rc ? : out->end_record(out, tag);
return rc;
}
int deserialize_SetACLResponse(struct iarchive *in, const char *tag, struct SetACLResponse*v){
int rc;
rc = in->start_record(in, tag);
rc = rc ? : deserialize_Stat(in, "stat", &v->stat);
rc = rc ? : in->end_record(in, tag);
return rc;
}
void deallocate_SetACLResponse(struct SetACLResponse*v){
deallocate_Stat(&v->stat);
}
int serialize_WatcherEvent(struct oarchive *out, const char *tag, struct WatcherEvent *v){
int rc;
rc = out->start_record(out, tag);
rc = rc ? : out->serialize_Int(out, "type", &v->type);
rc = rc ? : out->serialize_Int(out, "state", &v->state);
rc = rc ? : out->serialize_String(out, "path", &v->path);
rc = rc ? : out->end_record(out, tag);
return rc;
}
int deserialize_WatcherEvent(struct iarchive *in, const char *tag, struct WatcherEvent*v){
int rc;
rc = in->start_record(in, tag);
rc = rc ? : in->deserialize_Int(in, "type", &v->type);
rc = rc ? : in->deserialize_Int(in, "state", &v->state);
rc = rc ? : in->deserialize_String(in, "path", &v->path);
rc = rc ? : in->end_record(in, tag);
return rc;
}
void deallocate_WatcherEvent(struct WatcherEvent*v){
deallocate_String(&v->path);
}
int serialize_CreateResponse(struct oarchive *out, const char *tag, struct CreateResponse *v){
int rc;
rc = out->start_record(out, tag);
rc = rc ? : out->serialize_String(out, "path", &v->path);
rc = rc ? : out->end_record(out, tag);
return rc;
}
int deserialize_CreateResponse(struct iarchive *in, const char *tag, struct CreateResponse*v){
int rc;
rc = in->start_record(in, tag);
rc = rc ? : in->deserialize_String(in, "path", &v->path);
rc = rc ? : in->end_record(in, tag);
return rc;
}
void deallocate_CreateResponse(struct CreateResponse*v){
deallocate_String(&v->path);
}
int serialize_ExistsRequest(struct oarchive *out, const char *tag, struct ExistsRequest *v){
int rc;
rc = out->start_record(out, tag);
rc = rc ? : out->serialize_String(out, "path", &v->path);
rc = rc ? : out->serialize_Bool(out, "watch", &v->watch);
rc = rc ? : out->end_record(out, tag);
return rc;
}
int deserialize_ExistsRequest(struct iarchive *in, const char *tag, struct ExistsRequest*v){
int rc;
rc = in->start_record(in, tag);
rc = rc ? : in->deserialize_String(in, "path", &v->path);
rc = rc ? : in->deserialize_Bool(in, "watch", &v->watch);
rc = rc ? : in->end_record(in, tag);
return rc;
}
void deallocate_ExistsRequest(struct ExistsRequest*v){
deallocate_String(&v->path);
}
int serialize_ExistsResponse(struct oarchive *out, const char *tag, struct ExistsResponse *v){
int rc;
rc = out->start_record(out, tag);
rc = rc ? : serialize_Stat(out, "stat", &v->stat);
rc = rc ? : out->end_record(out, tag);
return rc;
}
int deserialize_ExistsResponse(struct iarchive *in, const char *tag, struct ExistsResponse*v){
int rc;
rc = in->start_record(in, tag);
rc = rc ? : deserialize_Stat(in, "stat", &v->stat);
rc = rc ? : in->end_record(in, tag);
return rc;
}
void deallocate_ExistsResponse(struct ExistsResponse*v){
deallocate_Stat(&v->stat);
}
int serialize_GetDataResponse(struct oarchive *out, const char *tag, struct GetDataResponse *v){
int rc;
rc = out->start_record(out, tag);
rc = rc ? : out->serialize_Buffer(out, "data", &v->data);
rc = rc ? : serialize_Stat(out, "stat", &v->stat);
rc = rc ? : out->end_record(out, tag);
return rc;
}
int deserialize_GetDataResponse(struct iarchive *in, const char *tag, struct GetDataResponse*v){
int rc;
rc = in->start_record(in, tag);
rc = rc ? : in->deserialize_Buffer(in, "data", &v->data);
rc = rc ? : deserialize_Stat(in, "stat", &v->stat);
rc = rc ? : in->end_record(in, tag);
return rc;
}
void deallocate_GetDataResponse(struct GetDataResponse*v){
deallocate_Buffer(&v->data);
deallocate_Stat(&v->stat);
}
int serialize_GetChildrenResponse(struct oarchive *out, const char *tag, struct GetChildrenResponse *v){
int rc;
rc = out->start_record(out, tag);
rc = rc ? : serialize_String_vector(out, "children", &v->children);
rc = rc ? : out->end_record(out, tag);
return rc;
}
int deserialize_GetChildrenResponse(struct iarchive *in, const char *tag, struct GetChildrenResponse*v){
int rc;
rc = in->start_record(in, tag);
rc = rc ? : deserialize_String_vector(in, "children", &v->children);
rc = rc ? : in->end_record(in, tag);
return rc;
}
void deallocate_GetChildrenResponse(struct GetChildrenResponse*v){
deallocate_String_vector(&v->children);
}
int serialize_GetChildren2Response(struct oarchive *out, const char *tag, struct GetChildren2Response *v){
int rc;
rc = out->start_record(out, tag);
rc = rc ? : serialize_String_vector(out, "children", &v->children);
rc = rc ? : serialize_Stat(out, "stat", &v->stat);
rc = rc ? : out->end_record(out, tag);
return rc;
}
int deserialize_GetChildren2Response(struct iarchive *in, const char *tag, struct GetChildren2Response*v){
int rc;
rc = in->start_record(in, tag);
rc = rc ? : deserialize_String_vector(in, "children", &v->children);
rc = rc ? : deserialize_Stat(in, "stat", &v->stat);
rc = rc ? : in->end_record(in, tag);
return rc;
}
void deallocate_GetChildren2Response(struct GetChildren2Response*v){
deallocate_String_vector(&v->children);
deallocate_Stat(&v->stat);
}
int serialize_GetACLResponse(struct oarchive *out, const char *tag, struct GetACLResponse *v){
int rc;
rc = out->start_record(out, tag);
rc = rc ? : serialize_ACL_vector(out, "acl", &v->acl);
rc = rc ? : serialize_Stat(out, "stat", &v->stat);
rc = rc ? : out->end_record(out, tag);
return rc;
}
int deserialize_GetACLResponse(struct iarchive *in, const char *tag, struct GetACLResponse*v){
int rc;
rc = in->start_record(in, tag);
rc = rc ? : deserialize_ACL_vector(in, "acl", &v->acl);
rc = rc ? : deserialize_Stat(in, "stat", &v->stat);
rc = rc ? : in->end_record(in, tag);
return rc;
}
void deallocate_GetACLResponse(struct GetACLResponse*v){
deallocate_ACL_vector(&v->acl);
deallocate_Stat(&v->stat);
}
int allocate_Id_vector(struct Id_vector *v, int32_t len) {
if (!len) {
v->count = 0;
v->data = 0;
} else {
v->count = len;
v->data = calloc(sizeof(*v->data), len);
}
return 0;
}
int deallocate_Id_vector(struct Id_vector *v) {
if (v->data) {
int32_t i;
for(i=0;i<v->count; i++) {
deallocate_Id(&v->data[i]);
}
free(v->data);
v->data = 0;
}
return 0;
}
int serialize_Id_vector(struct oarchive *out, const char *tag, struct Id_vector *v)
{
int32_t count = v->count;
int rc = 0;
int32_t i;
rc = out->start_vector(out, tag, &count);
for(i=0;i<v->count;i++) {
rc = rc ? : serialize_Id(out, "data", &v->data[i]);
}
rc = rc ? : out->end_vector(out, tag);
return rc;
}
int deserialize_Id_vector(struct iarchive *in, const char *tag, struct Id_vector *v)
{
int rc = 0;
int32_t i;
rc = in->start_vector(in, tag, &v->count);
v->data = calloc(v->count, sizeof(*v->data));
for(i=0;i<v->count;i++) {
rc = rc ? : deserialize_Id(in, "value", &v->data[i]);
}
rc = in->end_vector(in, tag);
return rc;
}
int serialize_QuorumPacket(struct oarchive *out, const char *tag, struct QuorumPacket *v){
int rc;
rc = out->start_record(out, tag);
rc = rc ? : out->serialize_Int(out, "type", &v->type);
rc = rc ? : out->serialize_Long(out, "zxid", &v->zxid);
rc = rc ? : out->serialize_Buffer(out, "data", &v->data);
rc = rc ? : serialize_Id_vector(out, "authinfo", &v->authinfo);
rc = rc ? : out->end_record(out, tag);
return rc;
}
int deserialize_QuorumPacket(struct iarchive *in, const char *tag, struct QuorumPacket*v){
int rc;
rc = in->start_record(in, tag);
rc = rc ? : in->deserialize_Int(in, "type", &v->type);
rc = rc ? : in->deserialize_Long(in, "zxid", &v->zxid);
rc = rc ? : in->deserialize_Buffer(in, "data", &v->data);
rc = rc ? : deserialize_Id_vector(in, "authinfo", &v->authinfo);
rc = rc ? : in->end_record(in, tag);
return rc;
}
void deallocate_QuorumPacket(struct QuorumPacket*v){
deallocate_Buffer(&v->data);
deallocate_Id_vector(&v->authinfo);
}
int serialize_FileHeader(struct oarchive *out, const char *tag, struct FileHeader *v){
int rc;
rc = out->start_record(out, tag);
rc = rc ? : out->serialize_Int(out, "magic", &v->magic);
rc = rc ? : out->serialize_Int(out, "version", &v->version);
rc = rc ? : out->serialize_Long(out, "dbid", &v->dbid);
rc = rc ? : out->end_record(out, tag);
return rc;
}
int deserialize_FileHeader(struct iarchive *in, const char *tag, struct FileHeader*v){
int rc;
rc = in->start_record(in, tag);
rc = rc ? : in->deserialize_Int(in, "magic", &v->magic);
rc = rc ? : in->deserialize_Int(in, "version", &v->version);
rc = rc ? : in->deserialize_Long(in, "dbid", &v->dbid);
rc = rc ? : in->end_record(in, tag);
return rc;
}
void deallocate_FileHeader(struct FileHeader*v){
}
int serialize_TxnHeader(struct oarchive *out, const char *tag, struct TxnHeader *v){
int rc;
rc = out->start_record(out, tag);
rc = rc ? : out->serialize_Long(out, "clientId", &v->clientId);
rc = rc ? : out->serialize_Int(out, "cxid", &v->cxid);
rc = rc ? : out->serialize_Long(out, "zxid", &v->zxid);
rc = rc ? : out->serialize_Long(out, "time", &v->time);
rc = rc ? : out->serialize_Int(out, "type", &v->type);
rc = rc ? : out->end_record(out, tag);
return rc;
}
int deserialize_TxnHeader(struct iarchive *in, const char *tag, struct TxnHeader*v){
int rc;
rc = in->start_record(in, tag);
rc = rc ? : in->deserialize_Long(in, "clientId", &v->clientId);
rc = rc ? : in->deserialize_Int(in, "cxid", &v->cxid);
rc = rc ? : in->deserialize_Long(in, "zxid", &v->zxid);
rc = rc ? : in->deserialize_Long(in, "time", &v->time);
rc = rc ? : in->deserialize_Int(in, "type", &v->type);
rc = rc ? : in->end_record(in, tag);
return rc;
}
void deallocate_TxnHeader(struct TxnHeader*v){
}
int serialize_CreateTxn(struct oarchive *out, const char *tag, struct CreateTxn *v){
int rc;
rc = out->start_record(out, tag);
rc = rc ? : out->serialize_String(out, "path", &v->path);
rc = rc ? : out->serialize_Buffer(out, "data", &v->data);
rc = rc ? : serialize_ACL_vector(out, "acl", &v->acl);
rc = rc ? : out->serialize_Bool(out, "ephemeral", &v->ephemeral);
rc = rc ? : out->end_record(out, tag);
return rc;
}
int deserialize_CreateTxn(struct iarchive *in, const char *tag, struct CreateTxn*v){
int rc;
rc = in->start_record(in, tag);
rc = rc ? : in->deserialize_String(in, "path", &v->path);
rc = rc ? : in->deserialize_Buffer(in, "data", &v->data);
rc = rc ? : deserialize_ACL_vector(in, "acl", &v->acl);
rc = rc ? : in->deserialize_Bool(in, "ephemeral", &v->ephemeral);
rc = rc ? : in->end_record(in, tag);
return rc;
}
void deallocate_CreateTxn(struct CreateTxn*v){
deallocate_String(&v->path);
deallocate_Buffer(&v->data);
deallocate_ACL_vector(&v->acl);
}
int serialize_DeleteTxn(struct oarchive *out, const char *tag, struct DeleteTxn *v){
int rc;
rc = out->start_record(out, tag);
rc = rc ? : out->serialize_String(out, "path", &v->path);
rc = rc ? : out->end_record(out, tag);
return rc;
}
int deserialize_DeleteTxn(struct iarchive *in, const char *tag, struct DeleteTxn*v){
int rc;
rc = in->start_record(in, tag);
rc = rc ? : in->deserialize_String(in, "path", &v->path);
rc = rc ? : in->end_record(in, tag);
return rc;
}
void deallocate_DeleteTxn(struct DeleteTxn*v){
deallocate_String(&v->path);
}
int serialize_SetDataTxn(struct oarchive *out, const char *tag, struct SetDataTxn *v){
int rc;
rc = out->start_record(out, tag);
rc = rc ? : out->serialize_String(out, "path", &v->path);
rc = rc ? : out->serialize_Buffer(out, "data", &v->data);
rc = rc ? : out->serialize_Int(out, "version", &v->version);
rc = rc ? : out->end_record(out, tag);
return rc;
}
int deserialize_SetDataTxn(struct iarchive *in, const char *tag, struct SetDataTxn*v){