summaryrefslogtreecommitdiffstats
path: root/gatchat/ppp_cp.c
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2010-04-12 18:02:11 -0700
committerMarcel Holtmann <marcel@holtmann.org>2010-04-12 18:02:11 -0700
commitf319e65b99360ce3b575b77d36c5e8b1dd6a8159 (patch)
tree3e4f19228c68fc40a75dd3adf25bdf858e8bb6ee /gatchat/ppp_cp.c
parent143d6db7c399274624e29d62b47561e7f6c385eb (diff)
downloadofono-f319e65b99360ce3b575b77d36c5e8b1dd6a8159.tar.bz2
Use ppp_debug() for PPP CP event debug statements
Diffstat (limited to 'gatchat/ppp_cp.c')
-rw-r--r--gatchat/ppp_cp.c33
1 files changed, 20 insertions, 13 deletions
diff --git a/gatchat/ppp_cp.c b/gatchat/ppp_cp.c
index 5ac01964..15163d26 100644
--- a/gatchat/ppp_cp.c
+++ b/gatchat/ppp_cp.c
@@ -34,6 +34,16 @@
#include "gatppp.h"
#include "ppp.h"
+static const char *pppcp_state_strings[] = {
+ "INITIAL", "STARTING", "CLOSED", "STOPPED", "CLOSING", "STOPPING",
+ "REQSENT", "ACKRCVD", "ACKSENT", "OPENED"
+};
+
+static const char *pppcp_event_strings[] = {
+ "Up", "Down", "Open", "Close", "TO+", "TO-", "RCR+", "RCR-",
+ "RCA", "RCN", "RTR", "RTA", "RUC", "RXJ+", "RXJ-", "RXR"
+};
+
#define pppcp_trace(p) do { \
char *str = g_strdup_printf("%s: %s: current state %d:%s", \
p->driver->name, __FUNCTION__, \
@@ -42,6 +52,15 @@
g_free(str); \
} while (0);
+#define pppcp_trace_event(p, type, actions, state) do { \
+ char *str = g_strdup_printf("event: %d (%s), " \
+ "action: %x, new_state: %d (%s)", \
+ type, pppcp_event_strings[type], \
+ actions, state, pppcp_state_strings[state]); \
+ ppp_debug(p->ppp, str); \
+ g_free(str); \
+} while (0);
+
#define PPP_HEADROOM 2
#define pppcp_to_ppp_packet(p) \
@@ -83,16 +102,6 @@ enum actions {
SER = 0x40000,
};
-static const char *pppcp_state_strings[] = {
- "INITIAL", "STARTING", "CLOSED", "STOPPED", "CLOSING", "STOPPING",
- "REQSENT", "ACKRCVD", "ACKSENT", "OPENED"
-};
-
-static const char *pppcp_event_strings[] = {
- "Up", "Down", "Open", "Close", "TO+", "TO-", "RCR+", "RCR-",
- "RCA", "RCN", "RTR", "RTA", "RUC", "RXJ+", "RXJ-", "RXR"
-};
-
/*
* Transition table straight from RFC 1661 Section 4.1
* Y coordinate is the events, while X coordinate is the state
@@ -626,9 +635,7 @@ static void pppcp_generate_event(struct pppcp_data *data,
actions = cp_transitions[event_type][data->state];
new_state = actions & 0xf;
- g_print("event: %d (%s), action: %x, new_state: %d (%s)\n",
- event_type, pppcp_event_strings[event_type],
- actions, new_state, pppcp_state_strings[new_state]);
+ pppcp_trace_event(data, event_type, actions, new_state);
if (actions & INV)
goto error;