Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
utility/uip_debug.cpp@0:e3fb1267e3c3, 2016-12-21 (annotated)
- Committer:
- cassyarduino
- Date:
- Wed Dec 21 16:58:10 2016 +0100
- Revision:
- 0:e3fb1267e3c3
initial release
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| cassyarduino | 0:e3fb1267e3c3 | 1 | #if defined(ARDUINO) |
| cassyarduino | 0:e3fb1267e3c3 | 2 | #include <Arduino.h> |
| cassyarduino | 0:e3fb1267e3c3 | 3 | #include <HardwareSerial.h> |
| cassyarduino | 0:e3fb1267e3c3 | 4 | #endif |
| cassyarduino | 0:e3fb1267e3c3 | 5 | #if defined(__MBED__) |
| cassyarduino | 0:e3fb1267e3c3 | 6 | #include <mbed.h> |
| cassyarduino | 0:e3fb1267e3c3 | 7 | #endif |
| cassyarduino | 0:e3fb1267e3c3 | 8 | #include <inttypes.h> |
| cassyarduino | 0:e3fb1267e3c3 | 9 | #include <utility/uip_debug.h> |
| cassyarduino | 0:e3fb1267e3c3 | 10 | #include <utility/logging.h> |
| cassyarduino | 0:e3fb1267e3c3 | 11 | extern "C" { |
| cassyarduino | 0:e3fb1267e3c3 | 12 | #include "utility/uip.h" |
| cassyarduino | 0:e3fb1267e3c3 | 13 | } |
| cassyarduino | 0:e3fb1267e3c3 | 14 | |
| cassyarduino | 0:e3fb1267e3c3 | 15 | struct uip_conn con[UIP_CONNS]; |
| cassyarduino | 0:e3fb1267e3c3 | 16 | |
| cassyarduino | 0:e3fb1267e3c3 | 17 | void |
| cassyarduino | 0:e3fb1267e3c3 | 18 | UIPDebug::uip_debug_printconns() |
| cassyarduino | 0:e3fb1267e3c3 | 19 | { |
| cassyarduino | 0:e3fb1267e3c3 | 20 | for(uint8_t i=0;i<UIP_CONNS;i++) |
| cassyarduino | 0:e3fb1267e3c3 | 21 | { |
| cassyarduino | 0:e3fb1267e3c3 | 22 | if (uip_debug_printcon(&con[i],&uip_conns[i])) |
| cassyarduino | 0:e3fb1267e3c3 | 23 | { |
| cassyarduino | 0:e3fb1267e3c3 | 24 | #if ACTLOGLEVEL>LOG_NONE |
| cassyarduino | 0:e3fb1267e3c3 | 25 | LogObject.uart_send_str(F("connection[")); |
| cassyarduino | 0:e3fb1267e3c3 | 26 | LogObject.uart_send_dec(i); |
| cassyarduino | 0:e3fb1267e3c3 | 27 | LogObject.uart_send_strln(F("] changed.")); |
| cassyarduino | 0:e3fb1267e3c3 | 28 | #endif |
| cassyarduino | 0:e3fb1267e3c3 | 29 | } |
| cassyarduino | 0:e3fb1267e3c3 | 30 | } |
| cassyarduino | 0:e3fb1267e3c3 | 31 | } |
| cassyarduino | 0:e3fb1267e3c3 | 32 | |
| cassyarduino | 0:e3fb1267e3c3 | 33 | bool |
| cassyarduino | 0:e3fb1267e3c3 | 34 | UIPDebug::uip_debug_printcon(struct uip_conn *lhs,struct uip_conn *rhs) |
| cassyarduino | 0:e3fb1267e3c3 | 35 | { |
| cassyarduino | 0:e3fb1267e3c3 | 36 | bool changed = false; |
| cassyarduino | 0:e3fb1267e3c3 | 37 | if (!uip_ipaddr_cmp(lhs->ripaddr,rhs->ripaddr)) |
| cassyarduino | 0:e3fb1267e3c3 | 38 | { |
| cassyarduino | 0:e3fb1267e3c3 | 39 | #if ACTLOGLEVEL>LOG_NONE |
| cassyarduino | 0:e3fb1267e3c3 | 40 | LogObject.uart_send_str(F(" ripaddr: ")); |
| cassyarduino | 0:e3fb1267e3c3 | 41 | uip_debug_printbytes((const uint8_t *)lhs->ripaddr,4); |
| cassyarduino | 0:e3fb1267e3c3 | 42 | LogObject.uart_send_str(F(" -> ")); |
| cassyarduino | 0:e3fb1267e3c3 | 43 | uip_debug_printbytes((const uint8_t *)rhs->ripaddr,4); |
| cassyarduino | 0:e3fb1267e3c3 | 44 | LogObject.uart_send_strln(F("")); |
| cassyarduino | 0:e3fb1267e3c3 | 45 | #endif |
| cassyarduino | 0:e3fb1267e3c3 | 46 | uip_ipaddr_copy(lhs->ripaddr,rhs->ripaddr); |
| cassyarduino | 0:e3fb1267e3c3 | 47 | changed = true; |
| cassyarduino | 0:e3fb1267e3c3 | 48 | } |
| cassyarduino | 0:e3fb1267e3c3 | 49 | if (lhs->lport != rhs->lport) |
| cassyarduino | 0:e3fb1267e3c3 | 50 | { |
| cassyarduino | 0:e3fb1267e3c3 | 51 | #if ACTLOGLEVEL>LOG_NONE |
| cassyarduino | 0:e3fb1267e3c3 | 52 | LogObject.uart_send_str(F(" lport: ")); |
| cassyarduino | 0:e3fb1267e3c3 | 53 | LogObject.uart_send_dec(htons(lhs->lport)); |
| cassyarduino | 0:e3fb1267e3c3 | 54 | LogObject.uart_send_str(F(" -> ")); |
| cassyarduino | 0:e3fb1267e3c3 | 55 | LogObject.uart_send_decln(htons(rhs->lport)); |
| cassyarduino | 0:e3fb1267e3c3 | 56 | #endif |
| cassyarduino | 0:e3fb1267e3c3 | 57 | lhs->lport = rhs->lport; |
| cassyarduino | 0:e3fb1267e3c3 | 58 | changed = true; |
| cassyarduino | 0:e3fb1267e3c3 | 59 | } |
| cassyarduino | 0:e3fb1267e3c3 | 60 | if (lhs->rport != rhs->rport) |
| cassyarduino | 0:e3fb1267e3c3 | 61 | { |
| cassyarduino | 0:e3fb1267e3c3 | 62 | #if ACTLOGLEVEL>LOG_NONE |
| cassyarduino | 0:e3fb1267e3c3 | 63 | LogObject.uart_send_str(F(" rport: ")); |
| cassyarduino | 0:e3fb1267e3c3 | 64 | LogObject.uart_send_dec(htons(lhs->rport)); |
| cassyarduino | 0:e3fb1267e3c3 | 65 | LogObject.uart_send_str(F(" -> ")); |
| cassyarduino | 0:e3fb1267e3c3 | 66 | LogObject.uart_send_decln(htons(rhs->rport)); |
| cassyarduino | 0:e3fb1267e3c3 | 67 | #endif |
| cassyarduino | 0:e3fb1267e3c3 | 68 | lhs->rport = rhs->rport; |
| cassyarduino | 0:e3fb1267e3c3 | 69 | changed = true; |
| cassyarduino | 0:e3fb1267e3c3 | 70 | } |
| cassyarduino | 0:e3fb1267e3c3 | 71 | if ((uint32_t)lhs->rcv_nxt[0] != (uint32_t)rhs->rcv_nxt[0]) |
| cassyarduino | 0:e3fb1267e3c3 | 72 | { |
| cassyarduino | 0:e3fb1267e3c3 | 73 | #if ACTLOGLEVEL>LOG_NONE |
| cassyarduino | 0:e3fb1267e3c3 | 74 | LogObject.uart_send_str(F(" rcv_nxt: ")); |
| cassyarduino | 0:e3fb1267e3c3 | 75 | uip_debug_printbytes(lhs->rcv_nxt,4); |
| cassyarduino | 0:e3fb1267e3c3 | 76 | LogObject.uart_send_str(F(" -> ")); |
| cassyarduino | 0:e3fb1267e3c3 | 77 | uip_debug_printbytes(rhs->rcv_nxt,4); |
| cassyarduino | 0:e3fb1267e3c3 | 78 | #endif |
| cassyarduino | 0:e3fb1267e3c3 | 79 | *((uint32_t *)&lhs->rcv_nxt[0]) = (uint32_t)rhs->rcv_nxt[0]; |
| cassyarduino | 0:e3fb1267e3c3 | 80 | #if ACTLOGLEVEL>LOG_NONE |
| cassyarduino | 0:e3fb1267e3c3 | 81 | LogObject.uart_send_strln(F("")); |
| cassyarduino | 0:e3fb1267e3c3 | 82 | #endif |
| cassyarduino | 0:e3fb1267e3c3 | 83 | changed = true; |
| cassyarduino | 0:e3fb1267e3c3 | 84 | } |
| cassyarduino | 0:e3fb1267e3c3 | 85 | if ((uint32_t)lhs->snd_nxt[0] != (uint32_t)rhs->snd_nxt[0]) |
| cassyarduino | 0:e3fb1267e3c3 | 86 | { |
| cassyarduino | 0:e3fb1267e3c3 | 87 | #if ACTLOGLEVEL>LOG_NONE |
| cassyarduino | 0:e3fb1267e3c3 | 88 | LogObject.uart_send_str(F(" snd_nxt: ")); |
| cassyarduino | 0:e3fb1267e3c3 | 89 | uip_debug_printbytes(lhs->snd_nxt,4); |
| cassyarduino | 0:e3fb1267e3c3 | 90 | LogObject.uart_send_str(F(" -> ")); |
| cassyarduino | 0:e3fb1267e3c3 | 91 | uip_debug_printbytes(rhs->snd_nxt,4); |
| cassyarduino | 0:e3fb1267e3c3 | 92 | #endif |
| cassyarduino | 0:e3fb1267e3c3 | 93 | *((uint32_t *)&lhs->snd_nxt[0]) = (uint32_t)rhs->snd_nxt[0]; |
| cassyarduino | 0:e3fb1267e3c3 | 94 | #if ACTLOGLEVEL>LOG_NONE |
| cassyarduino | 0:e3fb1267e3c3 | 95 | LogObject.uart_send_strln(F("")); |
| cassyarduino | 0:e3fb1267e3c3 | 96 | #endif |
| cassyarduino | 0:e3fb1267e3c3 | 97 | changed = true; |
| cassyarduino | 0:e3fb1267e3c3 | 98 | } |
| cassyarduino | 0:e3fb1267e3c3 | 99 | if (lhs->len != rhs->len) |
| cassyarduino | 0:e3fb1267e3c3 | 100 | { |
| cassyarduino | 0:e3fb1267e3c3 | 101 | #if ACTLOGLEVEL>LOG_NONE |
| cassyarduino | 0:e3fb1267e3c3 | 102 | LogObject.uart_send_str(F(" len: ")); |
| cassyarduino | 0:e3fb1267e3c3 | 103 | LogObject.uart_send_dec(lhs->len); |
| cassyarduino | 0:e3fb1267e3c3 | 104 | LogObject.uart_send_str(F(" -> ")); |
| cassyarduino | 0:e3fb1267e3c3 | 105 | LogObject.uart_send_decln(rhs->len); |
| cassyarduino | 0:e3fb1267e3c3 | 106 | #endif |
| cassyarduino | 0:e3fb1267e3c3 | 107 | lhs->len = rhs->len; |
| cassyarduino | 0:e3fb1267e3c3 | 108 | changed = true; |
| cassyarduino | 0:e3fb1267e3c3 | 109 | } |
| cassyarduino | 0:e3fb1267e3c3 | 110 | if (lhs->mss != rhs->mss) |
| cassyarduino | 0:e3fb1267e3c3 | 111 | { |
| cassyarduino | 0:e3fb1267e3c3 | 112 | #if ACTLOGLEVEL>LOG_NONE |
| cassyarduino | 0:e3fb1267e3c3 | 113 | LogObject.uart_send_str(F(" mss: ")); |
| cassyarduino | 0:e3fb1267e3c3 | 114 | LogObject.uart_send_dec(lhs->mss); |
| cassyarduino | 0:e3fb1267e3c3 | 115 | LogObject.uart_send_str(F(" -> ")); |
| cassyarduino | 0:e3fb1267e3c3 | 116 | LogObject.uart_send_decln(rhs->mss); |
| cassyarduino | 0:e3fb1267e3c3 | 117 | #endif |
| cassyarduino | 0:e3fb1267e3c3 | 118 | lhs->mss = rhs->mss; |
| cassyarduino | 0:e3fb1267e3c3 | 119 | changed = true; |
| cassyarduino | 0:e3fb1267e3c3 | 120 | } |
| cassyarduino | 0:e3fb1267e3c3 | 121 | if (lhs->initialmss != rhs->initialmss) |
| cassyarduino | 0:e3fb1267e3c3 | 122 | { |
| cassyarduino | 0:e3fb1267e3c3 | 123 | #if ACTLOGLEVEL>LOG_NONE |
| cassyarduino | 0:e3fb1267e3c3 | 124 | LogObject.uart_send_str(F(" initialmss: ")); |
| cassyarduino | 0:e3fb1267e3c3 | 125 | LogObject.uart_send_dec(lhs->initialmss); |
| cassyarduino | 0:e3fb1267e3c3 | 126 | LogObject.uart_send_str(F(" -> ")); |
| cassyarduino | 0:e3fb1267e3c3 | 127 | LogObject.uart_send_decln(rhs->initialmss); |
| cassyarduino | 0:e3fb1267e3c3 | 128 | #endif |
| cassyarduino | 0:e3fb1267e3c3 | 129 | lhs->initialmss = rhs->initialmss; |
| cassyarduino | 0:e3fb1267e3c3 | 130 | changed = true; |
| cassyarduino | 0:e3fb1267e3c3 | 131 | } |
| cassyarduino | 0:e3fb1267e3c3 | 132 | if (lhs->sa != rhs->sa) |
| cassyarduino | 0:e3fb1267e3c3 | 133 | { |
| cassyarduino | 0:e3fb1267e3c3 | 134 | #if ACTLOGLEVEL>LOG_NONE |
| cassyarduino | 0:e3fb1267e3c3 | 135 | LogObject.uart_send_str(F(" sa: ")); |
| cassyarduino | 0:e3fb1267e3c3 | 136 | LogObject.uart_send_dec(lhs->sa); |
| cassyarduino | 0:e3fb1267e3c3 | 137 | LogObject.uart_send_str(F(" -> ")); |
| cassyarduino | 0:e3fb1267e3c3 | 138 | LogObject.uart_send_decln(rhs->sa); |
| cassyarduino | 0:e3fb1267e3c3 | 139 | #endif |
| cassyarduino | 0:e3fb1267e3c3 | 140 | lhs->sa = rhs->sa; |
| cassyarduino | 0:e3fb1267e3c3 | 141 | changed = true; |
| cassyarduino | 0:e3fb1267e3c3 | 142 | } |
| cassyarduino | 0:e3fb1267e3c3 | 143 | if (lhs->sv != rhs->sv) |
| cassyarduino | 0:e3fb1267e3c3 | 144 | { |
| cassyarduino | 0:e3fb1267e3c3 | 145 | #if ACTLOGLEVEL>LOG_NONE |
| cassyarduino | 0:e3fb1267e3c3 | 146 | LogObject.uart_send_str(F(" sv: ")); |
| cassyarduino | 0:e3fb1267e3c3 | 147 | LogObject.uart_send_dec(lhs->sv); |
| cassyarduino | 0:e3fb1267e3c3 | 148 | LogObject.uart_send_str(F(" -> ")); |
| cassyarduino | 0:e3fb1267e3c3 | 149 | LogObject.uart_send_decln(rhs->sv); |
| cassyarduino | 0:e3fb1267e3c3 | 150 | #endif |
| cassyarduino | 0:e3fb1267e3c3 | 151 | lhs->sv = rhs->sv; |
| cassyarduino | 0:e3fb1267e3c3 | 152 | changed = true; |
| cassyarduino | 0:e3fb1267e3c3 | 153 | } |
| cassyarduino | 0:e3fb1267e3c3 | 154 | if (lhs->rto != rhs->rto) |
| cassyarduino | 0:e3fb1267e3c3 | 155 | { |
| cassyarduino | 0:e3fb1267e3c3 | 156 | #if ACTLOGLEVEL>LOG_NONE |
| cassyarduino | 0:e3fb1267e3c3 | 157 | LogObject.uart_send_str(F(" rto: ")); |
| cassyarduino | 0:e3fb1267e3c3 | 158 | LogObject.uart_send_dec(lhs->rto); |
| cassyarduino | 0:e3fb1267e3c3 | 159 | LogObject.uart_send_str(F(" -> ")); |
| cassyarduino | 0:e3fb1267e3c3 | 160 | LogObject.uart_send_decln(rhs->rto); |
| cassyarduino | 0:e3fb1267e3c3 | 161 | #endif |
| cassyarduino | 0:e3fb1267e3c3 | 162 | lhs->rto = rhs->rto; |
| cassyarduino | 0:e3fb1267e3c3 | 163 | changed = true; |
| cassyarduino | 0:e3fb1267e3c3 | 164 | } |
| cassyarduino | 0:e3fb1267e3c3 | 165 | if (lhs->tcpstateflags != rhs->tcpstateflags) |
| cassyarduino | 0:e3fb1267e3c3 | 166 | { |
| cassyarduino | 0:e3fb1267e3c3 | 167 | #if ACTLOGLEVEL>LOG_NONE |
| cassyarduino | 0:e3fb1267e3c3 | 168 | LogObject.uart_send_str(F(" tcpstateflags: ")); |
| cassyarduino | 0:e3fb1267e3c3 | 169 | LogObject.uart_send_dec(lhs->tcpstateflags); |
| cassyarduino | 0:e3fb1267e3c3 | 170 | LogObject.uart_send_str(F(" -> ")); |
| cassyarduino | 0:e3fb1267e3c3 | 171 | LogObject.uart_send_decln(rhs->tcpstateflags); |
| cassyarduino | 0:e3fb1267e3c3 | 172 | #endif |
| cassyarduino | 0:e3fb1267e3c3 | 173 | lhs->tcpstateflags = rhs->tcpstateflags; |
| cassyarduino | 0:e3fb1267e3c3 | 174 | changed = true; |
| cassyarduino | 0:e3fb1267e3c3 | 175 | } |
| cassyarduino | 0:e3fb1267e3c3 | 176 | if (lhs->timer != rhs->timer) |
| cassyarduino | 0:e3fb1267e3c3 | 177 | { |
| cassyarduino | 0:e3fb1267e3c3 | 178 | #if ACTLOGLEVEL>LOG_NONE |
| cassyarduino | 0:e3fb1267e3c3 | 179 | LogObject.uart_send_str(F(" timer: ")); |
| cassyarduino | 0:e3fb1267e3c3 | 180 | LogObject.uart_send_dec(lhs->timer); |
| cassyarduino | 0:e3fb1267e3c3 | 181 | LogObject.uart_send_str(F(" -> ")); |
| cassyarduino | 0:e3fb1267e3c3 | 182 | LogObject.uart_send_decln(rhs->timer); |
| cassyarduino | 0:e3fb1267e3c3 | 183 | #endif |
| cassyarduino | 0:e3fb1267e3c3 | 184 | lhs->timer = rhs->timer; |
| cassyarduino | 0:e3fb1267e3c3 | 185 | changed = true; |
| cassyarduino | 0:e3fb1267e3c3 | 186 | } |
| cassyarduino | 0:e3fb1267e3c3 | 187 | if (lhs->nrtx != rhs->nrtx) |
| cassyarduino | 0:e3fb1267e3c3 | 188 | { |
| cassyarduino | 0:e3fb1267e3c3 | 189 | #if ACTLOGLEVEL>LOG_NONE |
| cassyarduino | 0:e3fb1267e3c3 | 190 | LogObject.uart_send_str(F(" nrtx: ")); |
| cassyarduino | 0:e3fb1267e3c3 | 191 | LogObject.uart_send_dec(lhs->nrtx); |
| cassyarduino | 0:e3fb1267e3c3 | 192 | LogObject.uart_send_str(F(" -> ")); |
| cassyarduino | 0:e3fb1267e3c3 | 193 | LogObject.uart_send_decln(rhs->nrtx); |
| cassyarduino | 0:e3fb1267e3c3 | 194 | #endif |
| cassyarduino | 0:e3fb1267e3c3 | 195 | lhs->nrtx = rhs->nrtx; |
| cassyarduino | 0:e3fb1267e3c3 | 196 | changed = true; |
| cassyarduino | 0:e3fb1267e3c3 | 197 | } |
| cassyarduino | 0:e3fb1267e3c3 | 198 | return changed; |
| cassyarduino | 0:e3fb1267e3c3 | 199 | } |
| cassyarduino | 0:e3fb1267e3c3 | 200 | |
| cassyarduino | 0:e3fb1267e3c3 | 201 | void |
| cassyarduino | 0:e3fb1267e3c3 | 202 | UIPDebug::uip_debug_printbytes(const uint8_t *data, uint8_t len) |
| cassyarduino | 0:e3fb1267e3c3 | 203 | { |
| cassyarduino | 0:e3fb1267e3c3 | 204 | for(uint8_t i=0;i<len;i++) |
| cassyarduino | 0:e3fb1267e3c3 | 205 | { |
| cassyarduino | 0:e3fb1267e3c3 | 206 | #if ACTLOGLEVEL>LOG_NONE |
| cassyarduino | 0:e3fb1267e3c3 | 207 | LogObject.uart_send_dec(data[i]); |
| cassyarduino | 0:e3fb1267e3c3 | 208 | if (i<len-1) |
| cassyarduino | 0:e3fb1267e3c3 | 209 | LogObject.uart_send_str(F(",")); |
| cassyarduino | 0:e3fb1267e3c3 | 210 | #endif |
| cassyarduino | 0:e3fb1267e3c3 | 211 | } |
| cassyarduino | 0:e3fb1267e3c3 | 212 | } |