ast_err Msgtest_read(ast_runtime* rt, Msgtest** msgtest_vp) { ast_err status = AST_NOERR; uint32_t wiretype, fieldno; Msgtest* msgtest_v; msgtest_v = (Msgtest*)ast_alloc(rt,sizeof(Msgtest)); if(msgtest_v == NULL) return AST_ENOMEM; while(status == AST_NOERR) { status = ast_read_tag(rt,&wiretype,&fieldno); if(status == AST_EOF) {status = AST_NOERR; break;} if(status != AST_NOERR) break; switch (fieldno) { case 1: { size_t size; if(wiretype != ast_counted) {status=AST_EFAIL; goto done;} status = ast_read_size(rt,&size); if(status != AST_NOERR) {ACATCH(status); goto done;} ast_mark(rt,size); status = Submsg_read(rt,&msgtest_v->rmsg); if(status != AST_NOERR) {ACATCH(status); goto done;} ast_unmark(rt); } break; case 2: { size_t size; if(wiretype != ast_counted) {status=AST_EFAIL; goto done;} status = ast_read_size(rt,&size); if(status != AST_NOERR) {ACATCH(status); goto done;} ast_mark(rt,size); msgtest_v->omsg.defined = 1; msgtest_v->omsg.value = NULL; status = Submsg_read(rt,&msgtest_v->omsg.value); if(status != AST_NOERR) {ACATCH(status); goto done;} ast_unmark(rt); } break; case 3: { size_t size; Submsg* tmp; if(wiretype != ast_counted) {status=AST_EFAIL; goto done;} status = ast_read_size(rt,&size); if(status != AST_NOERR) {ACATCH(status); goto done;} ast_mark(rt,size); status = Submsg_read(rt,&tmp); if(status != AST_NOERR) {ACATCH(status); goto done;} status = ast_repeat_append(rt,ast_message,&msgtest_v->pmsg,&tmp); if(status != AST_NOERR) {ACATCH(status); goto done;} ast_unmark(rt); } break; default: status = ast_skip_field(rt,wiretype,fieldno); if(status != AST_NOERR) {ACATCH(status); goto done;} }; /*switch*/ };/*while*/ if(status != AST_NOERR) {ACATCH(status); goto done;} if(msgtest_vp) *msgtest_vp = msgtest_v; done: return status; } /*Msgtest_read*/
ast_err BytesRequired_read(ast_runtime* rt, BytesRequired** bytesrequired_vp) { ast_err status = AST_NOERR; uint32_t wiretype, fieldno; BytesRequired* bytesrequired_v; bytesrequired_v = (BytesRequired*)ast_alloc(rt,sizeof(BytesRequired)); if(bytesrequired_v == NULL) return AST_ENOMEM; while(status == AST_NOERR) { status = ast_read_tag(rt,&wiretype,&fieldno); if(status == AST_EOF) {status = AST_NOERR; break;} if(status != AST_NOERR) break; switch (fieldno) { case 1: { status = ast_read_primitive(rt,ast_string,1,&bytesrequired_v->f_string); } break; case 2: { status = ast_read_primitive(rt,ast_bytes,2,&bytesrequired_v->f_bytes); } break; default: status = ast_skip_field(rt,wiretype,fieldno); if(status != AST_NOERR) {goto done;} }; /*switch*/ };/*while*/ if(status != AST_NOERR) {goto done;} if(bytesrequired_vp) *bytesrequired_vp = bytesrequired_v; done: return status; } /*BytesRequired_read*/
ast_err Submsg_read(ast_runtime* rt, Submsg** submsg_vp) { ast_err status = AST_NOERR; uint32_t wiretype, fieldno; Submsg* submsg_v; submsg_v = (Submsg*)ast_alloc(rt,sizeof(Submsg)); if(submsg_v == NULL) return AST_ENOMEM; while(status == AST_NOERR) { status = ast_read_tag(rt,&wiretype,&fieldno); if(status == AST_EOF) {status = AST_NOERR; break;} if(status != AST_NOERR) break; switch (fieldno) { case 1: { status = ast_read_primitive(rt,ast_int32,1,&submsg_v->f_int32); } break; default: status = ast_skip_field(rt,wiretype,fieldno); if(status != AST_NOERR) {ACATCH(status); goto done;} }; /*switch*/ };/*while*/ if(status != AST_NOERR) {ACATCH(status); goto done;} if(submsg_vp) *submsg_vp = submsg_v; done: return status; } /*Submsg_read*/
int t_read(ast_runtime* rt, t** t_vp) { int status = AST_NOERR; uint32_t wiretype, fieldno; int i = 0; size_t count; t* t_v; t_v = (t*)ast_alloc(sizeof(t)); if(t_v == NULL) return AST_ENOMEM; while(status == AST_NOERR) ast_read_tag(rt,&wiretype,&fieldno) switch (fieldno) { case 1: { status = ast_read(rt,ast_int32,&t_v->f1_f); } break; case 2: { t_v->f2_f.exists = 1; t_v->f2_f.value = 0; status = ast_read(rt,ast_float,&t_v->f2_f.value); } break; case 3: { t_v->f3_f.count = 0; t_v->f3_f.values = NULL; status = ast_read_count(rt,&t_v->f3_f.count); if(!status) {goto done;} for(i=0;i<t_v->f3_f.count;i++) { int tmp; status = ast_read(rt,ast_sint32,&tmp); status = ast_append(rt,ast_sint32,&t_v->f3_f,&tmp); if(!status) {goto done;} } /*for*/; } break; case 4: { status = m2_read(rt,&t_v->f4_f); if(!status) {goto done;} } break; default: status = ast_skip_field(rt,wiretype,fieldno); }; /*switch*/ };/*while*/
ast_err BytesOptional_read(ast_runtime* rt, BytesOptional** bytesoptional_vp) { ast_err status = AST_NOERR; uint32_t wiretype, fieldno; BytesOptional* bytesoptional_v; bytesoptional_v = (BytesOptional*)ast_alloc(rt,sizeof(BytesOptional)); if(bytesoptional_v == NULL) return AST_ENOMEM; while(status == AST_NOERR) { status = ast_read_tag(rt,&wiretype,&fieldno); if(status == AST_EOF) {status = AST_NOERR; break;} if(status != AST_NOERR) break; switch (fieldno) { case 1: { bytesoptional_v->f_string.defined = 1; bytesoptional_v->f_string.value = NULL; status = ast_read_primitive(rt,ast_string,1,&bytesoptional_v->f_string.value); } break; case 2: { bytesoptional_v->f_bytes.defined = 1; bytesoptional_v->f_bytes.value.nbytes = 0; bytesoptional_v->f_bytes.value.bytes = NULL; status = ast_read_primitive(rt,ast_bytes,2,&bytesoptional_v->f_bytes.value); } break; default: status = ast_skip_field(rt,wiretype,fieldno); if(status != AST_NOERR) {goto done;} }; /*switch*/ };/*while*/ if(!bytesoptional_v->f_string.defined) { bytesoptional_v->f_string.value = "hello"; } if(!bytesoptional_v->f_bytes.defined) { bytesoptional_v->f_bytes.value.nbytes = 0; bytesoptional_v->f_bytes.value.bytes = NULL; } if(status != AST_NOERR) {goto done;} if(bytesoptional_vp) *bytesoptional_vp = bytesoptional_v; done: return status; } /*BytesOptional_read*/