File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / miniupnpd / minissdpd / asyncsendto.h
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Wed Sep 27 11:25:11 2023 UTC (14 months, 4 weeks ago) by misho
Branches: miniupnpd, MAIN
CVS tags: v2_3_3p0, HEAD
Version 2.3.3p0

    1: /* $Id: asyncsendto.h,v 1.1.1.1 2023/09/27 11:25:11 misho Exp $ */
    2: /* MiniUPnP project
    3:  * http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
    4:  * (c) 2006-2017 Thomas Bernard
    5:  * This software is subject to the conditions detailed
    6:  * in the LICENCE file provided within the distribution */
    7: 
    8: #ifndef ASYNCSENDTO_H_INCLUDED
    9: #define ASYNCSENDTO_H_INCLUDED
   10: /* for fd_set */
   11: #include <sys/select.h>
   12: 
   13: /* sendto_schedule() : see sendto(2)
   14:  * schedule sendto() call after delay (milliseconds) */
   15: ssize_t
   16: sendto_schedule2(int sockfd, const void *buf, size_t len, int flags,
   17:                  const struct sockaddr *dest_addr, socklen_t addrlen,
   18:                  const struct sockaddr_in6 *src_addr,
   19:                  unsigned int delay);
   20: 
   21: #define sendto_schedule(sockfd, buf, len, flags, dest_addr, addrlen, delay) \
   22:         sendto_schedule2(sockfd, buf, len, flags, dest_addr, addrlen, NULL, delay)
   23: 
   24: /* sendto_schedule() : see sendto(2)
   25:  * try sendto() at once and schedule if EINTR/EAGAIN/EWOULDBLOCK */
   26: ssize_t
   27: sendto_or_schedule(int sockfd, const void *buf, size_t len, int flags,
   28:                    const struct sockaddr *dest_addr, socklen_t addrlen);
   29: 
   30: /* same as sendto_schedule() except it will try to set source address
   31:  * (for IPV6 only) */
   32: ssize_t
   33: sendto_or_schedule2(int sockfd, const void *buf, size_t len, int flags,
   34:                    const struct sockaddr *dest_addr, socklen_t addrlen,
   35:                    const struct sockaddr_in6 *src_addr);
   36: 
   37: /* get_next_scheduled_send()
   38:  * return number of scheduled sendto
   39:  * set next_send to timestamp to send next packet */
   40: int get_next_scheduled_send(struct timeval * next_send);
   41: 
   42: /* execute sendto() for needed packets */
   43: int try_sendto(fd_set * writefds);
   44: 
   45: /* set writefds before select() */
   46: int get_sendto_fds(fd_set * writefds, int * max_fd, const struct timeval * now);
   47: 
   48: /* empty the list */
   49: void finalize_sendto(void);
   50: 
   51: #endif

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>