Changeset 478 for vendor/current/lib
- Timestamp:
- Aug 2, 2010, 6:40:21 PM (15 years ago)
- Location:
- vendor/current/lib
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
vendor/current/lib/replace/libreplace_network.m4
r414 r478 351 351 fi 352 352 353 dnl Some old Linux systems have broken header files and 354 dnl miss the IPV6_V6ONLY define in netinet/in.h, 355 dnl but have it in linux/in6.h. 356 dnl We can't include both files so we just check if the value 357 dnl if defined and do the replacement in system/network.h 358 AC_CACHE_CHECK([for IPV6_V6ONLY support],libreplace_cv_HAVE_IPV6_V6ONLY,[ 359 AC_TRY_COMPILE([ 360 #include <stdlib.h> /* for NULL */ 361 #include <sys/socket.h> 362 #include <sys/types.h> 363 #include <netdb.h> 364 #include <netinet/in.h> 365 ], 366 [ 367 #ifndef IPV6_V6ONLY 368 #error no IPV6_V6ONLY 369 #endif 370 ],[ 371 libreplace_cv_HAVE_IPV6_V6ONLY=yes 372 ],[ 373 libreplace_cv_HAVE_IPV6_V6ONLY=no 374 ]) 375 ]) 376 if test x"$libreplace_cv_HAVE_IPV6_V6ONLY" != x"yes"; then 377 dnl test for IPV6_V6ONLY 378 AC_CACHE_CHECK([for IPV6_V6ONLY in linux/in6.h],libreplace_cv_HAVE_LINUX_IPV6_V6ONLY_26,[ 379 AC_TRY_COMPILE([ 380 #include <linux/in6.h> 381 ], 382 [ 383 #if (IPV6_V6ONLY != 26) 384 #error no linux IPV6_V6ONLY 385 #endif 386 ],[ 387 libreplace_cv_HAVE_LINUX_IPV6_V6ONLY_26=yes 388 ],[ 389 libreplace_cv_HAVE_LINUX_IPV6_V6ONLY_26=no 390 ]) 391 ]) 392 if test x"$libreplace_cv_HAVE_LINUX_IPV6_V6ONLY_26" = x"yes"; then 393 AC_DEFINE(HAVE_LINUX_IPV6_V6ONLY_26,1,[Whether the system has IPV6_V6ONLY in linux/in6.h]) 394 fi 395 fi 396 353 397 dnl test for ipv6 354 398 AC_CACHE_CHECK([for ipv6 support],libreplace_cv_HAVE_IPV6,[ … … 371 415 } 372 416 freeaddrinfo(ai); 417 { 418 int val = 1; 419 #ifdef HAVE_LINUX_IPV6_V6ONLY_26 420 #define IPV6_V6ONLY 26 421 #endif 422 ret = setsockopt(s, IPPROTO_IPV6, IPV6_V6ONLY, 423 (const void *)&val, sizeof(val)); 424 } 373 425 ],[ 374 426 libreplace_cv_HAVE_IPV6=yes -
vendor/current/lib/replace/system/network.h
r414 r478 361 361 #endif 362 362 363 /* Some old Linux systems have broken header files */ 364 #ifdef HAVE_IPV6 365 #ifdef HAVE_LINUX_IPV6_V6ONLY_26 366 #define IPV6_V6ONLY 26 367 #endif /* HAVE_LINUX_IPV6_V6ONLY_26 */ 368 #endif /* HAVE_IPV6 */ 369 363 370 #ifdef SOCKET_WRAPPER 364 371 #ifndef SOCKET_WRAPPER_DISABLE -
vendor/current/lib/tsocket/tsocket.h
r414 r478 33 33 struct iovec; 34 34 35 /* 36 * tsocket_address related functions 35 /** 36 * @mainpage 37 * 38 * The tsocket abstraction is an API ... 39 */ 40 41 /** 42 * @defgroup tsocket The tsocket API 43 * 44 * The tsocket abstraction is split into two different kinds of 45 * communication interfaces. 46 * 47 * There's the "tstream_context" interface with abstracts the communication 48 * through a bidirectional byte stream between two endpoints. 49 * 50 * And there's the "tdgram_context" interface with abstracts datagram based 51 * communication between any number of endpoints. 52 * 53 * Both interfaces share the "tsocket_address" abstraction for endpoint 54 * addresses. 55 * 56 * The whole library is based on the talloc(3) and 'tevent' libraries and 57 * provides "tevent_req" based "foo_send()"/"foo_recv()" functions pairs for 58 * all abstracted methods that need to be async. 59 * 60 * @section vsock Virtual Sockets 61 * 62 * The abstracted layout of tdgram_context and tstream_context allow 63 * implementations around virtual sockets for encrypted tunnels (like TLS, 64 * SASL or GSSAPI) or named pipes over smb. 65 * 66 * @section npa Named Pipe Auth (NPA) Sockets 67 * 68 * Samba has an implementation to abstract named pipes over smb (within the 69 * server side). See libcli/named_pipe_auth/npa_tstream.[ch] for the core code. 70 * The current callers are located in source4/ntvfs/ipc/vfs_ipc.c and 71 * source4/rpc_server/service_rpc.c for the users. 72 */ 73 74 /** 75 * @defgroup tsocket_address The tsocket_address abstraction 76 * @ingroup tsocket 77 * 78 * The tsocket_address represents an socket endpoint genericly. 79 * As it's like an abstract class it has no specific constructor. 80 * The specific constructors are descripted in later sections. 81 * 82 * @{ 83 */ 84 85 /** 86 * @brief Get a string representaion of the endpoint. 87 * 88 * This function creates a string representation of the endpoint for debugging. 89 * The output will look as followed: 90 * prefix:address:port 91 * 92 * e.g. 93 * ipv4:192.168.1.1:143 94 * 95 * Callers should not try to parse the string! The should use additional methods 96 * of the specific tsocket_address implemention to get more details. 97 * 98 * @param[in] addr The address to convert. 99 * 100 * @param[in] mem_ctx The talloc memory context to allocate the memory. 101 * 102 * @return The address as a string representation, NULL on error. 103 * 104 * @see tsocket_address_inet_addr_string() 105 * @see tsocket_address_inet_port() 37 106 */ 38 107 char *tsocket_address_string(const struct tsocket_address *addr, 39 108 TALLOC_CTX *mem_ctx); 40 109 110 #ifdef DOXYGEN 111 /** 112 * @brief This creates a copy of a tsocket_address. 113 * 114 * This is useful when before doing modifications to a socket via additional 115 * methods of the specific tsocket_address implementation. 116 * 117 * @param[in] addr The address to create the copy from. 118 * 119 * @param[in] mem_ctx The talloc memory context to use. 120 * 121 * @return A newly allocated copy of addr (tsocket_address *), NULL 122 * on error. 123 */ 124 struct tsocket_address *tsocket_address_copy(const struct tsocket_address *addr, 125 TALLOC_CTX *mem_ctx); 126 #else 41 127 struct tsocket_address *_tsocket_address_copy(const struct tsocket_address *addr, 42 128 TALLOC_CTX *mem_ctx, … … 45 131 #define tsocket_address_copy(addr, mem_ctx) \ 46 132 _tsocket_address_copy(addr, mem_ctx, __location__) 47 48 /* 49 * tdgram_context related functions 133 #endif 134 135 /** 136 * @} 137 */ 138 139 /** 140 * @defgroup tdgram_context The tdgram_context abstraction 141 * @ingroup tsocket 142 * 143 * The tdgram_context is like an abstract class for datagram based sockets. The 144 * interface provides async 'tevent_req' based functions on top functionality 145 * is similar to the recvfrom(2)/sendto(2)/close(2) syscalls. 146 * 147 * @note You can always use talloc_free(tdgram) to cleanup the resources 148 * of the tdgram_context on a fatal error. 149 * @{ 150 */ 151 152 /** 153 * @brief Ask for next available datagram on the abstracted tdgram_context. 154 * 155 * It returns a 'tevent_req' handle, where the caller can register 156 * a callback with tevent_req_set_callback(). The callback is triggered 157 * when a datagram is available or an error happened. 158 * 159 * @param[in] mem_ctx The talloc memory context to use. 160 * 161 * @param[in] ev The tevent_context to run on. 162 * 163 * @param[in] dgram The dgram context to work on. 164 * 165 * @return Returns a 'tevent_req' handle, where the caller can 166 * register a callback with tevent_req_set_callback(). 167 * NULL on fatal error. 168 * 169 * @see tdgram_inet_udp_socket() 170 * @see tdgram_unix_socket() 50 171 */ 51 172 struct tevent_req *tdgram_recvfrom_send(TALLOC_CTX *mem_ctx, 52 173 struct tevent_context *ev, 53 174 struct tdgram_context *dgram); 175 176 /** 177 * @brief Receive the next available datagram on the abstracted tdgram_context. 178 * 179 * This function should be called by the callback when a datagram is available 180 * or an error happened. 181 * 182 * The caller can only have one outstanding tdgram_recvfrom_send() at a time 183 * otherwise the caller will get '*perrno = EBUSY'. 184 * 185 * @param[in] req The tevent request from tdgram_recvfrom_send(). 186 * 187 * @param[out] perrno The error number, set if an error occurred. 188 * 189 * @param[in] mem_ctx The memory context to use. 190 * 191 * @param[out] buf This will hold the buffer of the datagram. 192 * 193 * @param[out] src The abstracted tsocket_address of the sender of the 194 * received datagram. 195 * 196 * @return The length of the datagram (0 is never returned!), 197 * -1 on error with perrno set to the actual errno. 198 * 199 * @see tdgram_recvfrom_send() 200 */ 54 201 ssize_t tdgram_recvfrom_recv(struct tevent_req *req, 55 202 int *perrno, … … 58 205 struct tsocket_address **src); 59 206 207 /** 208 * @brief Send a datagram to a destination endpoint. 209 * 210 * The function can be called to send a datagram (specified by a buf/len) to a 211 * destination endpoint (specified by dst). It's not allowed for len to be 0. 212 * 213 * It returns a 'tevent_req' handle, where the caller can register a callback 214 * with tevent_req_set_callback(). The callback is triggered when the specific 215 * implementation (assumes it) has delivered the datagram to the "wire". 216 * 217 * The callback is then supposed to get the result by calling 218 * tdgram_sendto_recv() on the 'tevent_req'. 219 * 220 * @param[in] mem_ctx The talloc memory context to use. 221 * 222 * @param[in] ev The tevent_context to run on. 223 * 224 * @param[in] dgram The dgram context to work on. 225 * 226 * @param[in] buf The buffer to send. 227 * 228 * @param[in] len The length of the buffer to send. It has to be bigger 229 * than 0. 230 * 231 * @param[in] dst The destination to send the datagram to in form of a 232 * tsocket_address. 233 * 234 * @return Returns a 'tevent_req' handle, where the caller can 235 * register a callback with tevent_req_set_callback(). 236 * NULL on fatal error. 237 * 238 * @see tdgram_inet_udp_socket() 239 * @see tdgram_unix_socket() 240 * @see tdgram_sendto_recv() 241 */ 60 242 struct tevent_req *tdgram_sendto_send(TALLOC_CTX *mem_ctx, 61 243 struct tevent_context *ev, … … 63 245 const uint8_t *buf, size_t len, 64 246 const struct tsocket_address *dst); 247 248 /** 249 * @brief Receive the result of the sent datagram. 250 * 251 * The caller can only have one outstanding tdgram_sendto_send() at a time 252 * otherwise the caller will get '*perrno = EBUSY'. 253 * 254 * @param[in] req The tevent request from tdgram_sendto_send(). 255 * 256 * @param[out] perrno The error number, set if an error occurred. 257 * 258 * @return The length of the datagram (0 is never returned!), -1 on 259 * error with perrno set to the actual errno. 260 * 261 * @see tdgram_sendto_send() 262 */ 65 263 ssize_t tdgram_sendto_recv(struct tevent_req *req, 66 264 int *perrno); 67 265 266 /** 267 * @brief Shutdown/close an abstracted socket. 268 * 269 * It returns a 'tevent_req' handle, where the caller can register a callback 270 * with tevent_req_set_callback(). The callback is triggered when the specific 271 * implementation (assumes it) has delivered the datagram to the "wire". 272 * 273 * The callback is then supposed to get the result by calling 274 * tdgram_sendto_recv() on the 'tevent_req'. 275 * 276 * @param[in] mem_ctx The talloc memory context to use. 277 * 278 * @param[in] ev The tevent_context to run on. 279 * 280 * @param[in] dgram The dgram context diconnect from. 281 * 282 * @return Returns a 'tevent_req' handle, where the caller can 283 * register a callback with tevent_req_set_callback(). 284 * NULL on fatal error. 285 * 286 * @see tdgram_disconnect_recv() 287 */ 68 288 struct tevent_req *tdgram_disconnect_send(TALLOC_CTX *mem_ctx, 69 289 struct tevent_context *ev, 70 290 struct tdgram_context *dgram); 291 292 /** 293 * @brief Receive the result from a tdgram_disconnect_send() request. 294 * 295 * The caller should make sure there're no outstanding tdgram_recvfrom_send() 296 * and tdgram_sendto_send() calls otherwise the caller will get 297 * '*perrno = EBUSY'. 298 * 299 * @param[in] req The tevent request from tdgram_disconnect_send(). 300 * 301 * @param[out] perrno The error number, set if an error occurred. 302 * 303 * @return The length of the datagram (0 is never returned!), -1 on 304 * error with perrno set to the actual errno. 305 * 306 * @see tdgram_disconnect_send() 307 */ 71 308 int tdgram_disconnect_recv(struct tevent_req *req, 72 309 int *perrno); 73 310 74 /* 75 * tstream_context related functions 311 /** 312 * @} 313 */ 314 315 /** 316 * @defgroup tstream_context The tstream_context abstraction 317 * @ingroup tsocket 318 * 319 * The tstream_context is like an abstract class for stream based sockets. The 320 * interface provides async 'tevent_req' based functions on top functionality 321 * is similar to the readv(2)/writev(2)/close(2) syscalls. 322 * 323 * @note You can always use talloc_free(tstream) to cleanup the resources 324 * of the tstream_context on a fatal error. 325 * 326 * @{ 327 */ 328 329 /** 330 * @brief Report the number of bytes received but not consumed yet. 331 * 332 * The tstream_pending_bytes() function reports how much bytes of the incoming 333 * stream have been received but not consumed yet. 334 * 335 * @param[in] stream The tstream_context to check for pending bytes. 336 * 337 * @return The number of bytes received, -1 on error with errno 338 * set. 76 339 */ 77 340 ssize_t tstream_pending_bytes(struct tstream_context *stream); 78 341 342 /** 343 * @brief Read a specific amount of bytes from a stream socket. 344 * 345 * The function can be called to read for a specific amount of bytes from the 346 * stream into given buffers. The caller has to preallocate the buffers. 347 * 348 * The caller might need to use tstream_pending_bytes() if the protocol doesn't 349 * have a fixed pdu header containing the pdu size. 350 * 351 * @param[in] mem_ctx The talloc memory context to use. 352 * 353 * @param[in] ev The tevent_context to run on. 354 * 355 * @param[in] stream The tstream context to work on. 356 * 357 * @param[out] vector A preallocated iovec to store the data to read. 358 * 359 * @param[in] count The number of buffers in the vector allocated. 360 * 361 * @return A 'tevent_req' handle, where the caller can register 362 * a callback with tevent_req_set_callback(). NULL on 363 * fatal error. 364 * 365 * @see tstream_unix_connect_send() 366 * @see tstream_inet_tcp_connect_send() 367 */ 79 368 struct tevent_req *tstream_readv_send(TALLOC_CTX *mem_ctx, 80 369 struct tevent_context *ev, … … 82 371 struct iovec *vector, 83 372 size_t count); 373 374 /** 375 * @brief Get the result of a tstream_readv_send(). 376 * 377 * The caller can only have one outstanding tstream_readv_send() 378 * at a time otherwise the caller will get *perrno = EBUSY. 379 * 380 * @param[in] req The tevent request from tstream_readv_send(). 381 * 382 * @param[out] perrno The error number, set if an error occurred. 383 * 384 * @return The length of the stream (0 is never returned!), -1 on 385 * error with perrno set to the actual errno. 386 */ 84 387 int tstream_readv_recv(struct tevent_req *req, 85 388 int *perrno); 86 389 390 /** 391 * @brief Write buffers from a vector into a stream socket. 392 * 393 * The function can be called to write buffers from a given vector 394 * to a stream socket. 395 * 396 * You have to ensure that the vector is not empty. 397 * 398 * @param[in] mem_ctx The talloc memory context to use. 399 * 400 * @param[in] ev The tevent_context to run on. 401 * 402 * @param[in] stream The tstream context to work on. 403 * 404 * @param[in] vector The iovec vector with data to write on a stream socket. 405 * 406 * @param[in] count The number of buffers in the vector to write. 407 * 408 * @return A 'tevent_req' handle, where the caller can register 409 * a callback with tevent_req_set_callback(). NULL on 410 * fatal error. 411 */ 87 412 struct tevent_req *tstream_writev_send(TALLOC_CTX *mem_ctx, 88 413 struct tevent_context *ev, … … 90 415 const struct iovec *vector, 91 416 size_t count); 417 418 /** 419 * @brief Get the result of a tstream_writev_send(). 420 * 421 * The caller can only have one outstanding tstream_writev_send() 422 * at a time otherwise the caller will get *perrno = EBUSY. 423 * 424 * @param[in] req The tevent request from tstream_writev_send(). 425 * 426 * @param[out] perrno The error number, set if an error occurred. 427 * 428 * @return The length of the stream (0 is never returned!), -1 on 429 * error with perrno set to the actual errno. 430 */ 92 431 int tstream_writev_recv(struct tevent_req *req, 93 432 int *perrno); 94 433 434 /** 435 * @brief Shutdown/close an abstracted socket. 436 * 437 * It returns a 'tevent_req' handle, where the caller can register a callback 438 * with tevent_req_set_callback(). The callback is triggered when the specific 439 * implementation (assumes it) has delivered the stream to the "wire". 440 * 441 * The callback is then supposed to get the result by calling 442 * tdgram_sendto_recv() on the 'tevent_req'. 443 * 444 * @param[in] mem_ctx The talloc memory context to use. 445 * 446 * @param[in] ev The tevent_context to run on. 447 * 448 * @param[in] stream The tstream context to work on. 449 * 450 * @return A 'tevent_req' handle, where the caller can register 451 * a callback with tevent_req_set_callback(). NULL on 452 * fatal error. 453 */ 95 454 struct tevent_req *tstream_disconnect_send(TALLOC_CTX *mem_ctx, 96 455 struct tevent_context *ev, 97 456 struct tstream_context *stream); 457 458 /** 459 * @brief Get the result of a tstream_disconnect_send(). 460 * 461 * The caller can only have one outstanding tstream_writev_send() 462 * at a time otherwise the caller will get *perrno = EBUSY. 463 * 464 * @param[in] req The tevent request from tstream_disconnect_send(). 465 * 466 * @param[out] perrno The error number, set if an error occurred. 467 * 468 * @return The length of the stream (0 is never returned!), -1 on 469 * error with perrno set to the actual errno. 470 */ 98 471 int tstream_disconnect_recv(struct tevent_req *req, 99 472 int *perrno); 100 473 101 /* 102 * BSD sockets: inet, inet6 and unix 103 */ 104 474 /** 475 * @} 476 */ 477 478 479 /** 480 * @defgroup tsocket_bsd tsocket_bsd - inet, inet6 and unix 481 * @ingroup tsocket 482 * 483 * The main tsocket library comes with implentations for BSD style ipv4, ipv6 484 * and unix sockets. 485 * 486 * @{ 487 */ 488 489 #if DOXYGEN 490 /** 491 * @brief Create a tsocket_address for ipv4 and ipv6 endpoint addresses. 492 * 493 * @param[in] mem_ctx The talloc memory context to use. 494 * 495 * @param[in] fam The family can be can be "ipv4", "ipv6" or "ip". With 496 * "ip" is autodetects "ipv4" or "ipv6" based on the 497 * addr. 498 * 499 * @param[in] addr A valid ip address string based on the selected family 500 * (dns names are not allowed!). It's valid to pass NULL, 501 * which gets mapped to "0.0.0.0" or "::". 502 * 503 * @param[in] port A valid port number. 504 * 505 * @param[out] _addr A tsocket_address pointer to store the information. 506 * 507 * @return 0 on success, -1 on error with errno set. 508 */ 509 int tsocket_address_inet_from_strings(TALLOC_CTX *mem_ctx, 510 const char *fam, 511 const char *addr, 512 uint16_t port, 513 struct tsocket_address **_addr); 514 #else 105 515 int _tsocket_address_inet_from_strings(TALLOC_CTX *mem_ctx, 106 516 const char *fam, … … 109 519 struct tsocket_address **_addr, 110 520 const char *location); 521 111 522 #define tsocket_address_inet_from_strings(mem_ctx, fam, addr, port, _addr) \ 112 523 _tsocket_address_inet_from_strings(mem_ctx, fam, addr, port, _addr, \ 113 524 __location__) 114 525 #endif 526 527 /** 528 * @brief Get the address of an 'inet' tsocket_address as a string. 529 * 530 * @param[in] addr The address to convert to a string. 531 * 532 * @param[in] mem_ctx The talloc memory context to use. 533 * 534 * @return A newly allocated string of the address, NULL on error 535 * with errno set. 536 */ 115 537 char *tsocket_address_inet_addr_string(const struct tsocket_address *addr, 116 538 TALLOC_CTX *mem_ctx); 539 540 /** 541 * @brief Get the port number as an integer from an 'inet' tsocket_address. 542 * 543 * @param[in] addr The tsocket address to use. 544 * 545 * @return The port number, 0 on error with errno set. 546 */ 117 547 uint16_t tsocket_address_inet_port(const struct tsocket_address *addr); 548 549 /** 550 * @brief Set the port number of an existing 'inet' tsocket_address. 551 * 552 * @param[in] addr The existing tsocket_address to use. 553 * 554 * @param[in] port The valid port number to set. 555 * 556 * @return 0 on success, -1 on error with errno set. 557 */ 118 558 int tsocket_address_inet_set_port(struct tsocket_address *addr, 119 559 uint16_t port); 120 560 561 #ifdef DOXYGEN 562 /** 563 * @brief Create a tsocket_address for a unix domain endpoint addresses. 564 * 565 * @param[in] mem_ctx The talloc memory context to use. 566 * 567 * @param[in] path The filesystem path, NULL will map "". 568 * 569 * @param[in] _addr The tsocket_address pointer to store the information. 570 * 571 * @return 0 on success, -1 on error with errno set. 572 */ 573 int tsocket_address_unix_from_path(TALLOC_CTX *mem_ctx, 574 const char *path, 575 struct tsocket_address **_addr); 576 #else 121 577 int _tsocket_address_unix_from_path(TALLOC_CTX *mem_ctx, 122 578 const char *path, 123 579 struct tsocket_address **_addr, 124 580 const char *location); 581 125 582 #define tsocket_address_unix_from_path(mem_ctx, path, _addr) \ 126 583 _tsocket_address_unix_from_path(mem_ctx, path, _addr, \ 127 584 __location__) 585 #endif 586 587 /** 588 * @brief Get the address of an 'unix' tsocket_address. 589 * 590 * @param[in] addr A valid 'unix' tsocket_address. 591 * 592 * @param[in] mem_ctx The talloc memory context to use. 593 * 594 * @return The path of the unix domain socket, NULL on error or if 595 * the tsocket_address doesn't represent an unix domain 596 * endpoint path. 597 */ 128 598 char *tsocket_address_unix_path(const struct tsocket_address *addr, 129 599 TALLOC_CTX *mem_ctx); 130 600 601 #ifdef DOXYGEN 602 /** 603 * @brief Create a tdgram_context for a ipv4 or ipv6 UDP communication. 604 * 605 * @param[in] local An 'inet' tsocket_address for the local endpoint. 606 * 607 * @param[in] remote An 'inet' tsocket_address for the remote endpoint or 608 * NULL (??? to create a listener?). 609 * 610 * @param[in] mem_ctx The talloc memory context to use. 611 * 612 * @param[in] dgram The tdgram_context pointer to setup the udp 613 * communication. The function will allocate the memory. 614 * 615 * @return 0 on success, -1 on error with errno set. 616 */ 617 int tdgram_inet_udp_socket(const struct tsocket_address *local, 618 const struct tsocket_address *remote, 619 TALLOC_CTX *mem_ctx, 620 struct tdgram_context **dgram); 621 #else 131 622 int _tdgram_inet_udp_socket(const struct tsocket_address *local, 132 623 const struct tsocket_address *remote, … … 136 627 #define tdgram_inet_udp_socket(local, remote, mem_ctx, dgram) \ 137 628 _tdgram_inet_udp_socket(local, remote, mem_ctx, dgram, __location__) 138 629 #endif 630 631 #ifdef DOXYGEN 632 /** 633 * @brief Create a tdgram_context for unix domain datagram communication. 634 * 635 * @param[in] local An 'unix' tsocket_address for the local endpoint. 636 * 637 * @param[in] remote An 'unix' tsocket_address for the remote endpoint or 638 * NULL (??? to create a listener?). 639 * 640 * @param[in] mem_ctx The talloc memory context to use. 641 * 642 * @param[in] dgram The tdgram_context pointer to setup the udp 643 * communication. The function will allocate the memory. 644 * 645 * @return 0 on success, -1 on error with errno set. 646 */ 647 int tdgram_unix_socket(const struct tsocket_address *local, 648 const struct tsocket_address *remote, 649 TALLOC_CTX *mem_ctx, 650 struct tdgram_context **dgram); 651 #else 139 652 int _tdgram_unix_socket(const struct tsocket_address *local, 140 653 const struct tsocket_address *remote, … … 142 655 struct tdgram_context **dgram, 143 656 const char *location); 657 144 658 #define tdgram_unix_socket(local, remote, mem_ctx, dgram) \ 145 659 _tdgram_unix_socket(local, remote, mem_ctx, dgram, __location__) 146 147 struct tevent_req * tstream_inet_tcp_connect_send(TALLOC_CTX *mem_ctx, 660 #endif 661 662 /** 663 * @brief Connect async to a TCP endpoint and create a tstream_context for the 664 * stream based communication. 665 * 666 * Use this function to connenct asynchronously to a remote ipv4 or ipv6 TCP 667 * endpoint and create a tstream_context for the stream based communication. 668 * 669 * @param[in] mem_ctx The talloc memory context to use. 670 * 671 * @param[in] ev The tevent_context to run on. 672 * 673 * @param[in] local An 'inet' tsocket_address for the local endpoint. 674 * 675 * @param[in] remote An 'inet' tsocket_address for the remote endpoint. 676 * 677 * @return A 'tevent_req' handle, where the caller can register a 678 * callback with tevent_req_set_callback(). NULL on a fatal 679 * error. 680 * 681 * @see tstream_inet_tcp_connect_recv() 682 */ 683 struct tevent_req *tstream_inet_tcp_connect_send(TALLOC_CTX *mem_ctx, 148 684 struct tevent_context *ev, 149 685 const struct tsocket_address *local, 150 686 const struct tsocket_address *remote); 687 688 #ifdef DOXYGEN 689 /** 690 * @brief Receive the result from a tstream_inet_tcp_connect_send(). 691 * 692 * @param[in] req The tevent request from tstream_inet_tcp_connect_send(). 693 * 694 * @param[out] perrno The error number, set if an error occurred. 695 * 696 * @param[in] mem_ctx The talloc memory context to use. 697 * 698 * @param[in] stream A tstream_context pointer to setup the tcp communication 699 * on. This function will allocate the memory. 700 * 701 * @return 0 on success, -1 on error with perrno set. 702 */ 703 int tstream_inet_tcp_connect_recv(struct tevent_req *req, 704 int *perrno, 705 TALLOC_CTX *mem_ctx, 706 struct tstream_context **stream); 707 #else 151 708 int _tstream_inet_tcp_connect_recv(struct tevent_req *req, 152 709 int *perrno, … … 157 714 _tstream_inet_tcp_connect_recv(req, perrno, mem_ctx, stream, \ 158 715 __location__) 159 716 #endif 717 718 /** 719 * @brief Connect async to a unix domain endpoint and create a tstream_context 720 * for the stream based communication. 721 * 722 * Use this function to connenct asynchronously to a unix domainendpoint and 723 * create a tstream_context for the stream based communication. 724 * 725 * The callback is triggered when a socket is connected and ready for IO or an 726 * error happened. 727 * 728 * @param[in] mem_ctx The talloc memory context to use. 729 * 730 * @param[in] ev The tevent_context to run on. 731 * 732 * @param[in] local An 'unix' tsocket_address for the local endpoint. 733 * 734 * @param[in] remote An 'unix' tsocket_address for the remote endpoint. 735 * 736 * @return A 'tevent_req' handle, where the caller can register a 737 * callback with tevent_req_set_callback(). NULL on a falal 738 * error. 739 * 740 * @see tstream_unix_connect_recv() 741 */ 160 742 struct tevent_req * tstream_unix_connect_send(TALLOC_CTX *mem_ctx, 161 743 struct tevent_context *ev, 162 744 const struct tsocket_address *local, 163 745 const struct tsocket_address *remote); 746 747 #ifdef DOXYGEN 748 /** 749 * @brief Receive the result from a tstream_unix_connect_send(). 750 * 751 * @param[in] req The tevent request from tstream_inet_tcp_connect_send(). 752 * 753 * @param[out] perrno The error number, set if an error occurred. 754 * 755 * @param[in] mem_ctx The talloc memory context to use. 756 * 757 * @param[in] stream The tstream context to work on. 758 * 759 * @return 0 on success, -1 on error with perrno set. 760 */ 761 int tstream_unix_connect_recv(struct tevent_req *req, 762 int *perrno, 763 TALLOC_CTX *mem_ctx, 764 struct tstream_context **stream); 765 #else 164 766 int _tstream_unix_connect_recv(struct tevent_req *req, 165 767 int *perrno, … … 170 772 _tstream_unix_connect_recv(req, perrno, mem_ctx, stream, \ 171 773 __location__) 172 774 #endif 775 776 #ifdef DOXYGEN 777 /** 778 * @brief Create two connected 'unix' tsocket_contexts for stream based 779 * communication. 780 * 781 * @param[in] mem_ctx1 The talloc memory context to use for stream1. 782 * 783 * @param[in] stream1 The first stream to connect. 784 * 785 * @param[in] mem_ctx2 The talloc memory context to use for stream2. 786 * 787 * @param[in] stream2 The second stream to connect. 788 * 789 * @return 0 on success, -1 on error with errno set. 790 */ 791 int tstream_unix_socketpair(TALLOC_CTX *mem_ctx1, 792 struct tstream_context **stream1, 793 TALLOC_CTX *mem_ctx2, 794 struct tstream_context **stream2); 795 #else 173 796 int _tstream_unix_socketpair(TALLOC_CTX *mem_ctx1, 174 797 struct tstream_context **_stream1, … … 176 799 struct tstream_context **_stream2, 177 800 const char *location); 801 178 802 #define tstream_unix_socketpair(mem_ctx1, stream1, mem_ctx2, stream2) \ 179 803 _tstream_unix_socketpair(mem_ctx1, stream1, mem_ctx2, stream2, \ 180 804 __location__) 805 #endif 181 806 182 807 struct sockaddr; 183 808 809 #ifdef DOXYGEN 810 /** 811 * @brief Convert a tsocket address to a bsd socket address. 812 * 813 * @param[in] mem_ctx The talloc memory context to use. 814 * 815 * @param[in] sa The sockaddr structure to convert. 816 * 817 * @param[in] sa_socklen The lenth of the sockaddr sturucte. 818 * 819 * @param[out] addr The tsocket pointer to allocate and fill. 820 * 821 * @return 0 on success, -1 on error with errno set. 822 */ 823 int tsocket_address_bsd_from_sockaddr(TALLOC_CTX *mem_ctx, 824 struct sockaddr *sa, 825 size_t sa_socklen, 826 struct tsocket_address **addr); 827 #else 184 828 int _tsocket_address_bsd_from_sockaddr(TALLOC_CTX *mem_ctx, 185 829 struct sockaddr *sa, … … 187 831 struct tsocket_address **_addr, 188 832 const char *location); 833 189 834 #define tsocket_address_bsd_from_sockaddr(mem_ctx, sa, sa_socklen, _addr) \ 190 835 _tsocket_address_bsd_from_sockaddr(mem_ctx, sa, sa_socklen, _addr, \ 191 836 __location__) 192 837 #endif 838 839 /** 840 * @brief Fill a bsd sockaddr structure. 841 * 842 * @param[in] addr The tsocket address structure to use. 843 * 844 * @param[in] sa The bsd sockaddr structure to fill out. 845 * 846 * @param[in] sa_socklen The length of the bsd sockaddr structure to fill out. 847 * 848 * @return The actual size of the sockaddr structure, -1 on error 849 * with errno set. The size could differ from sa_socklen. 850 * 851 * @code 852 * ssize_t socklen; 853 * struct sockaddr_storage ss; 854 * 855 * socklen = tsocket_address_bsd_sockaddr(taddr, 856 * (struct sockaddr *) &ss, 857 * sizeof(struct sockaddr_storage)); 858 * if (socklen < 0) { 859 * return -1; 860 * } 861 * @endcode 862 */ 193 863 ssize_t tsocket_address_bsd_sockaddr(const struct tsocket_address *addr, 194 864 struct sockaddr *sa, 195 865 size_t sa_socklen); 196 866 867 #ifdef DOXYGEN 868 /** 869 * @brief Wrap an existing file descriptors into the tstream abstraction. 870 * 871 * You can use this function to wrap an existing file descriptors into the 872 * tstream abstraction. After that you're not able to use this file descriptor 873 * for anything else. The file descriptor will be closed when the stream gets 874 * freed. If you still want to use the fd you have have to create a duplicate. 875 * 876 * @param[in] mem_ctx The talloc memory context to use. 877 * 878 * @param[in] fd The non blocking fd to use! 879 * 880 * @param[in] stream The filed tstream_context you allocated before. 881 * 882 * @return 0 on success, -1 on error with errno set. 883 * 884 * @warning You should read the tsocket_bsd.c code and unterstand it in order 885 * use this function. 886 */ 887 int tstream_bsd_existing_socket(TALLOC_CTX *mem_ctx, 888 int fd, 889 struct tstream_context **stream); 890 #else 197 891 int _tstream_bsd_existing_socket(TALLOC_CTX *mem_ctx, 198 892 int fd, … … 202 896 _tstream_bsd_existing_socket(mem_ctx, fd, stream, \ 203 897 __location__) 204 205 /* 206 * Queue and PDU helpers 207 */ 208 898 #endif 899 900 /** 901 * @} 902 */ 903 904 /** 905 * @defgroup tsocket_helper Queue and PDU helpers 906 * @ingroup tsocket 907 * 908 * In order to make the live easier for callers which want to implement a 909 * function to receive a full PDU with a single async function pair, there're 910 * some helper functions. 911 * 912 * There're some cases where the caller wants doesn't care about the order of 913 * doing IO on the abstracted sockets. 914 * 915 * @{ 916 */ 917 918 /** 919 * @brief Queue a dgram blob for sending through the socket. 920 * 921 * This function queues a blob for sending to destination through an existing 922 * dgram socket. The async callback is triggered when the whole blob is 923 * delivered to the underlying system socket. 924 * 925 * The caller needs to make sure that all non-scalar input parameters hang 926 * around for the whole lifetime of the request. 927 * 928 * @param[in] mem_ctx The memory context for the result. 929 * 930 * @param[in] ev The event context the operation should work on. 931 * 932 * @param[in] dgram The tdgram_context to send the message buffer. 933 * 934 * @param[in] queue The existing dgram queue. 935 * 936 * @param[in] buf The message buffer to send. 937 * 938 * @param[in] len The message length. 939 * 940 * @param[in] dst The destination socket address. 941 * 942 * @return The async request handle. NULL on fatal error. 943 * 944 * @see tdgram_sendto_queue_recv() 945 */ 209 946 struct tevent_req *tdgram_sendto_queue_send(TALLOC_CTX *mem_ctx, 210 947 struct tevent_context *ev, … … 214 951 size_t len, 215 952 struct tsocket_address *dst); 953 954 /** 955 * @brief Receive the result of the sent dgram blob. 956 * 957 * @param[in] req The tevent request from tdgram_sendto_queue_send(). 958 * 959 * @param[out] perrno The error set to the actual errno. 960 * 961 * @return The length of the datagram (0 is never returned!), -1 on 962 * error with perrno set to the actual errno. 963 */ 216 964 ssize_t tdgram_sendto_queue_recv(struct tevent_req *req, int *perrno); 217 965 … … 221 969 struct iovec **vector, 222 970 size_t *count); 971 223 972 struct tevent_req *tstream_readv_pdu_send(TALLOC_CTX *mem_ctx, 224 973 struct tevent_context *ev, … … 228 977 int tstream_readv_pdu_recv(struct tevent_req *req, int *perrno); 229 978 979 /** 980 * @brief Queue a read request for a PDU on the socket. 981 * 982 * This function queues a read request for a PDU on a stream socket. The async 983 * callback is triggered when a full PDU has been read from the socket. 984 * 985 * The caller needs to make sure that all non-scalar input parameters hang 986 * around for the whole lifetime of the request. 987 * 988 * @param[in] mem_ctx The memory context for the result 989 * 990 * @param[in] ev The tevent_context to run on 991 * 992 * @param[in] stream The stream to send data through 993 * 994 * @param[in] queue The existing send queue 995 * 996 * @param[in] next_vector_fn The next vector function 997 * 998 * @param[in] next_vector_private The private_data of the next vector function 999 * 1000 * @return The async request handle. NULL on fatal error. 1001 * 1002 * @see tstream_readv_pdu_queue_recv() 1003 */ 230 1004 struct tevent_req *tstream_readv_pdu_queue_send(TALLOC_CTX *mem_ctx, 231 1005 struct tevent_context *ev, … … 234 1008 tstream_readv_pdu_next_vector_t next_vector_fn, 235 1009 void *next_vector_private); 1010 1011 /** 1012 * @brief Receive the PDU blob read from the stream. 1013 * 1014 * @param[in] req The tevent request from tstream_readv_pdu_queue_send(). 1015 * 1016 * @param[out] perrno The error set to the actual errno. 1017 * 1018 * @return The number of bytes read on success, -1 on error with 1019 * perrno set to the actual errno. 1020 */ 236 1021 int tstream_readv_pdu_queue_recv(struct tevent_req *req, int *perrno); 237 1022 1023 /** 1024 * @brief Queue an iovector for sending through the socket 1025 * 1026 * This function queues an iovector for sending to destination through an 1027 * existing stream socket. The async callback is triggered when the whole 1028 * vectror has been delivered to the underlying system socket. 1029 * 1030 * The caller needs to make sure that all non-scalar input parameters hang 1031 * around for the whole lifetime of the request. 1032 * 1033 * @param[in] mem_ctx The memory context for the result. 1034 * 1035 * @param[in] ev The tevent_context to run on. 1036 * 1037 * @param[in] stream The stream to send data through. 1038 * 1039 * @param[in] queue The existing send queue. 1040 * 1041 * @param[in] vector The iovec vector so write. 1042 * 1043 * @param[in] count The size of the vector. 1044 * 1045 * @return The async request handle. NULL on fatal error. 1046 */ 238 1047 struct tevent_req *tstream_writev_queue_send(TALLOC_CTX *mem_ctx, 239 1048 struct tevent_context *ev, … … 242 1051 const struct iovec *vector, 243 1052 size_t count); 1053 1054 /** 1055 * @brief Receive the result of the sent iovector. 1056 * 1057 * @param[in] req The tevent request from tstream_writev_queue_send(). 1058 * 1059 * @param[out] perrno The error set to the actual errno. 1060 * 1061 * @return The length of the iovector (0 is never returned!), -1 on 1062 * error with perrno set to the actual errno. 1063 */ 244 1064 int tstream_writev_queue_recv(struct tevent_req *req, int *perrno); 245 1065 1066 /** 1067 * @} 1068 */ 1069 246 1070 #endif /* _TSOCKET_H */ 247 1071 -
vendor/current/lib/tsocket/tsocket_bsd.c
r414 r478 191 191 192 192 struct tsocket_address_bsd { 193 socklen_t sa_socklen; 193 194 union { 194 195 struct sockaddr sa; … … 211 212 struct tsocket_address_bsd *bsda; 212 213 214 if (sa_socklen < sizeof(sa->sa_family)) { 215 errno = EINVAL; 216 return -1; 217 } 218 213 219 switch (sa->sa_family) { 214 220 case AF_UNIX: 215 if (sa_socklen < sizeof(struct sockaddr_un)) { 216 errno = EINVAL; 217 return -1; 221 if (sa_socklen > sizeof(struct sockaddr_un)) { 222 sa_socklen = sizeof(struct sockaddr_un); 218 223 } 219 224 break; … … 223 228 return -1; 224 229 } 230 sa_socklen = sizeof(struct sockaddr_in); 225 231 break; 226 232 #ifdef HAVE_IPV6 … … 230 236 return -1; 231 237 } 238 sa_socklen = sizeof(struct sockaddr_in6); 232 239 break; 233 240 #endif … … 256 263 memcpy(&bsda->u.ss, sa, sa_socklen); 257 264 265 bsda->sa_socklen = sa_socklen; 266 258 267 *_addr = addr; 259 268 return 0; … … 266 275 struct tsocket_address_bsd *bsda = talloc_get_type(addr->private_data, 267 276 struct tsocket_address_bsd); 268 ssize_t rlen = 0;269 277 270 278 if (!bsda) { … … 273 281 } 274 282 275 switch (bsda->u.sa.sa_family) { 276 case AF_UNIX: 277 rlen = sizeof(struct sockaddr_un); 278 break; 279 case AF_INET: 280 rlen = sizeof(struct sockaddr_in); 281 break; 282 #ifdef HAVE_IPV6 283 case AF_INET6: 284 rlen = sizeof(struct sockaddr_in6); 285 break; 286 #endif 287 default: 288 errno = EAFNOSUPPORT; 289 return -1; 290 } 291 292 if (sa_socklen < rlen) { 283 if (sa_socklen < bsda->sa_socklen) { 293 284 errno = EINVAL; 294 285 return -1; 295 286 } 296 287 297 if (sa_socklen > sizeof(struct sockaddr_storage)) {288 if (sa_socklen > bsda->sa_socklen) { 298 289 memset(sa, 0, sa_socklen); 299 sa_socklen = sizeof(struct sockaddr_storage);290 sa_socklen = bsda->sa_socklen; 300 291 } 301 292 302 293 memcpy(sa, &bsda->u.ss, sa_socklen); 303 return rlen;294 return sa_socklen; 304 295 } 305 296 … … 583 574 ret = _tsocket_address_bsd_from_sockaddr(mem_ctx, 584 575 &bsda->u.sa, 585 sizeof(bsda->u.ss),576 bsda->sa_socklen, 586 577 ©, 587 578 location); … … 822 813 struct tsocket_address_bsd *bsda; 823 814 ssize_t ret; 824 struct sockaddr *sa = NULL;825 socklen_t sa_socklen = 0;826 815 int err; 827 816 bool retry; … … 857 846 858 847 ZERO_STRUCTP(bsda); 859 860 sa = &bsda->u.sa; 861 sa_socklen = sizeof(bsda->u.ss); 862 /* 863 * for unix sockets we can't use the size of sockaddr_storage 864 * we would get EINVAL 865 */ 866 if (bsda->u.sa.sa_family == AF_UNIX) { 867 sa_socklen = sizeof(bsda->u.un); 868 } 869 870 ret = recvfrom(bsds->fd, state->buf, state->len, 0, sa, &sa_socklen); 848 bsda->sa_socklen = sizeof(bsda->u.ss); 849 850 ret = recvfrom(bsds->fd, state->buf, state->len, 0, 851 &bsda->u.sa, &bsda->sa_socklen); 871 852 err = tsocket_bsd_error_from_errno(ret, errno, &retry); 872 853 if (retry) { … … 1014 995 1015 996 sa = &bsda->u.sa; 1016 sa_socklen = sizeof(bsda->u.ss); 1017 /* 1018 * for unix sockets we can't use the size of sockaddr_storage 1019 * we would get EINVAL 1020 */ 1021 if (bsda->u.sa.sa_family == AF_UNIX) { 1022 sa_socklen = sizeof(bsda->u.un); 1023 } 997 sa_socklen = bsda->sa_socklen; 1024 998 } 1025 999 … … 1147 1121 bool is_inet = false; 1148 1122 int sa_fam = lbsda->u.sa.sa_family; 1149 socklen_t sa_socklen = sizeof(lbsda->u.ss);1150 1123 1151 1124 if (remote) { … … 1164 1137 do_bind = true; 1165 1138 } 1166 /*1167 * for unix sockets we can't use the size of sockaddr_storage1168 * we would get EINVAL1169 */1170 sa_socklen = sizeof(lbsda->u.un);1171 1139 break; 1172 1140 case AF_INET: … … 1179 1147 } 1180 1148 is_inet = true; 1181 sa_socklen = sizeof(rbsda->u.in);1182 1149 break; 1183 1150 #ifdef HAVE_IPV6 … … 1193 1160 } 1194 1161 is_inet = true; 1195 sa_socklen = sizeof(rbsda->u.in6);1196 1162 do_ipv6only = true; 1197 1163 break; … … 1206 1172 switch (sa_fam) { 1207 1173 case AF_INET: 1208 sa_socklen = sizeof(rbsda->u.in);1209 1174 do_ipv6only = false; 1210 1175 break; 1211 1176 #ifdef HAVE_IPV6 1212 1177 case AF_INET6: 1213 sa_socklen = sizeof(rbsda->u.in6);1214 1178 do_ipv6only = true; 1215 1179 break; … … 1285 1249 1286 1250 if (do_bind) { 1287 ret = bind(fd, &lbsda->u.sa, sa_socklen);1251 ret = bind(fd, &lbsda->u.sa, lbsda->sa_socklen); 1288 1252 if (ret == -1) { 1289 1253 int saved_errno = errno; … … 1301 1265 } 1302 1266 1303 ret = connect(fd, &rbsda->u.sa, sa_socklen);1267 ret = connect(fd, &rbsda->u.sa, rbsda->sa_socklen); 1304 1268 if (ret == -1) { 1305 1269 int saved_errno = errno; … … 1994 1958 bool is_inet = false; 1995 1959 int sa_fam = lbsda->u.sa.sa_family; 1996 socklen_t sa_socklen = sizeof(rbsda->u.ss);1997 1960 1998 1961 req = tevent_req_create(mem_ctx, &state, … … 2018 1981 do_bind = true; 2019 1982 } 2020 /*2021 * for unix sockets we can't use the size of sockaddr_storage2022 * we would get EINVAL2023 */2024 sa_socklen = sizeof(rbsda->u.un);2025 1983 break; 2026 1984 case AF_INET: … … 2033 1991 } 2034 1992 is_inet = true; 2035 sa_socklen = sizeof(rbsda->u.in);2036 1993 break; 2037 1994 #ifdef HAVE_IPV6 … … 2047 2004 } 2048 2005 is_inet = true; 2049 sa_socklen = sizeof(rbsda->u.in6);2050 2006 do_ipv6only = true; 2051 2007 break; … … 2060 2016 switch (sa_fam) { 2061 2017 case AF_INET: 2062 sa_socklen = sizeof(rbsda->u.in);2063 2018 do_ipv6only = false; 2064 2019 break; 2065 2020 #ifdef HAVE_IPV6 2066 2021 case AF_INET6: 2067 sa_socklen = sizeof(rbsda->u.in6);2068 2022 do_ipv6only = true; 2069 2023 break; … … 2109 2063 2110 2064 if (do_bind) { 2111 ret = bind(state->fd, &lbsda->u.sa, sa_socklen);2065 ret = bind(state->fd, &lbsda->u.sa, lbsda->sa_socklen); 2112 2066 if (ret == -1) { 2113 2067 tevent_req_error(req, errno); … … 2121 2075 } 2122 2076 2123 ret = connect(state->fd, &rbsda->u.sa, sa_socklen);2077 ret = connect(state->fd, &rbsda->u.sa, rbsda->sa_socklen); 2124 2078 err = tsocket_bsd_error_from_errno(ret, errno, &retry); 2125 2079 if (retry) { -
vendor/current/lib/tsocket/tsocket_helpers.c
r414 r478 43 43 static void tdgram_sendto_queue_done(struct tevent_req *subreq); 44 44 45 /**46 * @brief Queue a dgram blob for sending through the socket47 * @param[in] mem_ctx The memory context for the result48 * @param[in] ev The event context the operation should work on49 * @param[in] dgram The tdgram_context to send the message buffer50 * @param[in] queue The existing dgram queue51 * @param[in] buf The message buffer52 * @param[in] len The message length53 * @param[in] dst The destination socket address54 * @retval The async request handle55 *56 * This function queues a blob for sending to destination through an existing57 * dgram socket. The async callback is triggered when the whole blob is58 * delivered to the underlying system socket.59 *60 * The caller needs to make sure that all non-scalar input parameters hang61 * arround for the whole lifetime of the request.62 */63 45 struct tevent_req *tdgram_sendto_queue_send(TALLOC_CTX *mem_ctx, 64 46 struct tevent_context *ev, … … 336 318 static void tstream_readv_pdu_queue_done(struct tevent_req *subreq); 337 319 338 /**339 * @brief Queue a dgram blob for sending through the socket340 * @param[in] mem_ctx The memory context for the result341 * @param[in] ev The tevent_context to run on342 * @param[in] stream The stream to send data through343 * @param[in] queue The existing send queue344 * @param[in] next_vector_fn The next vector function345 * @param[in] next_vector_private The private_data of the next vector function346 * @retval The async request handle347 *348 * This function queues a blob for sending to destination through an existing349 * dgram socket. The async callback is triggered when the whole blob is350 * delivered to the underlying system socket.351 *352 * The caller needs to make sure that all non-scalar input parameters hang353 * arround for the whole lifetime of the request.354 */355 320 struct tevent_req *tstream_readv_pdu_queue_send(TALLOC_CTX *mem_ctx, 356 321 struct tevent_context *ev, … … 460 425 static void tstream_writev_queue_done(struct tevent_req *subreq); 461 426 462 /**463 * @brief Queue a dgram blob for sending through the socket464 * @param[in] mem_ctx The memory context for the result465 * @param[in] ev The tevent_context to run on466 * @param[in] stream The stream to send data through467 * @param[in] queue The existing send queue468 * @param[in] vector The iovec vector so write469 * @param[in] count The size of the vector470 * @retval The async request handle471 *472 * This function queues a blob for sending to destination through an existing473 * dgram socket. The async callback is triggered when the whole blob is474 * delivered to the underlying system socket.475 *476 * The caller needs to make sure that all non-scalar input parameters hang477 * arround for the whole lifetime of the request.478 */479 427 struct tevent_req *tstream_writev_queue_send(TALLOC_CTX *mem_ctx, 480 428 struct tevent_context *ev, -
vendor/current/lib/util/time.c
r414 r478 28 28 */ 29 29 30 #ifndef TIME_T_MIN31 /* we use 0 here, because (time_t)-1 means error */32 #define TIME_T_MIN 033 #endif34 35 30 #if (SIZEOF_LONG == 8) 36 31 #define TIME_FIXUP_CONSTANT_INT 11644473600L … … 40 35 41 36 42 43 /*44 * we use the INT32_MAX here as on 64 bit systems,45 * gmtime() fails with INT64_MAX46 */47 48 #ifndef TIME_T_MAX49 #define TIME_T_MAX MIN(INT32_MAX,_TYPE_MAXIMUM(time_t))50 #endif51 37 52 38 /** -
vendor/current/lib/util/time.h
r414 r478 24 24 #endif 25 25 26 #ifndef TIME_T_MIN 27 /* we use 0 here, because (time_t)-1 means error */ 28 #define TIME_T_MIN 0 29 #endif 30 31 /* 32 * we use the INT32_MAX here as on 64 bit systems, 33 * gmtime() fails with INT64_MAX 34 */ 35 #ifndef TIME_T_MAX 36 #define TIME_T_MAX MIN(INT32_MAX,_TYPE_MAXIMUM(time_t)) 37 #endif 38 39 26 40 /* 64 bit time (100 nanosec) 1601 - cifs6.txt, section 3.5, page 30, 4 byte aligned */ 27 41 typedef uint64_t NTTIME;
Note:
See TracChangeset
for help on using the changeset viewer.