Changeset 4614
- Timestamp:
- 02/14/07 01:40:10 (2 years ago)
- Files:
-
- libwired/trunk/libwired/p7/wi-p7-message.c (modified) (2 diffs)
- libwired/trunk/libwired/p7/wi-p7-private.h (modified) (1 diff)
- libwired/trunk/libwired/p7/wi-p7-socket.c (modified) (8 diffs)
- libwired/trunk/libwired/p7/wi-p7-spec.c (modified) (54 diffs)
- libwired/trunk/libwired/p7/wi-p7-spec.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
libwired/trunk/libwired/p7/wi-p7-message.c
r4608 r4614 511 511 field_id = wi_p7_spec_field_id(p7_message->spec, field_name); 512 512 513 if(field_id == WI_P7_SPEC_FIELD_ID_NULL) { 514 wi_p7_spec_log_warn(p7_message->spec, WI_STR("No id found for field \"%@\""), 515 field_name); 516 513 if(field_id == WI_P7_SPEC_FIELD_ID_NULL) 517 514 return false; 518 }519 515 520 516 return _wi_p7_message_get_binary_buffer_for_reading_for_id(p7_message, field_id, 0, out_buffer, out_field_length); … … 528 524 field_id = wi_p7_spec_field_id(p7_message->spec, field_name); 529 525 530 if(field_id == WI_P7_SPEC_FIELD_ID_NULL) { 531 wi_p7_spec_log_warn(p7_message->spec, WI_STR("No id found for field \"%@\""), 532 field_name); 533 526 if(field_id == WI_P7_SPEC_FIELD_ID_NULL) 534 527 return false; 535 }536 528 537 529 if(length > 0) libwired/trunk/libwired/p7/wi-p7-private.h
r4607 r4614 63 63 WI_EXPORT void wi_p7_message_deserialize(wi_p7_message_t *); 64 64 65 WI_EXPORT void wi_p7_spec_log_warn(wi_p7_spec_t *, wi_string_t *, ...);66 WI_EXPORT wi_boolean_t wi_p7_spec_is_checking(wi_p7_spec_t *);67 68 65 WI_EXPORT wi_string_t * wi_p7_xml_string_for_attribute(xmlNodePtr, wi_string_t *); 69 66 WI_EXPORT wi_integer_t wi_p7_xml_integer_for_attribute(xmlNodePtr, wi_string_t *); libwired/trunk/libwired/p7/wi-p7-socket.c
r4613 r4614 267 267 wi_p7_message_set_enum_for_name(p7_message, 0, WI_STR("p7.handshake.compression")); 268 268 269 wi_log_info(WI_STR("should set %u for encryption"), wi_p7_spec_enum_value(p7_socket->spec, 4, WI_STR("p7.handshake.encryption.rsa_aes_256"))); 270 269 271 if(options & WI_P7_ENCRYPTION_RSA_AES) 270 272 wi_p7_message_set_enum_for_name(p7_message, 0, WI_STR("p7.handshake.encryption")); … … 384 386 385 387 if(wi_p7_message_get_enum_for_name(p7_message, &encryption, WI_STR("p7.handshake.encryption"))) { 388 wi_log_info(WI_STR("should get %@ for %u"), wi_p7_spec_enum_name(p7_socket->spec, 4, encryption), encryption); 389 386 390 if(encryption == 0 && options & WI_P7_ENCRYPTION_RSA_AES) 387 391 p7_socket->options |= WI_P7_ENCRYPTION_RSA_AES; … … 438 442 439 443 static wi_boolean_t _wi_p7_socket_connect_key_exchange(wi_p7_socket_t *p7_socket, wi_time_interval_t timeout, wi_string_t *username_string, wi_string_t *password_string) { 440 wi_p7_message_t *p7_message;441 wi_data_t *data, *rsa_data;442 wi_string_t *client_password_string1, *client_password_string2, *server_password_string;443 unsigned char *cipher_key = NULL, *iv = NULL;444 const unsigned char *bytes;445 void *username = NULL, *server_password = NULL, *client_password = NULL;446 uint32_t cipher_key_length, iv_length, username_length, client_password_length, server_password_length;444 wi_p7_message_t *p7_message; 445 wi_data_t *data, *rsa_data; 446 wi_string_t *client_password_string1, *client_password_string2, *server_password_string; 447 const void *bytes; 448 void *username = NULL, *server_password = NULL, *client_password = NULL, *cipher_key = NULL, *iv = NULL; 449 uint32_t username_length, client_password_length, server_password_length; 450 int32_t iv_length, cipher_key_length; 447 451 448 452 p7_message = wi_p7_socket_read_message(p7_socket, timeout); … … 491 495 492 496 if(EVP_SealInit(&p7_socket->cipher_ctx, 493 NULL, &cipher_key, 497 NULL, 498 (unsigned char **) &cipher_key, 494 499 (int *) &cipher_key_length, 495 iv, 496 &p7_socket->public_key, 1) != 1) { 500 (unsigned char *) iv, 501 &p7_socket->public_key, 502 1) != 1) { 497 503 ERR_print_errors_fp(stderr); 498 504 … … 567 573 goto end; 568 574 569 server_password_string = wi_string_with_bytes( (char *)server_password, server_password_length);575 server_password_string = wi_string_with_bytes(server_password, server_password_length); 570 576 571 577 if(!wi_is_equal(server_password_string, client_password_string2)) { … … 599 605 600 606 static wi_boolean_t _wi_p7_socket_accept_key_exchange(wi_p7_socket_t *p7_socket, wi_time_interval_t timeout) { 601 wi_p7_message_t *p7_message; 602 wi_data_t *data, *rsa_data, *cipher_key_data, *iv_data; 603 wi_string_t *string, *username_string, *client_password_string, *server_password_string1, *server_password_string2; 604 unsigned char *public_key = NULL; 605 void *username = NULL, *client_password = NULL, *server_password; 606 uint32_t public_key_length, username_length, client_password_length, server_password_length; 607 wi_p7_message_t *p7_message; 608 wi_data_t *data, *rsa_data, *cipher_key_data, *iv_data; 609 wi_string_t *string, *username_string, *client_password_string, *server_password_string1, *server_password_string2; 610 void *public_key = NULL, *username = NULL, *client_password = NULL, *server_password = NULL; 611 uint32_t public_key_length, username_length, client_password_length, server_password_length; 607 612 608 613 if(!p7_socket->private_key) { … … 612 617 } 613 618 614 public_key_length = i2d_RSA_PUBKEY(p7_socket->rsa_key, &public_key);619 public_key_length = i2d_RSA_PUBKEY(p7_socket->rsa_key, (unsigned char **) &public_key); 615 620 616 621 if(public_key_length <= 0) { … … 836 841 } 837 842 838 p7_spec = wi_p7_spec_init_with_string(wi_p7_spec_alloc(), string , wi_p7_spec_is_checking(p7_socket->spec));843 p7_spec = wi_p7_spec_init_with_string(wi_p7_spec_alloc(), string); 839 844 840 845 if(!p7_spec) { libwired/trunk/libwired/p7/wi-p7-spec.c
r4613 r4614 244 244 wi_runtime_base_t base; 245 245 246 wi_boolean_t checking;247 248 246 wi_string_t *xml; 249 247 … … 261 259 static wi_string_t * _wi_p7_spec_description(wi_runtime_instance_t *); 262 260 263 static wi_boolean_t _wi_p7_spec_load_builtin(wi_p7_spec_t *, wi_boolean_t); 264 static wi_boolean_t _wi_p7_spec_load_file(wi_p7_spec_t *, wi_string_t *, wi_boolean_t); 265 static wi_boolean_t _wi_p7_spec_load_string(wi_p7_spec_t *, wi_string_t *, wi_boolean_t); 261 static void _wi_p7_spec_log_debug(wi_p7_spec_t *, wi_string_t *, ...); 262 263 static wi_boolean_t _wi_p7_spec_load_builtin(wi_p7_spec_t *); 264 static wi_boolean_t _wi_p7_spec_load_file(wi_p7_spec_t *, wi_string_t *); 265 static wi_boolean_t _wi_p7_spec_load_string(wi_p7_spec_t *, wi_string_t *); 266 266 static wi_boolean_t _wi_p7_spec_load_spec(wi_p7_spec_t *, xmlDocPtr); 267 267 static wi_boolean_t _wi_p7_spec_load_types(wi_p7_spec_t *, xmlNodePtr); … … 468 468 p7_spec->filename = wi_retain(WI_STR("(builtin)")); 469 469 470 if(!_wi_p7_spec_load_builtin(p7_spec , true)) {470 if(!_wi_p7_spec_load_builtin(p7_spec)) { 471 471 wi_error_set_lib_error(WI_ERROR_P7_INVALIDSPEC); 472 472 … … 481 481 482 482 483 wi_p7_spec_t * wi_p7_spec_init_with_file(wi_p7_spec_t *p7_spec, wi_string_t *path , wi_boolean_t checking) {483 wi_p7_spec_t * wi_p7_spec_init_with_file(wi_p7_spec_t *p7_spec, wi_string_t *path) { 484 484 if(!_wi_p7_spec_builtin_spec) { 485 485 _wi_p7_spec_builtin_spec = wi_p7_spec_init_builtin(wi_p7_spec_alloc()); … … 493 493 494 494 p7_spec = _wi_p7_spec_init(p7_spec); 495 p7_spec->checking = checking;496 495 p7_spec->filename = wi_retain(wi_string_last_path_component(path)); 497 496 498 if(!_wi_p7_spec_load_file(p7_spec, path , checking)) {497 if(!_wi_p7_spec_load_file(p7_spec, path)) { 499 498 wi_error_set_lib_error(WI_ERROR_P7_INVALIDSPEC); 500 499 … … 509 508 510 509 511 wi_p7_spec_t * wi_p7_spec_init_with_string(wi_p7_spec_t *p7_spec, wi_string_t *string , wi_boolean_t checking) {510 wi_p7_spec_t * wi_p7_spec_init_with_string(wi_p7_spec_t *p7_spec, wi_string_t *string) { 512 511 if(!_wi_p7_spec_builtin_spec) { 513 512 _wi_p7_spec_builtin_spec = wi_p7_spec_init_builtin(wi_p7_spec_alloc()); … … 522 521 p7_spec = _wi_p7_spec_init(p7_spec); 523 522 524 if(!_wi_p7_spec_load_string(p7_spec, string , checking)) {523 if(!_wi_p7_spec_load_string(p7_spec, string)) { 525 524 wi_error_set_lib_error(WI_ERROR_P7_INVALIDSPEC); 526 525 … … 572 571 #pragma mark - 573 572 574 static wi_boolean_t _wi_p7_spec_load_builtin(wi_p7_spec_t *p7_spec, wi_boolean_t checking) { 573 static void _wi_p7_spec_log_debug(wi_p7_spec_t *p7_spec, wi_string_t *fmt, ...) { 574 wi_string_t *string; 575 va_list ap; 576 577 if(wi_log_level >= WI_LOG_DEBUG) { 578 va_start(ap, fmt); 579 string = wi_string_init_with_format_and_arguments(wi_string_alloc(), fmt, ap); 580 va_end(ap); 581 582 if(p7_spec->filename) 583 wi_log_debug(WI_STR("%@: %@"), p7_spec->filename, string); 584 else 585 wi_log_debug(WI_STR("%@"), string); 586 } 587 } 588 589 590 591 #pragma mark - 592 593 static wi_boolean_t _wi_p7_spec_load_builtin(wi_p7_spec_t *p7_spec) { 575 594 xmlDocPtr doc; 576 595 … … 583 602 } 584 603 585 p7_spec->checking = checking;586 587 604 if(!_wi_p7_spec_load_spec(p7_spec, doc)) { 588 605 xmlFreeDoc(doc); … … 598 615 599 616 600 static wi_boolean_t _wi_p7_spec_load_file(wi_p7_spec_t *p7_spec, wi_string_t *path , wi_boolean_t checking) {617 static wi_boolean_t _wi_p7_spec_load_file(wi_p7_spec_t *p7_spec, wi_string_t *path) { 601 618 xmlDocPtr doc; 602 619 xmlChar *buffer; … … 629 646 630 647 631 static wi_boolean_t _wi_p7_spec_load_string(wi_p7_spec_t *p7_spec, wi_string_t *string , wi_boolean_t checking) {648 static wi_boolean_t _wi_p7_spec_load_string(wi_p7_spec_t *p7_spec, wi_string_t *string) { 632 649 xmlDocPtr doc; 633 650 xmlChar *buffer; … … 641 658 return false; 642 659 } 643 644 p7_spec->checking = checking;645 660 646 661 if(!_wi_p7_spec_load_spec(p7_spec, doc)) { … … 707 722 type = _wi_p7_spec_type_with_node(p7_spec, type_node); 708 723 709 if(!type) { 710 if(p7_spec->checking) 711 return false; 712 else 713 continue; 714 } 715 716 if(p7_spec->checking) { 724 if(!type) 725 return false; 726 727 if(wi_log_level >= WI_LOG_DEBUG) { 717 728 if(wi_hash_data_for_key(p7_spec->types_name, type->name)) { 718 wi_p7_spec_log_warn(p7_spec, WI_STR("Type with name \"%@\" already exists"),729 _wi_p7_spec_log_debug(p7_spec, WI_STR("Type with name \"%@\" already exists"), 719 730 type->name); 720 731 … … 723 734 724 735 if(wi_hash_data_for_key(p7_spec->types_id, (void *) type->id)) { 725 wi_p7_spec_log_warn(p7_spec, WI_STR("Type with id %u (name \"%@\") already exists"),736 _wi_p7_spec_log_debug(p7_spec, WI_STR("Type with id %u (name \"%@\") already exists"), 726 737 type->name, type->id); 727 738 … … 748 759 field = _wi_p7_spec_field_with_node(p7_spec, field_node); 749 760 750 if(!field) { 751 if(p7_spec->checking) 752 return false; 753 else 754 continue; 755 } 756 757 if(p7_spec->checking) { 761 if(!field) 762 return false; 763 764 if(wi_log_level >= WI_LOG_DEBUG) { 758 765 if(wi_hash_data_for_key(p7_spec->fields_name, field->name)) { 759 wi_p7_spec_log_warn(p7_spec, WI_STR("Field with name \"%@\" already exists"),766 _wi_p7_spec_log_debug(p7_spec, WI_STR("Field with name \"%@\" already exists"), 760 767 field->name); 761 768 … … 764 771 765 772 if(wi_hash_data_for_key(p7_spec->fields_id, (void *) field->id)) { 766 wi_p7_spec_log_warn(p7_spec, WI_STR("Field with id %u (name \"%@\") already exists"),773 _wi_p7_spec_log_debug(p7_spec, WI_STR("Field with id %u (name \"%@\") already exists"), 767 774 field->name, field->id); 768 775 … … 789 796 message = _wi_p7_spec_message_with_node(p7_spec, message_node); 790 797 791 if(!message) { 792 if(p7_spec->checking) 793 return false; 794 else 795 continue; 796 } 797 798 if(p7_spec->checking) { 798 if(!message) 799 return false; 800 801 if(wi_log_level >= WI_LOG_DEBUG) { 799 802 if(wi_hash_data_for_key(p7_spec->messages_name, message->name)) { 800 wi_p7_spec_log_warn(p7_spec, WI_STR("Message with name \"%@\" already exists"),803 _wi_p7_spec_log_debug(p7_spec, WI_STR("Message with name \"%@\" already exists"), 801 804 message->name); 802 805 … … 805 808 806 809 if(wi_hash_data_for_key(p7_spec->messages_id, (void *) message->id)) { 807 wi_p7_spec_log_warn(p7_spec, WI_STR("Message with id %u (name \"%@\") already exists"),810 _wi_p7_spec_log_debug(p7_spec, WI_STR("Message with id %u (name \"%@\") already exists"), 808 811 message->id, message->name); 809 812 … … 830 833 transaction = _wi_p7_spec_transaction_with_node(p7_spec, transaction_node); 831 834 832 if(!transaction) { 833 if(p7_spec->checking) 834 return false; 835 else 836 continue; 837 } 838 839 if(p7_spec->checking) { 835 if(!transaction) 836 return false; 837 838 if(wi_log_level >= WI_LOG_DEBUG) { 840 839 if(wi_hash_data_for_key(p7_spec->transactions_name, transaction->message->name)) { 841 wi_p7_spec_log_warn(p7_spec, WI_STR("Transaction with message \"%@\" already exists"),840 _wi_p7_spec_log_debug(p7_spec, WI_STR("Transaction with message \"%@\" already exists"), 842 841 transaction->message->name); 843 842 … … 857 856 #pragma mark - 858 857 859 void wi_p7_spec_log_warn(wi_p7_spec_t *p7_spec, wi_string_t *fmt, ...) {860 wi_string_t *string;861 va_list ap;862 863 if(p7_spec->checking) {864 va_start(ap, fmt);865 string = wi_string_init_with_format_and_arguments(wi_string_alloc(), fmt, ap);866 va_end(ap);867 868 if(p7_spec->filename)869 wi_log_warn(WI_STR("%@: %@"), p7_spec->filename, string);870 else871 wi_log_warn(WI_STR("%@"), string);872 }873 }874 875 876 877 #pragma mark -878 879 wi_boolean_t wi_p7_spec_is_checking(wi_p7_spec_t *p7_spec) {880 return p7_spec->checking;881 }882 883 884 885 #pragma mark -886 887 858 wi_boolean_t wi_p7_spec_is_compatible_with_id(wi_p7_spec_t *p7_spec, wi_uuid_t *id) { 888 859 return (wi_is_equal(p7_spec->id, id) || wi_set_contains_data(p7_spec->compatible_ids, id)); … … 928 899 if(!other_transaction || !other_transaction->required) { 929 900 if(!other_transaction) { 930 wi_p7_spec_log_warn(p7_spec, WI_STR("Transaction \"%@\" is required, but peer lacks it"),901 _wi_p7_spec_log_debug(p7_spec, WI_STR("Transaction \"%@\" is required, but peer lacks it"), 931 902 transaction->message->name); 932 903 } else { 933 wi_p7_spec_log_warn(p7_spec, WI_STR("Transaction \"%@\" is required, but peer has it optional"),904 _wi_p7_spec_log_debug(p7_spec, WI_STR("Transaction \"%@\" is required, but peer has it optional"), 934 905 transaction->message->name); 935 906 } … … 944 915 945 916 if(transaction->originator != other_transaction->originator) { 946 wi_p7_spec_log_warn(p7_spec, WI_STR("Transaction \"%@\" should be sent by %@, but peer sends it by %@"),917 _wi_p7_spec_log_debug(p7_spec, WI_STR("Transaction \"%@\" should be sent by %@, but peer sends it by %@"), 947 918 transaction->message->name, 948 919 _wi_p7_spec_transaction_originator(transaction), … … 1003 974 1004 975 if(count != other_count) { 1005 wi_p7_spec_log_warn(p7_spec, WI_STR("Transaction \"%@\" should have %u %@, but peer has %u"),976 _wi_p7_spec_log_debug(p7_spec, WI_STR("Transaction \"%@\" should have %u %@, but peer has %u"), 1006 977 transaction->message->name, 1007 978 count, … … 1028 999 if(!other_reply || !other_reply->required) { 1029 1000 if(!other_reply) { 1030 wi_p7_spec_log_warn(p7_spec, WI_STR("Reply \"%@\" in transaction \"%@\" is required, but peer lacks it"),1001 _wi_p7_spec_log_debug(p7_spec, WI_STR("Reply \"%@\" in transaction \"%@\" is required, but peer lacks it"), 1031 1002 reply->message->name, transaction->message->name); 1032 1003 } else { 1033 wi_p7_spec_log_warn(p7_spec, WI_STR("Reply \"%@\" in transaction \"%@\" is required, but peer has it optional"),1004 _wi_p7_spec_log_debug(p7_spec, WI_STR("Reply \"%@\" in transaction \"%@\" is required, but peer has it optional"), 1034 1005 reply->message->name, transaction->message->name); 1035 1006 } … … 1041 1012 if(other_reply) { 1042 1013 if(reply->count != other_reply->count) { 1043 wi_p7_spec_log_warn(p7_spec, WI_STR("Reply \"%@\" in transaction \"%@\" should be sent %u %@, but peer sends it %u %@"),1014 _wi_p7_spec_log_debug(p7_spec, WI_STR("Reply \"%@\" in transaction \"%@\" should be sent %u %@, but peer sends it %u %@"), 1044 1015 reply->message->name, 1045 1016 reply->count, … … 1071 1042 1072 1043 if(message->id != other_message->id) { 1073 wi_p7_spec_log_warn(p7_spec,1044 _wi_p7_spec_log_debug(p7_spec, 1074 1045 WI_STR("Message in reply \"%@\" in transaction \"%@\" should have id %u, but peer has id %u"), 1075 1046 message->name, transaction->message->name, message->id, other_message->id); … … 1087 1058 if(!other_parameter || !other_parameter->required) { 1088 1059 if(!other_parameter) { 1089 wi_p7_spec_log_warn(p7_spec,1060 _wi_p7_spec_log_debug(p7_spec, 1090 1061 WI_STR("Parameter \"%@\" in reply \"%@\" in transaction \"%@\" is required, but peer lacks it"), 1091 1062 parameter->field->name, message->name, transaction->message->name); 1092 1063 } else { 1093 wi_p7_spec_log_warn(p7_spec,1064 _wi_p7_spec_log_debug(p7_spec, 1094 1065 WI_STR("Parameter \"%@\" in reply \"%@\" in transaction \"%@\" is required, but peer has it optional"), 1095 1066 parameter->field->name, message->name, transaction->message->name); … … 1105 1076 1106 1077 if(field->id != other_field->id) { 1107 wi_p7_spec_log_warn(p7_spec,1078 _wi_p7_spec_log_debug(p7_spec, 1108 1079 WI_STR("Field in parameter \"%@\" in reply \"%@\" in transaction \"%@\" should have id %u, but peer has id %u"), 1109 1080 parameter->field->name, message->name, transaction->message->name, field->id, other_field->id); … … 1113 1084 1114 1085 if(field->type->id != other_field->type->id) { 1115 wi_p7_spec_log_warn(p7_spec,1086 _wi_p7_spec_log_debug(p7_spec, 1116 1087 WI_STR("Parameter \"%@\" in reply \"%@\" in transaction \"%@\" should be of type \"%@\", but peer has it as \"%@\""), 1117 1088 parameter->field->name, message->name, transaction->message->name, field->type->name, other_field->type->name); … … 1122 1093 if(field->type->id == WI_P7_ENUM) { 1123 1094 if(!wi_is_equal(field->enums_name, other_field->enums_name)) { 1124 wi_p7_spec_log_warn(p7_spec,1095 _wi_p7_spec_log_debug(p7_spec, 1125 1096 WI_STR("Parameter \"%@\" in reply \"%@\" in transaction \"%@\" have enumerations that differ with those of peer"), 1126 1097 parameter->field->name, message->name, transaction->message->name); … … 1159 1130 message = wi_hash_data_for_key(_wi_p7_spec_builtin_spec->messages_name, message_name); 1160 1131 1161 if(!message) 1132 if(!message) { 1133 _wi_p7_spec_log_debug(p7_spec, WI_STR("No id found for message \"%@\""), 1134 message_name); 1135 1162 1136 return WI_P7_SPEC_MESSAGE_ID_NULL; 1137 } 1163 1138 1164 1139 return message->id; … … 1191 1166 field = wi_hash_data_for_key(_wi_p7_spec_builtin_spec->fields_name, field_name); 1192 1167 1193 if(!field) 1168 if(!field) { 1169 _wi_p7_spec_log_debug(p7_spec, WI_STR("No id found for field \"%@\""), 1170 field_name); 1171 1194 1172 return WI_P7_SPEC_FIELD_ID_NULL; 1173 } 1195 1174 1196 1175 return field->id; … … 1320 1299 1321 1300 if(!type->name) { 1322 wi_p7_spec_log_warn(p7_spec, WI_STR("Type has no \"name\""));1301 _wi_p7_spec_log_debug(p7_spec, WI_STR("Type has no \"name\"")); 1323 1302 1324 1303 return NULL; … … 1328 1307 1329 1308 if(type->id == WI_P7_SPEC_TYPE_ID_NULL) { 1330 wi_p7_spec_log_warn(p7_spec, WI_STR("Type \"%@\" has no \"id\""),1309 _wi_p7_spec_log_debug(p7_spec, WI_STR("Type \"%@\" has no \"id\""), 1331 1310 type->name); 1332 1311 … … 1388 1367 1389 1368 if(!field->name) { 1390 wi_p7_spec_log_warn(p7_spec, WI_STR("Field has no \"name\""));1369 _wi_p7_spec_log_debug(p7_spec, WI_STR("Field has no \"name\"")); 1391 1370 1392 1371 return NULL; … … 1396 1375 1397 1376 if(!type) { 1398 wi_p7_spec_log_warn(p7_spec, WI_STR("Field \"%@\" has no \"type\""),1377 _wi_p7_spec_log_debug(p7_spec, WI_STR("Field \"%@\" has no \"type\""), 1399 1378 field->name); 1400 1379 … … 1408 1387 1409 1388 if(!field->type) { 1410 wi_p7_spec_log_warn(p7_spec, WI_STR("Field \"%@\" has an invalid \"type\" (\"%@\")"),1389 _wi_p7_spec_log_debug(p7_spec, WI_STR("Field \"%@\" has an invalid \"type\" (\"%@\")"), 1411 1390 field->name, type); 1412 1391 … … 1417 1396 1418 1397 if(field->id == WI_P7_SPEC_FIELD_ID_NULL) { 1419 wi_p7_spec_log_warn(p7_spec, WI_STR("Field \"%@\" has no \"id\""),1398 _wi_p7_spec_log_debug(p7_spec, WI_STR("Field \"%@\" has no \"id\""), 1420 1399 field->name); 1421 1400 … … 1432 1411 1433 1412 if(!name) { 1434 wi_p7_spec_log_warn(p7_spec, WI_STR("Field \"%@\" enum has no \"name\""),1413 _wi_p7_spec_log_debug(p7_spec, WI_STR("Field \"%@\" enum has no \"name\""), 1435 1414 field->name); 1436 1415 … … 1487 1466 1488 1467 if(!message->name) { 1489 wi_p7_spec_log_warn(p7_spec, WI_STR("Message has no name"));1468 _wi_p7_spec_log_debug(p7_spec, WI_STR("Message has no name")); 1490 1469 1491 1470 return NULL; … … 1495 1474 1496 1475 if(message->id == WI_P7_SPEC_MESSAGE_ID_NULL) { 1497 wi_p7_spec_log_warn(p7_spec, WI_STR("Message \"%@\" has no \"id\""),1476 _wi_p7_spec_log_debug(p7_spec, WI_STR("Message \"%@\" has no \"id\""), 1498 1477 message->name); 1499 1478 … … 1505 1484 parameter = _wi_p7_spec_parameter_with_node(p7_spec, parameter_node, message); 1506 1485 1507 if(!parameter) { 1508 if(p7_spec->checking) 1509 return NULL; 1510 else 1511 continue; 1512 } 1513 1514 if(p7_spec->checking) { 1486 if(!parameter) 1487 return NULL; 1488 1489 if(wi_log_level >= WI_LOG_DEBUG) { 1515 1490 if(wi_hash_data_for_key(message->parameters, parameter->field->name)) { 1516 wi_p7_spec_log_warn(p7_spec, WI_STR("Message \"%@\" has a duplicate field \"%@\""),1491 _wi_p7_spec_log_debug(p7_spec, WI_STR("Message \"%@\" has a duplicate field \"%@\""), 1517 1492 message->name, parameter->field->name); 1518 1493 … … 1562 1537 1563 1538 if(!field) { 1564 wi_p7_spec_log_warn(p7_spec, WI_STR("Parameter in message \"%@\" has no \"field\""),1539 _wi_p7_spec_log_debug(p7_spec, WI_STR("Parameter in message \"%@\" has no \"field\""), 1565 1540 message->name); 1566 1541 … … 1574 1549 1575 1550 if(!parameter->field) { 1576 wi_p7_spec_log_warn(p7_spec, WI_STR("Parameter in message \"%@\" has an invalid \"field\" (\"%@\")"),1551 _wi_p7_spec_log_debug(p7_spec, WI_STR("Parameter in message \"%@\" has an invalid \"field\" (\"%@\")"), 1577 1552 message->name, field); 1578 1553 … … 1583 1558 1584 1559 if(use) { 1585 if( p7_spec->checking) {1560 if(wi_log_level >= WI_LOG_DEBUG) { 1586 1561 if(wi_string_case_insensitive_compare(use, WI_STR("required")) != 0 && 1587 1562 wi_string_case_insensitive_compare(use, WI_STR("optional")) != 0) { 1588 wi_p7_spec_log_warn(p7_spec, WI_STR("Parameter \"%@\" in message \"%@\" has an invalid \"use\" (\"%@\")"),1563 _wi_p7_spec_log_debug(p7_spec, WI_STR("Parameter \"%@\" in message \"%@\" has an invalid \"use\" (\"%@\")"), 1589 1564 message->name, parameter->field->name, use); 1590 1565 … … 1631 1606 1632 1607 if(!message) { 1633 wi_p7_spec_log_warn(p7_spec, WI_STR("Transaction has no \"message\""));1608 _wi_p7_spec_log_debug(p7_spec, WI_STR("Transaction has no \"message\"")); 1634 1609 1635 1610 return NULL; … … 1642 1617 1643 1618 if(!transaction->message) { 1644 wi_p7_spec_log_warn(p7_spec, WI_STR("Transaction has an invalid \"message\" (\"%@\")"),1619 _wi_p7_spec_log_debug(p7_spec, WI_STR("Transaction has an invalid \"message\" (\"%@\")"), 1645 1620 message); 1646 1621 … … 1651 1626 1652 1627 if(!originator) { 1653 wi_p7_spec_log_warn(p7_spec, WI_STR("Transaction \"%@\" has no \"originator\""),1628 _wi_p7_spec_log_debug(p7_spec, WI_STR("Transaction \"%@\" has no \"originator\""), 1654 1629 transaction->message->name); 1655 1630 … … 1657 1632 } 1658 1633 1659 if( p7_spec->checking) {1634 if(wi_log_level >= WI_LOG_DEBUG) { 1660 1635 if(wi_string_case_insensitive_compare(originator, WI_STR("client")) != 0 && 1661 1636 wi_string_case_insensitive_compare(originator, WI_STR("server")) != 0 && 1662 1637 wi_string_case_insensitive_compare(originator, WI_STR("both")) != 0) { 1663 wi_p7_spec_log_warn(p7_spec, WI_STR("Transaction \"%@\" has an invalid \"originator\" (\"%@\")"),1638 _wi_p7_spec_log_debug(p7_spec, WI_STR("Transaction \"%@\" has an invalid \"originator\" (\"%@\")"), 1664 1639 transaction->message->name, originator); 1665 1640 … … 1678 1653 1679 1654 if(use) { 1680 if( p7_spec->checking) {1655 if(wi_log_level >= WI_LOG_DEBUG) { 1681 1656 if(wi_string_case_insensitive_compare(use, WI_STR("required")) != 0 && 1682 1657 wi_string_case_insensitive_compare(use, WI_STR("optional"))) { 1683 wi_p7_spec_log_warn(p7_spec, WI_STR("Transaction \"%@\" has an invalid \"use\" (\"%@\")"),1658 _wi_p7_spec_log_debug(p7_spec, WI_STR("Transaction \"%@\" has an invalid \"use\" (\"%@\")"), 1684 1659 transaction->message->name, use); 1685 1660 … … 1753 1728 reply = _wi_p7_spec_reply_with_node(p7_spec, andor_node, transaction); 1754 1729 1755 if(!reply) { 1756 if(p7_spec->checking) 1757 return NULL; 1758 else 1759 continue; 1760 } 1730 if(!reply) 1731 return NULL; 1761 1732 1762 if( p7_spec->checking) {1733 if(wi_log_level >= WI_LOG_DEBUG) { 1763 1734 if(wi_hash_data_for_key(andor->replies_hash, reply->message->name)) { 1764 wi_p7_spec_log_warn(p7_spec, WI_STR("Transaction \"%@\" has a duplicate reply \"%@\""),1735 _wi_p7_spec_log_debug(p7_spec, WI_STR("Transaction \"%@\" has a duplicate reply \"%@\""), 1765 1736 transaction->message->name, reply->message->name); 1766 1737 … … 1820 1791 1821 1792 if(!message) { 1822 wi_p7_spec_log_warn(p7_spec, WI_STR("Reply in transaction \"%@\" has no \"message\""),1793 _wi_p7_spec_log_debug(p7_spec, WI_STR("Reply in transaction \"%@\" has no \"message\""), 1823 1794 transaction->message->name); 1824 1795 … … 1832 1803 1833 1804 if(!reply->message) { 1834 wi_p7_spec_log_warn(p7_spec, WI_STR("Reply in transaction \"%@\" has an invalid \"message\" (\"%@\")"),1805 _wi_p7_spec_log_debug(p7_spec, WI_STR("Reply in transaction \"%@\" has an invalid \"message\" (\"%@\")"), 1835 1806 transaction->message->name, message); 1836 1807 … … 1841 1812 1842 1813 if(use) { 1843 if( p7_spec->checking) {1814 if(wi_log_level >= WI_LOG_DEBUG) { 1844 1815 if(wi_string_case_insensitive_compare(use, WI_STR("required")) != 0 && 1845 1816 wi_string_case_insensitive_compare(use, WI_STR("optional"))) { 1846 wi_p7_spec_log_warn(p7_spec, WI_STR("Reply \"%@\" in transaction \"%@\" has an invalid \"use\" (\"%@\")"),1817 _wi_p7_spec_log_debug(p7_spec, WI_STR("Reply \"%@\" in transaction \"%@\" has an invalid \"use\" (\"%@\")"), 1847 1818 reply->message->name, transaction->message->name, use); 1848 1819 libwired/trunk/libwired
