| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Automatically generated from ./regress.rpc | 2 * Automatically generated from ./regress.rpc |
| 3 * by event_rpcgen.py/0.1. DO NOT EDIT THIS FILE. | 3 * by event_rpcgen.py/0.1. DO NOT EDIT THIS FILE. |
| 4 */ | 4 */ |
| 5 | 5 |
| 6 #include <sys/types.h> | 6 #include <sys/types.h> |
| 7 #ifdef _EVENT_HAVE_SYS_TIME_H |
| 7 #include <sys/time.h> | 8 #include <sys/time.h> |
| 9 #endif |
| 8 #include <stdlib.h> | 10 #include <stdlib.h> |
| 9 #include <string.h> | 11 #include <string.h> |
| 10 #include <assert.h> | 12 #include <assert.h> |
| 13 #define EVENT_NO_STRUCT |
| 11 #include <event.h> | 14 #include <event.h> |
| 12 | 15 |
| 16 #ifdef _EVENT___func__ |
| 17 #define __func__ _EVENT___func__ |
| 18 #endif |
| 13 | 19 |
| 14 #include "./regress.gen.h" | 20 #include "./regress.gen.h" |
| 15 | 21 |
| 16 void event_err(int eval, const char *fmt, ...); | 22 void event_err(int eval, const char *fmt, ...); |
| 17 void event_warn(const char *fmt, ...); | 23 void event_warn(const char *fmt, ...); |
| 18 void event_errx(int eval, const char *fmt, ...); | 24 void event_errx(int eval, const char *fmt, ...); |
| 19 void event_warnx(const char *fmt, ...); | 25 void event_warnx(const char *fmt, ...); |
| 20 | 26 |
| 21 | 27 |
| 22 /* | 28 /* |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 int i; | 289 int i; |
| 284 for (i = 0; i < tmp->run_length; ++i) { | 290 for (i = 0; i < tmp->run_length; ++i) { |
| 285 evtag_marshal_run(evbuf, MSG_RUN, tmp->run_data[i]); | 291 evtag_marshal_run(evbuf, MSG_RUN, tmp->run_data[i]); |
| 286 } | 292 } |
| 287 } | 293 } |
| 288 } | 294 } |
| 289 | 295 |
| 290 int | 296 int |
| 291 msg_unmarshal(struct msg *tmp, struct evbuffer *evbuf) | 297 msg_unmarshal(struct msg *tmp, struct evbuffer *evbuf) |
| 292 { | 298 { |
| 293 uint32_t tag; | 299 ev_uint32_t tag; |
| 294 while (EVBUFFER_LENGTH(evbuf) > 0) { | 300 while (EVBUFFER_LENGTH(evbuf) > 0) { |
| 295 if (evtag_peek(evbuf, &tag) == -1) | 301 if (evtag_peek(evbuf, &tag) == -1) |
| 296 return (-1); | 302 return (-1); |
| 297 switch (tag) { | 303 switch (tag) { |
| 298 | 304 |
| 299 case MSG_FROM_NAME: | 305 case MSG_FROM_NAME: |
| 300 | 306 |
| 301 if (tmp->from_name_set) | 307 if (tmp->from_name_set) |
| 302 return (-1); | 308 return (-1); |
| 303 if (evtag_unmarshal_string(evbuf, MSG_FROM_NAME, &tmp->from_name_data) =
= -1) { | 309 if (evtag_unmarshal_string(evbuf, MSG_FROM_NAME, &tmp->from_name_data) =
= -1) { |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 368 int i; | 374 int i; |
| 369 for (i = 0; i < msg->run_length; ++i) { | 375 for (i = 0; i < msg->run_length; ++i) { |
| 370 if (run_complete(msg->run_data[i]) == -1) | 376 if (run_complete(msg->run_data[i]) == -1) |
| 371 return (-1); | 377 return (-1); |
| 372 } | 378 } |
| 373 } | 379 } |
| 374 return (0); | 380 return (0); |
| 375 } | 381 } |
| 376 | 382 |
| 377 int | 383 int |
| 378 evtag_unmarshal_msg(struct evbuffer *evbuf, uint32_t need_tag, struct msg *msg) | 384 evtag_unmarshal_msg(struct evbuffer *evbuf, ev_uint32_t need_tag, struct msg *ms
g) |
| 379 { | 385 { |
| 380 uint32_t tag; | 386 ev_uint32_t tag; |
| 381 int res = -1; | 387 int res = -1; |
| 382 | 388 |
| 383 struct evbuffer *tmp = evbuffer_new(); | 389 struct evbuffer *tmp = evbuffer_new(); |
| 384 | 390 |
| 385 if (evtag_unmarshal(evbuf, &tag, tmp) == -1 || tag != need_tag) | 391 if (evtag_unmarshal(evbuf, &tag, tmp) == -1 || tag != need_tag) |
| 386 goto error; | 392 goto error; |
| 387 | 393 |
| 388 if (msg_unmarshal(msg, tmp) == -1) | 394 if (msg_unmarshal(msg, tmp) == -1) |
| 389 goto error; | 395 goto error; |
| 390 | 396 |
| 391 res = 0; | 397 res = 0; |
| 392 | 398 |
| 393 error: | 399 error: |
| 394 evbuffer_free(tmp); | 400 evbuffer_free(tmp); |
| 395 return (res); | 401 return (res); |
| 396 } | 402 } |
| 397 | 403 |
| 398 void | 404 void |
| 399 evtag_marshal_msg(struct evbuffer *evbuf, uint32_t tag, const struct msg *msg) | 405 evtag_marshal_msg(struct evbuffer *evbuf, ev_uint32_t tag, const struct msg *msg
) |
| 400 { | 406 { |
| 401 struct evbuffer *_buf = evbuffer_new(); | 407 struct evbuffer *_buf = evbuffer_new(); |
| 402 assert(_buf != NULL); | 408 assert(_buf != NULL); |
| 403 evbuffer_drain(_buf, -1); | 409 evbuffer_drain(_buf, -1); |
| 404 msg_marshal(_buf, msg); | 410 msg_marshal(_buf, msg); |
| 405 evtag_marshal(evbuf, tag, EVBUFFER_DATA(_buf), EVBUFFER_LENGTH(_buf)); | 411 evtag_marshal(evbuf, tag, EVBUFFER_DATA(_buf), EVBUFFER_LENGTH(_buf)); |
| 406 evbuffer_free(_buf); | 412 evbuffer_free(_buf); |
| 407 } | 413 } |
| 408 | 414 |
| 409 /* | 415 /* |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 462 { | 468 { |
| 463 if (msg->action_data != NULL) | 469 if (msg->action_data != NULL) |
| 464 free(msg->action_data); | 470 free(msg->action_data); |
| 465 if ((msg->action_data = strdup(value)) == NULL) | 471 if ((msg->action_data = strdup(value)) == NULL) |
| 466 return (-1); | 472 return (-1); |
| 467 msg->action_set = 1; | 473 msg->action_set = 1; |
| 468 return (0); | 474 return (0); |
| 469 } | 475 } |
| 470 | 476 |
| 471 int | 477 int |
| 472 kill_how_often_assign(struct kill *msg, const uint32_t value) | 478 kill_how_often_assign(struct kill *msg, const ev_uint32_t value) |
| 473 { | 479 { |
| 474 msg->how_often_set = 1; | 480 msg->how_often_set = 1; |
| 475 msg->how_often_data = value; | 481 msg->how_often_data = value; |
| 476 return (0); | 482 return (0); |
| 477 } | 483 } |
| 478 | 484 |
| 479 int | 485 int |
| 480 kill_weapon_get(struct kill *msg, char * *value) | 486 kill_weapon_get(struct kill *msg, char * *value) |
| 481 { | 487 { |
| 482 if (msg->weapon_set != 1) | 488 if (msg->weapon_set != 1) |
| 483 return (-1); | 489 return (-1); |
| 484 *value = msg->weapon_data; | 490 *value = msg->weapon_data; |
| 485 return (0); | 491 return (0); |
| 486 } | 492 } |
| 487 | 493 |
| 488 int | 494 int |
| 489 kill_action_get(struct kill *msg, char * *value) | 495 kill_action_get(struct kill *msg, char * *value) |
| 490 { | 496 { |
| 491 if (msg->action_set != 1) | 497 if (msg->action_set != 1) |
| 492 return (-1); | 498 return (-1); |
| 493 *value = msg->action_data; | 499 *value = msg->action_data; |
| 494 return (0); | 500 return (0); |
| 495 } | 501 } |
| 496 | 502 |
| 497 int | 503 int |
| 498 kill_how_often_get(struct kill *msg, uint32_t *value) | 504 kill_how_often_get(struct kill *msg, ev_uint32_t *value) |
| 499 { | 505 { |
| 500 if (msg->how_often_set != 1) | 506 if (msg->how_often_set != 1) |
| 501 return (-1); | 507 return (-1); |
| 502 *value = msg->how_often_data; | 508 *value = msg->how_often_data; |
| 503 return (0); | 509 return (0); |
| 504 } | 510 } |
| 505 | 511 |
| 506 void | 512 void |
| 507 kill_clear(struct kill *tmp) | 513 kill_clear(struct kill *tmp) |
| 508 { | 514 { |
| (...skipping 25 matching lines...) Expand all Loading... |
| 534 evtag_marshal_string(evbuf, KILL_WEAPON, tmp->weapon_data); | 540 evtag_marshal_string(evbuf, KILL_WEAPON, tmp->weapon_data); |
| 535 evtag_marshal_string(evbuf, KILL_ACTION, tmp->action_data); | 541 evtag_marshal_string(evbuf, KILL_ACTION, tmp->action_data); |
| 536 if (tmp->how_often_set) { | 542 if (tmp->how_often_set) { |
| 537 evtag_marshal_int(evbuf, KILL_HOW_OFTEN, tmp->how_often_data); | 543 evtag_marshal_int(evbuf, KILL_HOW_OFTEN, tmp->how_often_data); |
| 538 } | 544 } |
| 539 } | 545 } |
| 540 | 546 |
| 541 int | 547 int |
| 542 kill_unmarshal(struct kill *tmp, struct evbuffer *evbuf) | 548 kill_unmarshal(struct kill *tmp, struct evbuffer *evbuf) |
| 543 { | 549 { |
| 544 uint32_t tag; | 550 ev_uint32_t tag; |
| 545 while (EVBUFFER_LENGTH(evbuf) > 0) { | 551 while (EVBUFFER_LENGTH(evbuf) > 0) { |
| 546 if (evtag_peek(evbuf, &tag) == -1) | 552 if (evtag_peek(evbuf, &tag) == -1) |
| 547 return (-1); | 553 return (-1); |
| 548 switch (tag) { | 554 switch (tag) { |
| 549 | 555 |
| 550 case KILL_WEAPON: | 556 case KILL_WEAPON: |
| 551 | 557 |
| 552 if (tmp->weapon_set) | 558 if (tmp->weapon_set) |
| 553 return (-1); | 559 return (-1); |
| 554 if (evtag_unmarshal_string(evbuf, KILL_WEAPON, &tmp->weapon_data) == -1)
{ | 560 if (evtag_unmarshal_string(evbuf, KILL_WEAPON, &tmp->weapon_data) == -1)
{ |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 594 kill_complete(struct kill *msg) | 600 kill_complete(struct kill *msg) |
| 595 { | 601 { |
| 596 if (!msg->weapon_set) | 602 if (!msg->weapon_set) |
| 597 return (-1); | 603 return (-1); |
| 598 if (!msg->action_set) | 604 if (!msg->action_set) |
| 599 return (-1); | 605 return (-1); |
| 600 return (0); | 606 return (0); |
| 601 } | 607 } |
| 602 | 608 |
| 603 int | 609 int |
| 604 evtag_unmarshal_kill(struct evbuffer *evbuf, uint32_t need_tag, struct kill *msg
) | 610 evtag_unmarshal_kill(struct evbuffer *evbuf, ev_uint32_t need_tag, struct kill *
msg) |
| 605 { | 611 { |
| 606 uint32_t tag; | 612 ev_uint32_t tag; |
| 607 int res = -1; | 613 int res = -1; |
| 608 | 614 |
| 609 struct evbuffer *tmp = evbuffer_new(); | 615 struct evbuffer *tmp = evbuffer_new(); |
| 610 | 616 |
| 611 if (evtag_unmarshal(evbuf, &tag, tmp) == -1 || tag != need_tag) | 617 if (evtag_unmarshal(evbuf, &tag, tmp) == -1 || tag != need_tag) |
| 612 goto error; | 618 goto error; |
| 613 | 619 |
| 614 if (kill_unmarshal(msg, tmp) == -1) | 620 if (kill_unmarshal(msg, tmp) == -1) |
| 615 goto error; | 621 goto error; |
| 616 | 622 |
| 617 res = 0; | 623 res = 0; |
| 618 | 624 |
| 619 error: | 625 error: |
| 620 evbuffer_free(tmp); | 626 evbuffer_free(tmp); |
| 621 return (res); | 627 return (res); |
| 622 } | 628 } |
| 623 | 629 |
| 624 void | 630 void |
| 625 evtag_marshal_kill(struct evbuffer *evbuf, uint32_t tag, const struct kill *msg) | 631 evtag_marshal_kill(struct evbuffer *evbuf, ev_uint32_t tag, const struct kill *m
sg) |
| 626 { | 632 { |
| 627 struct evbuffer *_buf = evbuffer_new(); | 633 struct evbuffer *_buf = evbuffer_new(); |
| 628 assert(_buf != NULL); | 634 assert(_buf != NULL); |
| 629 evbuffer_drain(_buf, -1); | 635 evbuffer_drain(_buf, -1); |
| 630 kill_marshal(_buf, msg); | 636 kill_marshal(_buf, msg); |
| 631 evtag_marshal(evbuf, tag, EVBUFFER_DATA(_buf), EVBUFFER_LENGTH(_buf)); | 637 evtag_marshal(evbuf, tag, EVBUFFER_DATA(_buf), EVBUFFER_LENGTH(_buf)); |
| 632 evbuffer_free(_buf); | 638 evbuffer_free(_buf); |
| 633 } | 639 } |
| 634 | 640 |
| 635 /* | 641 /* |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 677 { | 683 { |
| 678 if (msg->how_data != NULL) | 684 if (msg->how_data != NULL) |
| 679 free(msg->how_data); | 685 free(msg->how_data); |
| 680 if ((msg->how_data = strdup(value)) == NULL) | 686 if ((msg->how_data = strdup(value)) == NULL) |
| 681 return (-1); | 687 return (-1); |
| 682 msg->how_set = 1; | 688 msg->how_set = 1; |
| 683 return (0); | 689 return (0); |
| 684 } | 690 } |
| 685 | 691 |
| 686 int | 692 int |
| 687 run_some_bytes_assign(struct run *msg, const uint8_t * value, uint32_t len) | 693 run_some_bytes_assign(struct run *msg, const ev_uint8_t * value, ev_uint32_t len
) |
| 688 { | 694 { |
| 689 if (msg->some_bytes_data != NULL) | 695 if (msg->some_bytes_data != NULL) |
| 690 free (msg->some_bytes_data); | 696 free (msg->some_bytes_data); |
| 691 msg->some_bytes_data = malloc(len); | 697 msg->some_bytes_data = malloc(len); |
| 692 if (msg->some_bytes_data == NULL) | 698 if (msg->some_bytes_data == NULL) |
| 693 return (-1); | 699 return (-1); |
| 694 msg->some_bytes_set = 1; | 700 msg->some_bytes_set = 1; |
| 695 msg->some_bytes_length = len; | 701 msg->some_bytes_length = len; |
| 696 memcpy(msg->some_bytes_data, value, len); | 702 memcpy(msg->some_bytes_data, value, len); |
| 697 return (0); | 703 return (0); |
| 698 } | 704 } |
| 699 | 705 |
| 700 int | 706 int |
| 701 run_fixed_bytes_assign(struct run *msg, const uint8_t *value) | 707 run_fixed_bytes_assign(struct run *msg, const ev_uint8_t *value) |
| 702 { | 708 { |
| 703 msg->fixed_bytes_set = 1; | 709 msg->fixed_bytes_set = 1; |
| 704 memcpy(msg->fixed_bytes_data, value, 24); | 710 memcpy(msg->fixed_bytes_data, value, 24); |
| 705 return (0); | 711 return (0); |
| 706 } | 712 } |
| 707 | 713 |
| 708 int | 714 int |
| 709 run_how_get(struct run *msg, char * *value) | 715 run_how_get(struct run *msg, char * *value) |
| 710 { | 716 { |
| 711 if (msg->how_set != 1) | 717 if (msg->how_set != 1) |
| 712 return (-1); | 718 return (-1); |
| 713 *value = msg->how_data; | 719 *value = msg->how_data; |
| 714 return (0); | 720 return (0); |
| 715 } | 721 } |
| 716 | 722 |
| 717 int | 723 int |
| 718 run_some_bytes_get(struct run *msg, uint8_t * *value, uint32_t *plen) | 724 run_some_bytes_get(struct run *msg, ev_uint8_t * *value, ev_uint32_t *plen) |
| 719 { | 725 { |
| 720 if (msg->some_bytes_set != 1) | 726 if (msg->some_bytes_set != 1) |
| 721 return (-1); | 727 return (-1); |
| 722 *value = msg->some_bytes_data; | 728 *value = msg->some_bytes_data; |
| 723 *plen = msg->some_bytes_length; | 729 *plen = msg->some_bytes_length; |
| 724 return (0); | 730 return (0); |
| 725 } | 731 } |
| 726 | 732 |
| 727 int | 733 int |
| 728 run_fixed_bytes_get(struct run *msg, uint8_t **value) | 734 run_fixed_bytes_get(struct run *msg, ev_uint8_t **value) |
| 729 { | 735 { |
| 730 if (msg->fixed_bytes_set != 1) | 736 if (msg->fixed_bytes_set != 1) |
| 731 return (-1); | 737 return (-1); |
| 732 *value = msg->fixed_bytes_data; | 738 *value = msg->fixed_bytes_data; |
| 733 return (0); | 739 return (0); |
| 734 } | 740 } |
| 735 | 741 |
| 736 void | 742 void |
| 737 run_clear(struct run *tmp) | 743 run_clear(struct run *tmp) |
| 738 { | 744 { |
| (...skipping 27 matching lines...) Expand all Loading... |
| 766 evtag_marshal_string(evbuf, RUN_HOW, tmp->how_data); | 772 evtag_marshal_string(evbuf, RUN_HOW, tmp->how_data); |
| 767 if (tmp->some_bytes_set) { | 773 if (tmp->some_bytes_set) { |
| 768 evtag_marshal(evbuf, RUN_SOME_BYTES, tmp->some_bytes_data, tmp->some_bytes_l
ength); | 774 evtag_marshal(evbuf, RUN_SOME_BYTES, tmp->some_bytes_data, tmp->some_bytes_l
ength); |
| 769 } | 775 } |
| 770 evtag_marshal(evbuf, RUN_FIXED_BYTES, tmp->fixed_bytes_data, sizeof(tmp->fixed
_bytes_data)); | 776 evtag_marshal(evbuf, RUN_FIXED_BYTES, tmp->fixed_bytes_data, sizeof(tmp->fixed
_bytes_data)); |
| 771 } | 777 } |
| 772 | 778 |
| 773 int | 779 int |
| 774 run_unmarshal(struct run *tmp, struct evbuffer *evbuf) | 780 run_unmarshal(struct run *tmp, struct evbuffer *evbuf) |
| 775 { | 781 { |
| 776 uint32_t tag; | 782 ev_uint32_t tag; |
| 777 while (EVBUFFER_LENGTH(evbuf) > 0) { | 783 while (EVBUFFER_LENGTH(evbuf) > 0) { |
| 778 if (evtag_peek(evbuf, &tag) == -1) | 784 if (evtag_peek(evbuf, &tag) == -1) |
| 779 return (-1); | 785 return (-1); |
| 780 switch (tag) { | 786 switch (tag) { |
| 781 | 787 |
| 782 case RUN_HOW: | 788 case RUN_HOW: |
| 783 | 789 |
| 784 if (tmp->how_set) | 790 if (tmp->how_set) |
| 785 return (-1); | 791 return (-1); |
| 786 if (evtag_unmarshal_string(evbuf, RUN_HOW, &tmp->how_data) == -1) { | 792 if (evtag_unmarshal_string(evbuf, RUN_HOW, &tmp->how_data) == -1) { |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 832 run_complete(struct run *msg) | 838 run_complete(struct run *msg) |
| 833 { | 839 { |
| 834 if (!msg->how_set) | 840 if (!msg->how_set) |
| 835 return (-1); | 841 return (-1); |
| 836 if (!msg->fixed_bytes_set) | 842 if (!msg->fixed_bytes_set) |
| 837 return (-1); | 843 return (-1); |
| 838 return (0); | 844 return (0); |
| 839 } | 845 } |
| 840 | 846 |
| 841 int | 847 int |
| 842 evtag_unmarshal_run(struct evbuffer *evbuf, uint32_t need_tag, struct run *msg) | 848 evtag_unmarshal_run(struct evbuffer *evbuf, ev_uint32_t need_tag, struct run *ms
g) |
| 843 { | 849 { |
| 844 uint32_t tag; | 850 ev_uint32_t tag; |
| 845 int res = -1; | 851 int res = -1; |
| 846 | 852 |
| 847 struct evbuffer *tmp = evbuffer_new(); | 853 struct evbuffer *tmp = evbuffer_new(); |
| 848 | 854 |
| 849 if (evtag_unmarshal(evbuf, &tag, tmp) == -1 || tag != need_tag) | 855 if (evtag_unmarshal(evbuf, &tag, tmp) == -1 || tag != need_tag) |
| 850 goto error; | 856 goto error; |
| 851 | 857 |
| 852 if (run_unmarshal(msg, tmp) == -1) | 858 if (run_unmarshal(msg, tmp) == -1) |
| 853 goto error; | 859 goto error; |
| 854 | 860 |
| 855 res = 0; | 861 res = 0; |
| 856 | 862 |
| 857 error: | 863 error: |
| 858 evbuffer_free(tmp); | 864 evbuffer_free(tmp); |
| 859 return (res); | 865 return (res); |
| 860 } | 866 } |
| 861 | 867 |
| 862 void | 868 void |
| 863 evtag_marshal_run(struct evbuffer *evbuf, uint32_t tag, const struct run *msg) | 869 evtag_marshal_run(struct evbuffer *evbuf, ev_uint32_t tag, const struct run *msg
) |
| 864 { | 870 { |
| 865 struct evbuffer *_buf = evbuffer_new(); | 871 struct evbuffer *_buf = evbuffer_new(); |
| 866 assert(_buf != NULL); | 872 assert(_buf != NULL); |
| 867 evbuffer_drain(_buf, -1); | 873 evbuffer_drain(_buf, -1); |
| 868 run_marshal(_buf, msg); | 874 run_marshal(_buf, msg); |
| 869 evtag_marshal(evbuf, tag, EVBUFFER_DATA(_buf), EVBUFFER_LENGTH(_buf)); | 875 evtag_marshal(evbuf, tag, EVBUFFER_DATA(_buf), EVBUFFER_LENGTH(_buf)); |
| 870 evbuffer_free(_buf); | 876 evbuffer_free(_buf); |
| 871 } | 877 } |
| 872 | 878 |
| OLD | NEW |