Navigation


Changeset 112:6a294d977878 in freeDiameter


Ignore:
Timestamp:
Dec 8, 2009, 3:24:34 PM (14 years ago)
Author:
Sebastien Decugis <sdecugis@nict.go.jp>
Branch:
default
Phase:
public
Message:

Default to add Session-Id in answers

Files:
5 edited

Legend:

Unmodified
Added
Removed
  • extensions/app_test/atst_serv.c

    r93 r112  
    6868        ans = *msg;
    6969       
    70         /* Set the Session-Id AVP */
    71         {
    72                 char * sid;
    73                 CHECK_FCT( fd_sess_getsid ( sess, &sid ) );
    74                 CHECK_FCT( fd_msg_avp_new ( atst_sess_id, 0, &avp ) );
    75                 val.os.data = sid;
    76                 val.os.len  = strlen(sid);
    77                 CHECK_FCT( fd_msg_avp_setvalue( avp, &val ) );
    78                 CHECK_FCT( fd_msg_avp_add( ans, MSG_BRW_FIRST_CHILD, avp ) );
    79                
    80         }
    8170        /* Set the Test-AVP AVP */
    8271        {
  • freeDiameter/dispatch.c

    r104 r112  
    192192                               
    193193                                /* Create an answer with the error code and message */
    194                                 CHECK_FCT_DO( fd_msg_new_answer_from_req ( fd_g_config->cnf_dict, &msg, MSGFL_ANSW_ERROR ), goto fatal_error );
     194                                CHECK_FCT_DO( fd_msg_new_answer_from_req ( fd_g_config->cnf_dict, &msg, 0 ), goto fatal_error );
    195195                                CHECK_FCT_DO( fd_msg_rescode_set(msg, (char *)ec, (char *)em, NULL, 1 ), goto fatal_error );
    196196                               
  • freeDiameter/p_dp.c

    r80 r112  
    9898                /* Now reply with a DPA */
    9999                CHECK_FCT( fd_msg_new_answer_from_req ( fd_g_config->cnf_dict, msg, 0 ) );
    100                 CHECK_FCT( fd_msg_rescode_set( *msg, "DIAMETER_SUCCESS", NULL, NULL, 0 ) );
    101                 CHECK_FCT( fd_msg_add_origin ( *msg, 0 ) );
     100                CHECK_FCT( fd_msg_rescode_set( *msg, "DIAMETER_SUCCESS", NULL, NULL, 1 ) );
    102101               
    103102                /* Move to CLOSING state to failover outgoing messages (and avoid failing the DPA...) */
  • include/freeDiameter/libfreeDiameter.h

    r90 r112  
    17231723#define MSGFL_ALLOC_ETEID       0x01    /* When creating a message, a new end-to-end ID is allocated and set in the message */
    17241724#define MSGFL_ANSW_ERROR        0x02    /* When creating an answer message, set the 'E' bit and use the generic error ABNF instead of command-specific ABNF */
    1725 #define MSGFL_MAX               MSGFL_ANSW_ERROR        /* The biggest valid flag value */
     1725#define MSGFL_ANSW_NOSID        0x04    /* When creating an answer message, do not add the Session-Id even if present in request */
     1726#define MSGFL_MAX               MSGFL_ANSW_NOSID        /* The biggest valid flag value */
    17261727
    17271728/**************************************************/
  • libfreeDiameter/messages.c

    r100 r112  
    287287        struct dict_object * model = NULL;
    288288        struct msg *qry, *ans;
     289        struct session * sess = NULL;
    289290       
    290291        TRACE_ENTRY("%p %x", msg, flags);
     
    294295        qry = *msg;
    295296        CHECK_PARAMS( CHECK_MSG(qry) && (qry->msg_public.msg_flags & CMD_FLAG_REQUEST) );
     297       
     298        if (! (flags & MSGFL_ANSW_NOSID)) {
     299                /* Get the session of the message */
     300                CHECK_FCT_DO( fd_msg_sess_get(dict, qry, &sess, NULL), /* ignore an error */ );
     301        }
    296302       
    297303        /* Find the model for the answer */
     
    316322        ans->msg_public.msg_hbhid = qry->msg_public.msg_hbhid;
    317323       
     324        /* Add the Session-Id AVP if session is known */
     325        if (sess && dict) {
     326                struct dict_object * sess_id_avp;
     327                char * sid;
     328                struct avp * avp;
     329                union avp_value val;
     330               
     331                CHECK_FCT( fd_dict_search( dict, DICT_AVP, AVP_BY_NAME, "Session-Id", &sess_id_avp, ENOENT) );
     332                CHECK_FCT( fd_sess_getsid ( sess, &sid ) );
     333                CHECK_FCT( fd_msg_avp_new ( sess_id_avp, 0, &avp ) );
     334                val.os.data = sid;
     335                val.os.len  = strlen(sid);
     336                CHECK_FCT( fd_msg_avp_setvalue( avp, &val ) );
     337                CHECK_FCT( fd_msg_avp_add( ans, MSG_BRW_FIRST_CHILD, avp ) );
     338        }
     339       
    318340        /* associate with query */
    319          /* may do  CHECK_FCT(  msg_answ_associate( *msg, (msg_t *)qry )  ); but this is quicker */
    320341        ans->msg_query = qry;
    321342       
Note: See TracChangeset for help on using the changeset viewer.