jnpr_ether.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /* $Id$ */
  2. /*
  3. * Copyright (c) 2001-2010 Aaron Turner <aturner at synfin dot net>
  4. * Copyright (c) 2013-2017 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_jnpr_ether_H_
  20. #define _DLT_jnpr_ether_H_
  21. #include "jnpr_ether_types.h"
  22. #ifdef __cplusplus
  23. extern "C" {
  24. #endif
  25. #define JUNIPER_ETHER_HEADER_LEN 6
  26. #define JUNIPER_ETHER_MAGIC_LEN 3
  27. #define JUNIPER_ETHER_MAGIC "\x4d\x47\x43"
  28. #define JUNIPER_ETHER_OPTIONS_OFFSET 3
  29. #define JUNIPER_ETHER_L2PRESENT 0x80
  30. #define JUNIPER_ETHER_DIRECTION 0x01
  31. #define JUNIPER_ETHER_EXTLEN_OFFSET 4
  32. int dlt_jnpr_ether_register(tcpeditdlt_t *ctx);
  33. int dlt_jnpr_ether_init(tcpeditdlt_t *ctx);
  34. int dlt_jnpr_ether_post_init(tcpeditdlt_t *ctx);
  35. int dlt_jnpr_ether_cleanup(tcpeditdlt_t *ctx);
  36. int dlt_jnpr_ether_parse_opts(tcpeditdlt_t *ctx);
  37. int dlt_jnpr_ether_decode(tcpeditdlt_t *ctx, const u_char *packet, const int pktlen);
  38. int dlt_jnpr_ether_encode(tcpeditdlt_t *ctx, u_char *packet, int pktlen, tcpr_dir_t dir);
  39. int dlt_jnpr_ether_proto(tcpeditdlt_t *ctx, const u_char *packet, const int pktlen);
  40. u_char *dlt_jnpr_ether_get_layer3(tcpeditdlt_t *ctx, u_char *packet, const int pktlen);
  41. u_char *dlt_jnpr_ether_merge_layer3(tcpeditdlt_t *ctx, u_char *packet, const int pktlen, u_char *l3data);
  42. tcpeditdlt_l2addr_type_t dlt_jnpr_ether_l2addr_type(void);
  43. int dlt_jnpr_ether_l2len(tcpeditdlt_t *ctx, const u_char *packet, const int pktlen);
  44. u_char *dlt_jnpr_ether_get_mac(tcpeditdlt_t *ctx, tcpeditdlt_mac_type_t mac, const u_char *packet, const int pktlen);
  45. #ifdef __cplusplus
  46. }
  47. #endif
  48. #endif