1 /* 2 * FreeRTOS+TCP <DEVELOPMENT BRANCH> 3 * Copyright (C) 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 * 5 * SPDX-License-Identifier: MIT 6 * 7 * Permission is hereby granted, free of charge, to any person obtaining a copy of 8 * this software and associated documentation files (the "Software"), to deal in 9 * the Software without restriction, including without limitation the rights to 10 * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 * the Software, and to permit persons to whom the Software is furnished to do so, 12 * subject to the following conditions: 13 * 14 * The above copyright notice and this permission notice shall be included in all 15 * copies or substantial portions of the Software. 16 * 17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 * 24 * http://aws.amazon.com/freertos 25 * http://www.FreeRTOS.org 26 */ 27 28 #ifndef DUMP_PACKETS_H 29 30 31 #define DUMP_PACKETS_H 32 33 #ifndef dumpMAX_DUMP_ENTRIES 34 #define dumpMAX_DUMP_ENTRIES 16 35 #endif 36 37 #define flag_ICMP4 0x00000001UL 38 #define flag_ICMP6 0x00000002UL 39 #define flag_UDP 0x00000004UL 40 #define flag_TCP 0x00000008UL 41 #define flag_DNS 0x00000010UL 42 #define flag_REPLY 0x00000020UL 43 #define flag_REQUEST 0x00000040UL 44 #define flag_SYN 0x00000080UL 45 #define flag_FIN 0x00000100UL 46 #define flag_RST 0x00000200UL 47 #define flag_ACK 0x00000400UL 48 #define flag_IN 0x00000800UL 49 #define flag_OUT 0x00001000UL 50 #define flag_FRAME_ARP 0x00002000UL 51 #define flag_ARP 0x00004000UL 52 #define flag_UNKNOWN 0x00008000UL 53 #define flag_FRAME_4 0x00010000UL 54 #define flag_FRAME_6 0x00020000UL 55 #define flag_Unknown_FRAME 0x00040000UL 56 57 /** @brief Structure to hold information about one dump entry. 58 */ 59 typedef struct xDumpEntry 60 { 61 uint32_t ulMask; /**< The mask of the entry */ 62 size_t uxMax; /**< The max value of the entry */ 63 size_t uxCount; /**< The count of the entry */ 64 } DumpEntry_t; 65 66 /** @brief Structure to hold information of all the entries in this data dump. */ 67 typedef struct xDumpEntries 68 { 69 size_t uxEntryCount; /**< The number of entries*/ 70 DumpEntry_t xEntries[ dumpMAX_DUMP_ENTRIES ]; /**< Array of struct for all the entries */ 71 } DumpEntries_t; 72 73 #if ( ipconfigUSE_DUMP_PACKETS != 0 ) 74 75 extern void dump_packet_init( const char * pcFileName, 76 DumpEntries_t * pxEntries ); 77 #define iptraceDUMP_INIT( pcFileName, pxEntries ) \ 78 dump_packet_init( pcFileName, pxEntries ) 79 80 extern void dump_packet( const uint8_t * pucBuffer, 81 size_t uxLength, 82 BaseType_t xIncoming ); 83 #define iptraceDUMP_PACKET( pucBuffer, uxLength, xIncoming ) \ 84 dump_packet( pucBuffer, uxLength, xIncoming ) 85 86 #endif /* if ( ipconfigUSE_DUMP_PACKETS != 0 ) */ 87 88 #endif /* ifndef DUMP_PACKETS_H */ 89