Lines Matching +full:timer +full:- +full:secure
2 * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
31 Common convenience functions for cross-platform portability and
41 #include <event2/event-config.h>
88 * C99-specified stdint.h. Shamefully, some platforms do not include
203 /* Note that we define ev_off_t based on the compile-time size of off_t that
226 - The compiler does constant folding properly.
227 - The platform does signed arithmetic in two's complement.
241 #define EV_INT64_MIN ((-EV_INT64_MAX) - 1)
244 #define EV_INT32_MIN ((-EV_INT32_MAX) - 1)
247 #define EV_INT16_MIN ((-EV_INT16_MAX) - 1)
250 #define EV_INT8_MIN ((-EV_INT8_MAX) - 1)
286 #define EV_SSIZE_MIN ((-EV_SSIZE_MAX) - 1)
314 * Structure to hold information about a monotonic timer
345 * functions. You must configure the timer with
355 void evutil_monotonic_timer_free(struct evutil_monotonic_timer *timer);
361 int evutil_configure_monotonic_time(struct evutil_monotonic_timer *timer,
366 * time is guaranteed never to run in reverse, but is not necessarily epoch-
371 * It is not safe to use this funtion on the same timer from multiple
375 int evutil_gettime_monotonic(struct evutil_monotonic_timer *timer,
391 /** Do platform-specific operations as needed to make a socket nonblocking.
394 @return 0 on success, -1 on failure
399 /** Do platform-specific operations to make a listener socket reusable.
408 @return 0 on success, -1 on failure
413 /** Do platform-specific operations to make a listener port reusable.
421 @return 0 on success, -1 on failure
429 sockets is to work in IPv4-mapped mode. In IPv4-mapped mode, it is not possible
433 @return 0 on success, -1 on failure
438 /** Do platform-specific operations as needed to close a socket upon a
442 @return 0 on success, -1 on failure
447 /** Do the platform-specific call needed to close a socket returned from
452 -1 on failure
458 /** Do platform-specific operations, if possible, to make a tcp listener
467 * -1 on failure
490 Windows and Unix-like platforms.
508 #define EVUTIL_INVALID_SOCKET -1
516 #define EVUTIL_INVALID_SOCKET -1
534 (vvp)->tv_sec = (tvp)->tv_sec + (uvp)->tv_sec; \
535 (vvp)->tv_usec = (tvp)->tv_usec + (uvp)->tv_usec; \
536 if ((vvp)->tv_usec >= 1000000) { \
537 (vvp)->tv_sec++; \
538 (vvp)->tv_usec -= 1000000; \
543 (vvp)->tv_sec = (tvp)->tv_sec - (uvp)->tv_sec; \
544 (vvp)->tv_usec = (tvp)->tv_usec - (uvp)->tv_usec; \
545 if ((vvp)->tv_usec < 0) { \
546 (vvp)->tv_sec--; \
547 (vvp)->tv_usec += 1000000; \
555 #define evutil_timerclear(tvp) (tvp)->tv_sec = (tvp)->tv_usec = 0
562 (((tvp)->tv_sec == (uvp)->tv_sec) ? \
563 ((tvp)->tv_usec cmp (uvp)->tv_usec) : \
564 ((tvp)->tv_sec cmp (uvp)->tv_sec))
569 #define evutil_timerisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec)
576 #define evutil_offsetof(type, field) ((off_t)(&((type *)0)->field))
579 /* big-int related functions */
580 /** Parse a 64-bit value from a string. Arguments are as for strtol. */
629 - [IPv6Address]:port
630 - [IPv6Address]
631 - IPv6Address
632 - IPv4Address:port
633 - IPv4Address
642 @return -1 if the address is not well-formed, if the port is out of range,
658 /** As strcasecmp, but always compares the characters in locale-independent
659 ASCII. That's useful if you're handling data in ASCII-based protocols.
663 /** As strncasecmp, but always compares the characters in locale-independent
664 ASCII. That's useful if you're handling data in ASCII-based protocols.
700 #define EVUTIL_EAI_ADDRFAMILY -901
705 #define EVUTIL_EAI_AGAIN -902
710 #define EVUTIL_EAI_BADFLAGS -903
715 #define EVUTIL_EAI_FAIL -904
720 #define EVUTIL_EAI_FAMILY -905
725 #define EVUTIL_EAI_MEMORY -906
733 #define EVUTIL_EAI_NODATA -907
738 #define EVUTIL_EAI_NONAME -908
743 #define EVUTIL_EAI_SERVICE -909
748 #define EVUTIL_EAI_SOCKTYPE -910
753 #define EVUTIL_EAI_SYSTEM -911
756 #define EVUTIL_EAI_CANCEL -90001
801 * - When the system has no getaddrinfo, we fall back to gethostbyname_r or
803 * - The AI_V4MAPPED and AI_ALL flags are not currently implemented.
818 /** Generate n bytes of secure pseudorandom data, and store them in buf.
820 * Current versions of Libevent use an ARC4-based random number generator,
821 * seeded using the platform's entropy source (/dev/urandom on Unix-like
822 * systems; CryptGenRandom on Windows). This is not actually as secure as it
824 * provides only rudimentary prediction- and backtracking-resistance. Don't
831 * Seed the secure random number generator if needed, and return 0 on
832 * success or -1 on failure.
835 * 0 if the RNG has been successfully seeded and -1 if it can't be
840 * numbers. You only need to call it if (a) you want to double-check
850 * Set a filename to use in place of /dev/urandom for seeding the secure
851 * PRNG. Return 0 on success, -1 on failure.
857 * user of the secure RNG might be running. Don't pass anything other than a