Navigation


Changeset 889:4a299daed8b2 in freeDiameter for libfdproto


Ignore:
Timestamp:
Nov 18, 2012, 6:52:50 AM (11 years ago)
Author:
Sebastien Decugis <sdecugis@freediameter.net>
Branch:
default
Phase:
public
Message:

Add information about parsing errors

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libfdproto/messages.c

    r871 r889  
    16861686static int parsedict_do_chain(struct dictionary * dict, struct fd_list * head, int mandatory, struct fd_pei *error_info);
    16871687
     1688static char error_message[256];
     1689
    16881690/* Process an AVP. If we are not in recheck, the avp_source must be set. */
    16891691static int parsedict_do_avp(struct dictionary * dict, struct avp * avp, int mandatory, struct fd_pei *error_info)
     
    17691771        if ((avp_value_sizes[dictdata.avp_basetype] != 0) &&
    17701772            (avp->avp_public.avp_len - GETAVPHDRSZ( avp->avp_public.avp_flags ) != avp_value_sizes[dictdata.avp_basetype])) {
    1771                 TRACE_DEBUG(INFO, "The AVP size is not suitable for the type.");
     1773                TRACE_DEBUG(INFO, "The AVP size is not suitable for the type:");
     1774                fd_msg_dump_one(INFO, avp);
    17721775                if (error_info) {
    17731776                        error_info->pei_errcode = "DIAMETER_INVALID_AVP_LENGTH";
    17741777                        error_info->pei_avp = avp;
     1778                        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]);
     1779                        error_info->pei_message = error_message;
    17751780                }
    17761781                return EBADMSG;
     
    17881793                                                error_info->pei_errcode = "DIAMETER_INVALID_AVP_VALUE";
    17891794                                                error_info->pei_avp = avp;
     1795                                                snprintf(error_message, sizeof(error_message), "I cannot parse this AVP as a Grouped AVP");
     1796                                                error_info->pei_message = error_message;
    17901797                                        }
    17911798                                        return ret;
Note: See TracChangeset for help on using the changeset viewer.