probe_modules.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. #include "../state.h"
  2. #include "../fieldset.h"
  3. #ifndef PROBE_MODULES_H
  4. #define PROBE_MODULES_H
  5. typedef struct probe_response_type {
  6. const uint8_t is_success;
  7. const char *name;
  8. } response_type_t;
  9. typedef int (*probe_global_init_cb)(struct state_conf *);
  10. typedef int (*probe_thread_init_cb)(void* packetbuf, macaddr_t* src_mac,
  11. macaddr_t* gw_mac, port_n_t src_port, void **arg_ptr);
  12. typedef int (*probe_make_packet_cb)(void* packetbuf, ipaddr_n_t src_ip,
  13. ipaddr_n_t dst_ip,
  14. uint32_t *validation, int probe_num, void *arg);
  15. typedef void (*probe_print_packet_cb)(FILE *, void* packetbuf);
  16. typedef int (*probe_close_cb)(struct state_conf*,
  17. struct state_send*, struct state_recv*);
  18. typedef int (*probe_validate_packet_cb)(const struct ip *ip_hdr,
  19. uint32_t len, uint32_t *src_ip, uint32_t *validation);
  20. typedef void (*probe_classify_packet_cb)(const u_char* packetbuf,
  21. uint32_t len, fieldset_t*);
  22. typedef struct probe_module {
  23. const char *name;
  24. size_t packet_length;
  25. const char *pcap_filter;
  26. size_t pcap_snaplen;
  27. // Should ZMap complain if the user hasn't specified valid
  28. // source and target port numbers?
  29. uint8_t port_args;
  30. probe_global_init_cb global_initialize;
  31. probe_thread_init_cb thread_initialize;
  32. probe_make_packet_cb make_packet;
  33. probe_print_packet_cb print_packet;
  34. probe_validate_packet_cb validate_packet;
  35. probe_classify_packet_cb process_packet;
  36. probe_close_cb close;
  37. fielddef_t *fields;
  38. int numfields;
  39. const char *helptext;
  40. } probe_module_t;
  41. probe_module_t* get_probe_module_by_name(const char*);
  42. void fs_add_ip_fields(fieldset_t *fs, struct ip *ip);
  43. void fs_add_system_fields(fieldset_t *fs, int is_repeat, int in_cooldown);
  44. void print_probe_modules(void);
  45. extern int ip_fields_len;
  46. extern int sys_fields_len;
  47. extern fielddef_t ip_fields[];
  48. extern fielddef_t sys_fields[];
  49. #endif // HEADER_PROBE_MODULES_H