Navigation


Changes in / [1082:b380c9f3be1e:1081:758b21ae6c3e] in freeDiameter


Ignore:
Files:
3 deleted
12 edited

Legend:

Unmodified
Added
Removed
  • extensions/app_diameap/diameap_eap.c

    r1075 r1052  
    373373                case EAP_INTEGRITY_CHECK:
    374374                        if ((*eap_sm->selectedMethod->eap_method_check)(eap_sm,
    375                                         &eap_i->aaaEapRespData) == FALSE)
     375                                        eap_i->aaaEapRespData) == FALSE)
    376376                        {
    377377                                TRACE_DEBUG(INFO,"%s[EAP Protocol] Invalid EAP packet received {Type=%d, Vendor=%d}. Integrity check failed (non fatal error).",DIAMEAP_EXTENSION,eap_sm->currentMethod,eap_sm->currentVendor);
     
    434434                        }
    435435                        if ((*eap_sm->selectedMethod->eap_method_process)(eap_sm,
    436                                         &eap_i->aaaEapRespData))
     436                                        eap_i->aaaEapRespData))
    437437                        {
    438438                                TRACE_DEBUG(INFO,"%s[EAP Protocol] [%s plugin] Authentication process failed.",DIAMEAP_EXTENSION,eap_sm->selectedMethod->methodname);
  • extensions/app_diameap/diameap_plugins.c

    r1075 r1052  
    263263                {
    264264                        plugin->eap_method_check = (boolean(*)(struct eap_state_machine *,
    265                                         struct eap_packet*)) dlsym(plugin->handler,
     265                                        struct eap_packet)) dlsym(plugin->handler,
    266266                                        registerplugin->check);
    267267                        if (plugin->eap_method_check == NULL)
     
    285285                {
    286286                        plugin->eap_method_process = (int(*)(struct eap_state_machine *,
    287                                         struct eap_packet*)) dlsym(plugin->handler,
     287                                        struct eap_packet)) dlsym(plugin->handler,
    288288                                        registerplugin->process);
    289289                        if (plugin->eap_method_process == NULL)
  • extensions/app_diameap/libdiameap.h

    r1075 r610  
    110110        int (*eap_method_getTimeout)(struct eap_state_machine *smd, int * timeout); /* address of the eap_method_getTimeout method */
    111111        boolean (*eap_method_check)(struct eap_state_machine *smd,
    112                         struct eap_packet * eapRespData); /* address of the eap_method_check method */
     112                        struct eap_packet eapRespData); /* address of the eap_method_check method */
    113113        int (*eap_method_process)(struct eap_state_machine *smd,
    114                         struct eap_packet * eapRespData); /* address of the eap_method_process method */
     114                        struct eap_packet eapRespData); /* address of the eap_method_process method */
    115115        boolean (*eap_method_isDone)(struct eap_state_machine *smd); /* address of the eap_method_isDone method */
    116116        int (*eap_method_getKey)(struct eap_state_machine *smd, u8 ** msk,int *msklength,
  • extensions/dbg_interactive/queues.i

    r1071 r1060  
    6666        /* Get the length of the queue (nb elements) */
    6767        int length() {
    68                 return fd_fifo_length ( $self ) ;
     68                int l;
     69                int ret = fd_fifo_length ( $self, &l, NULL );
     70                if (ret != 0) {
     71                        DI_ERROR(ret, NULL, NULL);
     72                }
     73                return l;
    6974        }
    7075
  • extensions/dbg_monitor/dbg_monitor.c

    r1075 r974  
    5050EXTENSION_ENTRY("dbg_monitor", monitor_main);
    5151
    52 
    53 
    54 /* Display information about a queue */
    55 static void display_info(char * queue_desc, char * peer, int current_count, int limit_count, int highest_count, long long total_count,
    56                         struct timespec * total, struct timespec * blocking, struct timespec * last)
    57 {
    58         long long ms = (total->tv_sec * 1000000) + (total->tv_nsec / 1000);
    59         long double throughput = (long double)total_count * 1000000;
    60         throughput /= ms;
    61         if (peer) {
    62                 TRACE_DEBUG(INFO, "'%s'@'%s': cur:%d/%d, h:%d, T:%lld in %ld.%06lds (%.2LFitems/s), blocked:%ld.%06lds, last processing:%ld.%06lds",
    63                         queue_desc, peer, current_count, limit_count, highest_count,
    64                         total_count, total->tv_sec, total->tv_nsec, throughput,
    65                         blocking->tv_sec, blocking->tv_nsec, last->tv_sec, last->tv_nsec);
    66         } else {
    67                 TRACE_DEBUG(INFO, "Global '%s': cur:%d/%d, h:%d, T:%lld in %ld.%06lds (%.2LFitems/s), blocked:%ld.%06lds, last processing:%ld.%06lds",
    68                         queue_desc, current_count, limit_count, highest_count,
    69                         total_count, total->tv_sec, total->tv_nsec, throughput,
    70                         blocking->tv_sec, blocking->tv_nsec, last->tv_sec, last->tv_nsec);
    71         }
    72 }
    73 
    7452/* Thread to display periodical debug information */
    7553static pthread_t thr;
     
    8159        /* Loop */
    8260        while (1) {
    83                 int current_count, limit_count, highest_count;
    84                 long long total_count;
    85                 struct timespec total, blocking, last;
    86                 struct fd_list * li;
    87        
    8861                #ifdef DEBUG
    8962                for (i++; i % 30; i++) {
     
    9265                }
    9366                #else /* DEBUG */
    94                 sleep(3599); /* 1 hour */
     67                sleep(3600); /* 1 hour */
    9568                #endif /* DEBUG */
    96                 TRACE_DEBUG(INFO, "[dbg_monitor] Dumping queues statistics");
    97                
    98                 CHECK_FCT_DO( fd_stat_getstats(STAT_G_LOCAL, NULL, &current_count, &limit_count, &highest_count, &total_count, &total, &blocking, &last), );
    99                 display_info("Local delivery", NULL, current_count, limit_count, highest_count, total_count, &total, &blocking, &last);
    100                
    101                 CHECK_FCT_DO( fd_stat_getstats(STAT_G_INCOMING, NULL, &current_count, &limit_count, &highest_count, &total_count, &total, &blocking, &last), );
    102                 display_info("Total received", NULL, current_count, limit_count, highest_count, total_count, &total, &blocking, &last);
    103                
    104                 CHECK_FCT_DO( fd_stat_getstats(STAT_G_OUTGOING, NULL, &current_count, &limit_count, &highest_count, &total_count, &total, &blocking, &last), );
    105                 display_info("Total sending", NULL, current_count, limit_count, highest_count, total_count, &total, &blocking, &last);
    106                
    107                
    108                 CHECK_FCT_DO( pthread_rwlock_rdlock(&fd_g_peers_rw), /* continue */ );
    109 
    110                 for (li = fd_g_peers.next; li != &fd_g_peers; li = li->next) {
    111                         struct peer_hdr * p = (struct peer_hdr *)li->o;
    112                        
    113                         fd_peer_dump(p, NONE);
    114                        
    115                         CHECK_FCT_DO( fd_stat_getstats(STAT_P_PSM, p, &current_count, &limit_count, &highest_count, &total_count, &total, &blocking, &last), );
    116                         display_info("Events, incl. recept", p->info.pi_diamid, current_count, limit_count, highest_count, total_count, &total, &blocking, &last);
    117                        
    118                         CHECK_FCT_DO( fd_stat_getstats(STAT_P_TOSEND, p, &current_count, &limit_count, &highest_count, &total_count, &total, &blocking, &last), );
    119                         display_info("Outgoing", p->info.pi_diamid, current_count, limit_count, highest_count, total_count, &total, &blocking, &last);
    120                        
    121                 }
    122 
    123                 CHECK_FCT_DO( pthread_rwlock_unlock(&fd_g_peers_rw), /* continue */ );
    124 
    125                
    126                
     69                fd_log_debug("[dbg_monitor] Dumping current information");
     70                CHECK_FCT_DO(fd_event_send(fd_g_config->cnf_main_ev, FDEV_DUMP_QUEUES, 0, NULL), /* continue */);
    12771                CHECK_FCT_DO(fd_event_send(fd_g_config->cnf_main_ev, FDEV_DUMP_SERV, 0, NULL), /* continue */);
     72                CHECK_FCT_DO(fd_event_send(fd_g_config->cnf_main_ev, FDEV_DUMP_PEERS, 0, NULL), /* continue */);
    12873                sleep(1);
    12974        }
  • include/freeDiameter/libfdcore.h

    r1077 r1069  
    861861/*============================================================*/
    862862
    863 /* These functions allow an extension to collect state information about the
    864  * framework, as well as being hooked at some key checkpoints in the processing
     863/* These functions allows an extension to collect state information about the
     864 * framework state, as well as hooks at some key checkpoints in the processing
    865865 * for logging / statistics purpose.
    866866 */
     
    10971097 *  stat          : Which queue is being queried
    10981098 *  peer          : (depending on the stat parameter) which peer is being queried
    1099  *  current_count : (out) The number of items in the queue currently
    1100  *  limit_count   : (out) The max number of items the queue accepts before becoming blocking -- 0 means no max.
     1099 *  len          : (out) The number of items in the queue currently
     1100 *  max           : (out) The max number of items the queue accepts before becoming blocking -- 0 means no max.
    11011101 *  highest_count : (out) The highest count the queue has reached since startup
    11021102 *  total_count   : (out) Total number of items that this queue has processed (always growing, use deltas for monitoring)
     
    11141114 */
    11151115int fd_stat_getstats(enum fd_stat_type stat, struct peer_hdr * peer,
    1116                         int * current_count, int * limit_count, int * highest_count, long long * total_count,
     1116                        int * len, int * max, int * highest_count, long long * total_count,
    11171117                        struct timespec * total, struct timespec * blocking, struct timespec * last);
    11181118
  • include/freeDiameter/libfdproto.h

    r1082 r1078  
    29892989
    29902990/*
     2991 * FUNCTION:    fd_fifo_length
     2992 *
     2993 * PARAMETERS:
     2994 *  queue       : The queue from which to retrieve the number of elements.
     2995 *  length      : Upon success, the current number of elements in the queue is stored here.
     2996 *  max         : the maximum number of elements as specified during creation. Can be NULL.
     2997 *
     2998 * DESCRIPTION:
     2999 *  Retrieve the number of elements in a queue.
     3000 *
     3001 * RETURN VALUE:
     3002 *  0           : The length of the queue has been written.
     3003 *  EINVAL      : A parameter is invalid.
     3004 */
     3005int fd_fifo_length ( struct fifo * queue, int * length, int * max);
     3006int fd_fifo_length_noerr ( struct fifo * queue ); /* no error checking version */
     3007
     3008/*
    29913009 * FUNCTION:    fd_fifo_getstats
    29923010 *
    29933011 * PARAMETERS:
    2994  *  queue         : The queue from which to retrieve the information.
    2995  *  current_count : How many items in the queue at the time of execution. This changes each time an item is pushed or poped.
    2996  *  limit_count   : The maximum number of items allowed in this queue. This is specified during queue creation.
    2997  *  highest_count : The maximum number of items this queue has contained. This enables to see if limit_count count was reached.
    2998  *  total_count   : the total number of items that went through the queue (already pop'd). Always increasing.
    2999  *  total         : Cumulated time all items spent in this queue, including blocking time (always growing, use deltas for monitoring)
    3000  *  blocking      : Cumulated time threads trying to post new items were blocked (queue full).
    3001  *  last          : For the last element retrieved from the queue, how long it take between posting (including blocking) and poping
     3012 *  queue       : The queue from which to retrieve the timings information.
     3013 *  items       : the total number of items that went through the queue (already pop'd). Always increasing.
     3014 *  total       : Cumulated time all items spent in this queue, including blocking time (always growing, use deltas for monitoring)
     3015 *  blocking    : Cumulated time threads trying to post new items were blocked (queue full).
     3016 *  last        : For the last element retrieved from the queue, how long it take between posting (including blocking) and poping
    30023017 * 
    30033018 * DESCRIPTION:
     
    30083023 *  EINVAL      : A parameter is invalid.
    30093024 */
    3010 int fd_fifo_getstats( struct fifo * queue, int * current_count, int * limit_count, int * highest_count, long long * total_count,
    3011                                            struct timespec * total, struct timespec * blocking, struct timespec * last);
    3012 
    3013 /*
    3014  * FUNCTION:    fd_fifo_length
    3015  *
    3016  * PARAMETERS:
    3017  *  queue       : The queue from which to retrieve the number of elements.
    3018  *
    3019  * DESCRIPTION:
    3020  *  Retrieve the number of elements in a queue, without error checking.
    3021  *
    3022  * RETURN VALUE:
    3023  *  The number of items currently queued.
    3024  */
    3025 int fd_fifo_length ( struct fifo * queue );
     3025int fd_fifo_getstats( struct fifo * queue, long long *items, struct timespec * total, struct timespec * blocking, struct timespec * last);
     3026
    30263027
    30273028/*
  • libfdcore/CMakeLists.txt

    r1077 r668  
    1818        events.c
    1919        extensions.c
    20         fifo_stats.c
    21         hooks.c
    2220        dict_base_proto.c
    2321        messages.c
  • libfdproto/fifo.c

    r1073 r1067  
    152152                for (li = queue->list.next; li != &queue->list; li = li->next) {
    153153                        struct fifo_item * fi = (struct fifo_item *)li;
    154                         fd_log_debug("  [%i] item %p in fifo %p, posted:%ld.%06ld",
     154                        fd_log_debug("  [%i] item %p in fifo %p, posted:ld.%06ld",
    155155                                i++, fi->item.o, queue, (long)fi->posted_on.tv_sec,(long)(fi->posted_on.tv_nsec/1000));
    156156                        (*dump_item)(level, fi->item.o);
     
    284284}
    285285
    286 /* Get the information on the queue */
    287 int fd_fifo_getstats( struct fifo * queue, int * current_count, int * limit_count, int * highest_count, long long * total_count,
    288                                            struct timespec * total, struct timespec * blocking, struct timespec * last)
    289 {
    290         TRACE_ENTRY( "%p %p %p %p %p %p %p %p", queue, current_count, limit_count, highest_count, total_count, total, blocking, last);
     286/* Get the length of the queue */
     287int fd_fifo_length ( struct fifo * queue, int * length, int * max )
     288{
     289        TRACE_ENTRY( "%p %p %p", queue, length, max );
     290       
     291        /* Check the parameters */
     292        CHECK_PARAMS( CHECK_FIFO( queue ) && length );
     293       
     294        /* lock the queue */
     295        CHECK_POSIX(  pthread_mutex_lock( &queue->mtx )  );
     296       
     297        /* Retrieve the count */
     298        *length = queue->count;
     299       
     300        if (max)
     301                *max = queue->max;
     302       
     303        /* Unlock */
     304        CHECK_POSIX(  pthread_mutex_unlock( &queue->mtx )  );
     305       
     306        /* Done */
     307        return 0;
     308}
     309
     310/* Get the timings */
     311int fd_fifo_getstats( struct fifo * queue, long long *items, struct timespec * total, struct timespec * blocking, struct timespec * last)
     312{
     313        TRACE_ENTRY( "%p %p %p %p %p", queue, items, total, blocking, last);
    291314       
    292315        /* Check the parameters */
     
    296319        CHECK_POSIX(  pthread_mutex_lock( &queue->mtx )  );
    297320       
    298         if (current_count)
    299                 *current_count = queue->count;
    300        
    301         if (limit_count)
    302                 *limit_count = queue->max;
    303        
    304         if (highest_count)
    305                 *highest_count = queue->highest_ever;
    306        
    307         if (total_count)
    308                 *total_count = queue->total_items;
     321        if (items)
     322                *items = queue->total_items;
    309323       
    310324        if (total)
     
    326340
    327341/* alternate version with no error checking */
    328 int fd_fifo_length ( struct fifo * queue )
     342int fd_fifo_length_noerr ( struct fifo * queue )
    329343{
    330344        if ( !CHECK_FIFO( queue ) )
  • libfdproto/ostr.c

    r1070 r1068  
    188188int fd_os_validate_DiameterIdentity(char ** id, size_t * inoutsz, int memory)
    189189{
    190 #if !defined(DIAMID_IDNA_IGNORE) && !defined(DIAMID_IDNA_REJECT)
     190#if defined(DIAMID_IDNA_IGNORE) || defined(DIAMID_IDNA_REJECT)
    191191        int gotsize = 0;
    192192#endif /* defined(DIAMID_IDNA_IGNORE) || defined(DIAMID_IDNA_REJECT) */
     
    197197        if (!*inoutsz)
    198198                *inoutsz = strlen(*id);
    199 #if !defined(DIAMID_IDNA_IGNORE) && !defined(DIAMID_IDNA_REJECT)
     199#if defined(DIAMID_IDNA_IGNORE) || defined(DIAMID_IDNA_REJECT)
    200200        else
    201201                gotsize = 1;
  • tests/CMakeLists.txt

    r1076 r1031  
    2626        testdict
    2727        testmesg
    28         testmesg_stress
    2928        testsess
    3029        testdisp
  • tests/testfifo.c

    r1071 r1060  
    217217        {
    218218                struct fifo * queue = NULL;
     219                int count, max;
    219220                struct msg * msg  = NULL;
    220                 int max;
    221                 long long count;
    222221               
    223222                /* Create the queue */
     
    225224               
    226225                /* Check the count is 0 */
    227                 CHECK( 0, fd_fifo_length(queue) );
     226                CHECK( 0, fd_fifo_length(queue, &count, &max) );
     227                CHECK( 0, count);
     228                CHECK( 0, max);
    228229               
    229230                /* Now enqueue */
     
    236237               
    237238                /* Check the count is 3 */
    238                 CHECK( 3, fd_fifo_length(queue) );
     239                CHECK( 0, fd_fifo_length(queue, &count, &max) );
     240                CHECK( 3, count);
     241                CHECK( 0, max);
    239242               
    240243                /* Retrieve the first message using fd_fifo_get */
    241244                CHECK( 0, fd_fifo_get(queue, &msg) );
    242245                CHECK( msg1, msg);
    243                 CHECK( 2, fd_fifo_length(queue) );
     246                CHECK( 0, fd_fifo_length(queue, &count, NULL) );
     247                CHECK( 2, count);
    244248               
    245249                /* Retrieve the second message using fd_fifo_timedget */
     
    248252                CHECK( 0, fd_fifo_timedget(queue, &msg, &ts) );
    249253                CHECK( msg2, msg);
    250                 CHECK( 1, fd_fifo_length(queue) );
     254                CHECK( 0, fd_fifo_length(queue, &count, NULL) );
     255                CHECK( 1, count);
    251256               
    252257                /* Retrieve the third message using meq_tryget */
    253258                CHECK( 0, fd_fifo_tryget(queue, &msg) );
    254259                CHECK( msg3, msg);
    255                 CHECK( 0, fd_fifo_length(queue) );
     260                CHECK( 0, fd_fifo_length(queue, &count, NULL) );
     261                CHECK( 0, count);
    256262               
    257263                /* Check that another meq_tryget does not block */
    258264                CHECK( EWOULDBLOCK, fd_fifo_tryget(queue, &msg) );
    259                 CHECK( 0, fd_fifo_length(queue) );
     265                CHECK( 0, fd_fifo_length(queue, &count, NULL) );
     266                CHECK( 0, count);
    260267               
    261268                /* Check the timedget actually timesout */
     
    267274                }
    268275                CHECK( ETIMEDOUT, fd_fifo_timedget(queue, &msg, &ts) );
    269                 CHECK( 0, fd_fifo_length(queue) );
    270                
    271                 /* Post & get another message */
    272                 msg = msg1;
    273                 CHECK( 0, fd_fifo_post(queue, &msg) );
    274                 CHECK( 0, fd_fifo_timedget(queue, &msg, &ts) );
    275                 CHECK( msg1, msg);             
    276                
    277                 /* Check some statistics */
    278                 CHECK( 0, fd_fifo_getstats(queue, NULL, NULL, &max, &count, NULL, NULL, NULL) );
    279                 CHECK( 3, max );
    280                 CHECK( 4, count );     
     276                CHECK( 0, fd_fifo_length(queue, &count, NULL) );
     277                CHECK( 0, count);
    281278               
    282279                /* We're done for basic tests */
     
    295292                pthread_t                thr [NBR_THREADS * 2];
    296293                struct dict_object      *dwr_model = NULL;
     294                int                      count;
    297295                int                      i;
    298296                int                      nbr_threads;
     
    365363               
    366364                /* Check the count of the queue is back to 0 */
    367                 CHECK( 0, fd_fifo_length(queue) );
     365                CHECK( 0, fd_fifo_length(queue, &count, NULL) );
     366                CHECK( 0, count);
    368367               
    369368                /* Destroy this queue and the messages */
Note: See TracChangeset for help on using the changeset viewer.