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.
Dependents: oldheating gps motorhome heating
ip6/icmp/dest6.cpp@57:e0fb648acf48, 2017-11-28 (annotated)
- Committer:
- andrewboyson
- Date:
- Tue Nov 28 17:05:46 2017 +0000
- Revision:
- 57:e0fb648acf48
Added TFTP
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| andrewboyson | 57:e0fb648acf48 | 1 | #include "mbed.h" |
| andrewboyson | 57:e0fb648acf48 | 2 | #include "log.h" |
| andrewboyson | 57:e0fb648acf48 | 3 | #include "net.h" |
| andrewboyson | 57:e0fb648acf48 | 4 | #include "action.h" |
| andrewboyson | 57:e0fb648acf48 | 5 | |
| andrewboyson | 57:e0fb648acf48 | 6 | bool Dest6Trace = false; |
| andrewboyson | 57:e0fb648acf48 | 7 | |
| andrewboyson | 57:e0fb648acf48 | 8 | static void logCode(uint8_t code) |
| andrewboyson | 57:e0fb648acf48 | 9 | { |
| andrewboyson | 57:e0fb648acf48 | 10 | switch (code) |
| andrewboyson | 57:e0fb648acf48 | 11 | { |
| andrewboyson | 57:e0fb648acf48 | 12 | case 0: Log ("No route to destination" ); break; |
| andrewboyson | 57:e0fb648acf48 | 13 | case 1: Log ("Communication with destination administratively prohibited"); break; |
| andrewboyson | 57:e0fb648acf48 | 14 | case 2: Log ("Beyond scope of source address" ); break; |
| andrewboyson | 57:e0fb648acf48 | 15 | case 3: Log ("Address unreachable" ); break; |
| andrewboyson | 57:e0fb648acf48 | 16 | case 4: Log ("Port unreachable" ); break; |
| andrewboyson | 57:e0fb648acf48 | 17 | case 5: Log ("Source address failed ingress/egress policy" ); break; |
| andrewboyson | 57:e0fb648acf48 | 18 | case 6: Log ("Reject route to destination" ); break; |
| andrewboyson | 57:e0fb648acf48 | 19 | default: LogF("Unknown code %u", code ); break; |
| andrewboyson | 57:e0fb648acf48 | 20 | } |
| andrewboyson | 57:e0fb648acf48 | 21 | } |
| andrewboyson | 57:e0fb648acf48 | 22 | int Dest6HandleRequest(void (*traceback)(void), uint8_t* pType, uint8_t* pCode) |
| andrewboyson | 57:e0fb648acf48 | 23 | { |
| andrewboyson | 57:e0fb648acf48 | 24 | if (Dest6Trace) |
| andrewboyson | 57:e0fb648acf48 | 25 | { |
| andrewboyson | 57:e0fb648acf48 | 26 | if (NetTraceNewLine) Log("\r\n"); |
| andrewboyson | 57:e0fb648acf48 | 27 | LogTime("Dest6 - Destination unreacheable - "); logCode(*pCode); Log("\r\n"); |
| andrewboyson | 57:e0fb648acf48 | 28 | if (NetTraceStack) traceback(); |
| andrewboyson | 57:e0fb648acf48 | 29 | } |
| andrewboyson | 57:e0fb648acf48 | 30 | return DO_NOTHING; |
| andrewboyson | 57:e0fb648acf48 | 31 | } |