get.h 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /* $Id$ */
  2. /*
  3. * Copyright (c) 2001-2010 Aaron Turner <aturner at synfin dot net>
  4. * Copyright (c) 2013-2024 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. #pragma once
  20. #include "config.h"
  21. #include "defines.h"
  22. #include "common.h"
  23. int parse_mpls(const u_char *pktdata,
  24. uint32_t datalen,
  25. uint16_t *protocol,
  26. uint32_t *l2len,
  27. uint32_t *l2offset);
  28. int parse_vlan(const u_char *pktdata,
  29. uint32_t datalen,
  30. uint16_t *next_protocol,
  31. uint32_t *l2len);
  32. int get_l2len(const u_char *pktdata, int datalen, int datalink);
  33. int get_l2len_protocol(const u_char *pktdata,
  34. uint32_t datalen,
  35. int datalink,
  36. uint16_t *protocol,
  37. uint32_t *l2len,
  38. uint32_t *l2offset,
  39. uint32_t *vlan_offset);
  40. void *get_layer4_v4(const ipv4_hdr_t *ip_hdr, const u_char *end_ptr);
  41. void *get_layer4_v6(const ipv6_hdr_t *ip_hdr, const u_char *end_ptr);
  42. u_int8_t get_ipv6_l4proto(const ipv6_hdr_t *ip6_hdr, const u_char *end_ptr);
  43. const u_char *get_ipv4(const u_char *pktdata, int datalen, int datalink, u_char **newbuff);
  44. const u_char *get_ipv6(const u_char *pktdata, int datalen, int datalink, u_char **newbuff);
  45. u_int32_t get_name2addr4(const char *hostname, bool dnslookup);
  46. const char *get_addr2name4(u_int32_t ip, bool dnslookup);
  47. const char *get_addr2name6(const struct tcpr_in6_addr *addr, bool dnslookup);
  48. const char *get_pcap_version(void);
  49. int get_name2addr6(const char *hostname, bool dnslookup, struct tcpr_in6_addr *addr);
  50. const char *get_cidr2name(const tcpr_cidr_t *cidr_ptr, bool dnslookup);