You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
1.7 KiB

8 years ago
​
​
​
​
​
​
​
​
​
​
​
8 years ago
8 years ago
​
​
8 years ago
​
​
8 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. /* $Id: asyncsendto.h,v 1.2 2014/05/19 14:21:10 nanard Exp $ */
  2. /* MiniUPnP project
  3. * http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
  4. * (c) 2006-2014 Thomas Bernard
  5. * This software is subject to the conditions detailed
  6. * in the LICENCE file provided within the distribution */
  7. #ifndef ASYNCSENDTO_H_INCLUDED
  8. #define ASYNCSENDTO_H_INCLUDED
  9. /* sendto_schedule() : see sendto(2)
  10. * schedule sendto() call after delay (milliseconds) */
  11. ssize_t sendto_schedule2(int sockfd, const void * buf, size_t len, int flags, const struct sockaddr * dest_addr, socklen_t addrlen, const struct sockaddr_in6 * src_addr, unsigned int delay);
  12. #define sendto_schedule(sockfd, buf, len, flags, dest_addr, addrlen, delay) sendto_schedule2(sockfd, buf, len, flags, dest_addr, addrlen, NULL, delay)
  13. /* sendto_schedule() : see sendto(2)
  14. * try sendto() at once and schedule if EINTR/EAGAIN/EWOULDBLOCK */
  15. ssize_t sendto_or_schedule(int sockfd, const void * buf, size_t len, int flags, const struct sockaddr * dest_addr, socklen_t addrlen);
  16. /* same as sendto_schedule() except it will try to set source address
  17. * (for IPV6 only) */
  18. ssize_t sendto_or_schedule2(int sockfd, const void * buf, size_t len, int flags, const struct sockaddr * dest_addr, socklen_t addrlen, const struct sockaddr_in6 * src_addr);
  19. /* get_next_scheduled_send()
  20. * return number of scheduled sendto
  21. * set next_send to timestamp to send next packet */
  22. int get_next_scheduled_send(struct timeval * next_send);
  23. /* execute sendto() for needed packets */
  24. int try_sendto(fd_set * writefds);
  25. /* set writefds before select() */
  26. int get_sendto_fds(fd_set * writefds, int * max_fd, const struct timeval * now);
  27. /* empty the list */
  28. void finalize_sendto(void);
  29. #endif