Navigation


Changeset 1019:6fcd30ce3ce7 in freeDiameter


Ignore:
Timestamp:
Apr 1, 2013, 5:16:28 PM (11 years ago)
Author:
Sebastien Decugis <sdecugis@freediameter.net>
Branch:
default
Phase:
public
Message:

Retrieve additional information when adding a routing error

Files:
4 edited

Legend:

Unmodified
Added
Removed
  • extensions/dbg_interactive/routing.i

    r1013 r1019  
    6666                fd_rtd_candidate_del($self, (os0_t)STRING, LENGTH);
    6767        }
    68         void error(char * peerid, size_t peeridlen, char * STRING, size_t LENGTH, uint32_t rcode) {
    69                 int ret =  fd_rtd_error_add($self, peerid, peeridlen, (os0_t)STRING, LENGTH, rcode);
    70                 if (ret != 0) {
    71                         DI_ERROR(ret, NULL, NULL);
    72                 }
     68        int error(char * peerid, size_t peeridlen, char * STRING, size_t LENGTH, uint32_t rcode) {
     69                int n;
     70                int ret =  fd_rtd_error_add($self, peerid, peeridlen, (os0_t)STRING, LENGTH, rcode, NULL, &n);
     71                if (ret != 0) {
     72                        DI_ERROR(ret, NULL, NULL);
     73                }
     74                return n;
    7375        }
    7476        struct fd_list * extract(int score = 0) {
  • extensions/rt_redirect/redir_fwd.c

    r740 r1019  
    238238        CHECK_FCT( fd_msg_rt_get(q, &rtd) );
    239239        CHECK_FCT( fd_msg_source_get( m, &nh, &nhlen ) );
    240         CHECK_FCT( fd_rtd_error_add(rtd, nh, nhlen, a_oh->os.data, a_oh->os.len, a_rc->u32) );
     240        CHECK_FCT( fd_rtd_error_add(rtd, nh, nhlen, a_oh->os.data, a_oh->os.len, a_rc->u32, NULL, NULL) );
    241241       
    242242        /* Create a redir_rule  */
  • include/freeDiameter/libfdproto.h

    r1014 r1019  
    20482048void fd_rtd_candidate_extract(struct rt_data * rtd, struct fd_list ** candidates, int ini_score);
    20492049
    2050 /* If a peer returned a protocol error for this message, save it so that we don't try to send it there again */
    2051 int  fd_rtd_error_add(struct rt_data * rtd, DiamId_t sentto, size_t senttolen, uint8_t * origin, size_t originsz, uint32_t rcode);
     2050/* If a peer returned a protocol error for this message, save it so that we don't try to send it there again. Optionally retrieve the current list of candidates. */
     2051int  fd_rtd_error_add(struct rt_data * rtd, DiamId_t sentto, size_t senttolen, uint8_t * origin, size_t originsz, uint32_t rcode, struct fd_list ** candidates, int * sendingattemtps);
    20522052
    20532053/* The extracted list items have the following structure: */
    20542054struct rtd_candidate {
    2055         struct fd_list  chain;  /* link in the list returned by the previous fct */
     2055        struct fd_list  chain;  /* link in the list returned by the previous fcts */
    20562056        DiamId_t        diamid; /* the diameter Id of the peer */
    20572057        size_t          diamidlen; /* cached size of the diamid string */
  • libfdproto/rt_data.c

    r740 r1019  
    4343/* Structure that contains the routing data for a message */
    4444struct rt_data {
    45         int             extracted;      /* if 0, candidates is ordered by diamid, otherwise the order is unspecified */
     45        int             extracted;      /* if 0, candidates is ordered by diamid, otherwise the order is unspecified. This also counts the number of times the message was (re-)sent, as a side effect */
    4646        struct fd_list  candidates;     /* All the candidates. Items are struct rtd_candidate. */
    4747        struct fd_list  errors;         /* All errors received from other peers for this message */
     
    185185/* If a peer returned a protocol error for this message, save it so that we don't try to send it there again.
    186186 Case insensitive search since the names are received from other peers*/
    187 int  fd_rtd_error_add(struct rt_data * rtd, DiamId_t sentto, size_t senttolen, uint8_t * origin, size_t originsz, uint32_t rcode)
     187int  fd_rtd_error_add(struct rt_data * rtd, DiamId_t sentto, size_t senttolen, uint8_t * origin, size_t originsz, uint32_t rcode, struct fd_list ** candidates, int * sendingattemtps)
    188188{
    189189        struct fd_list * li;
    190190        int match = 0;
    191191       
    192         TRACE_ENTRY("%p %p %zd %p %zd %u", rtd, sentto, senttolen, origin, originsz, rcode);
     192        TRACE_ENTRY("%p %p %zd %p %zd %u %p %p", rtd, sentto, senttolen, origin, originsz, rcode, candidates, sendingattemtps);
    193193        CHECK_PARAMS( rtd && sentto && senttolen ); /* origin may be NULL */
    194194       
     
    239239                fd_rtd_candidate_del(rtd, origin, originsz);
    240240       
     241        if (candidates)
     242                *candidates = &rtd->candidates;
     243       
     244        if (sendingattemtps)
     245                *sendingattemtps = rtd->extracted;
     246       
    241247        /* Done! */
    242248        return 0;
     
    260266        }
    261267       
    262         rtd->extracted = 1;
     268        rtd->extracted += 1;
    263269        return;
    264270}
Note: See TracChangeset for help on using the changeset viewer.