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
ip.c@200:5acbc41bf469, 2021-05-20 (annotated)
- Committer:
- andrewboyson
- Date:
- Thu May 20 14:32:52 2021 +0000
- Revision:
- 200:5acbc41bf469
- Parent:
- 61:aad055f1b0d1
Increased number of arp entries from 20 to 30 to accommodate the number of WIZ devices plus a few incoming port 80 calls from the internet.
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 <string.h> |
andrewboyson | 61:aad055f1b0d1 | 3 | #include <stdio.h> |
andrewboyson | 61:aad055f1b0d1 | 4 | |
andrewboyson | 47:73af5c0b0dc2 | 5 | #include "log.h" |
andrewboyson | 14:e75a59c1123d | 6 | #include "ip.h" |
andrewboyson | 14:e75a59c1123d | 7 | |
andrewboyson | 47:73af5c0b0dc2 | 8 | void IpProtocolString(uint8_t protocol, int size, char* text) |
andrewboyson | 14:e75a59c1123d | 9 | { |
andrewboyson | 14:e75a59c1123d | 10 | switch (protocol) |
andrewboyson | 14:e75a59c1123d | 11 | { |
andrewboyson | 33:714a0345e59b | 12 | case ICMP: strncpy(text, "ICMP" , size); break; |
andrewboyson | 33:714a0345e59b | 13 | case IGMP: strncpy(text, "IGMP" , size); break; |
andrewboyson | 33:714a0345e59b | 14 | case ICMP6: strncpy(text, "ICMP6" , size); break; |
andrewboyson | 33:714a0345e59b | 15 | case TCP: strncpy(text, "TCP" , size); break; |
andrewboyson | 33:714a0345e59b | 16 | case UDP: strncpy(text, "UDP" , size); break; |
andrewboyson | 33:714a0345e59b | 17 | case IP6IN4: strncpy(text, "IP6IN4", size); break; |
andrewboyson | 14:e75a59c1123d | 18 | default: snprintf(text, size, "%d", protocol); break; |
andrewboyson | 14:e75a59c1123d | 19 | } |
andrewboyson | 14:e75a59c1123d | 20 | } |
andrewboyson | 47:73af5c0b0dc2 | 21 | void IpProtocolLog(uint8_t protocol) |
andrewboyson | 47:73af5c0b0dc2 | 22 | { |
andrewboyson | 47:73af5c0b0dc2 | 23 | switch (protocol) |
andrewboyson | 47:73af5c0b0dc2 | 24 | { |
andrewboyson | 47:73af5c0b0dc2 | 25 | case ICMP: Log("ICMP" ); break; |
andrewboyson | 47:73af5c0b0dc2 | 26 | case IGMP: Log("IGMP" ); break; |
andrewboyson | 47:73af5c0b0dc2 | 27 | case ICMP6: Log("ICMP6" ); break; |
andrewboyson | 47:73af5c0b0dc2 | 28 | case TCP: Log("TCP" ); break; |
andrewboyson | 47:73af5c0b0dc2 | 29 | case UDP: Log("UDP" ); break; |
andrewboyson | 47:73af5c0b0dc2 | 30 | case IP6IN4: Log("IP6IN4"); break; |
andrewboyson | 47:73af5c0b0dc2 | 31 | default: LogF("%d", protocol); break; |
andrewboyson | 47:73af5c0b0dc2 | 32 | } |
andrewboyson | 47:73af5c0b0dc2 | 33 | } |