Navigation


Changeset 1245:4b511d9b3def in freeDiameter for extensions


Ignore:
Timestamp:
Nov 11, 2013, 4:30:26 PM (10 years ago)
Author:
Sebastien Decugis <sdecugis@freediameter.net>
Branch:
default
Phase:
public
Message:

Change default dump of peer connection, add more options to the dbg_msg_dumps extensions

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/dbg_msg_dumps/dbg_msg_dumps.c

    r1244 r1245  
    5353#define HK_ROUTING_QUIET   0x0100        /* routing decisions are not dumped -- removes the default handling as well */
    5454#define HK_ROUTING_COMPACT 0x0200        /* routing decisions in compact mode */
     55#define HK_ROUTING_FULL    0x0400        /* routing decisions in full mode */
     56#define HK_ROUTING_TREE    0x0800        /* routing decisions in tree mode */
    5557
    5658#define HK_PEERS_QUIET     0x1000        /* peers connections events are not dumped -- removes the default handling as well */
    5759#define HK_PEERS_COMPACT   0x2000        /* peers connections events in compact mode */
     60#define HK_PEERS_FULL      0x4000        /* peers connections events in full mode */
     61#define HK_PEERS_TREE      0x8000        /* peers connections events in tree mode */
    5862/*
    59 Default value is HK_ERRORS_DETAIL + HK_SNDRCV_DETAIL + HK_PEERS_COMPACT
     63Default value is HK_ERRORS_TREE + HK_SNDRCV_TREE + HK_PEERS_TREE
    6064*/
    6165
     
    6367
    6468static struct fd_hook_hdl *md_hdl[4] = {NULL,NULL,NULL,NULL};
    65 static uint32_t dump_level = HK_ERRORS_TREE | HK_SNDRCV_TREE | HK_PEERS_COMPACT; /* default */
     69static uint32_t dump_level = HK_ERRORS_TREE | HK_SNDRCV_TREE | HK_PEERS_TREE; /* default */
    6670static char * buf = NULL;
    6771static size_t len;
     
    120124                break;
    121125       
    122 /* The following are not received in this hook */
     126/* routing */
    123127        case HOOK_MESSAGE_LOCAL:
     128                LOG_N("ISSUED:");
     129                LOG_SPLIT(FD_LOG_NOTICE, "     ", buf, NULL);
     130                break;
    124131        case HOOK_MESSAGE_ROUTING_FORWARD:
     132                LOG_N("FORWARDING: %s", buf);
     133                LOG_SPLIT(FD_LOG_NOTICE, "     ", buf, NULL);
     134                break;
    125135        case HOOK_MESSAGE_ROUTING_LOCAL:
    126        
     136                LOG_N("DISPATCHING: %s", buf);
     137                LOG_SPLIT(FD_LOG_NOTICE, "     ", buf, NULL);
     138                break;
     139       
     140/* peers */
    127141        case HOOK_PEER_CONNECT_FAILED:
     142                LOG_N("CONNECT FAILED to %s: %s", peer_name, (char *)other);
     143                break;
    128144        case HOOK_PEER_CONNECT_SUCCESS:
    129 
     145                {
     146                        char protobuf[40];
     147                        if (peer) {
     148                                CHECK_FCT_DO(fd_peer_cnx_proto_info(peer, protobuf, sizeof(protobuf)), break );
     149                        } else {
     150                                protobuf[0] = '-';
     151                                protobuf[1] = '\0';
     152                        }
     153                        LOG_N("CONNECTED TO '%s' (%s):", peer_name, protobuf);
     154                        LOG_SPLIT(FD_LOG_NOTICE, "     ", buf, NULL);
     155                }
     156                break;
     157
     158/* Not handled */
    130159        case HOOK_DATA_RECEIVED:
    131160                break;
     
    180209                break;
    181210       
    182 /* The following are not received in this hook */
     211/* routing */
    183212        case HOOK_MESSAGE_LOCAL:
     213                LOG_N("ISSUED: %s", buf);
     214                break;
    184215        case HOOK_MESSAGE_ROUTING_FORWARD:
     216                LOG_N("FORWARDING: %s", buf);
     217                break;
    185218        case HOOK_MESSAGE_ROUTING_LOCAL:
    186        
     219                LOG_N("DISPATCHING: %s", buf);
     220                break;
     221       
     222/* peers */
    187223        case HOOK_PEER_CONNECT_FAILED:
    188         case HOOK_PEER_CONNECT_SUCCESS:
    189 
     224                LOG_N("CONNECT FAILED to %s: %s", peer_name, (char *)other);
     225                break;
     226        case HOOK_PEER_CONNECT_SUCCESS: {
     227                        char protobuf[40];
     228                        if (peer) {
     229                                CHECK_FCT_DO(fd_peer_cnx_proto_info(peer, protobuf, sizeof(protobuf)), break );
     230                        } else {
     231                                protobuf[0] = '-';
     232                                protobuf[1] = '\0';
     233                        }
     234                        LOG_N("CONNECTED TO '%s' (%s): %s", peer_name, protobuf, buf);
     235                }
     236                break;
     237/* Not handled */
    190238        case HOOK_DATA_RECEIVED:
    191239                break;
     
    310358        mask_full  = (dump_level & HK_ERRORS_FULL)  ? mask_errors : 0;
    311359        mask_full |= (dump_level & HK_SNDRCV_FULL)  ? mask_sndrcv : 0;
     360        mask_full |= (dump_level & HK_ROUTING_FULL) ? mask_routing : 0;
     361        mask_full |= (dump_level & HK_PEERS_FULL)   ? mask_peers : 0;
    312362       
    313363        mask_tree  = (dump_level & HK_ERRORS_TREE)  ? mask_errors : 0;
    314364        mask_tree |= (dump_level & HK_SNDRCV_TREE)  ? mask_sndrcv : 0;
     365        mask_tree |= (dump_level & HK_ROUTING_TREE) ? mask_routing : 0;
     366        mask_tree |= (dump_level & HK_PEERS_TREE)   ? mask_peers : 0;
    315367       
    316368        if (mask_quiet) {
Note: See TracChangeset for help on using the changeset viewer.