Ignore:
Timestamp:
Aug 2, 2010, 8:16:45 PM (15 years ago)
Author:
Silvan Scherrer
Message:

Samba Server 3.5: trunk update to 3.5.4

Location:
trunk/server
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/server

  • trunk/server/lib/tsocket/tsocket.h

    r414 r480  
    3333struct iovec;
    3434
    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()
    37106 */
    38107char *tsocket_address_string(const struct tsocket_address *addr,
    39108                             TALLOC_CTX *mem_ctx);
    40109
     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 */
     124struct tsocket_address *tsocket_address_copy(const struct tsocket_address *addr,
     125                TALLOC_CTX *mem_ctx);
     126#else
    41127struct tsocket_address *_tsocket_address_copy(const struct tsocket_address *addr,
    42128                                              TALLOC_CTX *mem_ctx,
     
    45131#define tsocket_address_copy(addr, mem_ctx) \
    46132        _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()
    50171 */
    51172struct tevent_req *tdgram_recvfrom_send(TALLOC_CTX *mem_ctx,
    52173                                        struct tevent_context *ev,
    53174                                        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 */
    54201ssize_t tdgram_recvfrom_recv(struct tevent_req *req,
    55202                             int *perrno,
     
    58205                             struct tsocket_address **src);
    59206
     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 */
    60242struct tevent_req *tdgram_sendto_send(TALLOC_CTX *mem_ctx,
    61243                                      struct tevent_context *ev,
     
    63245                                      const uint8_t *buf, size_t len,
    64246                                      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 */
    65263ssize_t tdgram_sendto_recv(struct tevent_req *req,
    66264                           int *perrno);
    67265
     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 */
    68288struct tevent_req *tdgram_disconnect_send(TALLOC_CTX *mem_ctx,
    69289                                          struct tevent_context *ev,
    70290                                          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 */
    71308int tdgram_disconnect_recv(struct tevent_req *req,
    72309                           int *perrno);
    73310
    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.
    76339 */
    77340ssize_t tstream_pending_bytes(struct tstream_context *stream);
    78341
     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 */
    79368struct tevent_req *tstream_readv_send(TALLOC_CTX *mem_ctx,
    80369                                      struct tevent_context *ev,
     
    82371                                      struct iovec *vector,
    83372                                      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 */
    84387int tstream_readv_recv(struct tevent_req *req,
    85388                       int *perrno);
    86389
     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 */
    87412struct tevent_req *tstream_writev_send(TALLOC_CTX *mem_ctx,
    88413                                       struct tevent_context *ev,
     
    90415                                       const struct iovec *vector,
    91416                                       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 */
    92431int tstream_writev_recv(struct tevent_req *req,
    93432                        int *perrno);
    94433
     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 */
    95454struct tevent_req *tstream_disconnect_send(TALLOC_CTX *mem_ctx,
    96455                                           struct tevent_context *ev,
    97456                                           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 */
    98471int tstream_disconnect_recv(struct tevent_req *req,
    99472                            int *perrno);
    100473
    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 */
     509int 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
    105515int _tsocket_address_inet_from_strings(TALLOC_CTX *mem_ctx,
    106516                                       const char *fam,
     
    109519                                       struct tsocket_address **_addr,
    110520                                       const char *location);
     521
    111522#define tsocket_address_inet_from_strings(mem_ctx, fam, addr, port, _addr) \
    112523        _tsocket_address_inet_from_strings(mem_ctx, fam, addr, port, _addr, \
    113524                                           __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 */
    115537char *tsocket_address_inet_addr_string(const struct tsocket_address *addr,
    116538                                       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 */
    117547uint16_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 */
    118558int tsocket_address_inet_set_port(struct tsocket_address *addr,
    119559                                  uint16_t port);
    120560
     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 */
     573int tsocket_address_unix_from_path(TALLOC_CTX *mem_ctx,
     574                                   const char *path,
     575                                   struct tsocket_address **_addr);
     576#else
    121577int _tsocket_address_unix_from_path(TALLOC_CTX *mem_ctx,
    122578                                    const char *path,
    123579                                    struct tsocket_address **_addr,
    124580                                    const char *location);
     581
    125582#define tsocket_address_unix_from_path(mem_ctx, path, _addr) \
    126583        _tsocket_address_unix_from_path(mem_ctx, path, _addr, \
    127584                                        __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 */
    128598char *tsocket_address_unix_path(const struct tsocket_address *addr,
    129599                                TALLOC_CTX *mem_ctx);
    130600
     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 */
     617int 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
    131622int _tdgram_inet_udp_socket(const struct tsocket_address *local,
    132623                            const struct tsocket_address *remote,
     
    136627#define tdgram_inet_udp_socket(local, remote, mem_ctx, dgram) \
    137628        _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 */
     647int 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
    139652int _tdgram_unix_socket(const struct tsocket_address *local,
    140653                        const struct tsocket_address *remote,
     
    142655                        struct tdgram_context **dgram,
    143656                        const char *location);
     657
    144658#define tdgram_unix_socket(local, remote, mem_ctx, dgram) \
    145659        _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 */
     683struct tevent_req *tstream_inet_tcp_connect_send(TALLOC_CTX *mem_ctx,
    148684                                        struct tevent_context *ev,
    149685                                        const struct tsocket_address *local,
    150686                                        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 */
     703int tstream_inet_tcp_connect_recv(struct tevent_req *req,
     704                                  int *perrno,
     705                                  TALLOC_CTX *mem_ctx,
     706                                  struct tstream_context **stream);
     707#else
    151708int _tstream_inet_tcp_connect_recv(struct tevent_req *req,
    152709                                   int *perrno,
     
    157714        _tstream_inet_tcp_connect_recv(req, perrno, mem_ctx, stream, \
    158715                                       __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 */
    160742struct tevent_req * tstream_unix_connect_send(TALLOC_CTX *mem_ctx,
    161743                                        struct tevent_context *ev,
    162744                                        const struct tsocket_address *local,
    163745                                        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 */
     761int tstream_unix_connect_recv(struct tevent_req *req,
     762                              int *perrno,
     763                              TALLOC_CTX *mem_ctx,
     764                              struct tstream_context **stream);
     765#else
    164766int _tstream_unix_connect_recv(struct tevent_req *req,
    165767                               int *perrno,
     
    170772        _tstream_unix_connect_recv(req, perrno, mem_ctx, stream, \
    171773                                          __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 */
     791int tstream_unix_socketpair(TALLOC_CTX *mem_ctx1,
     792                            struct tstream_context **stream1,
     793                            TALLOC_CTX *mem_ctx2,
     794                            struct tstream_context **stream2);
     795#else
    173796int _tstream_unix_socketpair(TALLOC_CTX *mem_ctx1,
    174797                             struct tstream_context **_stream1,
     
    176799                             struct tstream_context **_stream2,
    177800                             const char *location);
     801
    178802#define tstream_unix_socketpair(mem_ctx1, stream1, mem_ctx2, stream2) \
    179803        _tstream_unix_socketpair(mem_ctx1, stream1, mem_ctx2, stream2, \
    180804                                 __location__)
     805#endif
    181806
    182807struct sockaddr;
    183808
     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 */
     823int 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
    184828int _tsocket_address_bsd_from_sockaddr(TALLOC_CTX *mem_ctx,
    185829                                       struct sockaddr *sa,
     
    187831                                       struct tsocket_address **_addr,
    188832                                       const char *location);
     833
    189834#define tsocket_address_bsd_from_sockaddr(mem_ctx, sa, sa_socklen, _addr) \
    190835        _tsocket_address_bsd_from_sockaddr(mem_ctx, sa, sa_socklen, _addr, \
    191836                                           __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 */
    193863ssize_t tsocket_address_bsd_sockaddr(const struct tsocket_address *addr,
    194864                                     struct sockaddr *sa,
    195865                                     size_t sa_socklen);
    196866
     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 */
     887int tstream_bsd_existing_socket(TALLOC_CTX *mem_ctx,
     888                                int fd,
     889                                struct tstream_context **stream);
     890#else
    197891int _tstream_bsd_existing_socket(TALLOC_CTX *mem_ctx,
    198892                                 int fd,
     
    202896        _tstream_bsd_existing_socket(mem_ctx, fd, stream, \
    203897                                     __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 */
    209946struct tevent_req *tdgram_sendto_queue_send(TALLOC_CTX *mem_ctx,
    210947                                            struct tevent_context *ev,
     
    214951                                            size_t len,
    215952                                            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 */
    216964ssize_t tdgram_sendto_queue_recv(struct tevent_req *req, int *perrno);
    217965
     
    221969                                               struct iovec **vector,
    222970                                               size_t *count);
     971
    223972struct tevent_req *tstream_readv_pdu_send(TALLOC_CTX *mem_ctx,
    224973                                struct tevent_context *ev,
     
    228977int tstream_readv_pdu_recv(struct tevent_req *req, int *perrno);
    229978
     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 */
    2301004struct tevent_req *tstream_readv_pdu_queue_send(TALLOC_CTX *mem_ctx,
    2311005                                struct tevent_context *ev,
     
    2341008                                tstream_readv_pdu_next_vector_t next_vector_fn,
    2351009                                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 */
    2361021int tstream_readv_pdu_queue_recv(struct tevent_req *req, int *perrno);
    2371022
     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 */
    2381047struct tevent_req *tstream_writev_queue_send(TALLOC_CTX *mem_ctx,
    2391048                                             struct tevent_context *ev,
     
    2421051                                             const struct iovec *vector,
    2431052                                             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 */
    2441064int tstream_writev_queue_recv(struct tevent_req *req, int *perrno);
    2451065
     1066/**
     1067 * @}
     1068 */
     1069
    2461070#endif /* _TSOCKET_H */
    2471071
  • trunk/server/lib/tsocket/tsocket_bsd.c

    r414 r480  
    191191
    192192struct tsocket_address_bsd {
     193        socklen_t sa_socklen;
    193194        union {
    194195                struct sockaddr sa;
     
    211212        struct tsocket_address_bsd *bsda;
    212213
     214        if (sa_socklen < sizeof(sa->sa_family)) {
     215                errno = EINVAL;
     216                return -1;
     217        }
     218
    213219        switch (sa->sa_family) {
    214220        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);
    218223                }
    219224                break;
     
    223228                        return -1;
    224229                }
     230                sa_socklen = sizeof(struct sockaddr_in);
    225231                break;
    226232#ifdef HAVE_IPV6
     
    230236                        return -1;
    231237                }
     238                sa_socklen = sizeof(struct sockaddr_in6);
    232239                break;
    233240#endif
     
    256263        memcpy(&bsda->u.ss, sa, sa_socklen);
    257264
     265        bsda->sa_socklen = sa_socklen;
     266
    258267        *_addr = addr;
    259268        return 0;
     
    266275        struct tsocket_address_bsd *bsda = talloc_get_type(addr->private_data,
    267276                                           struct tsocket_address_bsd);
    268         ssize_t rlen = 0;
    269277
    270278        if (!bsda) {
     
    273281        }
    274282
    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) {
    293284                errno = EINVAL;
    294285                return -1;
    295286        }
    296287
    297         if (sa_socklen > sizeof(struct sockaddr_storage)) {
     288        if (sa_socklen > bsda->sa_socklen) {
    298289                memset(sa, 0, sa_socklen);
    299                 sa_socklen = sizeof(struct sockaddr_storage);
     290                sa_socklen = bsda->sa_socklen;
    300291        }
    301292
    302293        memcpy(sa, &bsda->u.ss, sa_socklen);
    303         return rlen;
     294        return sa_socklen;
    304295}
    305296
     
    583574        ret = _tsocket_address_bsd_from_sockaddr(mem_ctx,
    584575                                                 &bsda->u.sa,
    585                                                  sizeof(bsda->u.ss),
     576                                                 bsda->sa_socklen,
    586577                                                 &copy,
    587578                                                 location);
     
    822813        struct tsocket_address_bsd *bsda;
    823814        ssize_t ret;
    824         struct sockaddr *sa = NULL;
    825         socklen_t sa_socklen = 0;
    826815        int err;
    827816        bool retry;
     
    857846
    858847        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);
    871852        err = tsocket_bsd_error_from_errno(ret, errno, &retry);
    872853        if (retry) {
     
    1014995
    1015996                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;
    1024998        }
    1025999
     
    11471121        bool is_inet = false;
    11481122        int sa_fam = lbsda->u.sa.sa_family;
    1149         socklen_t sa_socklen = sizeof(lbsda->u.ss);
    11501123
    11511124        if (remote) {
     
    11641137                        do_bind = true;
    11651138                }
    1166                 /*
    1167                  * for unix sockets we can't use the size of sockaddr_storage
    1168                  * we would get EINVAL
    1169                  */
    1170                 sa_socklen = sizeof(lbsda->u.un);
    11711139                break;
    11721140        case AF_INET:
     
    11791147                }
    11801148                is_inet = true;
    1181                 sa_socklen = sizeof(rbsda->u.in);
    11821149                break;
    11831150#ifdef HAVE_IPV6
     
    11931160                }
    11941161                is_inet = true;
    1195                 sa_socklen = sizeof(rbsda->u.in6);
    11961162                do_ipv6only = true;
    11971163                break;
     
    12061172                switch (sa_fam) {
    12071173                case AF_INET:
    1208                         sa_socklen = sizeof(rbsda->u.in);
    12091174                        do_ipv6only = false;
    12101175                        break;
    12111176#ifdef HAVE_IPV6
    12121177                case AF_INET6:
    1213                         sa_socklen = sizeof(rbsda->u.in6);
    12141178                        do_ipv6only = true;
    12151179                        break;
     
    12851249
    12861250        if (do_bind) {
    1287                 ret = bind(fd, &lbsda->u.sa, sa_socklen);
     1251                ret = bind(fd, &lbsda->u.sa, lbsda->sa_socklen);
    12881252                if (ret == -1) {
    12891253                        int saved_errno = errno;
     
    13011265                }
    13021266
    1303                 ret = connect(fd, &rbsda->u.sa, sa_socklen);
     1267                ret = connect(fd, &rbsda->u.sa, rbsda->sa_socklen);
    13041268                if (ret == -1) {
    13051269                        int saved_errno = errno;
     
    19941958        bool is_inet = false;
    19951959        int sa_fam = lbsda->u.sa.sa_family;
    1996         socklen_t sa_socklen = sizeof(rbsda->u.ss);
    19971960
    19981961        req = tevent_req_create(mem_ctx, &state,
     
    20181981                        do_bind = true;
    20191982                }
    2020                 /*
    2021                  * for unix sockets we can't use the size of sockaddr_storage
    2022                  * we would get EINVAL
    2023                  */
    2024                 sa_socklen = sizeof(rbsda->u.un);
    20251983                break;
    20261984        case AF_INET:
     
    20331991                }
    20341992                is_inet = true;
    2035                 sa_socklen = sizeof(rbsda->u.in);
    20361993                break;
    20371994#ifdef HAVE_IPV6
     
    20472004                }
    20482005                is_inet = true;
    2049                 sa_socklen = sizeof(rbsda->u.in6);
    20502006                do_ipv6only = true;
    20512007                break;
     
    20602016                switch (sa_fam) {
    20612017                case AF_INET:
    2062                         sa_socklen = sizeof(rbsda->u.in);
    20632018                        do_ipv6only = false;
    20642019                        break;
    20652020#ifdef HAVE_IPV6
    20662021                case AF_INET6:
    2067                         sa_socklen = sizeof(rbsda->u.in6);
    20682022                        do_ipv6only = true;
    20692023                        break;
     
    21092063
    21102064        if (do_bind) {
    2111                 ret = bind(state->fd, &lbsda->u.sa, sa_socklen);
     2065                ret = bind(state->fd, &lbsda->u.sa, lbsda->sa_socklen);
    21122066                if (ret == -1) {
    21132067                        tevent_req_error(req, errno);
     
    21212075        }
    21222076
    2123         ret = connect(state->fd, &rbsda->u.sa, sa_socklen);
     2077        ret = connect(state->fd, &rbsda->u.sa, rbsda->sa_socklen);
    21242078        err = tsocket_bsd_error_from_errno(ret, errno, &retry);
    21252079        if (retry) {
  • trunk/server/lib/tsocket/tsocket_helpers.c

    r414 r480  
    4343static void tdgram_sendto_queue_done(struct tevent_req *subreq);
    4444
    45 /**
    46  * @brief Queue a dgram blob for sending through the socket
    47  * @param[in] mem_ctx   The memory context for the result
    48  * @param[in] ev        The event context the operation should work on
    49  * @param[in] dgram     The tdgram_context to send the message buffer
    50  * @param[in] queue     The existing dgram queue
    51  * @param[in] buf       The message buffer
    52  * @param[in] len       The message length
    53  * @param[in] dst       The destination socket address
    54  * @retval              The async request handle
    55  *
    56  * This function queues a blob for sending to destination through an existing
    57  * dgram socket. The async callback is triggered when the whole blob is
    58  * delivered to the underlying system socket.
    59  *
    60  * The caller needs to make sure that all non-scalar input parameters hang
    61  * arround for the whole lifetime of the request.
    62  */
    6345struct tevent_req *tdgram_sendto_queue_send(TALLOC_CTX *mem_ctx,
    6446                                            struct tevent_context *ev,
     
    336318static void tstream_readv_pdu_queue_done(struct tevent_req *subreq);
    337319
    338 /**
    339  * @brief Queue a dgram blob for sending through the socket
    340  * @param[in] mem_ctx   The memory context for the result
    341  * @param[in] ev        The tevent_context to run on
    342  * @param[in] stream    The stream to send data through
    343  * @param[in] queue     The existing send queue
    344  * @param[in] next_vector_fn    The next vector function
    345  * @param[in] next_vector_private       The private_data of the next vector function
    346  * @retval              The async request handle
    347  *
    348  * This function queues a blob for sending to destination through an existing
    349  * dgram socket. The async callback is triggered when the whole blob is
    350  * delivered to the underlying system socket.
    351  *
    352  * The caller needs to make sure that all non-scalar input parameters hang
    353  * arround for the whole lifetime of the request.
    354  */
    355320struct tevent_req *tstream_readv_pdu_queue_send(TALLOC_CTX *mem_ctx,
    356321                                struct tevent_context *ev,
     
    460425static void tstream_writev_queue_done(struct tevent_req *subreq);
    461426
    462 /**
    463  * @brief Queue a dgram blob for sending through the socket
    464  * @param[in] mem_ctx   The memory context for the result
    465  * @param[in] ev        The tevent_context to run on
    466  * @param[in] stream    The stream to send data through
    467  * @param[in] queue     The existing send queue
    468  * @param[in] vector    The iovec vector so write
    469  * @param[in] count     The size of the vector
    470  * @retval              The async request handle
    471  *
    472  * This function queues a blob for sending to destination through an existing
    473  * dgram socket. The async callback is triggered when the whole blob is
    474  * delivered to the underlying system socket.
    475  *
    476  * The caller needs to make sure that all non-scalar input parameters hang
    477  * arround for the whole lifetime of the request.
    478  */
    479427struct tevent_req *tstream_writev_queue_send(TALLOC_CTX *mem_ctx,
    480428                                             struct tevent_context *ev,
Note: See TracChangeset for help on using the changeset viewer.