A stack which works with or without an Mbed os library. Provides IPv4 or IPv6 with a full 1500 byte buffer.
Dependents: oldheating gps motorhome heating
ip6/icmp/dest6.c@167:3ba4e3c49631, 2020-04-02 (annotated)
- Committer:
- andrewboyson
- Date:
- Thu Apr 02 19:08:25 2020 +0000
- Revision:
- 167:3ba4e3c49631
- Parent:
- 61:aad055f1b0d1
Modified resolution cache ajaxs to include the index
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
andrewboyson | 61:aad055f1b0d1 | 1 | #include <stdint.h> |
andrewboyson | 61:aad055f1b0d1 | 2 | #include <stdbool.h> |
andrewboyson | 61:aad055f1b0d1 | 3 | |
andrewboyson | 57:e0fb648acf48 | 4 | #include "log.h" |
andrewboyson | 57:e0fb648acf48 | 5 | #include "net.h" |
andrewboyson | 57:e0fb648acf48 | 6 | #include "action.h" |
andrewboyson | 57:e0fb648acf48 | 7 | |
andrewboyson | 57:e0fb648acf48 | 8 | bool Dest6Trace = false; |
andrewboyson | 57:e0fb648acf48 | 9 | |
andrewboyson | 57:e0fb648acf48 | 10 | static void logCode(uint8_t code) |
andrewboyson | 57:e0fb648acf48 | 11 | { |
andrewboyson | 57:e0fb648acf48 | 12 | switch (code) |
andrewboyson | 57:e0fb648acf48 | 13 | { |
andrewboyson | 57:e0fb648acf48 | 14 | case 0: Log ("No route to destination" ); break; |
andrewboyson | 57:e0fb648acf48 | 15 | case 1: Log ("Communication with destination administratively prohibited"); break; |
andrewboyson | 57:e0fb648acf48 | 16 | case 2: Log ("Beyond scope of source address" ); break; |
andrewboyson | 57:e0fb648acf48 | 17 | case 3: Log ("Address unreachable" ); break; |
andrewboyson | 57:e0fb648acf48 | 18 | case 4: Log ("Port unreachable" ); break; |
andrewboyson | 57:e0fb648acf48 | 19 | case 5: Log ("Source address failed ingress/egress policy" ); break; |
andrewboyson | 57:e0fb648acf48 | 20 | case 6: Log ("Reject route to destination" ); break; |
andrewboyson | 57:e0fb648acf48 | 21 | default: LogF("Unknown code %u", code ); break; |
andrewboyson | 57:e0fb648acf48 | 22 | } |
andrewboyson | 57:e0fb648acf48 | 23 | } |
andrewboyson | 57:e0fb648acf48 | 24 | int Dest6HandleRequest(void (*traceback)(void), uint8_t* pType, uint8_t* pCode) |
andrewboyson | 57:e0fb648acf48 | 25 | { |
andrewboyson | 57:e0fb648acf48 | 26 | if (Dest6Trace) |
andrewboyson | 57:e0fb648acf48 | 27 | { |
andrewboyson | 57:e0fb648acf48 | 28 | if (NetTraceNewLine) Log("\r\n"); |
andrewboyson | 57:e0fb648acf48 | 29 | LogTime("Dest6 - Destination unreacheable - "); logCode(*pCode); Log("\r\n"); |
andrewboyson | 57:e0fb648acf48 | 30 | if (NetTraceStack) traceback(); |
andrewboyson | 57:e0fb648acf48 | 31 | } |
andrewboyson | 57:e0fb648acf48 | 32 | return DO_NOTHING; |
andrewboyson | 57:e0fb648acf48 | 33 | } |