en10mb_types.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. /* $Id$ */
  2. /*
  3. * Copyright (c) 2001-2010 Aaron Turner <aturner at synfin dot net>
  4. * Copyright (c) 2013-2018 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_int16_t vlan_tag;
  28. u_int16_t vlan_pri;
  29. u_int16_t vlan_cfi;
  30. } en10mb_extra_t;
  31. typedef enum {
  32. TCPEDIT_MAC_MASK_SMAC1 = 1,
  33. TCPEDIT_MAC_MASK_SMAC2 = 2,
  34. TCPEDIT_MAC_MASK_DMAC1 = 4,
  35. TCPEDIT_MAC_MASK_DMAC2 = 8
  36. } tcpedit_mac_mask;
  37. typedef enum {
  38. TCPEDIT_VLAN_OFF = 0,
  39. TCPEDIT_VLAN_DEL, /* strip 802.1q and rewrite as standard 802.3 Ethernet */
  40. TCPEDIT_VLAN_ADD /* add/replace 802.1q vlan tag */
  41. } tcpedit_vlan;
  42. typedef struct {
  43. tcpr_macaddr_t target;
  44. tcpr_macaddr_t rewrite;
  45. } en10mb_sub_entry_t;
  46. typedef struct {
  47. int count;
  48. en10mb_sub_entry_t *entries;
  49. } en10mb_sub_conf_t;
  50. typedef struct {
  51. uint32_t set;
  52. int keep;
  53. tcpr_macaddr_t mask;
  54. } en10mb_random_conf_t;
  55. typedef struct {
  56. /* values to rewrite src/dst MAC addresses */
  57. tcpr_macaddr_t intf1_dmac;
  58. tcpr_macaddr_t intf1_smac;
  59. tcpr_macaddr_t intf2_dmac;
  60. tcpr_macaddr_t intf2_smac;
  61. en10mb_sub_conf_t subs;
  62. en10mb_random_conf_t random;
  63. /* we use the mask to say which are valid values */
  64. tcpedit_mac_mask mac_mask;
  65. /* 802.1q VLAN tag stuff */
  66. tcpedit_vlan vlan;
  67. /* user defined values, -1 means unset! */
  68. u_int16_t vlan_tag;
  69. u_int8_t vlan_pri;
  70. u_int8_t vlan_cfi;
  71. } en10mb_config_t;
  72. #ifdef __cplusplus
  73. }
  74. #endif
  75. #endif