send-bsd.h 852 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. /*
  2. * ZMap Copyright 2013 Regents of the University of Michigan
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License"); you may not
  5. * use this file except in compliance with the License. You may obtain a copy
  6. * of the License at http://www.apache.org/licenses/LICENSE-2.0
  7. */
  8. #ifndef ZMAP_SEND_BSD_H
  9. #define ZMAP_SEND_BSD_H
  10. #include <sys/types.h>
  11. #include <sys/time.h>
  12. #include <sys/ioctl.h>
  13. #include <fcntl.h>
  14. #include "../lib/includes.h"
  15. #include <netinet/in.h>
  16. #include <net/bpf.h>
  17. #ifdef ZMAP_SEND_LINUX_H
  18. #error "Don't include both send-bsd.h and send-linux.h"
  19. #endif
  20. int send_run_init(UNUSED sock_t sock)
  21. {
  22. // Don't need to do anything on BSD-like variants
  23. return EXIT_SUCCESS;
  24. }
  25. int send_packet(sock_t sock, void *buf, int len, UNUSED uint32_t idx)
  26. {
  27. return write(sock.sock, buf, len);
  28. }
  29. #endif /* ZMAP_SEND_BSD_H */