annotate extensions/dbg_msg_dumps/dbg_msg_dumps.c @ 1244:24a03140a6aa

Bug: parameters for peers were not taken into account
author Sebastien Decugis <sdecugis@freediameter.net>
date Mon, 11 Nov 2013 15:14:08 +0800
parents a4cdde705f30
children 4b511d9b3def
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1126
d6e18ebca0c5 New extension dbg_msg_dumps for debug / learning.
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
1 /*********************************************************************************************************
d6e18ebca0c5 New extension dbg_msg_dumps for debug / learning.
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
2 * Software License Agreement (BSD License) *
d6e18ebca0c5 New extension dbg_msg_dumps for debug / learning.
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
3 * Author: Sebastien Decugis <sdecugis@freediameter.net> *
d6e18ebca0c5 New extension dbg_msg_dumps for debug / learning.
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
4 * *
d6e18ebca0c5 New extension dbg_msg_dumps for debug / learning.
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
5 * Copyright (c) 2013, WIDE Project and NICT *
d6e18ebca0c5 New extension dbg_msg_dumps for debug / learning.
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
6 * All rights reserved. *
d6e18ebca0c5 New extension dbg_msg_dumps for debug / learning.
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
7 * *
d6e18ebca0c5 New extension dbg_msg_dumps for debug / learning.
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
8 * Redistribution and use of this software in source and binary forms, with or without modification, are *
d6e18ebca0c5 New extension dbg_msg_dumps for debug / learning.
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
9 * permitted provided that the following conditions are met: *
d6e18ebca0c5 New extension dbg_msg_dumps for debug / learning.
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
10 * *
d6e18ebca0c5 New extension dbg_msg_dumps for debug / learning.
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
11 * * Redistributions of source code must retain the above *
d6e18ebca0c5 New extension dbg_msg_dumps for debug / learning.
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
12 * copyright notice, this list of conditions and the *
d6e18ebca0c5 New extension dbg_msg_dumps for debug / learning.
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
13 * following disclaimer. *
d6e18ebca0c5 New extension dbg_msg_dumps for debug / learning.
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
14 * *
d6e18ebca0c5 New extension dbg_msg_dumps for debug / learning.
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
15 * * Redistributions in binary form must reproduce the above *
d6e18ebca0c5 New extension dbg_msg_dumps for debug / learning.
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
16 * copyright notice, this list of conditions and the *
d6e18ebca0c5 New extension dbg_msg_dumps for debug / learning.
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
17 * following disclaimer in the documentation and/or other *
d6e18ebca0c5 New extension dbg_msg_dumps for debug / learning.
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
18 * materials provided with the distribution. *
d6e18ebca0c5 New extension dbg_msg_dumps for debug / learning.
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
19 * *
d6e18ebca0c5 New extension dbg_msg_dumps for debug / learning.
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
20 * * Neither the name of the WIDE Project or NICT nor the *
d6e18ebca0c5 New extension dbg_msg_dumps for debug / learning.
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
21 * names of its contributors may be used to endorse or *
d6e18ebca0c5 New extension dbg_msg_dumps for debug / learning.
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
22 * promote products derived from this software without *
d6e18ebca0c5 New extension dbg_msg_dumps for debug / learning.
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
23 * specific prior written permission of WIDE Project and *
d6e18ebca0c5 New extension dbg_msg_dumps for debug / learning.
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
24 * NICT. *
d6e18ebca0c5 New extension dbg_msg_dumps for debug / learning.
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
25 * *
d6e18ebca0c5 New extension dbg_msg_dumps for debug / learning.
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
26 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED *
d6e18ebca0c5 New extension dbg_msg_dumps for debug / learning.
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
27 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
d6e18ebca0c5 New extension dbg_msg_dumps for debug / learning.
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
28 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR *
d6e18ebca0c5 New extension dbg_msg_dumps for debug / learning.
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
29 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT *
d6e18ebca0c5 New extension dbg_msg_dumps for debug / learning.
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
30 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS *
d6e18ebca0c5 New extension dbg_msg_dumps for debug / learning.
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
31 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR *
d6e18ebca0c5 New extension dbg_msg_dumps for debug / learning.
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
32 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF *
d6e18ebca0c5 New extension dbg_msg_dumps for debug / learning.
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
33 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
d6e18ebca0c5 New extension dbg_msg_dumps for debug / learning.
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
34 *********************************************************************************************************/
d6e18ebca0c5 New extension dbg_msg_dumps for debug / learning.
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
35
d6e18ebca0c5 New extension dbg_msg_dumps for debug / learning.
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
36 /* This extension uses the hooks mechanism to display the full content of received and sent messages, for
d6e18ebca0c5 New extension dbg_msg_dumps for debug / learning.
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
37 learning & debugging purpose.
d6e18ebca0c5 New extension dbg_msg_dumps for debug / learning.
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
38 Do NOT use this extension in production environment because it will slow down all operation. */
1204
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
39
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
40 /* You can add a configuration parameter on the LoadExtension line, e.g.
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
41 LoadExtension="dbg_msg_dump.fdx":"0x149";
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
42 The value is an hexadecimal value with the following bits meaning: */
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
43 #define HK_ERRORS_QUIET 0x0001 /* errors are not dumped -- removes the default handling as well */
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
44 #define HK_ERRORS_COMPACT 0x0002 /* errors in compact mode */
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
45 #define HK_ERRORS_FULL 0x0004 /* errors in full mode (1 line with all the data) */
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
46 #define HK_ERRORS_TREE 0x0008 /* errors in treeview mode (message split over multiple lines) */
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
47
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
48 #define HK_SNDRCV_QUIET 0x0010 /* send+rcv are not dumped -- removes the default handling as well */
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
49 #define HK_SNDRCV_COMPACT 0x0020 /* send+rcv in compact mode */
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
50 #define HK_SNDRCV_FULL 0x0040 /* send+rcv in full mode */
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
51 #define HK_SNDRCV_TREE 0x0080 /* send+rcv in tree mode */
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
52
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
53 #define HK_ROUTING_QUIET 0x0100 /* routing decisions are not dumped -- removes the default handling as well */
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
54 #define HK_ROUTING_COMPACT 0x0200 /* routing decisions in compact mode */
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
55
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
56 #define HK_PEERS_QUIET 0x1000 /* peers connections events are not dumped -- removes the default handling as well */
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
57 #define HK_PEERS_COMPACT 0x2000 /* peers connections events in compact mode */
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
58 /*
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
59 Default value is HK_ERRORS_DETAIL + HK_SNDRCV_DETAIL + HK_PEERS_COMPACT
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
60 */
1126
d6e18ebca0c5 New extension dbg_msg_dumps for debug / learning.
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
61
d6e18ebca0c5 New extension dbg_msg_dumps for debug / learning.
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
62 #include <freeDiameter/extension.h>
d6e18ebca0c5 New extension dbg_msg_dumps for debug / learning.
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
63
1204
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
64 static struct fd_hook_hdl *md_hdl[4] = {NULL,NULL,NULL,NULL};
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
65 static uint32_t dump_level = HK_ERRORS_TREE | HK_SNDRCV_TREE | HK_PEERS_COMPACT; /* default */
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
66 static char * buf = NULL;
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
67 static size_t len;
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
68 static pthread_mutex_t mtx = PTHREAD_MUTEX_INITIALIZER;
1126
d6e18ebca0c5 New extension dbg_msg_dumps for debug / learning.
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
69
d6e18ebca0c5 New extension dbg_msg_dumps for debug / learning.
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
70 /* The callback called when messages are received and sent */
1204
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
71 static void md_hook_cb_tree(enum fd_hook_type type, struct msg * msg, struct peer_hdr * peer, void * other, struct fd_hook_permsgdata *pmd, void * regdata)
1126
d6e18ebca0c5 New extension dbg_msg_dumps for debug / learning.
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
72 {
1204
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
73 char * peer_name = peer ? peer->info.pi_diamid : "<unknown peer>";
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
74
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
75 CHECK_POSIX_DO( pthread_mutex_lock(&mtx), );
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
76
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
77 if (msg) {
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
78 CHECK_MALLOC_DO( fd_msg_dump_treeview(&buf, &len, NULL, msg, fd_g_config->cnf_dict, (type == HOOK_MESSAGE_PARSING_ERROR) ? 0 : 1, 1),
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
79 { LOG_E("Error while dumping a message"); pthread_mutex_unlock(&mtx); return; } );
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
80 }
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
81
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
82 switch (type) {
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
83 /* errors */
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
84 case HOOK_MESSAGE_FAILOVER:
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
85 LOG_E("FAILOVER from '%s':", peer_name);
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
86 LOG_SPLIT(FD_LOG_ERROR, " ", buf, NULL);
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
87 break;
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
88 case HOOK_MESSAGE_PARSING_ERROR:
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
89 if (msg) {
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
90 DiamId_t id = NULL;
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
91 if (!fd_msg_source_get( msg, &id, NULL ))
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
92 id = (DiamId_t)"<error getting source>";
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
93 if (!id)
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
94 id = (DiamId_t)"<local>";
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
95 LOG_E("PARSING ERROR: '%s' from '%s': ", (char *)other, (char *)id);
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
96 LOG_SPLIT(FD_LOG_ERROR, " ", buf, NULL);
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
97 } else {
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
98 struct fd_cnx_rcvdata *rcv_data = other;
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
99 CHECK_MALLOC_DO(fd_dump_extend_hexdump(&buf, &len, NULL, rcv_data->buffer, rcv_data->length, 0, 0), break);
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
100 LOG_E("PARSING ERROR: %zdB msg from '%s': %s", rcv_data->length, peer_name, buf);
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
101 }
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
102 break;
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
103 case HOOK_MESSAGE_ROUTING_ERROR:
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
104 LOG_E("ROUTING ERROR '%s' for: ", (char *)other);
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
105 LOG_SPLIT(FD_LOG_ERROR, " ", buf, NULL);
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
106 break;
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
107 case HOOK_MESSAGE_DROPPED:
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
108 LOG_E("DROPPED '%s'", (char *)other);
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
109 LOG_SPLIT(FD_LOG_ERROR, " ", buf, NULL);
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
110 break;
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
111
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
112 /* send receive */
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
113 case HOOK_MESSAGE_RECEIVED:
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
114 LOG_N("RCV from '%s':", peer_name);
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
115 LOG_SPLIT(FD_LOG_NOTICE, " ", buf, NULL);
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
116 break;
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
117 case HOOK_MESSAGE_SENT:
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
118 LOG_N("SND to '%s':", peer_name);
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
119 LOG_SPLIT(FD_LOG_NOTICE, " ", buf, NULL);
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
120 break;
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
121
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
122 /* The following are not received in this hook */
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
123 case HOOK_MESSAGE_LOCAL:
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
124 case HOOK_MESSAGE_ROUTING_FORWARD:
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
125 case HOOK_MESSAGE_ROUTING_LOCAL:
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
126
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
127 case HOOK_PEER_CONNECT_FAILED:
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
128 case HOOK_PEER_CONNECT_SUCCESS:
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
129
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
130 case HOOK_DATA_RECEIVED:
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
131 break;
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
132 }
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
133
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
134 CHECK_POSIX_DO( pthread_mutex_unlock(&mtx), );
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
135 }
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
136
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
137 static void md_hook_cb_full(enum fd_hook_type type, struct msg * msg, struct peer_hdr * peer, void * other, struct fd_hook_permsgdata *pmd, void * regdata)
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
138 {
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
139 char * peer_name = peer ? peer->info.pi_diamid : "<unknown peer>";
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
140
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
141 CHECK_POSIX_DO( pthread_mutex_lock(&mtx), );
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
142
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
143 if (msg) {
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
144 CHECK_MALLOC_DO( fd_msg_dump_full(&buf, &len, NULL, msg, fd_g_config->cnf_dict, (type == HOOK_MESSAGE_PARSING_ERROR) ? 0 : 1, 1),
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
145 { LOG_E("Error while dumping a message"); pthread_mutex_unlock(&mtx); return; } );
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
146 }
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
147
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
148 switch (type) {
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
149 /* errors */
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
150 case HOOK_MESSAGE_FAILOVER:
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
151 LOG_E("FAILOVER from '%s': %s", peer_name, buf);
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
152 break;
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
153 case HOOK_MESSAGE_PARSING_ERROR:
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
154 if (msg) {
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
155 DiamId_t id = NULL;
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
156 if (!fd_msg_source_get( msg, &id, NULL ))
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
157 id = (DiamId_t)"<error getting source>";
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
158 if (!id)
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
159 id = (DiamId_t)"<local>";
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
160 LOG_E("PARSING ERROR: '%s' from '%s': %s", (char *)other, (char *)id, buf);
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
161 } else {
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
162 struct fd_cnx_rcvdata *rcv_data = other;
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
163 CHECK_MALLOC_DO(fd_dump_extend_hexdump(&buf, &len, NULL, rcv_data->buffer, rcv_data->length, 0, 0), break);
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
164 LOG_E("PARSING ERROR: %zdB msg from '%s': %s", rcv_data->length, peer_name, buf);
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
165 }
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
166 break;
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
167 case HOOK_MESSAGE_ROUTING_ERROR:
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
168 LOG_E("ROUTING ERROR '%s' for: %s", (char *)other, buf);
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
169 break;
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
170 case HOOK_MESSAGE_DROPPED:
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
171 LOG_E("DROPPED '%s' %s", (char *)other, buf);
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
172 break;
1126
d6e18ebca0c5 New extension dbg_msg_dumps for debug / learning.
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
173
1204
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
174 /* send receive */
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
175 case HOOK_MESSAGE_RECEIVED:
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
176 LOG_N("RCV from '%s': %s", peer_name, buf);
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
177 break;
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
178 case HOOK_MESSAGE_SENT:
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
179 LOG_N("SND to '%s': %s", peer_name, buf);
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
180 break;
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
181
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
182 /* The following are not received in this hook */
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
183 case HOOK_MESSAGE_LOCAL:
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
184 case HOOK_MESSAGE_ROUTING_FORWARD:
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
185 case HOOK_MESSAGE_ROUTING_LOCAL:
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
186
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
187 case HOOK_PEER_CONNECT_FAILED:
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
188 case HOOK_PEER_CONNECT_SUCCESS:
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
189
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
190 case HOOK_DATA_RECEIVED:
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
191 break;
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
192 }
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
193
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
194 CHECK_POSIX_DO( pthread_mutex_unlock(&mtx), );
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
195 }
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
196
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
197 static void md_hook_cb_compact(enum fd_hook_type type, struct msg * msg, struct peer_hdr * peer, void * other, struct fd_hook_permsgdata *pmd, void * regdata)
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
198 {
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
199 char * peer_name = peer ? peer->info.pi_diamid : "<unknown peer>";
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
200
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
201 CHECK_POSIX_DO( pthread_mutex_lock(&mtx), );
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
202
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
203 if (msg) {
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
204 CHECK_MALLOC_DO( fd_msg_dump_summary(&buf, &len, NULL, msg, fd_g_config->cnf_dict, 0, 0),
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
205 { LOG_E("Error while dumping a message"); pthread_mutex_unlock(&mtx); return; } );
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
206 }
1126
d6e18ebca0c5 New extension dbg_msg_dumps for debug / learning.
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
207
1204
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
208 switch (type) {
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
209 /* errors */
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
210 case HOOK_MESSAGE_FAILOVER:
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
211 LOG_E("FAILOVER from '%s': %s", peer_name, buf);
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
212 break;
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
213 case HOOK_MESSAGE_PARSING_ERROR:
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
214 if (msg) {
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
215 DiamId_t id = NULL;
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
216 if (!fd_msg_source_get( msg, &id, NULL ))
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
217 id = (DiamId_t)"<error getting source>";
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
218 if (!id)
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
219 id = (DiamId_t)"<local>";
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
220 LOG_E("PARSING ERROR: '%s' from '%s': %s", (char *)other, (char *)id, buf);
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
221 } else {
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
222 struct fd_cnx_rcvdata *rcv_data = other;
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
223 CHECK_MALLOC_DO(fd_dump_extend_hexdump(&buf, &len, NULL, rcv_data->buffer, rcv_data->length, 0, 0), break);
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
224 LOG_E("PARSING ERROR: %zdB msg from '%s': %s", rcv_data->length, peer_name, buf);
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
225 }
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
226 break;
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
227 case HOOK_MESSAGE_ROUTING_ERROR:
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
228 LOG_E("ROUTING ERROR '%s' for: %s", (char *)other, buf);
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
229 break;
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
230 case HOOK_MESSAGE_DROPPED:
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
231 LOG_E("DROPPED '%s' %s", (char *)other, buf);
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
232 break;
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
233
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
234 /* send receive */
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
235 case HOOK_MESSAGE_RECEIVED:
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
236 LOG_N("RCV from '%s': %s", peer_name, buf);
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
237 break;
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
238 case HOOK_MESSAGE_SENT:
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
239 LOG_N("SND to '%s': %s", peer_name, buf);
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
240 break;
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
241
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
242 /* routing */
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
243 case HOOK_MESSAGE_LOCAL:
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
244 LOG_N("ISSUED: %s", buf);
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
245 break;
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
246 case HOOK_MESSAGE_ROUTING_FORWARD:
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
247 LOG_N("FORWARDING: %s", buf);
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
248 break;
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
249 case HOOK_MESSAGE_ROUTING_LOCAL:
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
250 LOG_N("DISPATCHING: %s", buf);
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
251 break;
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
252
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
253 /* peers */
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
254 case HOOK_PEER_CONNECT_FAILED:
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
255 LOG_N("CONNECT FAILED to %s: %s", peer_name, (char *)other);
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
256 break;
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
257 case HOOK_PEER_CONNECT_SUCCESS: {
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
258 char protobuf[40];
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
259 if (peer) {
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
260 CHECK_FCT_DO(fd_peer_cnx_proto_info(peer, protobuf, sizeof(protobuf)), break );
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
261 } else {
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
262 protobuf[0] = '-';
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
263 protobuf[1] = '\0';
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
264 }
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
265 LOG_N("CONNECTED TO '%s' (%s): %s", peer_name, protobuf, buf);
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
266 }
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
267 break;
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
268 /* Not handled */
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
269 case HOOK_DATA_RECEIVED:
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
270 break;
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
271 }
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
272
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
273 CHECK_POSIX_DO( pthread_mutex_unlock(&mtx), );
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
274 }
1126
d6e18ebca0c5 New extension dbg_msg_dumps for debug / learning.
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
275
1204
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
276 static void md_hook_cb_quiet(enum fd_hook_type type, struct msg * msg, struct peer_hdr * peer, void * other, struct fd_hook_permsgdata *pmd, void * regdata)
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
277 {
1126
d6e18ebca0c5 New extension dbg_msg_dumps for debug / learning.
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
278 }
d6e18ebca0c5 New extension dbg_msg_dumps for debug / learning.
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
279
d6e18ebca0c5 New extension dbg_msg_dumps for debug / learning.
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
280 /* Entry point */
d6e18ebca0c5 New extension dbg_msg_dumps for debug / learning.
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
281 static int md_main(char * conffile)
d6e18ebca0c5 New extension dbg_msg_dumps for debug / learning.
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
282 {
1204
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
283 uint32_t mask_errors, mask_sndrcv, mask_routing, mask_peers;
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
284 uint32_t mask_quiet, mask_compact, mask_full, mask_tree;
1126
d6e18ebca0c5 New extension dbg_msg_dumps for debug / learning.
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
285 TRACE_ENTRY("%p", conffile);
d6e18ebca0c5 New extension dbg_msg_dumps for debug / learning.
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
286
1204
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
287 if (conffile != NULL) {
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
288 char * endp;
1244
24a03140a6aa Bug: parameters for peers were not taken into account
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1204
diff changeset
289 dump_level = (uint32_t)strtoul(conffile, &endp, 16);
1204
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
290 CHECK_PARAMS_DO( *endp == '\0', {
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
291 LOG_E("Configuration parameter must be in the form \"0xNNNN\"");
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
292 return EINVAL; });
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
293 }
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
294
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
295 mask_errors = HOOK_MASK( HOOK_MESSAGE_FAILOVER, HOOK_MESSAGE_PARSING_ERROR, HOOK_MESSAGE_ROUTING_ERROR, HOOK_MESSAGE_DROPPED );
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
296 mask_sndrcv = HOOK_MASK( HOOK_MESSAGE_RECEIVED, HOOK_MESSAGE_SENT );
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
297 mask_routing= HOOK_MASK( HOOK_MESSAGE_LOCAL, HOOK_MESSAGE_ROUTING_FORWARD, HOOK_MESSAGE_ROUTING_LOCAL );
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
298 mask_peers = HOOK_MASK( HOOK_PEER_CONNECT_FAILED, HOOK_PEER_CONNECT_SUCCESS );
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
299
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
300 mask_quiet = (dump_level & HK_ERRORS_QUIET) ? mask_errors : 0;
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
301 mask_quiet |= (dump_level & HK_SNDRCV_QUIET) ? mask_sndrcv : 0;
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
302 mask_quiet |= (dump_level & HK_ROUTING_QUIET) ? mask_routing : 0;
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
303 mask_quiet |= (dump_level & HK_PEERS_QUIET) ? mask_peers : 0;
1126
d6e18ebca0c5 New extension dbg_msg_dumps for debug / learning.
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
304
1204
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
305 mask_compact = (dump_level & HK_ERRORS_COMPACT) ? mask_errors : 0;
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
306 mask_compact |= (dump_level & HK_SNDRCV_COMPACT) ? mask_sndrcv : 0;
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
307 mask_compact |= (dump_level & HK_ROUTING_COMPACT) ? mask_routing : 0;
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
308 mask_compact |= (dump_level & HK_PEERS_COMPACT) ? mask_peers : 0;
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
309
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
310 mask_full = (dump_level & HK_ERRORS_FULL) ? mask_errors : 0;
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
311 mask_full |= (dump_level & HK_SNDRCV_FULL) ? mask_sndrcv : 0;
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
312
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
313 mask_tree = (dump_level & HK_ERRORS_TREE) ? mask_errors : 0;
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
314 mask_tree |= (dump_level & HK_SNDRCV_TREE) ? mask_sndrcv : 0;
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
315
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
316 if (mask_quiet) {
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
317 CHECK_FCT( fd_hook_register( mask_quiet, md_hook_cb_quiet, NULL, NULL, &md_hdl[0]) );
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
318 }
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
319 if (mask_compact) {
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
320 CHECK_FCT( fd_hook_register( mask_compact, md_hook_cb_compact, NULL, NULL, &md_hdl[1]) );
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
321 }
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
322 if (mask_full) {
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
323 CHECK_FCT( fd_hook_register( mask_full, md_hook_cb_full, NULL, NULL, &md_hdl[2]) );
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
324 }
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
325 if (mask_tree) {
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
326 CHECK_FCT( fd_hook_register( mask_tree, md_hook_cb_tree, NULL, NULL, &md_hdl[3]) );
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
327 }
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
328
1126
d6e18ebca0c5 New extension dbg_msg_dumps for debug / learning.
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
329 return 0;
d6e18ebca0c5 New extension dbg_msg_dumps for debug / learning.
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
330 }
d6e18ebca0c5 New extension dbg_msg_dumps for debug / learning.
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
331
d6e18ebca0c5 New extension dbg_msg_dumps for debug / learning.
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
332 /* Cleanup */
d6e18ebca0c5 New extension dbg_msg_dumps for debug / learning.
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
333 void fd_ext_fini(void)
d6e18ebca0c5 New extension dbg_msg_dumps for debug / learning.
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
334 {
d6e18ebca0c5 New extension dbg_msg_dumps for debug / learning.
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
335 TRACE_ENTRY();
1204
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
336 if (md_hdl[0]) { CHECK_FCT_DO( fd_hook_unregister( md_hdl[0] ), ); }
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
337 if (md_hdl[1]) { CHECK_FCT_DO( fd_hook_unregister( md_hdl[1] ), ); }
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
338 if (md_hdl[2]) { CHECK_FCT_DO( fd_hook_unregister( md_hdl[2] ), ); }
a4cdde705f30 Add options to dbg_msg_dumps.fdx to allow more control over the behavior
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1168
diff changeset
339 if (md_hdl[2]) { CHECK_FCT_DO( fd_hook_unregister( md_hdl[3] ), ); }
1126
d6e18ebca0c5 New extension dbg_msg_dumps for debug / learning.
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
340 return ;
d6e18ebca0c5 New extension dbg_msg_dumps for debug / learning.
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
341 }
d6e18ebca0c5 New extension dbg_msg_dumps for debug / learning.
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
342
d6e18ebca0c5 New extension dbg_msg_dumps for debug / learning.
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
343 EXTENSION_ENTRY("dbg_msg_dumps", md_main);
"Welcome to our mercurial repository"