flows.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /*
  2. * Copyright (c) 2001-2010 Aaron Turner <aturner at synfin dot net>
  3. * Copyright (c) 2013-2018 Fred Klassen <tcpreplay at appneta dot com> - AppNeta
  4. *
  5. * The Tcpreplay Suite of tools is free software: you can redistribute it
  6. * and/or modify it under the terms of the GNU General Public License as
  7. * published by the Free Software Foundation, either version 3 of the
  8. * License, or with the authors permission any later version.
  9. *
  10. * The Tcpreplay Suite is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with the Tcpreplay Suite. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. #ifndef FLOWS_H_
  19. #define FLOWS_H_
  20. #include "defines.h"
  21. #include "common.h"
  22. #define DEFAULT_FLOW_HASH_BUCKET_SIZE (1 << 16) /* 64K - must be a power of two */
  23. typedef enum flow_entry_type_e {
  24. FLOW_ENTRY_INVALID, /* unknown packet type */
  25. FLOW_ENTRY_NON_IP, /* is a flow, but non-IP */
  26. FLOW_ENTRY_NEW, /* flow never seen before */
  27. FLOW_ENTRY_EXISTING, /* flow already seen */
  28. FLOW_ENTRY_EXPIRED, /* flow existed but was expired */
  29. } flow_entry_type_t;
  30. typedef struct flow_hash_table flow_hash_table_t;
  31. flow_hash_table_t *flow_hash_table_init(size_t n);
  32. void flow_hash_table_release(flow_hash_table_t * table);
  33. flow_entry_type_t flow_decode(flow_hash_table_t *fht, const struct pcap_pkthdr *pkthdr,
  34. const u_char *pktdata, const int datalink, const int expiry);
  35. #endif /* FLOWS_H_ */