Navigation


Changeset 1425:b09f1b4c9fad in freeDiameter for include


Ignore:
Timestamp:
Feb 19, 2020, 8:26:29 AM (4 years ago)
Author:
Luke Mewburn <luke@mewburn.net>
Branch:
default
Phase:
public
committer:
Luke Mewburn <luke@mewburn.net> 1582068430 -39600
Message:

fd_msg_add_result: add function

Add fd_msg_add_result() as a superset of fd_msg_rescode_set()
to allow setting of either Result-Code or Experimental-Result (Grouped),
depending upon whether the supplied vendor is 0 or not.

Reimplement fd_msg_rescode_set() in terms of fd_msg_add_result().

File:
1 edited

Legend:

Unmodified
Added
Removed
  • include/freeDiameter/libfdcore.h

    r1397 r1425  
    553553
    554554/*
     555 * FUNCTION:    fd_msg_add_result
     556 *
     557 * PARAMETERS:
     558 *  msg         : A msg object -- it must be an answer.
     559 *  vendor      : Vendor. If 0, add Result-Code else add Experimental-Result.
     560 *  restype     : DICT_TYPE containing rescode (ex: from TYPE_BY_NAME "Enumerated(Result-Code)").
     561 *  rescode     : The name of the returned error code (ex: "DIAMETER_INVALID_AVP").
     562 *  errormsg    : (optional) human-readable error message to put in Error-Message AVP.
     563 *  optavp      : (optional) If provided, the content will be put inside a Failed-AVP.
     564 *  type_id     : 0 => nothing; 1 => adds Origin-Host and Origin-Realm with local info. 2=> adds Error-Reporting-Host.
     565 *
     566 * DESCRIPTION:
     567 *  This function adds a Result-Code AVP (if vendor is 0) or Experimental-Result AVP (vendor is not 0)
     568 *  to a message, and optionally
     569 *  - sets the 'E' error flag in the header,
     570 *  - adds Error-Message, Error-Reporting-Host and Failed-AVP AVPs.
     571 *
     572 * RETURN VALUE:
     573 *  0           : Operation complete.
     574 *  !0          : an error occurred.
     575 */
     576int fd_msg_add_result( struct msg * msg, vendor_id_t vendor, struct dict_object * restype, char * rescode, char * errormsg, struct avp * optavp, int type_id );
     577
     578/*
    555579 * FUNCTION:    fd_msg_rescode_set
    556580 *
     
    562586 *  type_id     : 0 => nothing; 1 => adds Origin-Host and Origin-Realm with local info. 2=> adds Error-Reporting-Host.
    563587 *
    564  * DESCRIPTION: 
    565  *   This function adds a Result-Code AVP to a message, and optionally
     588 * DESCRIPTION:
     589 *  This function adds a Result-Code AVP to a message, and optionally
    566590 *  - sets the 'E' error flag in the header,
    567591 *  - adds Error-Message, Error-Reporting-Host and Failed-AVP AVPs.
    568  *
    569  * RETURN VALUE:
    570  *  0           : Operation complete.
    571  *  !0          : an error occurred.
     592 *  Uses fd_msg_add_result with vendor 0 and restype for Enumerated(Result-Code).
     593 *
     594 * RETURN VALUE:
     595 *  0           : Operation complete.
     596 *  !0          : an error occurred.
    572597 */
    573598int fd_msg_rescode_set( struct msg * msg, char * rescode, char * errormsg, struct avp * optavp, int type_id );
Note: See TracChangeset for help on using the changeset viewer.