| b.liu | e958203 | 2025-04-17 19:18:16 +0800 | [diff] [blame] | 1 | /* |
| 2 | * siit.h -- definitions for the SIIT module |
| 3 | * |
| 4 | * |
| 5 | */ |
| 6 | |
| 7 | /* |
| 8 | * Constants |
| 9 | */ |
| 10 | |
| 11 | /* SIIT_ETH control the name of SIIT interface: |
| 12 | * 0 - interface name is siit0, |
| 13 | * 1 - interface name is ethX. |
| 14 | */ |
| 15 | #define SIIT_ETH 0 |
| 16 | |
| 17 | #define BUFF_SIZE 4096 |
| 18 | #define FRAG_BUFF_SIZE 1232 /* IPv6 max fragment size without IPv6 header |
| 19 | * to fragmanet IPv4 if result IPv6 packet will be > 1280 |
| 20 | */ |
| 21 | |
| 22 | #define TRANSLATED_PREFIX 0x0000ffff /* third byte in IPv4-translated addr prefix */ |
| 23 | #define MAPPED_PREFIX 0x0000ffff /* third byte in IPv4-mapped addr prefix */ |
| 24 | |
| 25 | #define IP4_IP6_HDR_DIFF 20 /* diffirence between IPv4 and IPv6 headers */ |
| 26 | #define IP6_FRAGMENT_SIZE 8 /* size of Fragment Header */ |
| 27 | |
| 28 | /* IPv6 header fields masks */ |
| 29 | #define IP6F_OFF_MASK 0xfff8 /* mask out offset from frag_off */ |
| 30 | #define IP6F_RESERVED_MASK 0x0006 /* reserved bits in frag_off */ |
| 31 | #define IP6F_MORE_FRAG 0x0001 /* more-fragments flag */ |
| 32 | |
| 33 | |
| 34 | |
| 35 | /* |
| 36 | * Macros to help debugging |
| 37 | */ |
| 38 | |
| 39 | #undef PDEBUG /* undef it, just in case */ |
| 40 | #ifdef SIIT_DEBUG |
| 41 | # ifdef __KERNEL__ |
| 42 | /* This one if debugging is on, and kernel space */ |
| 43 | # define PDEBUG(fmt, args...) printk(KERN_DEBUG "siit: " fmt, ## args) |
| 44 | # else |
| 45 | /* This one for user space */ |
| 46 | # define PDEBUG(fmt, args...) fprintf(stderr, fmt, ## args) |
| 47 | # endif |
| 48 | #else |
| 49 | # define PDEBUG(fmt, args...) /* not debugging: nothing */ |
| 50 | #endif |
| 51 | |
| 52 | #undef PDEBUGG |
| 53 | #define PDEBUGG(fmt, args...) |
| 54 | |
| 55 | |
| 56 | |
| 57 | |
| 58 | |
| 59 | |
| 60 | |
| 61 | |