Warning, file /include/event2/util.h was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026 #ifndef EVENT2_UTIL_H_INCLUDED_
0027 #define EVENT2_UTIL_H_INCLUDED_
0028
0029
0030
0031
0032
0033
0034
0035 #include <event2/visibility.h>
0036
0037 #ifdef __cplusplus
0038 extern "C" {
0039 #endif
0040
0041 #include <event2/event-config.h>
0042 #ifdef EVENT__HAVE_SYS_TIME_H
0043 #include <sys/time.h>
0044 #endif
0045 #ifdef EVENT__HAVE_STDINT_H
0046 #include <stdint.h>
0047 #elif defined(EVENT__HAVE_INTTYPES_H)
0048 #include <inttypes.h>
0049 #endif
0050 #ifdef EVENT__HAVE_SYS_TYPES_H
0051 #include <sys/types.h>
0052 #endif
0053 #ifdef EVENT__HAVE_STDDEF_H
0054 #include <stddef.h>
0055 #endif
0056 #ifdef _MSC_VER
0057 #include <BaseTsd.h>
0058 #endif
0059 #include <stdarg.h>
0060 #ifdef EVENT__HAVE_NETDB_H
0061 #include <netdb.h>
0062 #endif
0063
0064 #ifdef _WIN32
0065 #include <winsock2.h>
0066 #ifdef EVENT__HAVE_GETADDRINFO
0067
0068 #include <ws2tcpip.h>
0069 #endif
0070 #else
0071 #ifdef EVENT__HAVE_ERRNO_H
0072 #include <errno.h>
0073 #endif
0074 #include <sys/socket.h>
0075 #endif
0076
0077 #include <time.h>
0078
0079
0080 #if defined(EVENT__SIZEOF_VOID__) && !defined(EVENT__SIZEOF_VOID_P)
0081 #define EVENT__SIZEOF_VOID_P EVENT__SIZEOF_VOID__
0082 #endif
0083
0084
0085
0086
0087
0088
0089
0090
0091
0092
0093
0094
0095
0096
0097
0098
0099
0100
0101
0102
0103
0104
0105
0106
0107
0108
0109
0110
0111
0112
0113 #ifdef EVENT__HAVE_UINT64_T
0114 #define ev_uint64_t uint64_t
0115 #define ev_int64_t int64_t
0116 #elif defined(_WIN32)
0117 #define ev_uint64_t unsigned __int64
0118 #define ev_int64_t signed __int64
0119 #elif EVENT__SIZEOF_LONG_LONG == 8
0120 #define ev_uint64_t unsigned long long
0121 #define ev_int64_t long long
0122 #elif EVENT__SIZEOF_LONG == 8
0123 #define ev_uint64_t unsigned long
0124 #define ev_int64_t long
0125 #elif defined(EVENT_IN_DOXYGEN_)
0126 #define ev_uint64_t ...
0127 #define ev_int64_t ...
0128 #else
0129 #error "No way to define ev_uint64_t"
0130 #endif
0131
0132 #ifdef EVENT__HAVE_UINT32_T
0133 #define ev_uint32_t uint32_t
0134 #define ev_int32_t int32_t
0135 #elif defined(_WIN32)
0136 #define ev_uint32_t unsigned int
0137 #define ev_int32_t signed int
0138 #elif EVENT__SIZEOF_LONG == 4
0139 #define ev_uint32_t unsigned long
0140 #define ev_int32_t signed long
0141 #elif EVENT__SIZEOF_INT == 4
0142 #define ev_uint32_t unsigned int
0143 #define ev_int32_t signed int
0144 #elif defined(EVENT_IN_DOXYGEN_)
0145 #define ev_uint32_t ...
0146 #define ev_int32_t ...
0147 #else
0148 #error "No way to define ev_uint32_t"
0149 #endif
0150
0151 #ifdef EVENT__HAVE_UINT16_T
0152 #define ev_uint16_t uint16_t
0153 #define ev_int16_t int16_t
0154 #elif defined(_WIN32)
0155 #define ev_uint16_t unsigned short
0156 #define ev_int16_t signed short
0157 #elif EVENT__SIZEOF_INT == 2
0158 #define ev_uint16_t unsigned int
0159 #define ev_int16_t signed int
0160 #elif EVENT__SIZEOF_SHORT == 2
0161 #define ev_uint16_t unsigned short
0162 #define ev_int16_t signed short
0163 #elif defined(EVENT_IN_DOXYGEN_)
0164 #define ev_uint16_t ...
0165 #define ev_int16_t ...
0166 #else
0167 #error "No way to define ev_uint16_t"
0168 #endif
0169
0170 #ifdef EVENT__HAVE_UINT8_T
0171 #define ev_uint8_t uint8_t
0172 #define ev_int8_t int8_t
0173 #elif defined(EVENT_IN_DOXYGEN_)
0174 #define ev_uint8_t ...
0175 #define ev_int8_t ...
0176 #else
0177 #define ev_uint8_t unsigned char
0178 #define ev_int8_t signed char
0179 #endif
0180
0181 #ifdef EVENT__HAVE_UINTPTR_T
0182 #define ev_uintptr_t uintptr_t
0183 #define ev_intptr_t intptr_t
0184 #elif EVENT__SIZEOF_VOID_P <= 4
0185 #define ev_uintptr_t ev_uint32_t
0186 #define ev_intptr_t ev_int32_t
0187 #elif EVENT__SIZEOF_VOID_P <= 8
0188 #define ev_uintptr_t ev_uint64_t
0189 #define ev_intptr_t ev_int64_t
0190 #elif defined(EVENT_IN_DOXYGEN_)
0191 #define ev_uintptr_t ...
0192 #define ev_intptr_t ...
0193 #else
0194 #error "No way to define ev_uintptr_t"
0195 #endif
0196
0197 #ifdef EVENT__ssize_t
0198 #define ev_ssize_t EVENT__ssize_t
0199 #else
0200 #define ev_ssize_t ssize_t
0201 #endif
0202
0203
0204
0205
0206
0207
0208
0209
0210 #ifdef _WIN32
0211 #define ev_off_t ev_int64_t
0212 #elif EVENT__SIZEOF_OFF_T == 8
0213 #define ev_off_t ev_int64_t
0214 #elif EVENT__SIZEOF_OFF_T == 4
0215 #define ev_off_t ev_int32_t
0216 #elif defined(EVENT_IN_DOXYGEN_)
0217 #define ev_off_t ...
0218 #else
0219 #define ev_off_t off_t
0220 #endif
0221
0222
0223
0224
0225
0226
0227
0228
0229
0230
0231
0232
0233
0234
0235
0236
0237
0238 #ifndef EVENT__HAVE_STDINT_H
0239 #define EV_UINT64_MAX ((((ev_uint64_t)0xffffffffUL) << 32) | 0xffffffffUL)
0240 #define EV_INT64_MAX ((((ev_int64_t) 0x7fffffffL) << 32) | 0xffffffffL)
0241 #define EV_INT64_MIN ((-EV_INT64_MAX) - 1)
0242 #define EV_UINT32_MAX ((ev_uint32_t)0xffffffffUL)
0243 #define EV_INT32_MAX ((ev_int32_t) 0x7fffffffL)
0244 #define EV_INT32_MIN ((-EV_INT32_MAX) - 1)
0245 #define EV_UINT16_MAX ((ev_uint16_t)0xffffUL)
0246 #define EV_INT16_MAX ((ev_int16_t) 0x7fffL)
0247 #define EV_INT16_MIN ((-EV_INT16_MAX) - 1)
0248 #define EV_UINT8_MAX 255
0249 #define EV_INT8_MAX 127
0250 #define EV_INT8_MIN ((-EV_INT8_MAX) - 1)
0251 #else
0252 #define EV_UINT64_MAX UINT64_MAX
0253 #define EV_INT64_MAX INT64_MAX
0254 #define EV_INT64_MIN INT64_MIN
0255 #define EV_UINT32_MAX UINT32_MAX
0256 #define EV_INT32_MAX INT32_MAX
0257 #define EV_INT32_MIN INT32_MIN
0258 #define EV_UINT16_MAX UINT16_MAX
0259 #define EV_INT16_MIN INT16_MIN
0260 #define EV_INT16_MAX INT16_MAX
0261 #define EV_UINT8_MAX UINT8_MAX
0262 #define EV_INT8_MAX INT8_MAX
0263 #define EV_INT8_MIN INT8_MIN
0264
0265 #endif
0266
0267
0268
0269
0270
0271
0272
0273 #if EVENT__SIZEOF_SIZE_T == 8
0274 #define EV_SIZE_MAX EV_UINT64_MAX
0275 #define EV_SSIZE_MAX EV_INT64_MAX
0276 #elif EVENT__SIZEOF_SIZE_T == 4
0277 #define EV_SIZE_MAX EV_UINT32_MAX
0278 #define EV_SSIZE_MAX EV_INT32_MAX
0279 #elif defined(EVENT_IN_DOXYGEN_)
0280 #define EV_SIZE_MAX ...
0281 #define EV_SSIZE_MAX ...
0282 #else
0283 #error "No way to define SIZE_MAX"
0284 #endif
0285
0286 #define EV_SSIZE_MIN ((-EV_SSIZE_MAX) - 1)
0287
0288
0289 #ifdef _WIN32
0290 #define ev_socklen_t int
0291 #elif defined(EVENT__socklen_t)
0292 #define ev_socklen_t EVENT__socklen_t
0293 #else
0294 #define ev_socklen_t socklen_t
0295 #endif
0296
0297 #ifdef EVENT__HAVE_STRUCT_SOCKADDR_STORAGE___SS_FAMILY
0298 #if !defined(EVENT__HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY) \
0299 && !defined(ss_family)
0300 #define ss_family __ss_family
0301 #endif
0302 #endif
0303
0304
0305
0306
0307 #ifdef _WIN32
0308 #define evutil_socket_t intptr_t
0309 #else
0310 #define evutil_socket_t int
0311 #endif
0312
0313
0314
0315
0316
0317
0318
0319
0320
0321
0322
0323
0324
0325 struct evutil_monotonic_timer
0326 #ifdef EVENT_IN_DOXYGEN_
0327 {}
0328 #endif
0329 ;
0330
0331 #define EV_MONOT_PRECISE 1
0332 #define EV_MONOT_FALLBACK 2
0333
0334
0335
0336
0337
0338
0339
0340 EVENT2_EXPORT_SYMBOL int
0341 evutil_date_rfc1123(char *date, const size_t datelen, const struct tm *tm);
0342
0343
0344
0345
0346
0347
0348 EVENT2_EXPORT_SYMBOL
0349 struct evutil_monotonic_timer * evutil_monotonic_timer_new(void);
0350
0351
0352
0353
0354 EVENT2_EXPORT_SYMBOL
0355 void evutil_monotonic_timer_free(struct evutil_monotonic_timer *timer);
0356
0357
0358
0359
0360 EVENT2_EXPORT_SYMBOL
0361 int evutil_configure_monotonic_time(struct evutil_monotonic_timer *timer,
0362 int flags);
0363
0364
0365
0366
0367
0368
0369
0370
0371
0372
0373
0374 EVENT2_EXPORT_SYMBOL
0375 int evutil_gettime_monotonic(struct evutil_monotonic_timer *timer,
0376 struct timeval *tp);
0377
0378
0379
0380
0381
0382
0383
0384
0385
0386
0387
0388
0389 EVENT2_EXPORT_SYMBOL
0390 int evutil_socketpair(int d, int type, int protocol, evutil_socket_t sv[2]);
0391
0392
0393
0394
0395
0396 EVENT2_EXPORT_SYMBOL
0397 int evutil_make_socket_nonblocking(evutil_socket_t sock);
0398
0399
0400
0401
0402
0403
0404
0405
0406
0407
0408
0409
0410 EVENT2_EXPORT_SYMBOL
0411 int evutil_make_listen_socket_reuseable(evutil_socket_t sock);
0412
0413
0414
0415
0416
0417
0418
0419
0420
0421
0422
0423 EVENT2_EXPORT_SYMBOL
0424 int evutil_make_listen_socket_reuseable_port(evutil_socket_t sock);
0425
0426
0427
0428
0429
0430
0431
0432
0433
0434
0435 EVENT2_EXPORT_SYMBOL
0436 int evutil_make_listen_socket_ipv6only(evutil_socket_t sock);
0437
0438
0439
0440
0441
0442
0443
0444 EVENT2_EXPORT_SYMBOL
0445 int evutil_make_socket_closeonexec(evutil_socket_t sock);
0446
0447
0448
0449
0450
0451
0452
0453
0454 EVENT2_EXPORT_SYMBOL
0455 int evutil_closesocket(evutil_socket_t sock);
0456 #define EVUTIL_CLOSESOCKET(s) evutil_closesocket(s)
0457
0458
0459
0460
0461
0462
0463
0464
0465
0466
0467
0468
0469 EVENT2_EXPORT_SYMBOL
0470 int evutil_make_tcp_listen_socket_deferred(evutil_socket_t sock);
0471
0472 #ifdef _WIN32
0473
0474 #define EVUTIL_SOCKET_ERROR() WSAGetLastError()
0475
0476 #define EVUTIL_SET_SOCKET_ERROR(errcode) \
0477 do { WSASetLastError(errcode); } while (0)
0478
0479 EVENT2_EXPORT_SYMBOL
0480 int evutil_socket_geterror(evutil_socket_t sock);
0481
0482 EVENT2_EXPORT_SYMBOL
0483 const char *evutil_socket_error_to_string(int errcode);
0484 #define EVUTIL_INVALID_SOCKET INVALID_SOCKET
0485 #elif defined(EVENT_IN_DOXYGEN_)
0486
0487
0488
0489
0490
0491
0492
0493
0494
0495
0496
0497
0498
0499
0500
0501 #define EVUTIL_SOCKET_ERROR() ...
0502
0503 #define EVUTIL_SET_SOCKET_ERROR(errcode) ...
0504
0505 #define evutil_socket_geterror(sock) ...
0506
0507 #define evutil_socket_error_to_string(errcode) ...
0508 #define EVUTIL_INVALID_SOCKET -1
0509
0510 #else
0511 #define EVUTIL_SOCKET_ERROR() (errno)
0512 #define EVUTIL_SET_SOCKET_ERROR(errcode) \
0513 do { errno = (errcode); } while (0)
0514 #define evutil_socket_geterror(sock) (errno)
0515 #define evutil_socket_error_to_string(errcode) (strerror(errcode))
0516 #define EVUTIL_INVALID_SOCKET -1
0517 #endif
0518
0519
0520
0521
0522
0523
0524
0525
0526
0527
0528 #ifdef EVENT__HAVE_TIMERADD
0529 #define evutil_timeradd(tvp, uvp, vvp) timeradd((tvp), (uvp), (vvp))
0530 #define evutil_timersub(tvp, uvp, vvp) timersub((tvp), (uvp), (vvp))
0531 #else
0532 #define evutil_timeradd(tvp, uvp, vvp) \
0533 do { \
0534 (vvp)->tv_sec = (tvp)->tv_sec + (uvp)->tv_sec; \
0535 (vvp)->tv_usec = (tvp)->tv_usec + (uvp)->tv_usec; \
0536 if ((vvp)->tv_usec >= 1000000) { \
0537 (vvp)->tv_sec++; \
0538 (vvp)->tv_usec -= 1000000; \
0539 } \
0540 } while (0)
0541 #define evutil_timersub(tvp, uvp, vvp) \
0542 do { \
0543 (vvp)->tv_sec = (tvp)->tv_sec - (uvp)->tv_sec; \
0544 (vvp)->tv_usec = (tvp)->tv_usec - (uvp)->tv_usec; \
0545 if ((vvp)->tv_usec < 0) { \
0546 (vvp)->tv_sec--; \
0547 (vvp)->tv_usec += 1000000; \
0548 } \
0549 } while (0)
0550 #endif
0551
0552 #ifdef EVENT__HAVE_TIMERCLEAR
0553 #define evutil_timerclear(tvp) timerclear(tvp)
0554 #else
0555 #define evutil_timerclear(tvp) (tvp)->tv_sec = (tvp)->tv_usec = 0
0556 #endif
0557
0558
0559
0560
0561 #define evutil_timercmp(tvp, uvp, cmp) \
0562 (((tvp)->tv_sec == (uvp)->tv_sec) ? \
0563 ((tvp)->tv_usec cmp (uvp)->tv_usec) : \
0564 ((tvp)->tv_sec cmp (uvp)->tv_sec))
0565
0566 #ifdef EVENT__HAVE_TIMERISSET
0567 #define evutil_timerisset(tvp) timerisset(tvp)
0568 #else
0569 #define evutil_timerisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec)
0570 #endif
0571
0572
0573 #ifdef offsetof
0574 #define evutil_offsetof(type, field) offsetof(type, field)
0575 #else
0576 #define evutil_offsetof(type, field) ((off_t)(&((type *)0)->field))
0577 #endif
0578
0579
0580
0581 EVENT2_EXPORT_SYMBOL
0582 ev_int64_t evutil_strtoll(const char *s, char **endptr, int base);
0583
0584
0585 #ifdef EVENT__HAVE_GETTIMEOFDAY
0586 #define evutil_gettimeofday(tv, tz) gettimeofday((tv), (tz))
0587 #else
0588 struct timezone;
0589 EVENT2_EXPORT_SYMBOL
0590 int evutil_gettimeofday(struct timeval *tv, struct timezone *tz);
0591 #endif
0592
0593
0594
0595
0596 EVENT2_EXPORT_SYMBOL
0597 int evutil_snprintf(char *buf, size_t buflen, const char *format, ...)
0598 #ifdef __GNUC__
0599 __attribute__((format(printf, 3, 4)))
0600 #endif
0601 ;
0602
0603
0604
0605 EVENT2_EXPORT_SYMBOL
0606 int evutil_vsnprintf(char *buf, size_t buflen, const char *format, va_list ap)
0607 #ifdef __GNUC__
0608 __attribute__((format(printf, 3, 0)))
0609 #endif
0610 ;
0611
0612
0613 EVENT2_EXPORT_SYMBOL
0614 const char *evutil_inet_ntop(int af, const void *src, char *dst, size_t len);
0615
0616
0617
0618 EVENT2_EXPORT_SYMBOL
0619 int evutil_inet_pton_scope(int af, const char *src, void *dst,
0620 unsigned *indexp);
0621
0622 EVENT2_EXPORT_SYMBOL
0623 int evutil_inet_pton(int af, const char *src, void *dst);
0624 struct sockaddr;
0625
0626
0627
0628
0629
0630
0631
0632
0633
0634
0635
0636
0637
0638
0639
0640
0641
0642
0643
0644
0645
0646 EVENT2_EXPORT_SYMBOL
0647 int evutil_parse_sockaddr_port(const char *str, struct sockaddr *out, int *outlen);
0648
0649
0650
0651
0652
0653
0654 EVENT2_EXPORT_SYMBOL
0655 int evutil_sockaddr_cmp(const struct sockaddr *sa1, const struct sockaddr *sa2,
0656 int include_port);
0657
0658
0659
0660
0661 EVENT2_EXPORT_SYMBOL
0662 int evutil_ascii_strcasecmp(const char *str1, const char *str2);
0663
0664
0665
0666 EVENT2_EXPORT_SYMBOL
0667 int evutil_ascii_strncasecmp(const char *str1, const char *str2, size_t n);
0668
0669
0670
0671 #ifdef EVENT__HAVE_STRUCT_ADDRINFO
0672 #define evutil_addrinfo addrinfo
0673 #else
0674
0675
0676
0677
0678
0679 struct evutil_addrinfo {
0680 int ai_flags;
0681 int ai_family;
0682 int ai_socktype;
0683 int ai_protocol;
0684 size_t ai_addrlen;
0685 char *ai_canonname;
0686 struct sockaddr *ai_addr;
0687 struct evutil_addrinfo *ai_next;
0688 };
0689 #endif
0690
0691
0692
0693
0694
0695
0696
0697 #if defined(EAI_ADDRFAMILY) && defined(EVENT__HAVE_GETADDRINFO)
0698 #define EVUTIL_EAI_ADDRFAMILY EAI_ADDRFAMILY
0699 #else
0700 #define EVUTIL_EAI_ADDRFAMILY -901
0701 #endif
0702 #if defined(EAI_AGAIN) && defined(EVENT__HAVE_GETADDRINFO)
0703 #define EVUTIL_EAI_AGAIN EAI_AGAIN
0704 #else
0705 #define EVUTIL_EAI_AGAIN -902
0706 #endif
0707 #if defined(EAI_BADFLAGS) && defined(EVENT__HAVE_GETADDRINFO)
0708 #define EVUTIL_EAI_BADFLAGS EAI_BADFLAGS
0709 #else
0710 #define EVUTIL_EAI_BADFLAGS -903
0711 #endif
0712 #if defined(EAI_FAIL) && defined(EVENT__HAVE_GETADDRINFO)
0713 #define EVUTIL_EAI_FAIL EAI_FAIL
0714 #else
0715 #define EVUTIL_EAI_FAIL -904
0716 #endif
0717 #if defined(EAI_FAMILY) && defined(EVENT__HAVE_GETADDRINFO)
0718 #define EVUTIL_EAI_FAMILY EAI_FAMILY
0719 #else
0720 #define EVUTIL_EAI_FAMILY -905
0721 #endif
0722 #if defined(EAI_MEMORY) && defined(EVENT__HAVE_GETADDRINFO)
0723 #define EVUTIL_EAI_MEMORY EAI_MEMORY
0724 #else
0725 #define EVUTIL_EAI_MEMORY -906
0726 #endif
0727
0728
0729
0730 #if defined(EAI_NODATA) && defined(EVENT__HAVE_GETADDRINFO) && (!defined(EAI_NONAME) || EAI_NODATA != EAI_NONAME)
0731 #define EVUTIL_EAI_NODATA EAI_NODATA
0732 #else
0733 #define EVUTIL_EAI_NODATA -907
0734 #endif
0735 #if defined(EAI_NONAME) && defined(EVENT__HAVE_GETADDRINFO)
0736 #define EVUTIL_EAI_NONAME EAI_NONAME
0737 #else
0738 #define EVUTIL_EAI_NONAME -908
0739 #endif
0740 #if defined(EAI_SERVICE) && defined(EVENT__HAVE_GETADDRINFO)
0741 #define EVUTIL_EAI_SERVICE EAI_SERVICE
0742 #else
0743 #define EVUTIL_EAI_SERVICE -909
0744 #endif
0745 #if defined(EAI_SOCKTYPE) && defined(EVENT__HAVE_GETADDRINFO)
0746 #define EVUTIL_EAI_SOCKTYPE EAI_SOCKTYPE
0747 #else
0748 #define EVUTIL_EAI_SOCKTYPE -910
0749 #endif
0750 #if defined(EAI_SYSTEM) && defined(EVENT__HAVE_GETADDRINFO)
0751 #define EVUTIL_EAI_SYSTEM EAI_SYSTEM
0752 #else
0753 #define EVUTIL_EAI_SYSTEM -911
0754 #endif
0755
0756 #define EVUTIL_EAI_CANCEL -90001
0757
0758 #if defined(AI_PASSIVE) && defined(EVENT__HAVE_GETADDRINFO)
0759 #define EVUTIL_AI_PASSIVE AI_PASSIVE
0760 #else
0761 #define EVUTIL_AI_PASSIVE 0x1000
0762 #endif
0763 #if defined(AI_CANONNAME) && defined(EVENT__HAVE_GETADDRINFO)
0764 #define EVUTIL_AI_CANONNAME AI_CANONNAME
0765 #else
0766 #define EVUTIL_AI_CANONNAME 0x2000
0767 #endif
0768 #if defined(AI_NUMERICHOST) && defined(EVENT__HAVE_GETADDRINFO)
0769 #define EVUTIL_AI_NUMERICHOST AI_NUMERICHOST
0770 #else
0771 #define EVUTIL_AI_NUMERICHOST 0x4000
0772 #endif
0773 #if defined(AI_NUMERICSERV) && defined(EVENT__HAVE_GETADDRINFO)
0774 #define EVUTIL_AI_NUMERICSERV AI_NUMERICSERV
0775 #else
0776 #define EVUTIL_AI_NUMERICSERV 0x8000
0777 #endif
0778 #if defined(AI_V4MAPPED) && defined(EVENT__HAVE_GETADDRINFO)
0779 #define EVUTIL_AI_V4MAPPED AI_V4MAPPED
0780 #else
0781 #define EVUTIL_AI_V4MAPPED 0x10000
0782 #endif
0783 #if defined(AI_ALL) && defined(EVENT__HAVE_GETADDRINFO)
0784 #define EVUTIL_AI_ALL AI_ALL
0785 #else
0786 #define EVUTIL_AI_ALL 0x20000
0787 #endif
0788 #if defined(AI_ADDRCONFIG) && defined(EVENT__HAVE_GETADDRINFO)
0789 #define EVUTIL_AI_ADDRCONFIG AI_ADDRCONFIG
0790 #else
0791 #define EVUTIL_AI_ADDRCONFIG 0x40000
0792 #endif
0793
0794
0795 struct evutil_addrinfo;
0796
0797
0798
0799
0800
0801
0802
0803
0804
0805
0806
0807 EVENT2_EXPORT_SYMBOL
0808 int evutil_getaddrinfo(const char *nodename, const char *servname,
0809 const struct evutil_addrinfo *hints_in, struct evutil_addrinfo **res);
0810
0811
0812 EVENT2_EXPORT_SYMBOL
0813 void evutil_freeaddrinfo(struct evutil_addrinfo *ai);
0814
0815 EVENT2_EXPORT_SYMBOL
0816 const char *evutil_gai_strerror(int err);
0817
0818
0819
0820
0821
0822
0823
0824
0825
0826
0827 EVENT2_EXPORT_SYMBOL
0828 void evutil_secure_rng_get_bytes(void *buf, size_t n);
0829
0830
0831
0832
0833
0834
0835
0836
0837
0838
0839
0840
0841
0842
0843
0844
0845
0846 EVENT2_EXPORT_SYMBOL
0847 int evutil_secure_rng_init(void);
0848
0849
0850
0851
0852
0853
0854
0855
0856
0857
0858
0859
0860
0861
0862 EVENT2_EXPORT_SYMBOL
0863 int evutil_secure_rng_set_urandom_device_file(char *fname);
0864
0865 #if !defined(EVENT__HAVE_ARC4RANDOM) || defined(EVENT__HAVE_ARC4RANDOM_ADDRANDOM)
0866
0867
0868
0869
0870
0871
0872
0873
0874
0875
0876
0877
0878
0879
0880 EVENT2_EXPORT_SYMBOL
0881 void evutil_secure_rng_add_bytes(const char *dat, size_t datlen);
0882 #endif
0883
0884 #ifdef __cplusplus
0885 }
0886 #endif
0887
0888 #endif