Mercurial > hg > freeDiameter
comparison libfdproto/messages.c @ 1119:79dd22145f52
Fix a number of compilation warnings
author | Sebastien Decugis <sdecugis@freediameter.net> |
---|---|
date | Tue, 14 May 2013 11:04:20 +0800 |
parents | eb4ce68b6e5c |
children | c473581adff2 |
comparison
equal
deleted
inserted
replaced
1118:5b4dddbfccb3 | 1119:79dd22145f52 |
---|---|
918 { | 918 { |
919 int success = 0; | 919 int success = 0; |
920 struct dict_cmd_data dictdata; | 920 struct dict_cmd_data dictdata; |
921 | 921 |
922 if (!CHECK_MSG(msg)) { | 922 if (!CHECK_MSG(msg)) { |
923 CHECK_MALLOC_DO( fd_dump_extend( FD_DUMP_STD_PARAMS, "INVALID MESSAGE", msg), return NULL); | 923 CHECK_MALLOC_DO( fd_dump_extend( FD_DUMP_STD_PARAMS, "INVALID MESSAGE"), return NULL); |
924 return *buf; | 924 return *buf; |
925 } | 925 } |
926 | 926 |
927 if (!msg->msg_model) { | 927 if (!msg->msg_model) { |
928 CHECK_MALLOC_DO( fd_dump_extend( FD_DUMP_STD_PARAMS, "(no model) "), return NULL); | 928 CHECK_MALLOC_DO( fd_dump_extend( FD_DUMP_STD_PARAMS, "(no model) "), return NULL); |
952 | 952 |
953 static DECLARE_FD_DUMP_PROTOTYPE( avp_format_full, struct avp * avp, int level, int first, int last ) | 953 static DECLARE_FD_DUMP_PROTOTYPE( avp_format_full, struct avp * avp, int level, int first, int last ) |
954 { | 954 { |
955 int success = 0; | 955 int success = 0; |
956 struct dict_avp_data dictdata; | 956 struct dict_avp_data dictdata; |
957 struct dict_vendor_data vendordata; | |
958 struct dict_vendor_data *vendorinfo = NULL; | |
959 | |
960 | 957 |
961 if (level) { | 958 if (level) { |
962 if ((first) && ((*buf)[*offset - 1] == '=')) { | 959 if ((first) && ((*buf)[*offset - 1] == '=')) { |
963 /* We are first AVP of a grouped AVP */ | 960 /* We are first AVP of a grouped AVP */ |
964 CHECK_MALLOC_DO( fd_dump_extend( FD_DUMP_STD_PARAMS, "{ "), return NULL); | 961 CHECK_MALLOC_DO( fd_dump_extend( FD_DUMP_STD_PARAMS, "{ "), return NULL); |
1150 DECLARE_FD_DUMP_PROTOTYPE( fd_msg_dump_summary, msg_or_avp *obj, struct dictionary *dict, int force_parsing, int recurse ) | 1147 DECLARE_FD_DUMP_PROTOTYPE( fd_msg_dump_summary, msg_or_avp *obj, struct dictionary *dict, int force_parsing, int recurse ) |
1151 { | 1148 { |
1152 return msg_dump_process(FD_DUMP_STD_PARAMS, msg_format_summary, avp_format_summary, obj, dict, force_parsing, recurse); | 1149 return msg_dump_process(FD_DUMP_STD_PARAMS, msg_format_summary, avp_format_summary, obj, dict, force_parsing, recurse); |
1153 } | 1150 } |
1154 | 1151 |
1155 #ifndef OLD_CODE_TO_BE_REPLACED | |
1156 void fd_msg_dump_walk ( int level, msg_or_avp *obj ) | |
1157 { | |
1158 LOG_D("fd_msg_dump_walk %d, %p is deprecated", level, obj); | |
1159 } | |
1160 void fd_msg_dump_one ( int level, msg_or_avp * obj ) | |
1161 { | |
1162 LOG_D("fd_msg_dump_one %d, %p is deprecated", level, obj); | |
1163 } | |
1164 #endif | |
1165 /***************************************************************************************************************/ | 1152 /***************************************************************************************************************/ |
1166 /* Simple meta-data management */ | 1153 /* Simple meta-data management */ |
1167 | 1154 |
1168 /* Retrieve the model of an object */ | 1155 /* Retrieve the model of an object */ |
1169 int fd_msg_model ( msg_or_avp * reference, struct dict_object ** model ) | 1156 int fd_msg_model ( msg_or_avp * reference, struct dict_object ** model ) |
2055 | 2042 |
2056 /* First handle the case where we have not found this AVP in the dictionary */ | 2043 /* First handle the case where we have not found this AVP in the dictionary */ |
2057 if (!avp->avp_model) { | 2044 if (!avp->avp_model) { |
2058 | 2045 |
2059 if (mandatory && (avp->avp_public.avp_flags & AVP_FLAG_MANDATORY)) { | 2046 if (mandatory && (avp->avp_public.avp_flags & AVP_FLAG_MANDATORY)) { |
2060 TRACE_DEBUG(INFO, "Unsupported mandatory AVP found:"); | 2047 TRACE_DEBUG(INFO, "Unsupported mandatory AVP found"); |
2061 fd_msg_dump_one(INFO, avp); | |
2062 if (error_info) { | 2048 if (error_info) { |
2063 error_info->pei_errcode = "DIAMETER_AVP_UNSUPPORTED"; | 2049 error_info->pei_errcode = "DIAMETER_AVP_UNSUPPORTED"; |
2064 error_info->pei_avp = avp; | 2050 error_info->pei_avp = avp; |
2051 } else { | |
2052 char * buf = NULL; | |
2053 size_t buflen; | |
2054 CHECK_MALLOC(fd_msg_dump_treeview(&buf, &buflen, NULL, avp, NULL, 0, 0)); | |
2055 LOG_E("Unsupported AVP: %s", buf); | |
2056 free(buf); | |
2065 } | 2057 } |
2066 return ENOTSUP; | 2058 return ENOTSUP; |
2067 } | 2059 } |
2068 | 2060 |
2069 if (avp->avp_source) { | 2061 if (avp->avp_source) { |
2099 ASSERT(CHECK_BASETYPE(dictdata.avp_basetype)); | 2091 ASSERT(CHECK_BASETYPE(dictdata.avp_basetype)); |
2100 | 2092 |
2101 /* Check the size is valid */ | 2093 /* Check the size is valid */ |
2102 if ((avp_value_sizes[dictdata.avp_basetype] != 0) && | 2094 if ((avp_value_sizes[dictdata.avp_basetype] != 0) && |
2103 (avp->avp_public.avp_len - GETAVPHDRSZ( avp->avp_public.avp_flags ) != avp_value_sizes[dictdata.avp_basetype])) { | 2095 (avp->avp_public.avp_len - GETAVPHDRSZ( avp->avp_public.avp_flags ) != avp_value_sizes[dictdata.avp_basetype])) { |
2104 TRACE_DEBUG(INFO, "The AVP size is not suitable for the type:"); | 2096 TRACE_DEBUG(INFO, "The AVP size is not suitable for the type"); |
2105 fd_msg_dump_one(INFO, avp); | |
2106 if (error_info) { | 2097 if (error_info) { |
2107 error_info->pei_errcode = "DIAMETER_INVALID_AVP_LENGTH"; | 2098 error_info->pei_errcode = "DIAMETER_INVALID_AVP_LENGTH"; |
2108 error_info->pei_avp = avp; | 2099 error_info->pei_avp = avp; |
2109 snprintf(error_message, sizeof(error_message), "I expected a size of %d for this AVP according to my dictionary", avp_value_sizes[dictdata.avp_basetype]); | 2100 snprintf(error_message, sizeof(error_message), "I expected a size of %d for this AVP according to my dictionary", avp_value_sizes[dictdata.avp_basetype]); |
2110 error_info->pei_message = error_message; | 2101 error_info->pei_message = error_message; |
2102 } else { | |
2103 char * buf = NULL; | |
2104 size_t buflen; | |
2105 CHECK_MALLOC(fd_msg_dump_treeview(&buf, &buflen, NULL, avp, NULL, 0, 0)); | |
2106 LOG_E("Invalid length AVP: %s", buf); | |
2107 free(buf); | |
2111 } | 2108 } |
2112 avp->avp_model = NULL; | 2109 avp->avp_model = NULL; |
2113 return EBADMSG; | 2110 return EBADMSG; |
2114 } | 2111 } |
2115 | 2112 |