Napatech Software Suite: include/ntapi/pktdescr_dyn4.h Source File includentapi pktdescr_dyn4.h Go to the documentation of this file. 1 /* 2 * 3 * Copyright (C) 2023 Napatech A/S. 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions are met: 8 * * Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer. 10 * * Redistributions in binary form must reproduce the above copyright 11 * notice, this list of conditions and the following disclaimer in the 12 * documentation and/or other materials provided with the distribution. 13 * * Neither the name of the Napatech A/S nor the 14 * names of its contributors may be used to endorse or promote products 15 * derived from this software without specific prior written permission. 16 * 17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 * DISCLAIMED. IN NO EVENT SHALL NAPATECH A/S BE LIABLE FOR ANY 21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 * 28 * 29 30 */ 31 32 /** 33 * @file 34 * This source file contains the NT_DYN4 variable packet descriptor.\n 35 */ 36 37 #ifndef __PKT_DESCR_DYN4_H__ 38 #define __PKT_DESCR_DYN4_H__ 39 40 /** @addtogroup PacketDescriptorDyn4 41 * @{ 42 * 43 * This descriptor provides the option to have the 64-bit correlation key in 44 * the color1 field, alternatively (the default) 32-bits color and 32-bits 45 * hash value can be provided in color1. The color0 field contains the lower 8 46 * bits of the color when the color1 field is used for correlation key, 47 * otherwise (the default) color0 contains the outer protocol number 48 * The default values for the dynamic parts are: 49 * 50 * offset0 = outer L3\n 51 * offset1 = outer L4\n 52 * color0 = outer Protocol / Next Header field\n 53 * color1[31:0] = color value\n 54 * color1[63:32] = hash value\n 55 * descrLength = 24\n 56 * 57 */ 58 59 // Ensure that the following is packed. 60 #pragma pack(push, 1) 61 62 /** 63 * @brief NT Variable descriptor 4 64 */ 65 typedef struct NtDyn4Descr_s { 66 67 uint64_t capLength:14; /**< The length of the packet incl. descriptor. */ /* 0*/ 68 uint64_t offset0:10; /**< Programmable offset into the packet. Default is outer L3. */ /* 14*/ 69 uint64_t offset1:10; /**< Programmable offset into the packet. Default is outer L4. */ /* 24*/ 70 uint64_t color0:8; /**< Programmable packet color[8:0]. */ /* 34*/ 71 uint64_t rxPort:6; /**< The port that received the frame. */ /* 42*/ 72 uint64_t descrFormat:8; /**< The descriptor type. */ /* 48*/ 73 uint64_t descrLength:6; /**< The length of the descriptor in bytes. */ /* 56*/ 74 uint64_t tsColor:1; /**< Timestamp color. Reserved for future use. */ /* 62*/ 75 uint64_t ntDynDescr:1; /**< Set to 1 to identify this descriptor as a dynamic descriptor. */ /* 63*/ 76 uint64_t timestamp; /**< The time of arrival of the packet. */ /* 64*/ 77 uint64_t color1; /**< Programmable packet color[31:0] and hash[63:32]. */ /*128*/ 78 79 } NtDyn4Descr_t; // descrFormat = 4, default descrLength = 24 /*192 bits*/ 80 81 // Disable 1-byte packing 82 #pragma pack(pop) 83 84 #ifndef DOXYGEN_INTERNAL_ONLY 85 86 87 #define _NT_NET_GET_PKT_DESCR_PTR_DYN4(_hNetBuf_) ((NtDyn4Descr_t*)(_hNetBuf_)->hHdr) 88 89 90 #ifdef DEBUG 91 //Guards against misconfigurations 92 #ifdef _MSC_VER 93 static void __nt_dyn4_check__(void); 94 #else 95 static void __nt_dyn4_check__(void) __attribute__ ((unused)); 96 #endif 97 static void __nt_dyn4_check__(void) { 98 //Compile-time check to avoid sizeof(NtDyn4Descr_t) != 24 99 #ifndef WIN32 100 switch (0) { case 0: case sizeof (NtDyn4Descr_t) == 24: ; } 101 #endif 102 } 103 #endif // DEBUG 104 105 #endif // DOXYGEN_INTERNAL_ONLY 106 107 /** @} */ 108 109 #endif // __PKT_DESCR_DYN4_H__ DN-0449 Napatech Software Suite Reference Documentation (v. 3.28.3.185-b675882b)Copyright © 2023 Napatech A/S