Ignore:
Timestamp:
Nov 27, 2012, 4:43:17 PM (13 years ago)
Author:
Silvan Scherrer
Message:

Samba Server: updated trunk to 3.6.0

Location:
trunk/server
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/server

  • trunk/server/lib/tsocket/tsocket_guide.txt

    r414 r745  
    2424===============================
    2525
    26 The tsocket_address represents an socket endpoint genericly.
    27 As it's like an abstract class it has no specific constructor.
    28 The specific constructors are descripted later sections.
    29 
    30 There's a function get the string representation of the
    31 endpoint for debugging. Callers should not try to parse
    32 the string! The should use additional methods of the specific
    33 tsocket_address implemention to get more details.
     26A tsocket_address represents a generic socket endpoint.
     27It behaves like an abstract class, therefore it has no direct constructor.
     28Constructors are described in later sections of this document.
     29
     30A function get the string representation of an endpoint for debugging is
     31available but callers SHOULD NOT try to parse this string. To get more
     32details callers should use getter methods of the specific tsocket_address
     33implemention.
    3434
    3535  char *tsocket_address_string(const struct tsocket_address *addr,
    3636      TALLOC_CTX *mem_ctx);
    3737
    38 There's a function to create a copy of the tsocket_address.
    39 This is useful when before doing modifications to a socket
     38A function to create a copy of the tsocket_address is also avilable.
     39This is useful before doing modifications to a socket
    4040via additional methods of the specific tsocket_address implementation.
    4141
     
    4848The tdgram_context is like an abstract class for datagram
    4949based sockets. The interface provides async 'tevent_req' based
    50 functions on top functionality is similar to the
    51 recvfrom(2)/sendto(2)/close(2) syscalls.
     50functions similar to recvfrom(2)/sendto(2)/close(2) syscalls.
    5251
    5352The tdgram_recvfrom_send() method can be called to ask for the
    54 next available datagram on the abstracted tdgram_context.
     53next available datagram from the abstracted tdgram_context.
    5554It returns a 'tevent_req' handle, where the caller can register
    5655a callback with tevent_req_set_callback(). The callback is triggered
    57 when a datagram is available or an error happened.
     56when a datagram is available or an error occurs.
    5857
    5958The callback is then supposed to get the result by calling
     
    123122===============================
    124123
    125 The tstream_context is like an abstract class for stream
     124A tstream_context is like an abstract class for stream
    126125based sockets. The interface provides async 'tevent_req' based
    127 functions on top functionality is similar to the
    128 readv(2)/writev(2)/close(2) syscalls.
    129 
    130 The tstream_pending_bytes() function is able to report
    131 how much bytes of the incoming stream have arrived
    132 but not consumed yet. It returns -1 and sets 'errno' on failure.
    133 Otherwise it returns the number of uncomsumed bytes
    134 (it can return 0!).
     126functions similar to the readv(2)/writev(2)/close(2) syscalls.
     127
     128The tstream_pending_bytes() function is able to report how many bytes of
     129the incoming stream have been received but have not been consumed yet.
     130It returns -1 and sets 'errno' on failure.
     131Otherwise it returns the number of uncomsumed bytes (it can return 0!).
    135132
    136133  ssize_t tstream_pending_bytes(struct tstream_context *stream);
    137134
    138 The tstream_readv_send() method can be called to read for a
     135The tstream_readv_send() method can be called to read a
    139136specific amount of bytes from the stream into the buffers
    140137of the given iovec vector. The caller has to preallocate the buffers
     
    144141where the caller can register a callback with tevent_req_set_callback().
    145142The callback is triggered when all iovec buffers are completely
    146 filled with bytes from the socket or an error happened.
     143filled with bytes from the socket or an error occurs.
    147144
    148145The callback is then supposed to get the result by calling
    149146tstream_readv_recv() on the 'tevent_req'. It returns -1
    150147and sets '*perrno' to the actual 'errno' on failure.
    151 Otherwise it returns the length of the datagram
    152 (0 is never returned!).
     148Otherwise it returns the length of the datagram (0 is never returned!).
    153149
    154150The caller can only have one outstanding tstream_readv_send()
     
    166162The tstream_writev_send() method can be called to write
    167163buffers in the given iovec vector into the stream socket.
    168 It's invalid to pass an empty vector.
     164It is invalid to pass an empty vector.
    169165tstream_writev_send() returns a 'tevent_req' handle,
    170166where the caller can register a callback with tevent_req_set_callback().
     
    190186      int *perrno);
    191187
    192 The tstream_disconnect_send() method should be used to normally
     188The tstream_disconnect_send() method should normally be used to
    193189shutdown/close the abstracted socket.
    194190
     
    209205============================
    210206
    211 In order to make the live easier for callers which want to implement
     207In order to simplify the job, for callers that want to implement
    212208a function to receive a full PDU with a single async function pair,
    213 there're some helper functions.
     209some helper functions are provided.
    214210
    215211The caller can use the tstream_readv_pdu_send() function
     
    217213The caller needs to provide a "next_vector" function and a private
    218214state for this function. The tstream_readv_pdu engine will ask
    219 the next_vector function for the next iovec vetor to be filled.
     215the next_vector function for the next iovec vector to be used.
    220216There's a tstream_readv_send/recv pair for each vector returned
    221217by the next_vector function. If the next_vector function detects
     
    223219of the tevent_req (returned by tstream_readv_pdu_send()) is triggered.
    224220Note: the buffer allocation is completely up to the next_vector function
    225 and it's private state.
     221and its private state.
    226222
    227223See the 'dcerpc_read_ncacn_packet_send/recv' functions in Samba as an
     
    245241===========================================
    246242
    247 There're some cases where the caller wants doesn't care about the
    248 order of doing IO on the abstracted sockets.
     243In some cases the caller doesn't care about the IO ordering on the
     244abstracted socket.
    249245(Remember at the low level there's always only one IO in a specific
    250246 direction allowed, only one tdgram_sendto_send() at a time).
    251247
    252 There're some helpers using 'tevent_queue' to make it easier
    253 for callers. The functions just get a 'queue' argument
    254 and serialize the operations.
     248Some helpers that use 'tevent_queue' are avilable to simplify handling
     249multiple IO requests. The functions just get a 'queue' argument and
     250internally serialize all operations.
    255251
    256252  struct tevent_req *tdgram_sendto_queue_send(TALLOC_CTX *mem_ctx,
     
    296292(dns names are not allowed!). But it's valid to pass NULL,
    297293which gets mapped to "0.0.0.0" or "::".
    298 It return -1 and set errno on error. Otherwise it returns 0.
     294It returns -1 and sets errno on error. Otherwise it returns 0.
    299295
    300296  int tsocket_address_inet_from_strings(TALLOC_CTX *mem_ctx,
     
    343339you can use the tsocket_address_unix_path() function.
    344340It will return NULL and set errno to EINVAL if the tsocket_address
    345 doesn't represent an unix domain endpoint path.
     341doesn't represent a unix domain endpoint path.
    346342
    347343  char *tsocket_address_unix_path(const struct tsocket_address *addr,
     
    372368      struct tdgram_context **dgram);
    373369
    374 You can use tstream_inet_tcp_connect_send to async
     370You can use tstream_inet_tcp_connect_send to asynchronously
    375371connect to a remote ipv4 or ipv6 TCP endpoint and create a
    376372tstream_context for the stream based communication. "local_address" has to be
     
    398394      struct tstream_context **stream);
    399395
    400 You can use tstream_unix_connect_send to async
     396You can use tstream_unix_connect_send to asynchronously
    401397connect to a unix domain endpoint and create a
    402398tstream_context for the stream based communication.
     
    439435for that. This should only be used if really needed, because of
    440436already existing fixed APIs. Only AF_INET, AF_INET6 and AF_UNIX
    441 sockets are allowed. The function returns -1 and set errno on error.
     437sockets are allowed. The function returns -1 and sets errno on error.
    442438Otherwise it returns 0.
    443439
Note: See TracChangeset for help on using the changeset viewer.