en10mb_types.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. /* $Id$ */
  2. /*
  3. * Copyright (c) 2001-2010 Aaron Turner <aturner at synfin dot net>
  4. * Copyright (c) 2013-2022 Fred Klassen <tcpreplay at appneta dot com> - AppNeta
  5. *
  6. * The Tcpreplay Suite of tools is free software: you can redistribute it
  7. * and/or modify it under the terms of the GNU General Public License as
  8. * published by the Free Software Foundation, either version 3 of the
  9. * License, or with the authors permission any later version.
  10. *
  11. * The Tcpreplay Suite is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with the Tcpreplay Suite. If not, see <http://www.gnu.org/licenses/>.
  18. */
  19. #ifndef _DLT_en10mb_TYPES_H_
  20. #define _DLT_en10mb_TYPES_H_
  21. #include "plugins_types.h"
  22. #ifdef __cplusplus
  23. extern "C" {
  24. #endif
  25. typedef struct {
  26. int vlan; /* set to 1 for vlan_ fields being filled out */
  27. u_int32_t vlan_offset;
  28. u_int16_t vlan_tag;
  29. u_int16_t vlan_pri;
  30. u_int16_t vlan_cfi;
  31. u_int16_t vlan_proto;
  32. bool src_modified;
  33. bool dst_modified;
  34. } en10mb_extra_t;
  35. typedef enum {
  36. TCPEDIT_MAC_MASK_SMAC1 = 1,
  37. TCPEDIT_MAC_MASK_SMAC2 = 2,
  38. TCPEDIT_MAC_MASK_DMAC1 = 4,
  39. TCPEDIT_MAC_MASK_DMAC2 = 8
  40. } tcpedit_mac_mask;
  41. typedef enum {
  42. TCPEDIT_VLAN_OFF = 0,
  43. TCPEDIT_VLAN_DEL, /* strip 802.1q and rewrite as standard 802.3 Ethernet */
  44. TCPEDIT_VLAN_ADD /* add/replace 802.1q vlan tag */
  45. } tcpedit_vlan;
  46. typedef struct {
  47. tcpr_macaddr_t target;
  48. tcpr_macaddr_t rewrite;
  49. } en10mb_sub_entry_t;
  50. typedef struct {
  51. int count;
  52. en10mb_sub_entry_t *entries;
  53. } en10mb_sub_conf_t;
  54. typedef struct {
  55. uint32_t set;
  56. int keep;
  57. tcpr_macaddr_t mask;
  58. } en10mb_random_conf_t;
  59. typedef struct {
  60. /* values to rewrite src/dst MAC addresses */
  61. tcpr_macaddr_t intf1_dmac;
  62. tcpr_macaddr_t intf1_smac;
  63. tcpr_macaddr_t intf2_dmac;
  64. tcpr_macaddr_t intf2_smac;
  65. en10mb_sub_conf_t subs;
  66. en10mb_random_conf_t random;
  67. /* we use the mask to say which are valid values */
  68. tcpedit_mac_mask mac_mask;
  69. /* 802.1q VLAN tag stuff */
  70. tcpedit_vlan vlan;
  71. /* user defined values, -1 means unset! */
  72. u_int16_t vlan_tag;
  73. u_int8_t vlan_pri;
  74. u_int8_t vlan_cfi;
  75. /* 802.1Q/802.1ad VLAN Q-in-Q - 0 means 802.1Q */
  76. u_int16_t vlan_proto;
  77. } en10mb_config_t;
  78. #ifdef __cplusplus
  79. }
  80. #endif
  81. #endif